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 |  220 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 152 insertions(+), 68 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
index 677001d..71194ee 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
@@ -8,7 +8,74 @@
  * @param {object} card       // 鍥捐〃瀵硅薄
  * @param {Array}  columns    // 鏄剧ず鍒�
  */
-export function getBarOrLineChartOptionForm (card, columns) {
+export function getBaseForm (card, MenuType) {
+  let roleList = sessionStorage.getItem('sysRoles')
+  if (roleList) {
+    try {
+      roleList = JSON.parse(roleList)
+    } catch {
+      roleList = []
+    }
+  } else {
+    roleList = []
+  }
+
+  return [
+    {
+      type: 'text',
+      key: 'title',
+      label: '鏍囬',
+      initVal: card.title,
+      required: false
+    },
+    {
+      type: 'text',
+      key: 'name',
+      label: '缁勪欢鍚嶇О',
+      initVal: card.name,
+      tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�',
+      required: true
+    },
+    {
+      type: 'number',
+      key: 'width',
+      label: '瀹藉害',
+      initVal: card.width,
+      tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��',
+      min: 1,
+      max: 24,
+      decimal: 0,
+      required: true
+    },
+    {
+      type: 'number',
+      key: 'height',
+      label: '楂樺害',
+      initVal: card.height,
+      min: 100,
+      max: 1000,
+      decimal: 0,
+      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') {
@@ -33,6 +100,9 @@
     ]
   }
 
+  let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype))
+  let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype))
+
   return [
     {
       type: 'radio',
@@ -52,7 +122,47 @@
       label: 'X-杞�',
       initVal: card.Xaxis || '',
       required: true,
-      options: columns.filter(col => col.type === 'text')
+      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',
@@ -62,47 +172,7 @@
       multi: true, // 澶氶��
       hidden: card.datatype === 'statistics',
       required: true,
-      options: columns.filter(col => col.type === 'number')
-    },
-    {
-      type: 'select',
-      key: 'InfoType',
-      label: '绫诲瀷',
-      initVal: card.InfoType || '',
-      hidden: card.datatype !== 'statistics',
-      required: true,
-      options: columns.filter(col => col.type === 'text')
-    },
-    {
-      type: 'select',
-      key: 'InfoValue',
-      label: '鍊�',
-      initVal: card.InfoValue || '',
-      hidden: card.datatype !== 'statistics',
-      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' }
-      ]
+      options: yfields
     },
     {
       type: 'select',
@@ -115,7 +185,7 @@
     {
       type: 'radio',
       key: 'tooltip',
-      label: '鎻愮ず淇℃伅',
+      label: '鎮诞鎻愮ず',
       initVal: card.tooltip || 'true',
       required: false,
       options: [{
@@ -124,20 +194,6 @@
       }, {
         value: 'false',
         text: '闅愯棌'
-      }]
-    },
-    {
-      type: 'radio',
-      key: 'coordinate',
-      label: '鍧愭爣',
-      initVal: card.coordinate || 'angle',
-      required: false,
-      options: [{
-        value: 'angle',
-        text: '浜岀淮鍧愭爣'
-      }, {
-        value: 'polar',
-        text: '鏋佸潗鏍�'
       }]
     },
     {
@@ -160,6 +216,7 @@
       key: 'transpose',
       label: '鍙樻崲',
       initVal: card.transpose || 'false',
+      tooltip: '妯旱鍧愭爣杞翠氦鎹�',
       required: false,
       options: [{
         value: 'true',
@@ -172,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: [{
@@ -227,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: '灞曠ず鏁�',
@@ -239,15 +309,29 @@
       required: true
     }, {
       type: 'number',
-      key: 'correction',
-      label: '鏁版嵁淇',
-      tooltip: '褰撴暟鎹」灏戜簬璁剧疆鍊兼椂锛岀郴缁熶細鑷姩淇锛堥伩鍏嶆煴褰㈠浘杩囧锛�,鍦ㄨ嚜瀹氫箟涓紝璁剧疆涓烘姌绾垮浘鏃跺け鏁堛��',
+      key: 'barSize',
+      label: '鏌卞舰瀹藉害',
+      tooltip: '绌哄�兼椂锛屽搴﹁嚜閫傚簲銆�',
       min: 5,
-      max: 30,
+      max: 100,
       decimal: 0,
-      initVal: card.correction,
+      initVal: card.barSize,
       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: '鐧借壊'
+      }]
     }
   ]
 }

--
Gitblit v1.8.0