From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 17 十月 2022 17:57:34 +0800
Subject: [PATCH] 2022-10-17

---
 src/menu/components/share/actioncomponent/formconfig.jsx |  199 ++++++++++++++++++++++++++++---------------------
 1 files changed, 114 insertions(+), 85 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index 46fd198..5c1870c 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -1,8 +1,5 @@
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 import { btnCustomClasses } from '@/utils/option.js'
 
-const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 
 /**
  * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅
@@ -12,7 +9,7 @@
  * @param {*} usefulFields   瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈�
  * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
-export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = [], anchors = []) {
+export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = []) {
   let appType = sessionStorage.getItem('appType')
   let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview
   let printTemps = sessionStorage.getItem('printTemps')
@@ -20,34 +17,45 @@
   let setting = config.setting || {}
   let columns = config.columns || []
   let appMenus = []
+  let menulist = []
+  let type = ''
+
+  if (card.eleType === 'button') {
+    type = 'card'
+  } else if (config.subtype === 'datacard' || config.subtype === 'tablecard') {
+    type = 'datacard'
+  } else if (config.type === 'line' || config.type === 'bar' || config.type === 'scatter') {
+    type = 'chart'
+  }
+
   let opentypes = [
     {
       value: 'pop',
-      text: Formdict['model.form.popform']
+      text: '寮圭獥锛堣〃鍗曪級'
     }, {
       value: 'prompt',
-      text: Formdict['model.form.prompt']
+      text: '鎻愮ず妗�'
     }, {
       value: 'exec',
-      text: Formdict['model.form.exec']
+      text: '鐩存帴鎵ц'
     }, {
       value: 'excelIn',
-      text: Formdict['model.form.excelIn']
+      text: '瀵煎叆Excel'
     }, {
       value: 'excelOut',
-      text: Formdict['model.form.excelOut']
+      text: '瀵煎嚭Excel'
     }, {
       value: 'popview',
-      text: Formdict['model.form.popview']
+      text: '寮圭獥锛堟爣绛撅級'
     }, {
       value: 'tab',
-      text: Formdict['model.form.tab']
+      text: '鏍囩椤�'
     }, {
       value: 'innerpage',
-      text: Formdict['model.form.newpage']
+      text: '鏂伴〉闈�'
     }, {
       value: 'funcbutton',
-      text: Formdict['model.form.funcbutton']
+      text: '鍔熻兘鎸夐挳'
     }
   ]
 
@@ -76,30 +84,20 @@
     return _list
   }
 
-  // if (type === 'editable') {
-  //   opentypes = [
-  //     {
-  //       value: 'excelIn',
-  //       text: Formdict['model.form.excelIn']
-  //     }, {
-  //       value: 'excelOut',
-  //       text: Formdict['model.form.excelOut']
-  //     }
-  //   ]
-  // }
   let tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components)))
 
   let pageTemps = [
     { value: 'billprint', text: '鍗曟嵁鎵撳嵃' },
-    { value: 'pay', text: Formdict['model.pay'] },
-    { value: 'custom', text: Formdict['header.form.custom'] }
+    { value: 'pay', text: '鏀粯' },
+    { value: 'custom', text: '鑷畾涔�' }
   ]
   const isApp = ['pc', 'mob'].includes(appType)
 
   let funTypes = [
     { value: 'print', text: '鏍囩鎵撳嵃' },
-    { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' },
+    { value: 'refund', text: '閫�娆�' },
     { value: 'closetab', text: '鏍囩鍏抽棴' },
+    { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' },
     { value: 'megvii', text: '鏃疯闈㈡澘鏈�' },
     { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' },
   ]
@@ -115,12 +113,24 @@
     } else {
       appMenus = []
     }
+  } else {
+    menulist = sessionStorage.getItem('fstMenuList')
+    if (menulist) {
+      try {
+        menulist = JSON.parse(menulist)
+      } catch (e) {
+        menulist = []
+      }
+    } else {
+      menulist = []
+    }
   }
   if (appType === 'mob') {
     opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value))
     funTypes = [
       { value: 'scan', text: '鎵爜' },
       { value: 'pay', text: '鏀粯' },
+      { value: 'refund', text: '閫�娆�' },
       { value: 'resetPwd', text: '淇敼瀵嗙爜'},
       { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' },
       { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' },
@@ -137,18 +147,23 @@
   } else if (appType === 'pc') {
     opentypes = opentypes.filter(item => item.value !== 'tab')
     funTypes = [
+      { value: 'refund', text: '閫�娆�' },
       { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' },
     ]
     pageTemps = [
       { value: 'linkpage', text: '鍏宠仈鑿滃崟' },
       { value: 'billprint', text: '鍗曟嵁鎵撳嵃' },
-      { value: 'pay', text: Formdict['model.pay'] },
+      { value: 'pay', text: '鏀粯' },
       { value: 'custom', text: '閾炬帴' }
     ]
   }
   
   if (type === 'chart' && appType !== 'mob') {
     opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut')
+
+    if (card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut') { // 鎷栨嫿娣诲姞绫诲瀷杞崲
+      card.OpenType = 'excelOut'
+    }
   }
 
   let refresh = []
@@ -167,8 +182,10 @@
   if (type === 'card') {
     opentypes.push({
       value: 'form',
-      text: '琛ㄥ崟锛堝紑鍏虫垨鍕鹃�夋锛�'
+      text: '琛ㄥ崟'
     })
+  } else if (card.OpenType === 'form') { // 鎷栨嫿娣诲姞绫诲瀷杞崲
+    card.OpenType = 'pop'
   }
 
   if (!card.control && card.controlField) {
@@ -191,11 +208,21 @@
     }]
   }
 
+  let formTypes = []
+  if (appType === 'mob') {
+    formTypes = [{
+      value: 'scan',
+      text: '鎵弿'
+    }]
+  } else if (card.formType === 'scan') {
+    card.formType = 'switch'
+  }
+
   let forms = [
     {
       type: 'select',
       key: 'OpenType',
-      label: Formdict['header.form.openType'],
+      label: '鎵撳紑鏂瑰紡',
       initVal: card.OpenType,
       required: true,
       options: opentypes
@@ -237,29 +264,30 @@
       }, {
         value: 'radio',
         text: '鍕鹃�夋'
-      }]
+      }, 
+      ...formTypes]
     },
     {
       type: 'select',
       key: 'execMode',
-      label: Formdict['model.form.execMode'],
+      label: '鎵ц鏂瑰紡',
       initVal: card.execMode || 'exec',
       required: true,
       options: [{
         value: 'exec',
-        text: Formdict['model.form.exec']
+        text: '鐩存帴鎵ц'
       }, {
         value: 'prompt',
-        text: Formdict['model.form.prompt']
+        text: '鎻愮ず妗�'
       }, {
         value: 'pop',
-        text: Formdict['model.form.popform']
+        text: '寮圭獥锛堣〃鍗曪級'
       }]
     },
     {
       type: 'radio',
       key: 'intertype',
-      label: Formdict['header.form.intertype'],
+      label: '鎺ュ彛绫诲瀷',
       initVal: card.intertype || 'system',
       required: true,
       options: []
@@ -273,16 +301,16 @@
       options: [{
         value: 'wxpay',
         text: '寰俊'
-      }, {
-        value: 'alipay',
-        text: '鏀粯瀹�'
+      // }, {
+      //   value: 'alipay',
+      //   text: '鏀粯瀹�'
       }]
     },
     {
       type: 'radio',
       key: 'procMode',
       label: '鍙傛暟澶勭悊',
-      initVal: card.procMode || 'system',
+      initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'),
       required: true,
       options: [{
         value: 'system',
@@ -298,7 +326,7 @@
     {
       type: 'radio',
       key: 'sqlType',
-      label: Formdict['header.form.action.type'],
+      label: '鎿嶄綔绫诲瀷',
       initVal: card.sqlType || '',
       required: true,
       options: []
@@ -306,14 +334,14 @@
     {
       type: 'text',
       key: 'sql',
-      label: Formdict['model.form.tablename'],
+      label: '琛ㄥ悕',
       initVal: card.sql || setting.tableName || '',
       required: true
     },
     {
       type: 'text',
       key: 'innerFunc',
-      label: Formdict['header.form.innerFunc'],
+      label: '鍐呴儴鍑芥暟',
       initVal: card.innerFunc || '',
       tooltip: functip,
       fields: usefulFields,
@@ -331,7 +359,7 @@
     {
       type: 'select',
       key: 'pageTemplate',
-      label: Formdict['model.form.newpage.type'],
+      label: '椤甸潰绫诲瀷',
       initVal: card.pageTemplate || '',
       required: true,
       options: pageTemps
@@ -356,28 +384,28 @@
     {
       type: 'textarea',
       key: 'url',
-      label: Formdict['model.pageUrl'],
+      label: '椤甸潰鍦板潃',
       initVal: card.url || '',
       required: true
     },
     {
       type: 'radio',
       key: 'sysInterface',
-      label: Formdict['header.form.sysInterface'],
+      label: '绯荤粺鎺ュ彛',
       initVal: card.sysInterface || 'false',
       required: true,
       options: [{
         value: 'true',
-        text: Formdict['model.true']
+        text: '鏄�'
       }, {
         value: 'false',
-        text: Formdict['model.false']
+        text: '鍚�'
       }]
     },
     {
       type: 'text',
       key: 'outerFunc',
-      label: Formdict['header.form.outerFunc'],
+      label: '澶栭儴鍑芥暟',
       initVal: card.outerFunc || '',
       required: false,
     },
@@ -430,7 +458,7 @@
       type: 'radio',
       key: 'callbackType',
       label: '鍥炶皟鏂瑰紡',
-      initVal: card.callbackType || 'script',
+      initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'),
       tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��',
       required: true,
       options: [{
@@ -457,14 +485,14 @@
     {
       type: 'text',
       key: 'callbackFunc',
-      label: Formdict['header.form.callbackFunc'],
+      label: '鍥炶皟鍑芥暟',
       initVal: card.callbackFunc || '',
       required: true
     },
     {
       type: 'select',
       key: 'Ot',
-      label: Formdict['header.form.isRequired'],
+      label: '琛岃缃�',
       initVal: card.Ot || (card.sqlType === 'insert' ? 'notRequired' : 'requiredSgl'),
       required: true,
       options: []
@@ -472,13 +500,13 @@
     {
       type: 'select',
       key: 'execSuccess',
-      label: Formdict['model.form.afterSuccess'],
+      label: '鎴愬姛鍚�',
       initVal: card.execSuccess || 'grid',
       tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍笺�傛敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�',
       required: true,
       options: [{
         value: 'never',
-        text: Formdict['header.form.refresh.never']
+        text: '涓嶅埛鏂�'
       }, {
         value: 'line',
         text: '鍒锋柊琛�'
@@ -495,13 +523,13 @@
     {
       type: 'select',
       key: 'execError',
-      label: Formdict['model.form.afterError'],
+      label: '澶辫触鍚�',
       initVal: card.execError || 'never',
       tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '閫夋嫨鍒锋柊琛屾椂锛屽鏋滈�夋嫨澶氭潯鏁版嵁浼氬埛鏂拌〃鏍硷紝娉細涓婄骇缁勪欢鍦ㄦ暟鎹簮涓坊鍔犮��',
       required: true,
       options: [{
         value: 'never',
-        text: Formdict['header.form.refresh.never']
+        text: '涓嶅埛鏂�'
       }, {
         value: 'line',
         text: '鍒锋柊琛�'
@@ -517,12 +545,12 @@
     {
       type: 'select',
       key: 'popClose',
-      label: Formdict['header.form.popClose'],
+      label: '鍏抽棴鍚�',
       initVal: card.popClose || 'never',
       required: true,
       options: [{
         value: 'never',
-        text: Formdict['header.form.refresh.never']
+        text: '涓嶅埛鏂�'
       }, {
         value: 'grid',
         text: '鍒锋柊褰撳墠缁勪欢'
@@ -596,7 +624,7 @@
     {
       type: 'icon',
       key: 'icon',
-      label: Formdict['model.icon'],
+      label: '鍥炬爣',
       initVal: card.icon,
       required: false,
       forbid: type === 'datacard' && appType === 'mob', // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鏄剧ず鏂囧瓧
@@ -605,7 +633,7 @@
     {
       type: 'select',
       key: 'class',
-      label: Formdict['model.form.color'],
+      label: '棰滆壊',
       initVal: card.class,
       tooltip: '姝ら鑹蹭负鎸夐挳鍒濆鍖栭鑹诧紝鍙湪鏍峰紡璋冩暣涓慨鏀广��',
       required: false,
@@ -615,7 +643,7 @@
     {
       type: 'radio',
       key: 'color',
-      label: Formdict['model.form.color'],
+      label: '棰滆壊',
       initVal: card.color || 'primary',
       required: false,
       forbid: (type !== 'datacard' || appType !== 'mob'), // 绉诲姩绔紝婊戝姩鏄剧ず鐨勬寜閽彧鍙缃浐瀹氶鑹�
@@ -639,21 +667,21 @@
     {
       type: 'radio',
       key: 'joint',
-      label: Formdict['model.form.paramJoint'],
+      label: '鎷兼帴鍙傛暟',
       initVal: card.joint || 'true',
       required: false,
       options: [{
         value: 'true',
-        text: Formdict['model.true']
+        text: '鏄�'
       }, {
         value: 'false',
-        text: Formdict['model.false']
+        text: '鍚�'
       }]
     },
     {
       type: 'text',
       key: 'sheet',
-      label: Formdict['model.form.tablename'],
+      label: '琛ㄥ悕',
       initVal: card.sheet || setting.tableName || '',
       required: true
     },
@@ -665,10 +693,10 @@
       required: false,
       options: [{
         value: 'true',
-        text: Formdict['model.true']
+        text: '鏄�'
       }, {
         value: 'false',
-        text: Formdict['model.false']
+        text: '鍚�'
       }]
     },
     {
@@ -690,7 +718,7 @@
       key: 'syncComponent',
       label: '鍒锋柊缁勪欢',
       initVal: card.syncComponent || [],
-      tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堛��',
+      tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��',
       required: false,
       options: modules
     },
@@ -729,6 +757,7 @@
       tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��',
       initVal: card.openmenu || (!appType ? [] : ''),
       help: appType === 'mob' || appType === 'pc' ? '鍙繑鍥炰笂涓�椤点��' : null,
+      extendName: 'MenuNo',
       required: false,
       allowClear: true,
       options: appType === 'mob' || appType === 'pc' ? [...appMenus, {value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}] : menulist,
@@ -738,7 +767,7 @@
       type: 'text',
       key: 'output',
       label: '杩斿洖鍊�',
-      tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�傜郴缁熷嚱鏁板彲鎸囧畾杩斿洖鐨勫彉閲忥紙浠绗﹀紑澶达紝濡侤id锛夛紱鑷畾涔夊嚱鏁板彲鎸囧畾杩斿洖瀛楁锛堝id锛夈��',
+      tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�傜郴缁熷嚱鏁板彲鎸囧畾杩斿洖鐨勫彉閲忥紙浠绗﹀紑澶达紝杩斿洖id鏃跺彲浣跨敤@id@锛夛紱鑷畾涔夊嚱鏁板彲鎸囧畾杩斿洖瀛楁锛堝id锛夈��',
       initVal: card.output || '',
       required: false,
       forbid: viewType === 'popview'
@@ -899,6 +928,21 @@
       required: false
     },
     {
+      type: 'radio',
+      key: 'hidden',
+      label: '闅愯棌',
+      initVal: card.hidden || 'false',
+      tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��',
+      required: false,
+      options: [{
+        value: 'false',
+        text: '鍚�'
+      }, {
+        value: 'true',
+        text: '鏄�'
+      }]
+    },
+    {
       type: 'splitLine',
       key: 'title',
       label: '琛ㄥ崟',
@@ -907,7 +951,7 @@
     {
       type: 'text',
       key: 'field',
-      label: Formdict['model.form.field'],
+      label: '瀛楁',
       initVal: card.field || '',
       required: true,
       readonly: false
@@ -957,21 +1001,6 @@
       label: '鍏抽棴鎻愮ず',
       initVal: card.closeText || '',
       required: false,
-    },
-    {
-      type: 'radio',
-      key: 'hidden',
-      label: '闅愯棌',
-      initVal: card.hidden || 'false',
-      tooltip: '闅愯棌鍚庢寜閽湪椤甸潰涓笉鏄剧ず锛屼笖涓嶅弬涓庢潈闄愬垎閰嶃��',
-      required: false,
-      options: [{
-        value: 'false',
-        text: '鍚�'
-      }, {
-        value: 'true',
-        text: '鏄�'
-      }]
     },
     {
       type: 'radio',

--
Gitblit v1.8.0