From f01086dc94827dbb15811760e5d13683977fcec9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 十一月 2022 00:40:12 +0800
Subject: [PATCH] 2022-11-10

---
 src/templates/comtableconfig/updatetable/index.jsx |   65 +++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/src/templates/comtableconfig/updatetable/index.jsx b/src/templates/comtableconfig/updatetable/index.jsx
index 39b7c6c..54e8072 100644
--- a/src/templates/comtableconfig/updatetable/index.jsx
+++ b/src/templates/comtableconfig/updatetable/index.jsx
@@ -77,24 +77,22 @@
       style: { backgroundColor: '#ffffff', paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px'},
     }
 
-    let uuids = {}
     let formActions = []
     let popActions = []
     let errors = []
-    let mainTb = {name: '涓昏〃', uuid: Utils.getuuid(), useMSearch: 'false'}
+    let mainTb = {name: '涓昏〃', uuid: Utils.getuuid(), useMSearch: 'false', isMain: true}
 
     let oldtabs = {
       mainTable: mainTb.uuid
     }
 
-    let tbl = this.getTable(config, mainTb, uuids, errors, formActions, popActions, oldtabs)
+    let tbl = this.getTable(config, mainTb, errors, formActions, popActions, oldtabs)
 
-    if (config.autoMatic && config.autoMatic.enable === 'true' && uuids[config.autoMatic.action]) {
-      _config.autoMatic = {...config.autoMatic}
-      _config.autoMatic.action = uuids[config.autoMatic.action]
-
-      if (tbl.action.filter(item => item.uuid === _config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))).length === 0) {
+    if (config.autoMatic && config.autoMatic.enable === 'true') {
+      if (tbl.action.filter(item => item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))).length === 0) {
         _config.autoMatic = {enable: 'false'}
+      } else {
+        _config.autoMatic = {...config.autoMatic}
       }
     } else {
       _config.autoMatic = {enable: 'false'}
@@ -185,7 +183,7 @@
         _config.components = _config.components.map(item => {
           if (item.type === 'tabs') {
             item.subtabs = item.subtabs.map(tab => {
-              tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], uuids, errors, formActions, popActions, oldtabs)
+              tab.components[0] = this.getTable(menus[tab.components[0].linkTab], tab.components[0], errors, formActions, popActions, oldtabs)
 
               return tab
             })
@@ -262,7 +260,7 @@
                       MenuName: btn.label,
                       tables: _config.tables || [],
                       Template: 'BaseTable',
-                      components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
+                      components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                       viewType: 'popview',
                       style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                     }
@@ -286,7 +284,7 @@
                         MenuName: btn.label,
                         tables: _config.tables || [],
                         Template: 'BaseTable',
-                        components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
+                        components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                         viewType: 'popview',
                         style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                       }
@@ -311,7 +309,7 @@
                     MenuName: btn.label,
                     tables: _config.tables || [],
                     Template: 'BaseTable',
-                    components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
+                    components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                     viewType: 'popview',
                     style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                   }
@@ -335,7 +333,7 @@
                       MenuName: btn.label,
                       tables: _config.tables || [],
                       Template: 'BaseTable',
-                      components: [this.getTable(menus[btn.uuid], mainTb, {}, errors, formActions)],
+                      components: [this.getTable(menus[btn.uuid], mainTb, errors, formActions)],
                       viewType: 'popview',
                       style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' }
                     }
@@ -682,6 +680,8 @@
     param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
     param.secretkey = Utils.encrypt(param.LText, param.timestamp)
 
+    let save = false
+
     new Promise(resolve => {
       Api.getSystemConfig(param).then(res => {
         resolve(res)
@@ -689,10 +689,14 @@
     }).then(res => { // 鍒犻櫎鍘熻彍鍗�
       if (!res || !res.status) return res
 
+      save = true
+      localStorage.setItem('menuUpdate', new Date().getTime() + ',' + config.uuid)
+
       if (this.delButtons.length === 0) return res
 
       return Api.getSystemConfig({
         func: 'sPC_MainMenu_Del',
+        up_type: 'Y',
         MenuID: this.delButtons.join(',')
       })
     }).then(res => {
@@ -701,8 +705,6 @@
       _resolve()
 
       if (res.status) {
-        localStorage.setItem('menuUpdate', new Date().getTime())
-
         notification.success({
           top: 92,
           message: '鍗囩骇鎴愬姛',
@@ -719,16 +721,28 @@
           window.location.reload()
         }, 2000)
       } else {
-        notification.warning({
-          top: 92,
-          message: res.message,
-          duration: 5
+        Modal.warning({
+          title: res.message,
+          okText: '鐭ラ亾浜�',
+          onOk: () => {
+            if (save) {
+              delete urlparam.type
+              delete urlparam.MenuType
+
+              let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
+
+              window.history.replaceState(null, null, window.location.href.split('#')[0] + `#/tabledesign/${_param}`)
+              window.location.reload()
+            } else {
+              window.location.reload()
+            }
+          }
         })
       }
     })
   }
 
-  getTable = (config, newCon, uuids, errors, formActions, popActions, oldtabs) => { 
+  getTable = (config, newCon, errors, formActions, popActions, oldtabs) => { 
     let _card = {
       uuid: newCon.uuid,
       type: 'table',
@@ -961,11 +975,12 @@
     let colbtns = []
     let colors = { primary: '#1890ff', yellow: '#c49f47', orange: 'orange', danger: '#ff4d4f', green: '#26C281', dgreen: '#32c5d2', purple: '#8E44AD', cyan: '#13c2c2', gray: '#666666', default: 'rgba(0, 0, 0, 0.65)' }
 
+    let uuids = {}
     config.action.forEach(btn => {
       let _c = btn.class ? btn.class.replace('border-', '') : ''
       let color = colors[_c] || '#1890ff'
       let _btn = fromJS(btn).toJS()
-      _btn.uuid = Utils.getuuid()
+      // _btn.uuid = Utils.getuuid()
       delete _btn.position
       delete _btn.linkTab
 
@@ -1001,8 +1016,6 @@
         _btn.popClose = 'mainline'
       }
 
-      uuids[btn.uuid] = _btn.uuid
-
       if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) {
 
         formActions.push({origin: btn.uuid, uuid: _btn.uuid, name: newCon.name, label: btn.label})
@@ -1017,6 +1030,8 @@
           return
         }
       }
+
+      uuids[btn.uuid] = true
 
       if (_btn.tabType === 'CommonTable' || _btn.tabType === 'SubTable') {
         _btn.tabType = 'BaseTable'
@@ -1075,9 +1090,7 @@
       }
     })
 
-    if (config.setting.doubleClick && uuids[config.setting.doubleClick]) {
-      _card.wrap.doubleClick = uuids[config.setting.doubleClick]
-    } else {
+    if (config.setting.doubleClick && !uuids[config.setting.doubleClick]) {
       _card.wrap.doubleClick = ''
     }
 

--
Gitblit v1.8.0