From c51f5e007a3e03c9d6731ab7f28f0080de009990 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 17 十一月 2021 18:38:32 +0800
Subject: [PATCH] 2021-11-17

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index b811fe8..2c3b427 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -37,12 +37,13 @@
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     visible: false,
     formdata: null,
-    tabledata: null,
+    selines: null,
     confirmLoading: false,
     btnconfig: null,
     loading: false,
     loadingNumber: '',
     disabled: false,
+    hidden: false,
     checkParam: null,
     autoMatic: false
   }
@@ -60,7 +61,7 @@
           disabled = true
         }
       })
-      this.setState({disabled})
+      this.setState({disabled, hidden: disabled && btn.control === 'hidden'})
     }
   }
 
@@ -96,7 +97,7 @@
           }
         })
       }
-      this.setState({disabled})
+      this.setState({disabled, hidden: disabled && btn.control === 'hidden'})
     }
   }
 
@@ -125,7 +126,7 @@
 
     this.setState({ loading: true })
 
-    this.execSubmit(this.state.tabledata, () => {}, res.form)
+    this.execSubmit(this.state.selines, () => {}, res.form)
   }
 
   resetModuleParam = (menuId, btnId, param) => {
@@ -244,10 +245,11 @@
       return
     }
 
+    this.setState({
+      selines: data
+    })
+    
     if (btn.OpenType === 'formSubmit') {
-      this.setState({
-        tabledata: data
-      })
       MKEmitter.emit('mkFormSubmit', btn.uuid)
       return
     } else if (btn.OpenType === 'prompt') {
@@ -274,7 +276,6 @@
 
       this.setState({
         loading: true,
-        tabledata: data,
         btnconfig: modal
       }, () => {
         this.improveAction()
@@ -1413,7 +1414,7 @@
     if (btn.execSuccess === 'closetab') {
       MKEmitter.emit('closeTabView', btn.$MenuID)
     } else if (btn.execSuccess !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines)
     }
 
     if (btn.refreshTab && btn.refreshTab.length > 0) {
@@ -1627,7 +1628,7 @@
               visible: false
             })
             if (btn.execError !== 'never') {
-              MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
+              MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
             }
           }
         })
@@ -1645,7 +1646,7 @@
     }
 
     if (btn.execError !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
     }
   }
 
@@ -1756,7 +1757,7 @@
     this.formRef.handleConfirm().then(res => {
       this.setState({ confirmLoading: true })
 
-      this.execSubmit(this.state.tabledata, () => { this.setState({ confirmLoading: false }) }, res)
+      this.execSubmit(this.state.selines, () => { this.setState({ confirmLoading: false }) }, res)
     })
   }
 
@@ -1773,7 +1774,7 @@
 
   modelconfirm = () => {
     const { BData } = this.props
-    const { btnconfig, tabledata } = this.state
+    const { btnconfig, selines } = this.state
     let _this = this
 
     let result = []
@@ -1788,8 +1789,8 @@
 
       if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) {
         _initval = BData[item.field]
-      } else if (_readin && tabledata[0] && tabledata[0].hasOwnProperty(item.field)) {
-        _initval = tabledata[0][item.field]
+      } else if (_readin && selines[0] && selines[0].hasOwnProperty(item.field)) {
+        _initval = selines[0][item.field]
       } else if (item.type === 'date' && _initval) {
         _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD')
       } else if (item.type === 'datemonth' && _initval) {
@@ -1830,7 +1831,7 @@
       title: this.state.dict['main.action.confirm.tip'],
       onOk() {
         return new Promise(resolve => {
-          _this.execSubmit(tabledata, resolve, result)
+          _this.execSubmit(selines, resolve, result)
         })
       },
       onCancel() {
@@ -1876,7 +1877,7 @@
             menuType={this.props.menuType}
             action={btnconfig}
             inputSubmit={this.handleOk}
-            data={this.state.tabledata[0]}
+            data={this.state.selines[0]}
             BData={BData}
             wrappedComponentRef={(inst) => this.formRef = inst}
           />
@@ -1919,7 +1920,7 @@
             menuType={this.props.menuType}
             action={btnconfig}
             inputSubmit={this.handleOk}
-            data={this.state.tabledata[0]}
+            data={this.state.selines[0]}
             BData={BData}
             wrappedComponentRef={(inst) => this.formRef = inst}
           />
@@ -1930,7 +1931,9 @@
 
   render() {
     const { btn, show, style } = this.props
-    const { loadingNumber, loading, disabled } = this.state
+    const { loadingNumber, loading, disabled, hidden } = this.state
+
+    if (hidden) return null
 
     if (show === 'actionList') {
       return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>

--
Gitblit v1.8.0