From 4e1938344ca46c0cbe699756ecaffa630e698aec Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 06 五月 2020 13:59:54 +0800
Subject: [PATCH] 2020-05-06

---
 src/templates/zshare/formconfig.jsx |  104 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 84 insertions(+), 20 deletions(-)

diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index a21d0bd..f09f32e 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -1310,14 +1310,14 @@
 
 /**
  * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟
- * @param {object} card       // 鎼滅储鏉′欢瀵硅薄
+ * @param {object} card       // 鍥捐〃瀵硅薄
  * @param {Array}  columns    // 鏄剧ず鍒�
- * @param {String} type       // 鍥捐〃绫诲瀷
+ * @param {String} setting    // 椤甸潰璁剧疆
  */
-export function getChartOptionForm (card, columns, type) {
+export function getChartOptionForm (card, columns, setting) {
   let shapes = []
 
-  if (type === 'line') {
+  if (card.chartType === 'line') {
     shapes = [
       { field: 'smooth', label: 'smooth' },
       { field: 'line', label: 'line' },
@@ -1328,7 +1328,7 @@
       { field: 'hvh', label: 'hvh' },
       { field: 'vhv', label: 'vhv' }
     ]
-  } else if (type === 'bar') {
+  } else if (card.chartType === 'bar') {
     shapes = [
       { field: 'rect', label: 'rect' },
       { field: 'hollow-rect', label: 'hollow-rect' },
@@ -1337,7 +1337,7 @@
       { field: 'funnel', label: 'funnel' },
       { field: 'pyramid', label: 'pyramid' }
     ]
-  } else if (type === 'pie') {
+  } else if (card.chartType === 'pie') {
     shapes = [
       { field: 'pie', label: '楗煎浘' },
       { field: 'ring', label: '鐜浘' }
@@ -1346,9 +1346,23 @@
 
   return [
     {
+      type: 'radio',
+      key: 'datatype',
+      label: '鏁版嵁绫诲瀷',
+      initVal: card.datatype || 'query',
+      tooltip: '缁熻鍥捐〃閫傜敤浜庤〃鏍间笉鍒嗛〉锛屼笖鏁版嵁闇�瑕佽浆鎹�',
+      required: false,
+      readonly: !(setting.laypage === 'false'),
+      forbid: !['line', 'bar'].includes(card.chartType),
+      options: [
+        { value: 'query', text: Formdict['header.form.query'] },
+        { value: 'statistics', text: Formdict['header.form.statistics'] }
+      ]
+    },
+    {
       type: 'select',
       key: 'Xaxis',
-      label: type === 'pie' ? 'Text' : 'X-杞�',
+      label: card.chartType === 'pie' ? 'Text' : 'X-杞�',
       initVal: card.Xaxis || '',
       required: true,
       options: columns.filter(col => col.type === 'text')
@@ -1356,9 +1370,30 @@
     {
       type: 'select',
       key: 'Yaxis',
-      label: type === 'pie' ? 'Value' : 'Y-杞�',
-      initVal: type === 'pie' ? card.Yaxis || '' : card.Yaxis || [],
-      multi: type !== 'pie',
+      label: card.chartType === 'pie' ? 'Value' : 'Y-杞�',
+      initVal: card.chartType === 'pie' ? card.Yaxis || '' : card.Yaxis || [],
+      multi: card.chartType !== 'pie',
+      hidden: card.datatype === 'statistics',
+      required: true,
+      options: columns.filter(col => col.type === 'number')
+    },
+    {
+      type: 'select',
+      key: 'InfoType',
+      label: '绫诲瀷',
+      initVal: card.InfoType || '',
+      forbid: !['line', 'bar'].includes(card.chartType),
+      hidden: card.datatype !== 'statistics',
+      required: true,
+      options: columns.filter(col => col.type === 'text')
+    },
+    {
+      type: 'select',
+      key: 'InfoValue',
+      label: '鍊�',
+      initVal: card.InfoValue || '',
+      forbid: !['line', 'bar'].includes(card.chartType),
+      hidden: card.datatype !== 'statistics',
       required: true,
       options: columns.filter(col => col.type === 'number')
     },
@@ -1390,7 +1425,7 @@
       label: '褰㈢姸',
       initVal: card.shape || (shapes[0] && shapes[0].field),
       required: false,
-      hidden: !['line', 'bar', 'pie'].includes(type),
+      forbid: !['line', 'bar', 'pie'].includes(card.chartType),
       options: shapes
     },
     {
@@ -1413,7 +1448,7 @@
       label: '鍧愭爣',
       initVal: card.coordinate || 'angle',
       required: false,
-      hidden: !['line', 'bar'].includes(type),
+      forbid: !['line', 'bar'].includes(card.chartType),
       options: [{
         value: 'angle',
         text: '浜岀淮鍧愭爣'
@@ -1428,7 +1463,7 @@
       label: '鐐瑰浘',
       initVal: card.point || 'false',
       required: false,
-      hidden: !['line'].includes(type),
+      forbid: !['line'].includes(card.chartType),
       options: [{
         value: 'true',
         text: '鏄剧ず'
@@ -1443,7 +1478,7 @@
       label: '鍙樻崲',
       initVal: card.transpose || 'false',
       required: false,
-      hidden: !['line', 'bar'].includes(type),
+      forbid: !['line', 'bar'].includes(card.chartType),
       options: [{
         value: 'true',
         text: Formdict['header.form.true']
@@ -1458,7 +1493,7 @@
       label: '鏄剧ず鍊�',
       initVal: card.pieshow || 'percent',
       required: false,
-      hidden: !['pie'].includes(type),
+      forbid: !['pie'].includes(card.chartType),
       options: [{
         value: 'percent',
         text: '鐧惧垎姣�'
@@ -1471,9 +1506,9 @@
       type: 'radio',
       key: 'label',
       label: '鏂囨湰鏍囩',
-      initVal: card.label || (type === 'pie' ? 'true' : 'false'),
+      initVal: card.label || (card.chartType === 'pie' ? 'true' : 'false'),
       required: false,
-      hidden: !['pie', 'line'].includes(type),
+      forbid: !['pie', 'line'].includes(card.chartType),
       options: [{
         value: 'true',
         text: '鏄剧ず'
@@ -1487,7 +1522,7 @@
       label: '鏍囩甯冨眬',
       initVal: card.labelLayout || 'normal',
       required: false,
-      hidden: !['pie'].includes(type),
+      forbid: !['pie'].includes(card.chartType),
       options: [{
         value: 'normal',
         text: '甯歌'
@@ -1501,7 +1536,7 @@
       label: '澶氭煴鎺掑垪',
       initVal: card.adjust || 'dodge',
       required: false,
-      hidden: !['bar'].includes(type),
+      forbid: !['bar'].includes(card.chartType),
       options: [{
         value: 'dodge',
         text: '鍒嗙粍'
@@ -1509,7 +1544,36 @@
         value: 'stack',
         text: '鍫嗗彔'
       }]
-    }
+    }, {
+      type: 'radio',
+      key: 'repeat',
+      label: '閲嶅鏁版嵁',
+      initVal: card.repeat || 'unrepeat',
+      required: false,
+      // forbid: !['bar', 'pie', 'line'].includes(card.chartType),
+      options: [{
+        value: 'unrepeat',
+        text: '鍘婚噸'
+      }, {
+        value: 'average',
+        text: '骞冲潎'
+      }, {
+        value: 'cumsum',
+        text: '绱姞'
+      }]
+    }, {
+      type: 'number',
+      key: 'InfoDefNumber',
+      label: '灞曠ず鏁�',
+      tooltip: '榛樿鏄剧ず绫诲瀷鏁伴噺',
+      min: 1,
+      max: 50,
+      decimal: 0,
+      initVal: card.InfoDefNumber || 5,
+      forbid: !['line', 'bar'].includes(card.chartType),
+      hidden: card.datatype !== 'statistics',
+      required: true
+    },
   ]
 }
 

--
Gitblit v1.8.0