From 3bb266595fbfa9af6b97405737496ed61c6b7c55 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 01 三月 2022 17:10:57 +0800
Subject: [PATCH] 2022-03-01

---
 src/templates/zshare/formconfig.jsx |  284 ++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 172 insertions(+), 112 deletions(-)

diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index d57f0c6..b714e61 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -1,6 +1,6 @@
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
-import { formRule } from '@/utils/option.js'
+import { formRule, btnClasses } from '@/utils/option.js'
 
 const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 
@@ -364,23 +364,30 @@
     }
   }
 
+  let options = card.options || []
+  if (['select', 'link'].includes(card.type) && card.setAll === 'true') { // 鍏煎
+    options.unshift({
+      key: 'empty',
+      Value: '',
+      Text: '鍏ㄩ儴',
+      ParentID: ''
+    })
+  }
+
   return [
     {
       type: 'text',
       key: 'label',
       label: Formdict['model.name'],
       initVal: card.label || '',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'text',
       key: 'field',
       label: Formdict['model.form.field'],
       initVal: card.field || '',
-      tooltipClass: 'middle',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'select',
@@ -395,8 +402,7 @@
       key: 'datefield',
       label: '鏃堕棿瀛楁',
       initVal: card.datefield || '',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'text',
@@ -420,19 +426,19 @@
         text: Formdict['header.form.datasource']
       }]
     },
-    {
-      type: 'radio',
-      key: 'setAll',
-      label: '璁剧疆鍏ㄩ儴',
-      initVal: card.setAll || 'true',
-      options: [{
-        value: 'true',
-        text: Formdict['model.true']
-      }, {
-        value: 'false',
-        text: Formdict['model.false']
-      }]
-    },
+    // {
+    //   type: 'radio',
+    //   key: 'setAll',
+    //   label: '璁剧疆鍏ㄩ儴',
+    //   initVal: card.setAll || 'true',
+    //   options: [{
+    //     value: 'true',
+    //     text: Formdict['model.true']
+    //   }, {
+    //     value: 'false',
+    //     text: Formdict['model.false']
+    //   }]
+    // },
     {
       type: 'radio',
       key: 'display',
@@ -463,16 +469,14 @@
       key: 'cardValField',
       label: '鍊悸峰瓧娈�',
       initVal: card.cardValField || 'Value',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'text',
       key: 'urlField',
       label: '鍦板潃瀛楁',
       initVal: card.urlField || '',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'radio',
@@ -499,24 +503,21 @@
       key: 'fields',
       label: '瀛楁闆�',
       initVal: card.fields || [],
-      required: true,
-      readonly: false
+      required: true
     },
     {
-      type: 'textarea',
+      type: 'codemirror',
       key: 'dataSource',
       label: Formdict['header.form.datasource'],
       initVal: card.dataSource || '',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'options',
       key: 'options',
       label: '閫夐」',
-      initVal: card.options || [],
-      required: true,
-      readonly: false
+      initVal: options,
+      required: true
     },
     {
       type: 'checkbox',
@@ -524,7 +525,6 @@
       label: '閫夐」',
       initVal: card.items || ['day', 'week', 'month', 'quarter', 'year', 'customized'],
       required: true,
-      readonly: false,
       options: [{
         value: 'day',
         label: '鏃�'
@@ -546,12 +546,26 @@
       }]
     },
     {
+      type: 'radio',
+      key: 'multiple',
+      label: '閫夋嫨褰㈠紡',
+      initVal: card.multiple || 'false',
+      required: true,
+      options: [{
+        value: 'false',
+        text: '鍗曢��'
+      }, {
+        value: 'true',
+        text: '澶氶��'
+      }]
+    },
+    {
       type: 'select',
       key: 'linkField',
       label: '鍏宠仈瀛楁',
       initVal: card.linkField || '',
       required: true,
-      readonly: false,
+      allowClear: true,
       options: linkableFields
     },
     {
@@ -559,24 +573,21 @@
       key: 'valueField',
       label: '鍊悸峰瓧娈�',
       initVal: card.valueField || '',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'text',
       key: 'valueText',
       label: '鏂囨湰路瀛楁',
       initVal: card.valueText || '',
-      required: true,
-      readonly: false
+      required: true
     },
     {
       type: 'text',
       key: 'orderBy',
       label: '鎺掑簭路瀛楁',
       initVal: card.orderBy || '',
-      required: false,
-      readonly: false
+      required: false
     },
     {
       type: 'select',
@@ -637,20 +648,6 @@
       initVal: card.ratio || 6,
       forbid: appType === 'mob',
       required: false
-    },
-    {
-      type: 'radio',
-      key: 'multiple',
-      label: '鍙閫�',
-      initVal: card.multiple || 'false',
-      required: true,
-      options: [{
-        value: 'true',
-        text: '鏄�'
-      }, {
-        value: 'false',
-        text: '鍚�'
-      }]
     },
     {
       type: 'radio',
@@ -820,7 +817,7 @@
  * @param {*} usefulFields   瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈�
  * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
-export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = []) {
+export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) {
   let columns = (config.columns || []).filter(col => col.field)
 
   let opentypes = [
@@ -862,6 +859,11 @@
   }
   if (card.popClose === 'view') {
     card.popClose = 'grid'
+  }
+
+  if (card.OpenType === 'outerpage') {
+    card.pageTemplate = 'custom'
+    card.OpenType = 'innerpage'
   }
 
   let refresh = []
@@ -981,7 +983,6 @@
       initVal: card.innerFunc || '',
       tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬨�俙,
       fields: usefulFields,
-      tooltipClass: 'middle',
       required: card.intertype === 'inner',
       readonly: false
     },
@@ -991,7 +992,13 @@
       label: '鍏宠仈鏍囩',
       initVal: card.linkTab || '',
       required: false,
-      options: []
+      options: [
+        {
+          value: '',
+          text: '鏂板缓'
+        },
+        ...tabs
+      ]
     },
     {
       type: 'select',
@@ -1170,7 +1177,7 @@
       type: refresh.length === 0 ? 'radio' : 'select',
       key: 'execSuccess',
       label: Formdict['model.form.afterSuccess'],
-      initVal: card.execSuccess || 'never',
+      initVal: card.execSuccess || 'grid',
       tooltip: '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍笺��',
       required: true,
       options: [{
@@ -1246,7 +1253,7 @@
       label: Formdict['model.form.color'],
       initVal: card.class,
       required: false,
-      options: []
+      options: btnClasses
     },
     {
       type: 'cascader',
@@ -1263,6 +1270,14 @@
       label: '杩斿洖鍊�',
       tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺��',
       initVal: card.output || '',
+      required: false
+    },
+    {
+      type: 'text',
+      key: 'tipTitle',
+      label: '纭鎻愮ず',
+      initVal: card.tipTitle || '',
+      tooltip: '娉細寮圭獥锛堣〃鍗曪級鍦ㄦ樉绀轰负鏄惁妗嗘椂鏈夋晥銆�',
       required: false
     },
     {
@@ -1332,7 +1347,7 @@
       type: 'number',
       key: 'ratio',
       min: 1,
-      max: 24,
+      max: 3000,
       precision: 0,
       label: '姣斾緥',
       initVal: card.ratio || 85,
@@ -1380,7 +1395,6 @@
       initVal: card.preFunc || '',
       tooltip: `鍑芥暟鍚嶇О闇�浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鍓嶇疆鍑芥暟鎵ц瀹屾垚鍚庯紝缁撴灉浼氫紶鍏ュ唴閮ㄥ嚱鏁颁腑锛屾鏃跺唴閮ㄥ嚱鏁颁細寮傛鎵ц锛涘綋鍓嶇疆鍑芥暟杩斿洖涓璄rrCode绛変簬-1鏃讹紝灏嗕笉鍐嶆墽琛屽唴閮ㄥ嚱鏁般�俙,
       fields: usefulFields,
-      tooltipClass: 'middle',
       required: false,
       readonly: false
     },
@@ -1618,7 +1632,7 @@
         text: Formdict['model.empty']
       }, {
         value: 'thdSeparator',
-        text: Formdict['header.form.thdSeparator']
+        text: '鍗冨垎浣�'
       }, {
         value: 'percent',
         text: '鐧惧垎姣�'
@@ -2337,6 +2351,9 @@
     }, {
       value: 'split',
       text: '鍒嗛殧绾�'
+    }, {
+      value: 'linkMain',
+      text: '鍏宠仈涓昏〃'
     }]
   }
 
@@ -2344,6 +2361,27 @@
     _fieldlength = 512
   } else if (['textarea', 'brafteditor'].includes(card.type)) {
     _fieldlength = 8000
+  }
+
+  let options = card.options || []
+  if (['select', 'radio', 'link'].includes(card.type) && card.setAll === 'true') { // 鍏煎
+    options.unshift({
+      key: 'empty',
+      Value: '',
+      Text: card.emptyText || '绌�',
+      ParentID: ''
+    })
+  }
+
+  let initval = card.initval || ''
+  if (card.type === 'switch') {
+    initval = card.initval === true
+  } else if (card.type === 'number') {
+    initval = card.initval || 0
+  }
+
+  if (appType === 'mob' && ![24, 12, 8, 6].includes(card.span)) {
+    card.span = 24
   }
 
   return [
@@ -2375,8 +2413,7 @@
       type: 'text',
       key: 'initval',
       label: Formdict['header.form.initval'],
-      tooltip: '涓嬫媺澶氶�変笌澶氶�夋锛屾坊鍔犲涓垵濮嬪�艰浣跨敤鈥�,鈥濆彿鍒嗛殧銆傛敞锛氫笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曟垨鍗曢�夋涓�$first琛ㄧず閫夋嫨绗竴椤�',
-      initVal: card.initval || '',
+      initVal: initval,
       required: false
     },
     {
@@ -2406,16 +2443,14 @@
       key: 'openText',
       label: '寮�鍚彁绀�',
       initVal: card.openText || '',
-      required: false,
-      forbid: appType === 'mob'
+      required: false
     },
     {
       type: 'text',
       key: 'closeText',
       label: '鍏抽棴鎻愮ず',
       initVal: card.closeText || '',
-      required: false,
-      forbid: appType === 'mob'
+      required: false
     },
     {
       type: 'radio',
@@ -2492,19 +2527,19 @@
         text: '16:9'
       }]
     },
-    {
-      type: 'radio',
-      key: 'setAll',
-      label: '璁剧疆绌哄��',
-      initVal: card.setAll || 'false',
-      options: [{
-        value: 'true',
-        text: Formdict['model.true']
-      }, {
-        value: 'false',
-        text: Formdict['model.false']
-      }]
-    },
+    // {
+    //   type: 'radio',
+    //   key: 'setAll',
+    //   label: '璁剧疆绌哄��',
+    //   initVal: card.setAll || 'false',
+    //   options: [{
+    //     value: 'true',
+    //     text: Formdict['model.true']
+    //   }, {
+    //     value: 'false',
+    //     text: Formdict['model.false']
+    //   }]
+    // },
     {
       type: 'fields',
       key: 'fields',
@@ -2517,7 +2552,7 @@
       type: 'options',
       key: 'options',
       label: '閫夐」',
-      initVal: card.options || [],
+      initVal: options,
       required: true,
       readonly: false
     },
@@ -2530,12 +2565,27 @@
       readonly: false
     },
     {
+      type: 'radio',
+      key: 'multiple',
+      label: '閫夋嫨褰㈠紡',
+      initVal: card.multiple || 'false',
+      required: true,
+      options: [{
+        value: 'false',
+        text: '鍗曢��'
+      }, {
+        value: 'true',
+        text: '澶氶��'
+      }]
+    },
+    {
       type: 'select',
       key: 'linkField',
       label: '鍏宠仈瀛楁',
       initVal: card.linkField || '',
       required: true,
       readonly: false,
+      allowClear: true,
       options: linkableFields
     },
     {
@@ -2583,20 +2633,6 @@
       tooltip: '璁剧疆绂佺敤瀛楁锛屼笖瀛楁鍊间负true鏃讹紝閫夐」涓嶅彲閫夈��',
       required: false,
       readonly: false
-    },
-    {
-      type: 'radio',
-      key: 'multiple',
-      label: '鍙閫�',
-      initVal: card.multiple || 'false',
-      required: true,
-      options: [{
-        value: 'true',
-        text: '鏄�'
-      }, {
-        value: 'false',
-        text: '鍚�'
-      }]
     },
     {
       type: 'number',
@@ -2726,10 +2762,10 @@
       type: 'number',
       key: 'fieldlength',
       min: 1,
-      max: 1000000,
+      max: 100000,
       precision: 0,
       label: Formdict['model.form.field'] + Formdict['model.length'],
-      tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512',
+      // tooltip: '鏂囨湰銆佷笅鎷夋銆佹棩鏈熺瓑瀛楁榛樿闀垮害涓�50锛屽琛屾枃鏈笌鏂囦欢涓婁紶瀛楁榛樿闀垮害涓�512',
       initVal: card.fieldlength || _fieldlength,
       required: false
     },
@@ -3042,7 +3078,7 @@
       type: 'radio',
       key: 'interception',
       label: '鎴彇绌烘牸',
-      initVal: card.interception || 'false',
+      initVal: card.interception || 'true',
       tooltip: '鎻愪氦鏃讹紝鏄惁鎴彇棣栧熬鐨勭┖鐧藉瓧绗︺��',
       options: [{
         value: 'true',
@@ -3134,6 +3170,28 @@
       forbid: appType === 'mob'
     },
     {
+      type: 'radio',
+      key: 'span',
+      label: '琛ㄥ崟瀹藉害',
+      initVal: card.span || 24,
+      tooltip: '鏍呮牸甯冨眬鏁磋24绛夊垎銆�',
+      required: true,
+      forbid: appType !== 'mob',
+      options: [{
+        value: 24,
+        text: 24
+      }, {
+        value: 12,
+        text: 12
+      }, {
+        value: 8,
+        text: 8
+      }, {
+        value: 6,
+        text: 6
+      }]
+    },
+    {
       type: 'number',
       key: 'labelwidth',
       min: 1,
@@ -3179,19 +3237,21 @@
       type: 'select',
       key: 'supField',
       label: '涓婄骇琛ㄥ崟',
-      tooltip: '涓婄骇琛ㄥ崟涓轰笅鎷夐�夋嫨銆佽仈鍔ㄨ彍鍗曘�佸崟閫夋鍙婂閫夋锛屾坊鍔犲悗璇ヨ〃鍗曟樉绀哄強闅愯棌灏嗗彈涓婄骇琛ㄥ崟鎺у埗锛屾敞锛氬彈鎺у叧绯诲湪璇ヨ〃鍗曢殣钘忔椂澶辨晥銆�',
+      tooltip: '璇ヨ〃鍗曟樉绀烘垨闅愯棌鍙椾笂绾ц〃鍗曟帶鍒躲��',
       initVal: card.supField || '',
       required: false,
       readonly: false,
+      allowClear: true,
       options: linksupFields
     },
     {
       type: 'text',
       key: 'supvalue',
+      max: 512,
       label: '鏄剧ず鍊�',
       tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛�1銆佸涓�肩敤閫楀彿鍒嗛殧锛�2銆佷笂绾ц〃鍗曞垵濮嬪�间负$first鏃舵殏鏈鐞嗐��',
       initVal: card.supvalue || '',
-      required: true,
+      required: false,
       readonly: false
     },
     {
@@ -3220,14 +3280,14 @@
       initVal: card.placeholder || '',
       required: false
     },
-    {
-      type: 'text',
-      key: 'emptyText',
-      label: '绌哄�兼枃鏈�',
-      tooltip: '绌哄�肩殑鎻愮ず鏂囨湰锛岄�夋嫨璁剧疆绌哄�兼椂鏈夋晥锛岄粯璁ゅ�间负銆婄┖銆嬨��',
-      initVal: card.emptyText || '',
-      required: false
-    },
+    // {
+    //   type: 'text',
+    //   key: 'emptyText',
+    //   label: '绌哄�兼枃鏈�',
+    //   tooltip: '绌哄�肩殑鎻愮ず鏂囨湰锛岄�夋嫨璁剧疆绌哄�兼椂鏈夋晥锛岄粯璁ゅ�间负銆婄┖銆嬨��',
+    //   initVal: card.emptyText || '',
+    //   required: false
+    // },
     {
       type: 'radio',
       key: 'enter',
@@ -3256,8 +3316,8 @@
     {
       type: 'multiselect',
       key: 'linkSubField',
-      label: Formdict['model.form.linkform'],
-      tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆傛敞锛氫娇鐢ㄩ�夐」鍗′笖璁句负鍙閫夋椂鏃犳晥銆�',
+      label: '濉厖琛ㄥ崟',
+      tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆�',
       initVal: card.linkSubField || [],
       options: inputfields
     },

--
Gitblit v1.8.0