From 2aa5ab63b4bbce5c36dbb3511b205b3b5f6af9bd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 07 五月 2024 11:34:20 +0800
Subject: [PATCH] 2024-05-07

---
 src/menu/components/form/formaction/formconfig.jsx |  369 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 313 insertions(+), 56 deletions(-)

diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx
index 01b6326..5d3565e 100644
--- a/src/menu/components/form/formaction/formconfig.jsx
+++ b/src/menu/components/form/formaction/formconfig.jsx
@@ -1,21 +1,21 @@
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
-
-const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
-
 /**
  * @description 鑾峰彇琛ㄥ崟鎸夐挳閰嶇疆淇℃伅
  * @param {*} card           缂栬緫鎸夐挳
  * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
 
-export function getActionForm (card, functip, tableName, usefulFields, modules) {
+export function getActionForm (card, functip, tableName, usefulFields, modules, anchors, uuid, fields) {
   const appType = sessionStorage.getItem('appType')
+  let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview
   let _type = '鎻愪氦'
   if (card.type === 'prev') {
     _type = '涓婁竴姝�'
   } else if (card.type === 'next') {
     _type = '涓嬩竴姝�'
+  } else if (card.type === 'close') {
+    _type = '鍏抽棴'
+  } else if (card.type === 'reset') {
+    _type = '閲嶇疆'
   }
 
   let menulist = []
@@ -31,9 +31,7 @@
     } else {
       menulist = []
     }
-    if (appType === 'mob') {
-      menulist.push({value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'})
-    }
+    menulist.push({value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'})
   } else {
     menulist = sessionStorage.getItem('fstMenuList')
     if (menulist) {
@@ -47,10 +45,120 @@
     }
   }
 
+  let linkButtons = []
+  let filterComponent = (components) => {
+    components.forEach(item => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          filterComponent(tab.components)
+        })
+      } else if (item.type === 'group') {
+        filterComponent(item.components)
+      } else {
+        item.action && item.action.forEach(cell => {
+          if (cell.hidden === 'true' || cell.uuid === uuid) return
+          if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return
+  
+          linkButtons.push({
+            value: cell.uuid,
+            label: cell.label + '锛�' + item.name + '锛�'
+          })
+        })
+  
+        if (item.type === 'card' && item.subcards) {
+          item.subcards.forEach(m => {
+            if ((item.subtype === 'datacard' || item.subtype === 'dualdatacard') && m.$cardType !== 'extendCard') return
+            m.elements.forEach(cell => {
+              if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === uuid) return
+              if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return
+  
+              linkButtons.push({
+                value: cell.uuid,
+                label: cell.label + '锛�' + item.name + '锛�'
+              })
+            })
+          })
+        } else if (item.type === 'balcony') {
+          item.elements.forEach(cell => {
+            if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === uuid) return
+            if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return
+            
+            linkButtons.push({
+              value: cell.uuid,
+              label: cell.label + '锛�' + item.name + '锛�'
+            })
+          })
+        } else if (item.type === 'form') {
+          item.subcards.forEach(group => {
+            if(group.uuid === uuid) return
+
+            if (item.subcards.length > 1) {
+              linkButtons.push({
+                value: group.uuid,
+                label: group.subButton.label + '锛�' + item.name + '-' + group.setting.title + '锛�'
+              })
+            } else {
+              linkButtons.push({
+                value: group.uuid,
+                label: group.subButton.label + '锛�' + item.name + '锛�'
+              })
+            }
+          })
+        }
+      }
+    })
+  }
+
+  filterComponent(window.GLOB.customMenu.components)
+
+  let refresh = []
+  if (viewType === 'popview') { // 寮圭獥鏍囩
+    refresh.push({
+      value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩
+      text: '鍏抽棴寮圭獥'
+    })
+    refresh.push({
+      value: 'popclose',  // 鎵ц寮圭獥鍏抽棴鏃剁殑鍒锋柊
+      text: '鍒锋柊婧愮粍浠�'
+    })
+  }
+
+  let closetab = []
+  if (!appType && viewType !== 'popview') {
+    closetab = [{
+      value: 'closetab',
+      text: '鍏抽棴鏍囩'
+    }]
+  }
+
+  let resets = []
+  fields.forEach(item => {
+    if (item.type !== 'text' && item.type !== 'number') return
+
+    if (item.label !== item.field) {
+      resets.push({
+        value: item.field,
+        text: item.label + ' (' + item.field + ')'
+      })
+    } else {
+      resets.push({
+        value: item.field,
+        text: item.label
+      })
+    }
+  })
+
   return [
     {
       type: 'tip',
       key: 'type',
+      label: '鎸夐挳绫诲瀷',
+      initVal: card.type,
+      forbid: true
+    },
+    {
+      type: 'tip',
+      key: 'typeName',
       label: '鎸夐挳绫诲瀷',
       initVal: _type
     },
@@ -64,19 +172,34 @@
     },
     {
       type: 'radio',
+      key: 'actionType',
+      label: '鎵ц鎿嶄綔',
+      initVal: card.actionType || 'default',
+      tooltip: '鍏抽棴鍔熻兘锛氱鐞嗙郴缁熶腑浼氬叧闂綋鍓嶆爣绛撅紝瀛愬簲鐢ㄤ腑涓鸿繑鍥炰笂涓�椤点��',
+      required: true,
+      options: [{
+        value: 'default',
+        text: '榛樿'
+      }, {
+        value: 'close',
+        text: '鍏抽棴'
+      }]
+    },
+    {
+      type: 'radio',
       key: 'intertype',
-      label: Formdict['header.form.intertype'],
+      label: '鎺ュ彛绫诲瀷',
       initVal: card.intertype || 'system',
       required: true,
       options: [{
         value: 'system',
-        text: Formdict['model.interface.system']
+        text: '绯荤粺'
       }, {
         value: 'inner',
-        text: Formdict['model.interface.inner']
+        text: '鍐呴儴'
       }, {
         value: 'outer',
-        text: Formdict['model.interface.outer']
+        text: '澶栭儴'
       }, {
         value: 'custom',
         text: '鑷畾涔�'
@@ -87,6 +210,7 @@
       key: 'procMode',
       label: '鍙傛暟澶勭悊',
       initVal: card.procMode || 'system',
+      tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛锛涘綋杩斿洖鍊煎瓨鍦� mk_ex_data 鏃讹紝灏嗕互姝や负鍙傛暟鍒嗘壒璇锋眰鑷畾涔夋帴鍙c�傛敞锛氬綋閫夆�滄棤鈥濇椂锛屾寜閽�夎鏃朵細浼犻�掍富閿紝瀛樺湪琛ㄥ崟鏃朵細浼犻�掕〃鍗曞瓧娈碉紝瀛樺湪BID鏃朵細浼燘ID瀛楁銆�',
       required: true,
       options: [{
         value: 'system',
@@ -94,41 +218,44 @@
       }, {
         value: 'inner',
         text: '鍐呴儴鍑芥暟'
+      }, {
+        value: 'none',
+        text: '鏃�'
       }]
     },
     {
       type: 'radio',
       key: 'sqlType',
-      label: Formdict['header.form.action.type'],
-      initVal: card.sqlType || 'update',
+      label: '鎿嶄綔绫诲瀷',
+      initVal: card.sqlType || '',
       required: true,
       options: [{
         value: 'insert',
-        text: Formdict['header.form.action.insert']
+        text: '娣诲姞'
       }, {
         value: 'update',
-        text: Formdict['header.form.action.update']
+        text: '淇敼'
       }, {
         value: 'audit',
-        text: Formdict['header.form.action.audit']
+        text: '瀹℃牳'
       }]
     },
     {
       type: 'text',
       key: 'sql',
-      label: Formdict['model.form.tablename'],
+      label: '琛ㄥ悕',
       initVal: card.sql || tableName || '',
       required: true
     },
     {
       type: 'text',
       key: 'innerFunc',
-      label: Formdict['header.form.innerFunc'],
+      label: '鍐呴儴鍑芥暟',
       initVal: card.innerFunc || '',
       tooltip: functip,
       fields: usefulFields,
       tooltipClass: 'middle',
-      required: card.intertype === 'inner',
+      required: true,
       readonly: false
     },
     {
@@ -142,28 +269,29 @@
     {
       type: 'text',
       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',
+      tooltip: '涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺',
       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,
       readonly: false
@@ -186,6 +314,42 @@
     },
     {
       type: 'radio',
+      key: 'callbackType',
+      label: '鍥炶皟鏂瑰紡',
+      initVal: card.callbackType || 'script',
+      tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��',
+      required: true,
+      options: [{
+        value: 'script',
+        text: '鑷畾涔夎剼鏈�'
+      }, {
+        value: 'default',
+        text: '鍚庡彴鑴氭湰'
+      }, {
+        value: 'func',
+        text: '鍥炶皟鍑芥暟'
+      }, {
+        value: 'none',
+        text: '鏃�'
+      }]
+    },
+    {
+      type: 'text',
+      key: 'cbTable',
+      label: '鍥炶皟琛ㄥ悕',
+      initVal: card.cbTable || '',
+      required: true
+    },
+    {
+      type: 'text',
+      key: 'callbackFunc',
+      label: '鍥炶皟鍑芥暟',
+      initVal: card.callbackFunc || '',
+      required: true,
+      readonly: false
+    },
+    {
+      type: 'radio',
       key: 'method',
       label: '璇锋眰鏂瑰紡',
       initVal: card.method || 'post',
@@ -201,7 +365,7 @@
     {
       type: 'radio',
       key: 'cross',
-      label: '璺ㄥ煙璇锋眰',
+      label: '鎺ュ彛璺ㄥ煙',
       initVal: card.cross || 'true',
       tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�',
       required: false,
@@ -215,33 +379,77 @@
     },
     {
       type: 'radio',
-      key: 'callbackType',
-      label: '鍥炶皟鏂瑰紡',
-      initVal: card.callbackType || 'script',
-      tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��',
-      required: true,
+      key: 'stringify',
+      label: '搴忓垪鍖�',
+      initVal: card.stringify || 'text',
+      required: false,
       options: [{
-        value: 'script',
-        text: '鑷畾涔夎剼鏈�'
+        value: 'text',
+        text: 'Text'
       }, {
-        value: 'default',
-        text: '鍚庡彴鑴氭湰'
+        value: 'JSON',
+        text: 'JSON'
+      }, {
+        value: 'qs',
+        text: 'qs'
       }]
     },
     {
       type: 'text',
-      key: 'cbTable',
-      label: '鍥炶皟琛ㄥ悕',
-      initVal: card.cbTable || '',
-      required: true
+      key: 'ContentType',
+      label: 'Content-Type',
+      initVal: card.ContentType || '',
+      tooltip: '榛樿鍊硷細application/x-www-form-urlencoded;charset=UTF-8',
+      required: false
     },
     {
       type: 'text',
-      key: 'callbackFunc',
-      label: Formdict['header.form.callbackFunc'],
-      initVal: card.callbackFunc || '',
+      key: 'outerBlacklist',
+      label: '瀛楁榛戝悕鍗�',
+      initVal: card.outerBlacklist || '',
+      tooltip: '涓嶉渶瑕佸洖浼犵殑瀛楁鍙缃瓧娈甸粦鍚嶅崟锛屽涓�艰鐢ㄩ�楀彿鍒嗛殧銆�',
+      required: false
+    },
+    {
+      type: 'radio',
+      key: 'Ot',
+      label: '琛岃缃�',
+      initVal: card.Ot,
+      required: true,
+      options: [{
+        value: 'notRequired',
+        text: '涓嶉�夋嫨琛�'
+      }, {
+        value: 'requiredSgl',
+        text: '閫夋嫨鍗曡'
+      }]
+    },
+    {
+      type: 'select',
+      key: 'execSuccess',
+      label: '鎴愬姛鍚�',
+      initVal: card.execSuccess || 'grid',
+      required: true,
+      options: [{
+        value: 'never',
+        text: '涓嶅埛鏂�'
+      }, {
+        value: 'grid',
+        text: '鍒锋柊褰撳墠缁勪欢'
+      }, {
+        value: 'mainline',
+        text: '鍒锋柊涓婄骇缁勪欢 - 琛�'
+      }, ...closetab, ...refresh]
+    },
+    {
+      type: 'cascader',
+      key: 'refreshTab',
+      label: '鍒锋柊鑿滃崟',
+      initVal: card.refreshTab || [],
+      tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧姛鑳芥寜閽腑鏍囩鍏抽棴绫诲瀷锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟',
       required: false,
-      readonly: false
+      forbid: appType === 'pc' || appType === 'mob' || viewType === 'popview',
+      options: menulist
     },
     {
       type: (appType === 'pc' || appType === 'mob') ? 'select' : 'cascader',
@@ -249,7 +457,7 @@
       label: '涓嬩竴姝ユ搷浣�',
       tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��',
       initVal: card.linkmenu,
-      help: '鍙繑鍥炰笂涓�椤点��',
+      help: appType === 'pc' || appType === 'mob' ? '鍙繑鍥炰笂涓�椤点��' : null,
       required: false,
       allowClear: true,
       options: menulist
@@ -258,7 +466,7 @@
       type: 'text',
       key: 'output',
       label: '杩斿洖鍊�',
-      tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�備緥濡傦細@id',
+      tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺�傜郴缁熷嚱鏁板彲鎸囧畾杩斿洖鐨勫彉閲忥紙浠绗﹀紑澶达紝杩斿洖id鏃跺彲浣跨敤@id@锛夛紱鑷畾涔夊嚱鏁板彲鎸囧畾杩斿洖瀛楁锛堝id锛夈��',
       initVal: card.output || '',
       required: false
     },
@@ -268,23 +476,72 @@
       label: '鎵撳紑鏂瑰紡',
       initVal: card.open || 'blank',
       required: false,
-      forbid: appType !== 'pc',
-      options: [{
-        value: 'blank',
-        text: '鏂扮獥鍙�'
-      }, {
-        value: 'self',
-        text: '褰撳墠绐楀彛'
-      }]
+      forbid: appType !== 'pc' && appType !== 'mob',
+      options: [
+        {value: 'blank', text: appType !== 'mob' ? '鏂扮獥鍙�' : '鏂伴〉闈�'},
+        {value: 'self', text: appType !== 'mob' ? '褰撳墠绐楀彛' : '褰撳墠椤甸潰'},
+      ]
     },
     {
       type: 'cascader',
       key: 'syncComponent',
       label: '鍚屾鍒锋柊',
       initVal: card.syncComponent,
-      tooltip: '鎵ц鎴愬姛鍚庨渶瑕佸埛鏂扮殑缁勪欢銆�',
+      tooltip: '鎵ц鎴愬姛鍚庨渶瑕佸埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��',
       required: false,
       options: modules
+    },
+    {
+      type: 'number',
+      key: 'syncDelay',
+      label: '鍒锋柊寤惰繜',
+      initVal: card.syncDelay,
+      tooltip: '鍚屾鍒锋柊缁勪欢鐨勫欢杩熸椂闂达紝鍗曚綅姣銆�',
+      // placeholder: '鍗曚綅姣',
+      required: false
+    },
+    {
+      type: 'cascader',
+      key: 'anchors',
+      label: '璺宠浆閿氱偣',
+      initVal: card.anchors || [],
+      tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佽烦杞殑閿氱偣銆�' + (appType === 'mob' ? '娉細灏忕▼搴忎腑鏃犳晥' : ''),
+      required: false,
+      options: anchors
+    },
+    {
+      type: 'select',
+      key: 'preButton',
+      label: '鍓嶇疆鎸夐挳',
+      tooltip: '褰撳墠鎸夐挳鎵ц鍓嶏紝闇�瑕佹墽琛岀殑鎸夐挳銆�',
+      initVal: card.preButton || '',
+      required: false,
+      allowClear: true,
+      options: linkButtons
+    },
+    {
+      type: 'select',
+      key: 'resetForms',
+      label: '閲嶇疆琛ㄥ崟',
+      tooltip: '鎸夐挳鎵ц鎴愬姛鍚庨渶瑕侀噸缃殑琛ㄥ崟锛岃〃鍗曚細鎭㈠榛樿鍊煎苟鑱氱劍銆�',
+      initVal: card.resetForms || [],
+      required: false,
+      mode: 'multiple',
+      options: resets
+    },
+    {
+      type: 'radio',
+      key: 'returnValue',
+      label: '鏇存柊琛ㄥ崟',
+      initVal: card.returnValue || 'false',
+      tooltip: '涓庨噸缃〃鍗曢厤鍚堜娇鐢紝寮�鍚椂锛屽繀椤诲湪鑷畾涔夎剼鏈腑杩斿洖鏁版嵁锛岀敤浜庢浛鎹㈠瓧娈甸泦鍜屽~鍏呰〃鍗曘��',
+      options: [{
+        value: 'false',
+        text: '绂佺敤'
+      }, {
+        value: 'true',
+        text: '鍚敤'
+      }]
     },
     {
       type: 'radio',
@@ -300,6 +557,6 @@
         value: 'true',
         text: '鍒锋柊'
       }]
-    },
+    }
   ]
 }

--
Gitblit v1.8.0