From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/menu/components/share/actioncomponent/formconfig.jsx |  246 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 207 insertions(+), 39 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index 29b9405..388b4f9 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -13,6 +13,7 @@
  */
 export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) {
   let appType = sessionStorage.getItem('appType')
+  let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview
   let setting = config.setting || {}
   let columns = config.columns || []
   let appMenus = []
@@ -47,6 +48,32 @@
     }
   ]
 
+  let getTabs = (list) => {
+    return list.filter(item => {
+      if (item.type !== 'tabs') return false
+
+      item.children = item.children.map(cell => {
+        cell.children = getTabs(cell.children)
+        return cell
+      })
+      return item
+    })
+  }
+
+  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(modules)))
+
   let pageTemps = [
     { value: 'billprint', text: '鍗曟嵁鎵撳嵃' },
     { value: 'pay', text: Formdict['model.pay'] },
@@ -56,26 +83,16 @@
 
   let funTypes = [
     { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
-    { value: 'print', text: '鏍囩鎵撳嵃' }
+    { value: 'print', text: '鏍囩鎵撳嵃' },
+    { value: 'closetab', text: '鏍囩鍏抽棴' },
   ]
   
   if (isApp) {
-    pageTemps = [
-      // { value: 'page', text: '鑿滃崟' },
-      { value: 'linkpage', text: '鍏宠仈鑿滃崟' },
-      { value: 'billprint', text: '鍗曟嵁鎵撳嵃' },
-      { value: 'pay', text: Formdict['model.pay'] },
-      { value: 'custom', text: '閾炬帴' }
-    ]
-    funTypes = [
-      { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
-    ]
     appMenus = sessionStorage.getItem('appMenus')
     if (appMenus) {
       try {
         appMenus = JSON.parse(appMenus)
-        appMenus = appMenus.map(item => ({value: item.MenuID, text: item.MenuName}))
-      } catch {
+      } catch (e) {
         appMenus = []
       }
     } else {
@@ -83,8 +100,30 @@
     }
 
     if (appType === 'mob') {
-      opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage'].includes(item.value))
+      opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value))
+      funTypes = [
+        { value: 'scan', text: '鎵爜' },
+        { value: 'logout', text: '閫�鍑�' },
+        { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' },
+        { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' },
+        { value: 'reAuth', text: '鍒囨崲绯荤粺' },
+        { value: 'goBack', text: '杩斿洖' },
+      ]
+      pageTemps = [
+        { value: 'linkpage', text: '鍏宠仈鑿滃崟' },
+        // { value: 'pay', text: Formdict['model.pay'] },
+        { value: 'custom', text: '閾炬帴' }
+      ]
     } else {
+      pageTemps = [
+        { value: 'linkpage', text: '鍏宠仈鑿滃崟' },
+        { value: 'billprint', text: '鍗曟嵁鎵撳嵃' },
+        { value: 'pay', text: Formdict['model.pay'] },
+        { value: 'custom', text: '閾炬帴' }
+      ]
+      funTypes = [
+        { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
+      ]
       opentypes = opentypes.filter(item => item.value !== 'tab')
     }
   }
@@ -94,12 +133,16 @@
   }
 
   let refresh = []
-  if (sessionStorage.getItem('editMenuType') === 'popview') { // 寮圭獥鏍囩
+  if (viewType === 'popview') { // 寮圭獥鏍囩
     opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton')
     refresh.push({
       value: 'popclose',
-      text: '鏍囩鍒锋柊'
+      text: '鍒锋柊婧愮粍浠�'
     })
+  }
+
+  if (!card.control && card.controlField) {
+    card.control = 'disabled'
   }
 
   let forms = [
@@ -112,7 +155,7 @@
       options: opentypes
     },
     {
-      type: 'radio',
+      type: 'select',
       key: 'funcType',
       label: Formdict['header.form.funcType'],
       initVal: card.funcType || '',
@@ -336,7 +379,7 @@
       key: 'execSuccess',
       label: Formdict['model.form.afterSuccess'],
       initVal: card.execSuccess || 'never',
-      tooltip: refresh.length ? '鎵ц鏍囩鍒锋柊鏃讹紝浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�',
+      tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�',
       required: true,
       options: [{
         value: 'never',
@@ -345,8 +388,14 @@
         value: 'grid',
         text: '鍒锋柊褰撳墠缁勪欢'
       }, {
+        value: 'line',
+        text: '鍒锋柊琛�'
+      }, {
         value: 'mainline',
         text: '鍒锋柊涓婄骇缁勪欢 - 琛�'
+      }, {
+        value: !appType ? 'closetab' : 'goback',
+        text: !appType ? '鍏抽棴寮圭獥' : '杩斿洖锛堜笂涓�涓〉闈級'
       },
       ...refresh]
     },
@@ -355,7 +404,7 @@
       key: 'execError',
       label: Formdict['model.form.afterError'],
       initVal: card.execError || 'never',
-      tooltip: refresh.length ? '鎵ц鏍囩鍏抽棴鍒锋柊鏃讹紝浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�',
+      tooltip: refresh.length ? '鎵ц鍒锋柊婧愮粍浠舵椂锛岃鍦ㄦ簮鎸夐挳涓缃叧闂悗鍒锋柊閭d竴椤癸紝娉細姝ゆ椂浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�',
       required: true,
       options: [{
         value: 'never',
@@ -363,6 +412,9 @@
       }, {
         value: 'grid',
         text: '鍒锋柊褰撳墠缁勪欢'
+      }, {
+        value: 'line',
+        text: '鍒锋柊琛�'
       }, {
         value: 'mainline',
         text: '鍒锋柊涓婄骇缁勪欢 - 琛�'
@@ -514,41 +566,61 @@
       }]
     },
     {
-      type: 'mcascader',
+      type: 'cascader',
       key: 'syncComponent',
-      label: '鍚屾鍒锋柊',
+      label: '鍒锋柊缁勪欢',
       initVal: card.syncComponent || [],
+      tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢',
       required: false,
       options: modules
     },
     {
-      type: 'select',
-      key: 'controlField',
-      label: '鎺у埗瀛楁',
-      tooltip: '绂佺敤鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鏄惁绂佺敤銆�',
-      initVal: card.controlField || '',
+      type: 'cascader',
+      key: 'switchTab',
+      label: '鍒囨崲鏍囩',
+      initVal: card.switchTab || [],
+      tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佸垏鎹㈢殑鏍囩椤�',
       required: false,
-      allowClear: true,
-      options: columns
+      options: tabs
     },
     {
-      type: 'text',
-      key: 'controlVal',
-      label: '鎺у埗鍊�',
-      tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細绂佺敤锛屽涓�肩敤閫楀彿鍒嗛殧銆�',
-      initVal: card.controlVal || '',
-      required: false
+      type: 'cascader',
+      key: 'refreshTab',
+      label: '鍒锋柊鑿滃崟',
+      initVal: card.refreshTab || [],
+      tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧姛鑳芥寜閽腑鏍囩鍏抽棴绫诲瀷锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟',
+      required: false,
+      forbid: isApp || viewType === 'popview',
+      options: menulist
     },
     {
-      type: 'select',
+      type: 'cascader',
+      key: 'linkmenu',
+      label: Formdict['model.form.linkmenu'],
+      initVal: card.linkmenu || [],
+      required: true,
+      forbid: isApp,
+      options: menulist
+    },
+    {
+      type: !appType ? 'cascader' : 'select',
       key: 'openmenu',
       label: '鎵撳紑鑿滃崟',
       tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��',
-      initVal: card.openmenu || '',
-      forbid: appType !== 'pc' && appType !== 'mob',
+      initVal: card.openmenu || (!appType ? [] : ''),
       required: false,
       allowClear: true,
-      options: appMenus
+      options: appType === 'mob' ? [...appMenus, {value: 'goback', text: '杩斿洖'}] : (appType === 'pc' ? appMenus : menulist),
+      forbid: viewType === 'popview'
+    },
+    {
+      type: 'text',
+      key: 'output',
+      label: '杩斿洖鍊�',
+      tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺��',
+      initVal: card.output || '',
+      required: false,
+      forbid: viewType === 'popview'
     },
     {
       type: 'radio',
@@ -564,7 +636,103 @@
         value: 'self',
         text: '褰撳墠绐楀彛'
       }]
-    }
+    },
+    {
+      type: 'radio',
+      key: 'display',
+      label: '鏄剧ず鏂瑰紡',
+      initVal: card.display || 'modal',
+      required: true,
+      options: [{
+        value: 'modal',
+        text: '妯℃�佹'
+      }, {
+        value: 'drawer',
+        text: '鎶藉眽'
+      }]
+    },
+    {
+      type: 'number',
+      key: 'ratio',
+      min: 1,
+      max: 24,
+      precision: 0,
+      label: '姣斾緥',
+      initVal: card.ratio || 85,
+      tooltip: '灏忎簬100涓哄搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬100涓哄儚绱犲�笺��',
+      required: true
+    },
+    {
+      type: 'radio',
+      key: 'placement',
+      label: '鎶藉眽鏂瑰悜',
+      initVal: card.placement || 'right',
+      tooltip: '浣跨敤鎶藉眽鏃舵湁鏁堛��',
+      required: false,
+      options: [{
+        value: 'right',
+        text: '鍙充晶'
+      }, {
+        value: 'left',
+        text: '宸︿晶'
+      }, {
+        value: 'top',
+        text: '涓婁晶'
+      }, {
+        value: 'bottom',
+        text: '涓嬩晶'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'reload',
+      label: '杩斿洖鍚�',
+      initVal: card.reload || 'false',
+      tooltip: '鎸夐挳鎴愬姛鍚庤繑鍥炰笂涓�椤甸潰鎴栦娇鐢ㄥ姛鑳芥寜閽�-杩斿洖鍔熻兘鏃讹紝杩斿洖鍚庢槸鍚﹀埛鏂版暟鎹�傛敞锛氬湪鏄庣浜慳pp涓紙搴旂敤妯″紡涓篴pp锛夋湁鏁堛��',
+      forbid: appType !== 'mob',
+      options: [{
+        value: 'false',
+        text: '涓嶅埛鏂�'
+      }, {
+        value: 'true',
+        text: '鍒锋柊'
+      }]
+    },
+    {
+      type: 'radio',
+      key: 'control',
+      label: '鎸夐挳鎺у埗',
+      initVal: card.control || (card.controlField ? 'disabled' : ''),
+      required: false,
+      options: [{
+        value: '',
+        text: '鏃�'
+      }, {
+        value: 'disabled',
+        text: '绂佺敤'
+      }, {
+        value: 'hidden',
+        text: '闅愯棌'
+      }]
+    },
+    {
+      type: 'select',
+      key: 'controlField',
+      label: '鎺у埗瀛楁',
+      tooltip: '鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鐨勯殣钘忔垨绂佺敤銆�',
+      initVal: card.controlField || '',
+      required: true,
+      allowClear: true,
+      options: columns
+    },
+    {
+      type: 'text',
+      key: 'controlVal',
+      label: '鎺у埗鍊�',
+      tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細闅愯棌鎴栫鐢紝澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�',
+      initVal: card.controlVal || '',
+      required: false
+    },
   ]
 
   return forms

--
Gitblit v1.8.0