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/templates/sharecomponent/actioncomponent/index.jsx |   54 ++++++++++++++++++++++--------------------------------
 1 files changed, 22 insertions(+), 32 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx
index 72ff755..50cdb74 100644
--- a/src/templates/sharecomponent/actioncomponent/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/index.jsx
@@ -14,6 +14,7 @@
 import ActionForm from './actionform'
 import CreateFunc from '@/templates/zshare/createfunc'
 import CreateInterface from '@/templates/zshare/createinterface'
+import { updateForm } from '@/utils/utils-update.js'
 import DragElement from './dragaction'
 import './index.scss'
 
@@ -34,7 +35,7 @@
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,          // 缂栬緫涓厓绱�
     formlist: null,      // 琛ㄥ崟淇℃伅
     actionlist: null,    // 鎸夐挳缁�
@@ -143,7 +144,7 @@
     if (usefulFields) {
       try {
         usefulFields = JSON.parse(usefulFields)
-      } catch {
+      } catch (e) {
         usefulFields = []
       }
     } else {
@@ -262,12 +263,12 @@
       new Promise(resolve => {
         if (
           !card.originCard ||
-          (btn.OpenType === 'pop' && card.originCard.OpenType !== 'pop') ||
-          (['tab', 'blank'].includes(btn.OpenType) && !['tab', 'blank'].includes(card.originCard.OpenType)) ||
-          (btn.OpenType === 'popview' && (!btn.createTab || card.originCard.OpenType !== 'popview' || !card.originCard.linkTab))
+          (btn.OpenType !== card.originCard.OpenType) ||
+          (btn.OpenType === 'tab' && btn.tabTemplate !== 'FormTab') ||
+          (btn.OpenType === 'funcbutton' && btn.execMode !== 'pop')
         ) { // 鎸夐挳涓嶆槸澶嶅埗锛屾垨鎸夐挳鍓嶅悗绫诲瀷涓嶄竴鑷存椂锛岀洿鎺ヤ繚瀛�
           resolve('save')
-        } else if (btn.OpenType === 'pop' || btn.OpenType === 'tab' || btn.OpenType === 'blank') {
+        } else if (btn.OpenType === 'pop' || btn.OpenType === 'tab' || btn.execMode === 'pop') {
           resolve('subconf')
         } else if (btn.OpenType === 'popview') {
           resolve('subtab')
@@ -297,20 +298,21 @@
             }
           }
 
+          if (!_LongParam) return 'save'
+
           let _temp = '' // 閰嶇疆淇℃伅绫诲瀷
 
           // 淇敼妯℃�佹鏍囬鍚嶇О
-          if (btn.OpenType === 'pop' && _LongParam && _LongParam.type === 'Modal') {
+          if ((btn.OpenType === 'pop' || btn.execMode === 'pop') && _LongParam.type === 'Modal') {
             try {
               _LongParam.setting.title = btn.label
               _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam)))
               _temp = 'Modal'
-            } catch {
+            } catch (e) {
               console.warn('Stringify Failure')
-              _LongParam = ''
               _temp = ''
             }
-          } else if (['tab', 'blank'].includes(btn.OpenType) && _LongParam && _LongParam.type === 'FormTab') {
+          } else if (btn.OpenType === 'tab' && _LongParam.type === 'FormTab') {
             try {
               _LongParam.action = _LongParam.action.map(_btn => {
                 _btn.uuid = Utils.getuuid()
@@ -326,9 +328,8 @@
               })
               _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam)))
               _temp = 'FormTab'
-            } catch {
+            } catch (e) {
               console.warn('Stringify Failure')
-              _LongParam = ''
               _temp = ''
             }
           }
@@ -484,7 +485,7 @@
       _tab.action = _tab.action.map((item, index) => {
         let uuid = Utils.getuuid()
 
-        if (item.OpenType === 'pop') {
+        if (item.OpenType === 'pop' || item.execMode === 'pop') {
           _oriActions.push({
             prebtn: JSON.parse(JSON.stringify(item)),
             curuuid: uuid,
@@ -521,7 +522,7 @@
       btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
 
       _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_tab)))
-    } catch {
+    } catch (e) {
       console.warn('Stringify Failure')
       _LongParam = ''
       _resolve('save')
@@ -744,19 +745,12 @@
             }
 
             if (_LongParam) {
-              let fields = []
-              if (_LongParam.groups.length > 0) {
-                _LongParam.groups.forEach(group => {
-                  fields = [...fields, ...group.sublist]
-                })
-              } else {
-                fields = _LongParam.fields
-              }
+              _LongParam = updateForm(_LongParam)
 
               let _param = {
                 funcName: btn.innerFunc,
                 name: _config.setting.tableName || '',
-                fields: fields,
+                fields: _LongParam.fields,
                 menuNo: menu.MenuNo
               }
               newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config))
@@ -837,15 +831,12 @@
   /**
    * @description 鎸夐挳鍙屽嚮瑙﹀彂瀛愰厤缃�
    */
-  btnDoubleClick = (element) => {
-    if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || (element.OpenType === 'tab' && element.tabTemplate === 'FormTab'))) {
-      this.props.setSubConfig(element)
+  btnDoubleClick = (el) => {
+    // execMode === 'pop' 涓� OpenType === 'funcbutton'
+    if (!el.origin && (el.OpenType === 'pop' || el.execMode === 'pop' || el.OpenType === 'popview' || (el.OpenType === 'tab' && el.tabTemplate === 'FormTab'))) {
+      this.props.setSubConfig(el)
     } else {
-      notification.warning({
-        top: 92,
-        message: '姝ゆ寜閽棤瀛愰厤缃」锛�',
-        duration: 5
-      })
+      this.handleAction(el)
     }
   }
 
@@ -914,7 +905,6 @@
           visible={profVisible}
           width={'75vw'}
           maskClosable={false}
-          style={{minWidth: '900px', maxWidth: '1200px'}}
           okText={dict['model.submit']}
           onOk={this.verifySubmit}
           onCancel={() => { this.setState({ profVisible: false }) }}

--
Gitblit v1.8.0