From bef4f9e4fc767e8dd80b106a47545f78e75e7e41 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 一月 2020 11:52:30 +0800 Subject: [PATCH] 2020-01-17 --- src/templates/subtableconfig/index.jsx | 145 +++++++++++++++++++++++++----------------------- 1 files changed, 76 insertions(+), 69 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index c3fe1aa..d0cfec9 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -1089,6 +1089,7 @@ * @description 鏍囩椤典繚瀛� */ submitConfig = () => { + const { delActions } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) this.menuformRef.handleConfirm().then(res => { @@ -1159,29 +1160,78 @@ }) } - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - config: _config, - originConfig: _config - }, () => { + + // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� + // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 + new Promise(resolve => { + if (delActions.length > 0) { + let deffers = delActions.map(item => { + let _param = { + func: 'sPC_MainMenu_Del', + MenuID: item + } + return new Promise(resolve => { + Api.getSystemConfig(_param).then(response => { + resolve(response) + }) + }) + }) + Promise.all(deffers).then(result => { + let error = null + result.forEach(response => { + if (!response.status) { + error = response + } + }) + + if (error) { + this.setState({ + menuloading: false, + menucloseloading: false + }) + notification.warning({ + top: 92, + message: error.message, + duration: 10 + }) + resolve(false) + } else { + this.setState({ + delActions: [] + }) + resolve(true) + } + }) + } else if (delActions.length === 0) { + resolve(true) + } + }).then(resp => { + if (resp === false) return + + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + config: _config, + originConfig: _config + }, () => { + this.setState({ + menuloading: false, + menucloseloading: false + }) + this.submitAction(btnParam) + }) + } else { this.setState({ menuloading: false, menucloseloading: false }) - this.submitAction(btnParam) - }) - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 10 - }) - } + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + } + }) }) }, () => { notification.warning({ @@ -1198,64 +1248,21 @@ submitAction = (param) => { const { config } = this.state new Promise(resolve => { - // 鍐呴儴璇锋眰 - if (this.state.delActions.length > 0) { - let deffers = this.state.delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item - } - return new Promise(resolve => { - Api.getSystemConfig(_param).then(res => { - resolve(res) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = false - result.forEach(res => { - if (!res.status) { - error = res - } - }) - - if (error) { + if (param.LText) { + Api.getSystemConfig(param).then(res => { + if (res.status) { + resolve(true) + } else { notification.warning({ top: 92, - message: error.message, + message: res.message, duration: 10 }) resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(param) } }) - } else if (this.state.delActions.length === 0) { - resolve(param) - } - }).then(res => { - if (res === false) return res - - if (res.LText) { - return Api.getSystemConfig(res) } else { - return 'copy' - } - }).then(response => { - if (response === false || response === 'copy') return response - - if (response.status) { - return 'copy' - } else { - notification.warning({ - top: 92, - message: response.message, - duration: 10 - }) - return false + resolve(true) } }).then(response => { if (response === false) return response -- Gitblit v1.8.0