From e41a64966b7832baffe96c21d1ea77ef6adb2905 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 14 十月 2021 18:31:55 +0800 Subject: [PATCH] 2021-10-14 --- src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx | 434 ++---------------------------------------------------- 1 files changed, 16 insertions(+), 418 deletions(-) diff --git a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx index ac311aa..58786ea 100644 --- a/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/chart-custom/chartcompile/formconfig.jsx @@ -1,13 +1,9 @@ -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' - -const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS - /** * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟 * @param {object} card // 鍥捐〃瀵硅薄 */ export function getBaseForm (card) { + let appType = sessionStorage.getItem('appType') let roleList = sessionStorage.getItem('sysRoles') if (roleList) { try { @@ -34,6 +30,17 @@ initVal: card.name, tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', required: true + }, + { + type: 'radio', + key: 'chartType', + label: '鍥捐〃绫诲瀷', + initVal: card.chartType || 'antv', + required: true, + options: [ + { value: 'antv', text: 'antv' }, + { value: 'echarts', text: 'echarts' } + ] }, { type: 'number', @@ -63,7 +70,8 @@ initVal: card.blacklist || [], multi: true, required: false, - options: roleList + options: roleList, + forbid: !!appType }, // { // type: 'cascader', @@ -85,416 +93,6 @@ // 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 appType = sessionStorage.getItem('appType') - 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)) - - let labelOptions = [{ - value: 'false', - text: '闅愯棌' - }, { - value: 'true', - text: '鏄剧ず' - }] - - if (card.chartType === 'bar') { - labelOptions[1].text = '澶栭儴' - labelOptions.push(...[{ - value: 'top', - text: '椤堕儴' - }, { - value: 'middle', - text: '涓棿' - }, { - value: 'bottom', - text: '搴曢儴' - }]) - } - - return [ - { - type: 'radio', - key: 'datatype', - label: '鏁版嵁绫诲瀷', - initVal: card.datatype || 'query', - 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: '绫诲瀷', - initVal: card.InfoType || '', - hidden: card.datatype !== 'statistics', - required: true, - options: xfields - }, { - type: 'select', - key: 'InfoValue', - label: '鍊�', - initVal: card.InfoValue || '', - hidden: card.datatype !== 'statistics', - required: true, - options: yfields - }, { - type: 'select', - key: 'legend', - label: '鍥句緥浣嶇疆', - initVal: card.legend || 'bottom', - required: false, - options: [ - { field: 'bottom', label: '涓�' }, - { field: 'bottom-left', label: '涓嬪乏' }, - { field: 'bottom-right', label: '涓嬪彸' }, - { field: 'top', label: '涓�' }, - { field: 'top-left', label: '涓婂乏' }, - { field: 'top-right', label: '涓婂彸' }, - { field: 'right', label: '鍙�' }, - { field: 'right-top', label: '鍙充笂' }, - { field: 'right-bottom', label: '鍙充笅' }, - { field: 'left', label: '宸�' }, - { field: 'left-top', label: '宸︿笂' }, - { field: 'left-bottom', label: '宸︿笅' }, - { field: 'hidden', label: '闅愯棌' } - ] - }, { - type: 'select', - key: 'Yaxis', - label: 'Y-杞�', - initVal: card.Yaxis || [], - multi: true, // 澶氶�� - 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: '鎮诞鎻愮ず', - initVal: card.tooltip || 'true', - required: false, - options: [{ - value: 'true', - text: '鏄剧ず' - }, { - value: 'false', - text: '闅愯棌' - }] - }, { - type: 'radio', - key: 'point', - label: '鐐瑰浘', - initVal: card.point || 'false', - required: false, - forbid: !['line'].includes(card.chartType), - options: [{ - value: 'true', - text: '鏄剧ず' - }, { - value: 'false', - text: '闅愯棌' - }] - }, { - type: 'radio', - key: 'transpose', - label: '鍙樻崲', - initVal: card.transpose || 'false', - tooltip: '妯旱鍧愭爣杞翠氦鎹�', - required: false, - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, { - type: 'radio', - key: 'show', - label: '鏍煎紡鍖�', - initVal: card.show || 'value', - required: false, - options: [{ - value: 'value', - text: '鏃�' - }, { - value: 'percent', - text: '鐧惧垎姣�' - }] - }, { - type: labelOptions.length > 20 ? 'select' : 'radio', - key: 'label', - label: '鏍囩', - initVal: card.label || 'false', - required: false, - options: labelOptions - }, { - type: 'radio', - key: 'labelColor', - label: '鏍囩棰滆壊', - initVal: card.labelColor || 'system', - tooltip: '浣跨敤绯荤粺鑹叉椂锛屼娇鐢ㄨ壊绯婚�夐」璁剧疆鐨勭郴缁熼鑹诧紝浣跨敤鑷畾涔変负棰滆壊璁剧疆涓畾涔夌殑鍥惧舰棰滆壊銆�', - required: false, - options: [{ - value: 'system', - text: '绯荤粺' - }, { - value: 'custom', - 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', - label: '澶氭煴鎺掑垪', - initVal: card.adjust || 'dodge', - required: false, - forbid: !['bar'].includes(card.chartType), - options: [{ - value: 'dodge', - text: '鍒嗙粍' - }, { - value: 'stack', - text: '鍫嗗彔' - }] - }, { - type: 'radio', - key: 'area', - label: '闈㈢Н鍥�', - initVal: card.area || 'false', - // tooltip: '浠呭湪褰㈢姸涓簊mooth鏃舵湁鏁堛��', - required: false, - forbid: ['bar'].includes(card.chartType), - options: [{ - value: 'true', - text: '鏄剧ず' - }, { - value: 'false', - text: '涓嶆樉绀�' - }] - }, { - type: 'radio', - key: 'repeat', - label: '閲嶅鏁版嵁', - initVal: card.repeat || 'unrepeat', - required: false, - options: [{ - value: 'unrepeat', - text: '鍘婚噸' - }, { - value: 'average', - text: '骞冲潎' - }, { - value: 'cumsum', - text: '绱姞' - }] - }, { - type: 'radio', - key: 'coordinate', - label: '鍧愭爣', - initVal: card.coordinate || 'angle', - required: false, - options: [{ - value: 'angle', - text: '浜岀淮鍧愭爣' - }, { - value: 'polar', - text: '鏋佸潗鏍�' - }] - }, { - type: 'radio', - key: 'grid', - label: '缃戞牸绾�', - initVal: card.grid || 'show', - required: false, - options: [{ - value: 'show', - text: '鏄剧ず' - }, { - value: 'hidden', - text: '闅愯棌' - }] - }, { - type: 'radio', - key: 'y_line', - label: 'y杞磋竟绾�', - initVal: card.y_line || 'hidden', - tooltip: '鍥惧舰宸︿晶鎴栧彸渚х殑杈圭嚎銆�', - required: false, - options: [{ - value: 'show', - text: '鏄剧ず' - }, { - value: 'hidden', - text: '闅愯棌' - }] - }, { - type: 'number', - key: 'barSize', - label: '鏌卞舰瀹藉害', - tooltip: '绌哄�兼椂锛屽搴﹁嚜閫傚簲銆�', - min: 5, - max: 100, - decimal: 0, - initVal: card.barSize, - 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: 'number', - key: 'min', - label: '鏈�灏忓��', - tooltip: 'y杞存渶灏忓�硷紝涓虹┖鏃惰嚜閫傚簲銆�', - initVal: card.min, - required: false - }, { - type: 'number', - key: 'max', - label: '鏈�澶у��', - tooltip: 'y杞存渶澶у�硷紝涓虹┖鏃惰嚜閫傚簲銆�', - initVal: card.max, - required: false - }, { - type: 'color', - key: 'color', - label: '鑹茬郴', - initVal: card.color || 'rgba(0, 0, 0, 0.65)', - tooltip: '鍧愭爣杞存彁绀烘枃瀛楀強绀轰緥鐨勯鑹层��', - required: false - }, { - type: 'color', - key: 'lineColor', - label: '杞寸嚎棰滆壊', - initVal: card.lineColor, - tooltip: '鍧愭爣杞寸嚎鐨勯鑹诧紝鍖呮嫭x杞淬�亂杞村強缃戞牸绾裤��', - allowClear: true, - required: false - }, { - type: 'color', - key: 'selectColor', - label: '閫変腑棰滆壊', - initVal: card.selectColor || '', - tooltip: '閫変腑鏌卞舰鍥剧殑棰滆壊锛屽湪浜や簰鏁堟灉銆婂厓绱犻�変腑锛堝閫夛級銆嬪拰銆婂厓绱犻�変腑锛堝崟閫夛級銆嬩腑鏈夋晥锛岃嚜瀹氫箟璁剧疆涓棤鏁堛��', - forbid: !['bar'].includes(card.chartType), - allowClear: true, - required: false - }, { - type: 'number', - key: 'rotate', - label: '鏃嬭浆', - tooltip: '鍧愭爣杞存爣娉ㄦ枃鏈殑鏃嬭浆瑙掑害銆�', - min: 0, - max: 360, - decimal: 0, - initVal: card.rotate, - forbid: appType !== 'mob', - required: false - }, { - type: 'select', - key: 'interaction', - label: '浜や簰鏁堟灉', - initVal: card.interaction || [], - multi: true, - required: false, - forbid: appType === 'mob', - options: [ - { value: 'element-active', label: '鍏冪礌鑱氱劍' }, - { value: 'element-selected', label: '鍏冪礌閫変腑锛堝閫夛級' }, - { value: 'element-single-selected', label: '鍏冪礌閫変腑锛堝崟閫夛級' }, - { value: 'active-region', label: '鑳屾櫙妗�' }, - { value: 'view-zoom', label: '瑙嗗浘缂╂斁' }, - { value: 'element-highlight', label: '鍏冪礌楂樹寒' }, - { value: 'element-highlight-by-color', label: '鍚岃壊鍏冪礌楂樹寒' }, - { value: 'element-highlight-by-x', label: '鍚孹杞村厓绱犻珮浜�' }, - { value: 'legend-filter', label: '鍥句緥杩囨护' }, - { value: 'legend-active', label: '鍥句緥鑱氱劍' }, - { value: 'legend-highlight', label: '鍥句緥楂樹寒' }, - { value: 'brush', label: '閫夋杩囨护' }, - ] - } - ] -} +} \ No newline at end of file -- Gitblit v1.8.0