From 6055fa01416fc57ee33b291a8103ccc1a8edce44 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 20 七月 2021 23:21:14 +0800
Subject: [PATCH] 2021-07-20

---
 src/templates/zshare/editcomponent/index.jsx |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/templates/zshare/editcomponent/index.jsx b/src/templates/zshare/editcomponent/index.jsx
index 785ee7b..6fd72b8 100644
--- a/src/templates/zshare/editcomponent/index.jsx
+++ b/src/templates/zshare/editcomponent/index.jsx
@@ -25,6 +25,7 @@
     thawVisible: false,
     thawbtnlist: null,
     pasteVisible: false,
+    targetKeys: []
   }
 
   /**
@@ -34,7 +35,8 @@
     const { MenuID } = this.props
 
     this.setState({
-      thawVisible: true
+      thawVisible: true,
+      targetKeys: []
     })
 
     Api.getSystemConfig({
@@ -84,32 +86,31 @@
    */
   thawBtnSubmit = () => {
     const { thawButtons } = this.props
-    const { thawbtnlist, dict } = this.state
+    const { thawbtnlist, dict, targetKeys } = this.state
     let config = fromJS(this.props.config).toJS()
 
-    // 涓夌骇鑿滃崟瑙i櫎鍐荤粨
-    if (this.refs.trawmenu.state.targetKeys.length === 0) {
+    if (targetKeys.length === 0) {
       notification.warning({
         top: 92,
         message: dict['form.required.select'] + dict['header.form.thawbutton'],
         duration: 5
       })
     } else {
-
       thawbtnlist.forEach(item => {
-        if (this.refs.trawmenu.state.targetKeys.includes(item.key)) {
+        if (targetKeys.includes(item.key)) {
           config.action.push(item.btnParam)
         }
       })
 
       this.props.refresh({
         type: 'thaw',
-        thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys],
+        thawButtons: [...thawButtons, ...targetKeys],
         config: config
       })
 
       this.setState({
-        thawVisible: false
+        thawVisible: false,
+        targetKeys: []
       })
     }
   }
@@ -249,11 +250,11 @@
           title={dict['header.form.thawbutton']}
           visible={this.state.thawVisible}
           onOk={this.thawBtnSubmit}
-          onCancel={() => {this.setState({thawVisible: false, thawbtnlist: null})}}
+          onCancel={() => {this.setState({thawVisible: false, thawbtnlist: null, targetKeys: []})}}
           destroyOnClose
         >
           {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />}
-          {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>}
+          {this.state.thawbtnlist && <TransferForm onChange={(vals) => this.setState({targetKeys: vals})} menulist={this.state.thawbtnlist}/>}
         </Modal>
         {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */}
         <Modal

--
Gitblit v1.8.0