From 9b6ce1a5778c6e1a813237e87588c0052aae1bbb Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 29 四月 2020 17:26:15 +0800
Subject: [PATCH] 2020-04-29

---
 src/templates/zshare/formconfig.jsx |  377 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 340 insertions(+), 37 deletions(-)

diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index d72cf10..371490a 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -1,5 +1,5 @@
-import zhCN from '@/locales/zh-CN/comtable.js'
-import enUS from '@/locales/en-US/comtable.js'
+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
 
@@ -252,8 +252,55 @@
  * @param {*} functip        鐢熸垚瀛樺偍杩囩▼鎻愮ず
  * @param {*} config         椤甸潰閰嶇疆
  * @param {*} permFuncField  瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈�
+ * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
-export function getActionForm (card, functip, config, permFuncField) {
+export function getActionForm (card, functip, config, permFuncField, type) {
+  let opentypes = [
+    {
+      value: 'pop',
+      text: Formdict['header.form.popform']
+    }, {
+      value: 'prompt',
+      text: Formdict['header.form.prompt']
+    }, {
+      value: 'exec',
+      text: Formdict['header.form.exec']
+    }, {
+      value: 'excelIn',
+      text: Formdict['header.form.excelIn']
+    }, {
+      value: 'excelOut',
+      text: Formdict['header.form.excelOut']
+    }, {
+      value: 'popview',
+      text: Formdict['header.form.popview']
+    }
+  ]
+
+  if (type === 'subtable') {
+    opentypes.push({
+      value: 'funcbutton',
+      text: Formdict['header.form.funcbutton']
+    })
+  } else {
+    opentypes.push({
+      value: 'tab',
+      text: Formdict['header.form.tab']
+    }, {
+      value: 'blank',
+      text: Formdict['header.form.blank']
+    }, {
+      value: 'innerpage',
+      text: Formdict['header.form.newpage.inner']
+    }, {
+      value: 'outerpage',
+      text: Formdict['header.form.newpage.outer']
+    }, {
+      value: 'funcbutton',
+      text: Formdict['header.form.funcbutton']
+    })
+  }
+
   return [
     {
       type: 'text',
@@ -269,40 +316,7 @@
       label: Formdict['header.form.openType'],
       initVal: card.OpenType,
       required: true,
-      options: [{
-        value: 'pop',
-        text: Formdict['header.form.popform']
-      }, {
-        value: 'prompt',
-        text: Formdict['header.form.prompt']
-      }, {
-        value: 'exec',
-        text: Formdict['header.form.exec']
-      }, {
-        value: 'excelIn',
-        text: Formdict['header.form.excelIn']
-      }, {
-        value: 'excelOut',
-        text: Formdict['header.form.excelOut']
-      }, {
-        value: 'popview',
-        text: Formdict['header.form.popview']
-      }, {
-        value: 'tab',
-        text: Formdict['header.form.tab']
-      }, {
-        value: 'blank',
-        text: Formdict['header.form.blank']
-      }, {
-        value: 'innerpage',
-        text: Formdict['header.form.newpage.inner']
-      }, {
-        value: 'outerpage',
-        text: Formdict['header.form.newpage.outer']
-      }, {
-        value: 'funcbutton',
-        text: Formdict['header.form.funcbutton']
-      }]
+      options: opentypes
     },
     {
       type: 'select',
@@ -871,6 +885,295 @@
 }
 
 /**
+ * @description 鑾峰彇鍥捐〃瑙嗗浘澶栭儴閰嶇疆琛ㄥ崟
+ * @param {*} card
+ */
+export function getChartViewForm (card, roleList = []) {
+  let _charts = [{
+    value: 'line',
+    text: '鎶樼嚎鍥�'
+  }, {
+    value: 'bar',
+    text: '鏌辩姸鍥�'
+  }, {
+    value: 'pie',
+    text: '楗煎浘'
+  }]
+
+  if (card.chartType === 'table') {
+    _charts = [{
+      value: 'table',
+      text: '琛ㄦ牸'
+    }]
+  }
+
+  return [
+    {
+      type: 'text',
+      key: 'title',
+      label: Formdict['header.form.title'],
+      initVal: card.title,
+      required: false
+    },
+    {
+      type: 'select',
+      key: 'chartType',
+      label: '鍥捐〃绫诲瀷',
+      initVal: card.chartType,
+      required: true,
+      readonly: card.chartType === 'table',
+      options: _charts
+    },
+    {
+      type: 'number',
+      key: 'height',
+      min: 100,
+      max: 1000,
+      decimal: 0,
+      label: '楂樺害',
+      initVal: card.height || 400,
+      required: true
+    },
+    {
+      type: 'number',
+      key: 'width',
+      min: 1,
+      max: 24,
+      decimal: 0,
+      label: '瀹藉害',
+      tooltip: '姣忚绛夊垎涓�24鍒楋紝24鍗充负100%銆�',
+      initVal: card.width || 24,
+      required: true
+    },
+    {
+      type: 'radio',
+      key: 'Hide',
+      label: Formdict['header.form.Hide'],
+      initVal: card.Hide,
+      required: true,
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'multiselect',
+      key: 'blacklist',
+      label: Formdict['header.form.blacklist'],
+      initVal: card.blacklist || [],
+      required: false,
+      options: roleList
+    }
+  ]
+}
+
+/**
+ * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟
+ * @param {*} card
+ */
+export function getChartOptionForm (card, columns, type) {
+  let shapes = []
+
+  if (type === '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 (type === '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' }
+    ]
+  } else if (type === 'pie') {
+    shapes = [
+      { field: 'pie', label: '楗煎浘' },
+      { field: 'ring', label: '鐜浘' }
+    ]
+  }
+
+  return [
+    {
+      type: 'select',
+      key: 'Xaxis',
+      label: type === 'pie' ? 'Text' : 'X-杞�',
+      initVal: card.Xaxis || '',
+      required: true,
+      options: columns.filter(col => col.type === 'text')
+    },
+    {
+      type: 'select',
+      key: 'Yaxis',
+      label: type === 'pie' ? 'Value' : 'Y-杞�',
+      initVal: type === 'pie' ? card.Yaxis || '' : card.Yaxis || [],
+      multi: type !== 'pie',
+      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' }
+      ]
+    },
+    {
+      type: 'select',
+      key: 'shape',
+      label: '褰㈢姸',
+      initVal: card.shape || (shapes[0] && shapes[0].field),
+      required: false,
+      hidden: !['line', 'bar', 'pie'].includes(type),
+      options: shapes
+    },
+    {
+      type: 'radio',
+      key: 'tooltip',
+      label: '鎻愮ず淇℃伅',
+      initVal: card.tooltip || 'true',
+      required: false,
+      options: [{
+        value: 'true',
+        text: '鏄剧ず'
+      }, {
+        value: 'false',
+        text: '闅愯棌'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'coordinate',
+      label: '鍧愭爣',
+      initVal: card.coordinate || 'angle',
+      required: false,
+      hidden: !['line', 'bar'].includes(type),
+      options: [{
+        value: 'angle',
+        text: '浜岀淮鍧愭爣'
+      }, {
+        value: 'polar',
+        text: '鏋佸潗鏍�'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'point',
+      label: '鐐瑰浘',
+      initVal: card.point || 'false',
+      required: false,
+      hidden: !['line'].includes(type),
+      options: [{
+        value: 'true',
+        text: '鏄剧ず'
+      }, {
+        value: 'false',
+        text: '闅愯棌'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'transpose',
+      label: '鍙樻崲',
+      initVal: card.transpose || 'false',
+      required: false,
+      hidden: !['line', 'bar'].includes(type),
+      options: [{
+        value: 'true',
+        text: Formdict['header.form.true']
+      }, {
+        value: 'false',
+        text: Formdict['header.form.false']
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'pieshow',
+      label: '鏄剧ず鍊�',
+      initVal: card.pieshow || 'percent',
+      required: false,
+      hidden: !['pie'].includes(type),
+      options: [{
+        value: 'percent',
+        text: '鐧惧垎姣�'
+      }, {
+        value: 'value',
+        text: '鏁板��'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'label',
+      label: '鏂囨湰鏍囩',
+      initVal: card.label || (type === 'pie' ? 'true' : 'false'),
+      required: false,
+      hidden: !['pie', 'line'].includes(type),
+      options: [{
+        value: 'true',
+        text: '鏄剧ず'
+      }, {
+        value: 'false',
+        text: '闅愯棌'
+      }]
+    }, {
+      type: 'radio',
+      key: 'labelLayout',
+      label: '鏍囩甯冨眬',
+      initVal: card.labelLayout || 'normal',
+      required: false,
+      hidden: !['pie'].includes(type),
+      options: [{
+        value: 'normal',
+        text: '甯歌'
+      }, {
+        value: 'overlap',
+        text: '闃查噸鍙�'
+      }]
+    }, {
+      type: 'radio',
+      key: 'adjust',
+      label: '澶氭煴鎺掑垪',
+      initVal: card.adjust || 'dodge',
+      required: false,
+      hidden: !['bar'].includes(type),
+      options: [{
+        value: 'dodge',
+        text: '鍒嗙粍'
+      }, {
+        value: 'stack',
+        text: '鍫嗗彔'
+      }]
+    }
+  ]
+}
+
+/**
  * @description 鑾峰彇琛ㄥ崟閰嶇疆淇℃伅
  * @param {*} card 
  * @param {*} inputfields 

--
Gitblit v1.8.0