From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 01 九月 2021 10:31:45 +0800
Subject: [PATCH] 2021-09-01

---
 src/menu/components/share/actioncomponent/formconfig.jsx |  257 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 223 insertions(+), 34 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index ce7f6d2..04945f0 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -1,7 +1,7 @@
 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
+const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 
 /**
  * @description 鑾峰彇鎸夐挳琛ㄥ崟閰嶇疆淇℃伅
@@ -11,7 +11,11 @@
  * @param {*} usefulFields   瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈�
  * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
-export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = []) {
+export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) {
+  let appType = sessionStorage.getItem('appType')
+  let setting = config.setting || {}
+  let columns = config.columns || []
+  let appMenus = []
   let opentypes = [
     {
       value: 'pop',
@@ -43,7 +47,55 @@
     }
   ]
 
-  if (type === 'chart') {
+  let pageTemps = [
+    { value: 'billprint', text: '鍗曟嵁鎵撳嵃' },
+    { value: 'pay', text: Formdict['model.pay'] },
+    { value: 'custom', text: Formdict['header.form.custom'] }
+  ]
+  const isApp = ['pc', 'mob'].includes(appType)
+
+  let funTypes = [
+    { value: 'changeuser', text: Formdict['header.form.func.changeuser'] },
+    { 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)
+      } catch (e) {
+        appMenus = []
+      }
+    } else {
+      appMenus = []
+    }
+
+    if (appType === 'mob') {
+      opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value))
+      funTypes = [
+        { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' },
+        { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' },
+        { value: 'scan', text: '鎵竴鎵�' },
+        { value: 'reAuth', text: '閲嶆柊鎺堟潈' },
+      ]
+    } else {
+      opentypes = opentypes.filter(item => item.value !== 'tab')
+    }
+  }
+  
+  if (type === 'chart' && appType !== 'mob') {
     opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut')
   }
 
@@ -66,18 +118,12 @@
       options: opentypes
     },
     {
-      type: 'radio',
+      type: 'select',
       key: 'funcType',
       label: Formdict['header.form.funcType'],
-      initVal: card.funcType || 'print',
+      initVal: card.funcType || '',
       required: true,
-      options: [{
-        value: 'changeuser',
-        text: Formdict['header.form.func.changeuser']
-      }, {
-        value: 'print',
-        text: '鏍囩鎵撳嵃'
-      }]
+      options: funTypes
     },
     {
       type: 'select',
@@ -158,21 +204,21 @@
       label: Formdict['model.form.newpage.type'],
       initVal: card.pageTemplate || '',
       required: true,
-      options: [{
-        value: 'billprint',
-        text: '鍗曟嵁鎵撳嵃'
-      }, {
-        value: 'pay',
-        text: Formdict['model.pay']
-      }, {
-        value: 'custom',
-        text: Formdict['header.form.custom']
-      }]
+      options: pageTemps
     },
     {
-      type: 'text',
+      type: 'select',
+      key: 'linkmenu',
+      label: '鍏宠仈鑿滃崟',
+      initVal: card.linkmenu || '',
+      required: true,
+      forbid: !isApp,
+      options: appMenus
+    },
+    {
+      type: 'textarea',
       key: 'url',
-      label: Formdict['model.form.newpage.url'],
+      label: Formdict['model.pageUrl'],
       initVal: card.url || '',
       required: true
     },
@@ -230,17 +276,32 @@
     },
     {
       type: 'radio',
+      key: 'cross',
+      label: '璺ㄥ煙璇锋眰',
+      initVal: card.cross || 'true',
+      tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�',
+      required: false,
+      options: [{
+        value: 'true',
+        text: '鏀寔'
+      }, {
+        value: 'false',
+        text: '涓嶆敮鎸�'
+      }]
+    },
+    {
+      type: 'radio',
       key: 'callbackType',
       label: '鍥炶皟鏂瑰紡',
       initVal: card.callbackType || 'script',
-      tooltip: '浣跨敤榛樿鏂瑰紡鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��',
+      tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��',
       required: true,
       options: [{
-        value: 'default',
-        text: '榛樿鑴氭湰'
-      }, {
         value: 'script',
         text: '鑷畾涔夎剼鏈�'
+      }, {
+        value: 'default',
+        text: '鍚庡彴鑴氭湰'
       }]
     },
     {
@@ -273,6 +334,16 @@
       label: Formdict['model.form.linkmenu'],
       initVal: card.linkmenu || [],
       required: true,
+      forbid: isApp,
+      options: menulist
+    },
+    {
+      type: 'cascader',
+      key: 'refreshTab',
+      label: '鍒锋柊鏍囩',
+      initVal: card.refreshTab || [],
+      required: false,
+      forbid: isApp,
       options: menulist
     },
     {
@@ -359,22 +430,40 @@
     {
       type: 'radio',
       key: 'show',
-      label: "鏄剧ず涓�",
-      initVal: card.show || 'icon',
+      label: '鏄剧ず涓�',
+      initVal: card.show || 'button',
       required: true,
       options: [{
         value: 'icon',
         text: '鍥炬爣'
       }, {
         value: 'button',
-        text: '鎸夐挳'
+        text: '鍥炬爣+鏂囧瓧'
       }, {
         value: 'link',
-        text: '閾炬帴'
+        text: '鏂囧瓧+鍥炬爣'
       }]
     },
     {
-      type: 'select',
+      type: 'radio',
+      key: 'swipe',
+      label: "婊戝姩鏄剧ず",
+      initVal: card.swipe || 'false',
+      required: false,
+      forbid: (type !== 'datacard' || appType !== 'mob'),
+      options: [{
+        value: 'false',
+        text: '鍚�'
+      }, {
+        value: 'left',
+        text: '宸︽粦'
+      }, {
+        value: 'right',
+        text: '鍙虫粦'
+      }]
+    },
+    {
+      type: 'icon',
       key: 'icon',
       label: Formdict['model.icon'],
       initVal: card.icon,
@@ -386,6 +475,7 @@
       key: 'class',
       label: Formdict['model.form.color'],
       initVal: card.class,
+      tooltip: '姝ら鑹蹭负鎸夐挳鍒濆鍖栭鑹诧紝鍙湪鏍峰紡璋冩暣涓慨鏀广��',
       required: false,
       options: []
     },
@@ -445,7 +535,106 @@
       initVal: card.syncComponent || [],
       required: false,
       options: modules
-    }
+    },
+    {
+      type: 'select',
+      key: 'controlField',
+      label: '鎺у埗瀛楁',
+      tooltip: '绂佺敤鎺у埗瀛楁锛屽彲鏍规嵁鏁版嵁鎺у埗鎸夐挳鏄惁绂佺敤銆�',
+      initVal: card.controlField || '',
+      required: false,
+      allowClear: true,
+      options: columns
+    },
+    {
+      type: 'text',
+      key: 'controlVal',
+      label: '鎺у埗鍊�',
+      tooltip: '褰撻�夋嫨鎺у埗瀛楁锛屼笖瀛楁鍊间笌鎺у埗鍊肩浉绛夋椂锛屾寜閽細绂佺敤锛屽涓�肩敤閫楀彿鍒嗛殧銆�',
+      initVal: card.controlVal || '',
+      required: false
+    },
+    {
+      type: 'select',
+      key: 'openmenu',
+      label: '鎵撳紑鑿滃崟',
+      tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��',
+      initVal: card.openmenu || '',
+      forbid: appType !== 'pc' && appType !== 'mob',
+      required: false,
+      allowClear: true,
+      options: appMenus
+    },
+    {
+      type: 'text',
+      key: 'output',
+      label: '杩斿洖鍊�',
+      tooltip: '鎵ц鎴愬姛鍚庣殑杩斿洖鍊笺��',
+      initVal: card.output || '',
+      forbid: appType !== 'pc' && appType !== 'mob',
+      required: false
+    },
+    {
+      type: 'radio',
+      key: 'open',
+      label: '鎵撳紑鏂瑰紡',
+      initVal: card.open || 'blank',
+      required: true,
+      forbid: appType !== 'pc',
+      options: [{
+        value: 'blank',
+        text: '鏂扮獥鍙�'
+      }, {
+        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: '涓嬩晶'
+      }]
+    },
   ]
 
   return forms

--
Gitblit v1.8.0