From e543372cc70a19ff2630c79d8421c2c593e54e5f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 六月 2021 17:15:21 +0800 Subject: [PATCH] 2021-06-02 --- src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 274 +++++++++++++++++++++++++++++++++++------------------- 1 files changed, 175 insertions(+), 99 deletions(-) diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index e53c3d6..817a0a5 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -1,41 +1,52 @@ 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 +const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS /** * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟 * @param {object} card // 鍥捐〃瀵硅薄 - * @param {Array} columns // 鏄剧ず鍒� */ -export function getBarOrLineChartOptionForm (card, columns, sysRoles = [], MenuType) { - let shapes = [] - let _sysRoles = sysRoles.map(item => ({...item, field: item.value, label: item.text})) +export function getBaseForm (card) { + let appType = sessionStorage.getItem('appType') + let menulist = null - if (card.chartType === '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 (card.chartType === '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' } - ] + if (appType === 'pc') { + menulist = sessionStorage.getItem('appMenus') + if (Array.isArray(card.linkmenu)) { + card.linkmenu = '' + } + } else { + menulist = sessionStorage.getItem('fstMenuList') } - let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype)) - let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype)) + if (menulist) { + try { + menulist = JSON.parse(menulist) + if (appType === 'pc') { + menulist = menulist.map(item => { + item.value = item.MenuID + item.text = item.MenuName + return item + }) + } + } catch { + menulist = [] + } + } else { + menulist = [] + } + + let roleList = sessionStorage.getItem('sysRoles') + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch { + roleList = [] + } + } else { + roleList = [] + } return [ { @@ -75,26 +86,102 @@ required: true }, { + type: 'select', + key: 'blacklist', + label: '榛戝悕鍗�', + initVal: card.blacklist || [], + multi: true, + required: false, + options: roleList + }, + { + type: 'cascader', + key: 'linkmenu', + label: '鍏宠仈鑿滃崟', + initVal: card.linkmenu || [], + tooltip: '鍦ㄤ娇鐢ㄦ煴褰㈠浘涓旀湭鍚敤鑷畾涔夎缃椂鏈夋晥銆�', + required: false, + forbid: appType === 'pc' || appType === 'mob', + options: menulist + }, + { + type: 'select', + key: 'linkmenu', + label: '鍏宠仈鑿滃崟', + initVal: card.linkmenu || '', + tooltip: '鍙屽嚮鏌辩姸鍥撅紝浼氭墦寮�鍏宠仈鐨勮彍鍗曘��', + required: false, + forbid: appType !== 'pc', + options: menulist + }, + { + type: 'radio', + key: 'open', + label: '鎵撳紑鏂瑰紡', + initVal: card.open || 'blank', + required: false, + forbid: appType !== 'pc', + options: [ + { value: 'blank', text: '鏂扮獥鍙�' }, + { value: 'self', text: '褰撳墠绐楀彛' } + ] + } + ] +} + +/** + * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟 + * @param {object} card // 鍥捐〃瀵硅薄 + * @param {Array} columns // 鏄剧ず鍒� + */ +export function getOptionForm (card, columns) { + let shapes = [] + + if (card.chartType === '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 (card.chartType === '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' } + ] + } + + let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype)) + let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype)) + + return [ + { type: 'radio', key: 'datatype', label: '鏁版嵁绫诲瀷', initVal: card.datatype || 'query', - tooltip: '缁熻鍥捐〃閫傜敤浜庤〃鏍间笉鍒嗛〉锛屼笖鏁版嵁闇�瑕佽浆鎹�', + tooltip: '缁熻鍥捐〃閫傜敤浜庡睍绀烘暟鎹被鍨嬩负鍔ㄦ�佸�笺��', required: false, options: [ { value: 'query', text: Formdict['header.form.query'] }, { value: 'statistics', text: Formdict['header.form.statistics'] } ] - }, - { + }, { type: 'select', key: 'Xaxis', label: 'X-杞�', initVal: card.Xaxis || '', required: true, options: xfields - }, - { + }, { type: 'select', key: 'InfoType', label: '绫诲瀷', @@ -102,8 +189,7 @@ hidden: card.datatype !== 'statistics', required: true, options: xfields - }, - { + }, { type: 'select', key: 'InfoValue', label: '鍊�', @@ -111,8 +197,7 @@ hidden: card.datatype !== 'statistics', required: true, options: yfields - }, - { + }, { type: 'select', key: 'legend', label: '鍥句緥浣嶇疆', @@ -133,8 +218,7 @@ { field: 'left-bottom', label: '宸︿笅' }, { field: 'hidden', label: '闅愯棌' } ] - }, - { + }, { type: 'select', key: 'Yaxis', label: 'Y-杞�', @@ -143,19 +227,17 @@ hidden: card.datatype === 'statistics', required: true, options: yfields - }, - { + }, { type: 'select', key: 'shape', label: '褰㈢姸', initVal: card.shape || (shapes[0] && shapes[0].field), required: false, options: shapes - }, - { + }, { type: 'radio', key: 'tooltip', - label: '鎻愮ず淇℃伅', + label: '鎮诞鎻愮ず', initVal: card.tooltip || 'true', required: false, options: [{ @@ -165,22 +247,7 @@ value: 'false', text: '闅愯棌' }] - }, - { - type: 'radio', - key: 'coordinate', - label: '鍧愭爣', - initVal: card.coordinate || 'angle', - required: false, - options: [{ - value: 'angle', - text: '浜岀淮鍧愭爣' - }, { - value: 'polar', - text: '鏋佸潗鏍�' - }] - }, - { + }, { type: 'radio', key: 'point', label: '鐐瑰浘', @@ -194,12 +261,12 @@ value: 'false', text: '闅愯棌' }] - }, - { + }, { type: 'radio', key: 'transpose', label: '鍙樻崲', initVal: card.transpose || 'false', + tooltip: '妯旱鍧愭爣杞翠氦鎹�', required: false, options: [{ value: 'true', @@ -208,25 +275,23 @@ value: 'false', text: Formdict['model.false'] }] - }, - { + }, { type: 'radio', key: 'show', - label: '鏄剧ず鍊�', + label: '鏍煎紡鍖�', initVal: card.show || 'value', required: false, options: [{ + value: 'value', + text: '鏃�' + }, { value: 'percent', text: '鐧惧垎姣�' - }, { - value: 'value', - text: '鏁板��' }] - }, - { + }, { type: 'radio', key: 'label', - label: '鏍囨敞-鍊�', + label: '鏍囨敞鍊�', initVal: card.label || 'false', required: false, options: [{ @@ -236,6 +301,20 @@ value: 'false', text: '闅愯棌' }] + // }, { + // type: 'radio', + // key: 'offset', + // label: '鏍囨敞浣嶇疆', + // initVal: card.offset || 'outer', + // required: false, + // options: [{ + // value: 'outer', + // text: '澶栭儴' + // }, { + // value: 'inner', + // text: '鍐呴儴' + // }], + // forbid: card.chartType !== 'bar' }, { type: 'radio', key: 'adjust', @@ -267,16 +346,18 @@ text: '绱姞' }] }, { - type: 'number', - key: 'InfoDefNumber', - label: '灞曠ず鏁�', - tooltip: '榛樿鏄剧ず绫诲瀷鏁伴噺', - min: 1, - max: 50, - decimal: 0, - initVal: card.InfoDefNumber || 5, - hidden: card.datatype !== 'statistics', - required: true + type: 'radio', + key: 'coordinate', + label: '鍧愭爣', + initVal: card.coordinate || 'angle', + required: false, + options: [{ + value: 'angle', + text: '浜岀淮鍧愭爣' + }, { + value: 'polar', + text: '鏋佸潗鏍�' + }] }, { type: 'number', key: 'barSize', @@ -289,28 +370,23 @@ forbid: !['bar'].includes(card.chartType), required: false }, { + type: 'number', + key: 'barRadius', + label: '鏌卞舰鍦嗚', + tooltip: '鏌卞舰鍥句笂绔渾瑙掋��', + min: 0, + max: 200, + decimal: 0, + initVal: card.barRadius || 0, + forbid: !['bar'].includes(card.chartType), + required: false + }, { type: 'color', key: 'color', label: '鑹茬郴', - initVal: card.color || 'rgba(0, 0, 0, 0.85)', - tooltip: '鍧愭爣杞村強绀轰緥绛夋彁绀烘枃瀛椾娇鐢ㄧ殑棰滆壊銆�', - required: false, - options: [{ - value: 'black', - text: '榛戣壊' - }, { - value: 'white', - text: '鐧借壊' - }] - }, { - type: 'select', - key: 'blacklist', - label: '榛戝悕鍗�', - initVal: card.blacklist || [], - multi: true, - required: false, - forbid: MenuType === 'billPrint', - options: _sysRoles + initVal: card.color || 'rgba(0, 0, 0, 0.65)', + tooltip: '鍧愭爣杞存彁绀烘枃瀛楀強绀轰緥鐨勯鑹层��', + required: false } ] } -- Gitblit v1.8.0