From a859b8d276dcdc0a9a806498f4a6af845858e3a9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 24 十二月 2019 15:32:11 +0800
Subject: [PATCH] 2019-12-24

---
 src/templates/subtableconfig/index.jsx |   69 +++++++++++-----------------------
 1 files changed, 22 insertions(+), 47 deletions(-)

diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index aa2766b..c67c199 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -31,6 +31,7 @@
 class SubTableConfig extends Component {
   static propTpyes = {
     config: PropTypes.object,
+    menu: PropTypes.any,
     handleConfig: PropTypes.func,
     handleSubConfig: PropTypes.func,
     supMenuList: PropTypes.array
@@ -73,7 +74,7 @@
    */
   UNSAFE_componentWillMount () {
     const { config } = this.props
-    console.log(config)
+
     let _config = null
 
     if (!config || config.create) {
@@ -1543,9 +1544,9 @@
     })
   }
 
-  changeTemplate = () => {
-    this.props.handleConfig('template')
-  }
+  // changeTemplate = () => {
+  //   this.props.handleConfig('template')
+  // }
 
   /**
    * @description 鏍囩椤典繚瀛�
@@ -1788,7 +1789,8 @@
           duration: 2
         })
         if (this.state.closeVisible) {
-          this.props.handleConfig('')
+          let view = this.props.menu ? this.props.menu.type : ''
+          this.props.handleConfig(view)
         } else {
           this.setState({
             menuloading: false,
@@ -1824,7 +1826,8 @@
         okText: this.state.dict['header.confirm'],
         cancelText: this.state.dict['header.cancel'],
         onOk() {
-          _this.props.handleConfig('')
+          let view = _this.props.menu ? _this.props.menu.type : ''
+          _this.props.handleConfig(view)
         },
         onCancel() {}
       })
@@ -1837,7 +1840,8 @@
             closeVisible: true
           })
         } else {
-          this.props.handleConfig('')
+          let view = this.props.menu ? this.props.menu.type : ''
+          this.props.handleConfig(view)
         }
       }, () => {
         this.setState({
@@ -2154,7 +2158,7 @@
   /**
    * @description 璁剧疆鍙厤缃寜閽�
    */
-  setSubConfig = (btn, type) => {
+  setSubConfig = (btn) => {
     const { config, originConfig } = this.state
 
     let isAdd = false
@@ -2183,7 +2187,7 @@
             message: '鑿滃崟閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒',
             duration: 10
           })
-        } else if (type === 'button') {
+        } else {
           this.setState({
             loading: true
           })
@@ -2204,7 +2208,7 @@
                   _LongParam = ''
                 }
               }
-              this.props.handleSubConfig(btn, '', _LongParam, type)
+              this.props.handleSubConfig(btn, config, _LongParam, 'tabButton')
             } else {
               this.setState({
                 loading: false
@@ -2216,40 +2220,6 @@
               })
             }
           })
-        } else if (type === 'tab') {
-          this.props.handleSubConfig(btn, '', '', type)
-          // this.setState({
-          //   loading: true
-          // })
-          // Api.getSystemConfig({
-          //   func: 'sPC_Get_LongParam',
-          //   MenuID: btn.uuid
-          // }).then(res => {
-          //   if (res.status) {
-          //     this.setState({
-          //       loading: false
-          //     })
-          //     let _LongParam = ''
-          //     if (res.LongParam) {
-          //       _LongParam = window.decodeURIComponent(window.atob(res.LongParam))
-          //       try {
-          //         _LongParam = JSON.parse(_LongParam)
-          //       } catch (e) {
-          //         _LongParam = ''
-          //       }
-          //     }
-          //     this.props.handleSubConfig(btn, '', _LongParam)
-          //   } else {
-          //     this.setState({
-          //       loading: false
-          //     })
-          //     notification.warning({
-          //       top: 92,
-          //       message: res.message,
-          //       duration: 10
-          //     })
-          //   }
-          // })
         }
       }, () => {
         notification.warning({
@@ -2275,6 +2245,11 @@
     this.setState({
       showColumnName: !showColumnName
     })
+  }
+
+  dontsave = () => {
+    let view = this.props.menu ? this.props.menu.type : ''
+    this.props.handleConfig(view)
   }
 
   render () {
@@ -2365,7 +2340,7 @@
                         icon={item.icon}
                         style={{marginBottom: '10px'}}
                         className={'mk-btn mk-' + item.class}
-                        onClick={() => this.setSubConfig(item, 'button')}
+                        onClick={() => this.setSubConfig(item)}
                       >{item.label}</Button>
                     </div>
                   )
@@ -2386,7 +2361,7 @@
             <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={
               <div>
                 <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} />
-                <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button>
+                {/* <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> */}
                 <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>
                 <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button>
               </div>
@@ -2558,7 +2533,7 @@
           onCancel={() => { this.setState({closeVisible: false}) }}
           footer={[
             <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
-            <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>,
+            <Button key="confirm" className="mk-btn mk-yellow" onClick={this.dontsave}>{this.state.dict['header.notsave']}</Button>,
             <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button>
           ]}
           destroyOnClose

--
Gitblit v1.8.0