| | |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | |
| | | const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | |
| | | * @param {*} functip 生成存储过程提示 |
| | | * @param {*} config 页面配置 |
| | | * @param {*} permFuncField 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, config, permFuncField) { |
| | | export function getActionForm (card, functip, config, permFuncField, type) { |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | | text: Formdict['header.form.popform'] |
| | | }, { |
| | | value: 'prompt', |
| | | text: Formdict['header.form.prompt'] |
| | | }, { |
| | | value: 'exec', |
| | | text: Formdict['header.form.exec'] |
| | | }, { |
| | | value: 'excelIn', |
| | | text: Formdict['header.form.excelIn'] |
| | | }, { |
| | | value: 'excelOut', |
| | | text: Formdict['header.form.excelOut'] |
| | | }, { |
| | | value: 'popview', |
| | | text: Formdict['header.form.popview'] |
| | | } |
| | | ] |
| | | |
| | | if (type === 'subtable') { |
| | | opentypes.push({ |
| | | value: 'funcbutton', |
| | | text: Formdict['header.form.funcbutton'] |
| | | }) |
| | | } else { |
| | | opentypes.push({ |
| | | value: 'tab', |
| | | text: Formdict['header.form.tab'] |
| | | }, { |
| | | value: 'blank', |
| | | text: Formdict['header.form.blank'] |
| | | }, { |
| | | value: 'innerpage', |
| | | text: Formdict['header.form.newpage.inner'] |
| | | }, { |
| | | value: 'outerpage', |
| | | text: Formdict['header.form.newpage.outer'] |
| | | }, { |
| | | value: 'funcbutton', |
| | | text: Formdict['header.form.funcbutton'] |
| | | }) |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | label: Formdict['header.form.openType'], |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: [{ |
| | | value: 'pop', |
| | | text: Formdict['header.form.popform'] |
| | | }, { |
| | | value: 'prompt', |
| | | text: Formdict['header.form.prompt'] |
| | | }, { |
| | | value: 'exec', |
| | | text: Formdict['header.form.exec'] |
| | | }, { |
| | | value: 'excelIn', |
| | | text: Formdict['header.form.excelIn'] |
| | | }, { |
| | | value: 'excelOut', |
| | | text: Formdict['header.form.excelOut'] |
| | | }, { |
| | | value: 'popview', |
| | | text: Formdict['header.form.popview'] |
| | | }, { |
| | | value: 'tab', |
| | | text: Formdict['header.form.tab'] |
| | | }, { |
| | | value: 'blank', |
| | | text: Formdict['header.form.blank'] |
| | | }, { |
| | | value: 'innerpage', |
| | | text: Formdict['header.form.newpage.inner'] |
| | | }, { |
| | | value: 'outerpage', |
| | | text: Formdict['header.form.newpage.outer'] |
| | | }, { |
| | | value: 'funcbutton', |
| | | text: Formdict['header.form.funcbutton'] |
| | | }] |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取图表视图外部配置表单 |
| | | * @param {*} card |
| | | */ |
| | | export function getChartViewForm (card, roleList = []) { |
| | | let _charts = [{ |
| | | value: 'line', |
| | | text: '折线图' |
| | | }, { |
| | | value: 'bar', |
| | | text: '柱状图' |
| | | }, { |
| | | value: 'pie', |
| | | text: '饼图' |
| | | }] |
| | | |
| | | if (card.chartType === 'table') { |
| | | _charts = [{ |
| | | value: 'table', |
| | | text: '表格' |
| | | }] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'title', |
| | | label: Formdict['header.form.title'], |
| | | initVal: card.title, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'chartType', |
| | | label: '图表类型', |
| | | initVal: card.chartType, |
| | | required: true, |
| | | readonly: card.chartType === 'table', |
| | | options: _charts |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 100, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '高度', |
| | | initVal: card.height || 400, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '宽度', |
| | | tooltip: '每行等分为24列,24即为100%。', |
| | | initVal: card.width || 24, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: Formdict['header.form.Hide'], |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: Formdict['header.form.blacklist'], |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取图表视图配置表单 |
| | | * @param {*} card |
| | | */ |
| | | export function getChartOptionForm (card, columns, type) { |
| | | let shapes = [] |
| | | |
| | | if (type === 'line') { |
| | | shapes = [ |
| | | { field: 'smooth', label: 'smooth' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'dot', label: 'dot' }, |
| | | { field: 'dash', label: 'dash' }, |
| | | { field: 'hv', label: 'hv' }, |
| | | { field: 'vh', label: 'vh' }, |
| | | { field: 'hvh', label: 'hvh' }, |
| | | { field: 'vhv', label: 'vhv' } |
| | | ] |
| | | } else if (type === 'bar') { |
| | | shapes = [ |
| | | { field: 'rect', label: 'rect' }, |
| | | { field: 'hollow-rect', label: 'hollow-rect' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'tick', label: 'tick' }, |
| | | { field: 'funnel', label: 'funnel' }, |
| | | { field: 'pyramid', label: 'pyramid' } |
| | | ] |
| | | } else if (type === 'pie') { |
| | | shapes = [ |
| | | { field: 'pie', label: '饼图' }, |
| | | { field: 'ring', label: '环图' } |
| | | ] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'select', |
| | | key: 'Xaxis', |
| | | label: type === 'pie' ? 'Text' : 'X-轴', |
| | | initVal: card.Xaxis || '', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Yaxis', |
| | | label: type === 'pie' ? 'Value' : 'Y-轴', |
| | | initVal: type === 'pie' ? card.Yaxis || '' : card.Yaxis || [], |
| | | multi: type !== 'pie', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'legend', |
| | | label: '图例位置', |
| | | initVal: card.legend || 'bottom', |
| | | required: false, |
| | | options: [ |
| | | { field: 'top', label: 'top' }, |
| | | { field: 'top-left', label: 'top-left' }, |
| | | { field: 'top-right', label: 'top-right' }, |
| | | { field: 'right', label: 'right' }, |
| | | { field: 'right-top', label: 'right-top' }, |
| | | { field: 'right-bottom', label: 'right-bottom' }, |
| | | { field: 'left', label: 'left' }, |
| | | { field: 'left-top', label: 'left-top' }, |
| | | { field: 'left-bottom', label: 'left-bottom' }, |
| | | { field: 'bottom', label: 'bottom' }, |
| | | { field: 'bottom-left', label: 'bottom-left' }, |
| | | { field: 'bottom-right', label: 'bottom-right' }, |
| | | { field: 'hidden', label: 'hidden' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'shape', |
| | | label: '形状', |
| | | initVal: card.shape || (shapes[0] && shapes[0].field), |
| | | required: false, |
| | | hidden: !['line', 'bar', 'pie'].includes(type), |
| | | options: shapes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'tooltip', |
| | | label: '提示信息', |
| | | initVal: card.tooltip || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'coordinate', |
| | | label: '坐标', |
| | | initVal: card.coordinate || 'angle', |
| | | required: false, |
| | | hidden: !['line', 'bar'].includes(type), |
| | | options: [{ |
| | | value: 'angle', |
| | | text: '二维坐标' |
| | | }, { |
| | | value: 'polar', |
| | | text: '极坐标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'point', |
| | | label: '点图', |
| | | initVal: card.point || 'false', |
| | | required: false, |
| | | hidden: !['line'].includes(type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'transpose', |
| | | label: '变换', |
| | | initVal: card.transpose || 'false', |
| | | required: false, |
| | | hidden: !['line', 'bar'].includes(type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pieshow', |
| | | label: '显示值', |
| | | initVal: card.pieshow || 'percent', |
| | | required: false, |
| | | hidden: !['pie'].includes(type), |
| | | options: [{ |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'value', |
| | | text: '数值' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'label', |
| | | label: '文本标签', |
| | | initVal: card.label || (type === 'pie' ? 'true' : 'false'), |
| | | required: false, |
| | | hidden: !['pie', 'line'].includes(type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelLayout', |
| | | label: '标签布局', |
| | | initVal: card.labelLayout || 'normal', |
| | | required: false, |
| | | hidden: !['pie'].includes(type), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '常规' |
| | | }, { |
| | | value: 'overlap', |
| | | text: '防重叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'adjust', |
| | | label: '多柱排列', |
| | | initVal: card.adjust || 'dodge', |
| | | required: false, |
| | | hidden: !['bar'].includes(type), |
| | | options: [{ |
| | | value: 'dodge', |
| | | text: '分组' |
| | | }, { |
| | | value: 'stack', |
| | | text: '堆叠' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表单配置信息 |
| | | * @param {*} card |
| | | * @param {*} inputfields |