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/printbutton/index.jsx |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index 1c76c94..ebedaf7 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -37,10 +37,11 @@
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     visible: false,
     formdata: null,
-    tabledata: null,
+    selines: null,
     btnconfig: null,
     loading: false,
     disabled: false,
+    hidden: false,
     loadingNumber: '',
     autoMatic: false
   }
@@ -56,7 +57,7 @@
           disabled = true
         }
       })
-      this.setState({disabled})
+      this.setState({disabled, hidden: disabled && btn.control === 'hidden'})
     }
   }
 
@@ -88,7 +89,7 @@
           }
         })
       }
-      this.setState({disabled})
+      this.setState({disabled, hidden: disabled && btn.control === 'hidden'})
     }
   }
 
@@ -168,6 +169,10 @@
       return
     }
 
+    this.setState({
+      selines: data
+    })
+
     if (btn.execMode === 'pop') {
       let modal = this.state.btnconfig
       if (!modal && btn.modal) {
@@ -176,7 +181,6 @@
 
       this.setState({
         loading: true,
-        tabledata: data,
         btnconfig: modal
       }, () => {
         this.improveAction()
@@ -1250,7 +1254,7 @@
     }
 
     if (btn.execSuccess !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', this.state.selines)
     }
   }
 
@@ -1299,7 +1303,7 @@
     }
 
     if (btn.execError !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
     }
   }
 
@@ -1416,7 +1420,7 @@
           visible: false
         })
       }
-      this.triggerPrint(this.state.tabledata, res)
+      this.triggerPrint(this.state.selines, res)
     })
   }
 
@@ -1432,7 +1436,7 @@
 
   modelconfirm = () => {
     const { BData } = this.props
-    const { btnconfig, tabledata } = this.state
+    const { btnconfig, selines } = this.state
     let _this = this
     let result = []
     
@@ -1447,8 +1451,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) {
@@ -1481,7 +1485,7 @@
     confirm({
       title: this.state.dict['main.action.confirm.tip'],
       onOk() {
-        _this.triggerPrint(tabledata, result)
+        _this.triggerPrint(selines, result)
       },
       onCancel() {
         _this.setState({ loading: false })
@@ -1533,7 +1537,7 @@
           menuType={this.props.menuType}
           action={btnconfig}
           inputSubmit={this.handleOk}
-          data={this.state.tabledata[0]}
+          data={this.state.selines[0]}
           BData={this.props.BData}
           wrappedComponentRef={(inst) => this.formRef = inst}
         />
@@ -1543,7 +1547,9 @@
 
   render() {
     const { btn, show } = 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