From 42fae277ae5ebe794fc070bf38482a919eb661fc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 十一月 2020 14:36:02 +0800
Subject: [PATCH] 2020-11-25

---
 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx |  153 +++++++++++++++++++++++++++++----------------------
 1 files changed, 87 insertions(+), 66 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
index 4b3fe02..71194ee 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
@@ -8,34 +8,17 @@
  * @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}))
-
-  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' }
-    ]
+export function getBaseForm (card, MenuType) {
+  let roleList = sessionStorage.getItem('sysRoles')
+  if (roleList) {
+    try {
+      roleList = JSON.parse(roleList)
+    } catch {
+      roleList = []
+    }
+  } else {
+    roleList = []
   }
-
-  let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype))
-  let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype))
 
   return [
     {
@@ -75,6 +58,53 @@
       required: true
     },
     {
+      type: 'select',
+      key: 'blacklist',
+      label: '榛戝悕鍗�',
+      initVal: card.blacklist || [],
+      multi: true,
+      required: false,
+      forbid: MenuType === 'billPrint',
+      options: roleList
+    }
+  ]
+}
+
+/**
+ * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟
+ * @param {object} card       // 鍥捐〃瀵硅薄
+ * @param {Array}  columns    // 鏄剧ず鍒�
+ */
+export function getOptionForm (card, columns, MenuType) {
+  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: '鏁版嵁绫诲瀷',
@@ -93,16 +123,6 @@
       initVal: card.Xaxis || '',
       required: true,
       options: xfields
-    },
-    {
-      type: 'select',
-      key: 'Yaxis',
-      label: 'Y-杞�',
-      initVal: card.Yaxis || [],
-      multi: true, // 澶氶��
-      hidden: card.datatype === 'statistics',
-      required: true,
-      options: yfields
     },
     {
       type: 'select',
@@ -146,6 +166,16 @@
     },
     {
       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),
@@ -155,7 +185,7 @@
     {
       type: 'radio',
       key: 'tooltip',
-      label: '鎻愮ず淇℃伅',
+      label: '鎮诞鎻愮ず',
       initVal: card.tooltip || 'true',
       required: false,
       options: [{
@@ -164,20 +194,6 @@
       }, {
         value: 'false',
         text: '闅愯棌'
-      }]
-    },
-    {
-      type: 'radio',
-      key: 'coordinate',
-      label: '鍧愭爣',
-      initVal: card.coordinate || 'angle',
-      required: false,
-      options: [{
-        value: 'angle',
-        text: '浜岀淮鍧愭爣'
-      }, {
-        value: 'polar',
-        text: '鏋佸潗鏍�'
       }]
     },
     {
@@ -200,6 +216,7 @@
       key: 'transpose',
       label: '鍙樻崲',
       initVal: card.transpose || 'false',
+      tooltip: '妯旱鍧愭爣杞翠氦鎹�',
       required: false,
       options: [{
         value: 'true',
@@ -212,21 +229,21 @@
     {
       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: [{
@@ -267,6 +284,19 @@
         text: '绱姞'
       }]
     }, {
+      type: 'radio',
+      key: 'coordinate',
+      label: '鍧愭爣',
+      initVal: card.coordinate || 'angle',
+      required: false,
+      options: [{
+        value: 'angle',
+        text: '浜岀淮鍧愭爣'
+      }, {
+        value: 'polar',
+        text: '鏋佸潗鏍�'
+      }]
+    }, {
       type: 'number',
       key: 'InfoDefNumber',
       label: '灞曠ず鏁�',
@@ -302,15 +332,6 @@
         value: 'white',
         text: '鐧借壊'
       }]
-    }, {
-      type: 'select',
-      key: 'blacklist',
-      label: '榛戝悕鍗�',
-      initVal: card.blacklist || [],
-      multi: true,
-      required: false,
-      forbid: MenuType === 'billPrint',
-      options: _sysRoles
     }
   ]
 }

--
Gitblit v1.8.0