From 0c1c59933e95c4c691d6ba3d11bf4aef98fe9e8d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 15 四月 2020 15:37:44 +0800 Subject: [PATCH] 2020-04-15 --- src/templates/zshare/verifycard/index.jsx | 84 +++++++++++++++++++++++++----------------- 1 files changed, 50 insertions(+), 34 deletions(-) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 9d8f8bf..396c41e 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -15,6 +15,7 @@ import './index.scss' const { TabPane } = Tabs +const { confirm } = Modal class VerifyCard extends Component { static propTpyes = { @@ -27,7 +28,6 @@ } state = { - updateloading: false, // 淇敼涓� initsql: '', // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪�� verify: {}, fields: [], @@ -772,25 +772,6 @@ }) } - updateChange = () => { - let _loading = false - if (this.customForm && this.customForm.state.editItem) { - _loading = true - } else if (this.uniqueForm && this.uniqueForm.state.editItem) { - _loading = true - } else if (this.orderForm && this.orderForm.state.editItem) { - _loading = true - } else if (this.scriptsForm && this.scriptsForm.state.editItem) { - _loading = true - } else if (this.contrastForm && this.contrastForm.state.editItem) { - _loading = true - } - - this.setState({ - updateloading: _loading - }) - } - uniqueChange = (values) => { let verify = JSON.parse(JSON.stringify(this.state.verify)) @@ -809,8 +790,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -832,8 +811,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -855,8 +832,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -878,8 +853,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -901,8 +874,6 @@ this.setState({ verify: verify - }, () => { - this.updateChange() }) } @@ -960,10 +931,6 @@ } }, 10) } - - this.setState({ - updateloading: true - }) } handleStatus = (record, type) => { @@ -1165,6 +1132,55 @@ }) } + handleConfirm = () => { + let verify = JSON.parse(JSON.stringify(this.state.verify)) + + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + if (verify.default === 'false' && verify.scripts.length === 0) { + notification.warning({ + top: 92, + message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', + duration: 10 + }) + return + } + + let _loading = false + if (this.customForm && this.customForm.state.editItem) { + _loading = true + } else if (this.uniqueForm && this.uniqueForm.state.editItem) { + _loading = true + } else if (this.orderForm && this.orderForm.state.editItem) { + _loading = true + } else if (this.scriptsForm && this.scriptsForm.state.editItem) { + _loading = true + } else if (this.contrastForm && this.contrastForm.state.editItem) { + _loading = true + } + + if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { + _loading = true + } else if (this.customForm && this.customForm.props.form.getFieldValue('sql')) { + _loading = true + } + + if (_loading) { + confirm({ + content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋, + okText: this.props.dict['header.confirm'], + cancelText: this.props.dict['header.cancel'], + onOk() { + resolve(verify) + }, + onCancel() {} + }) + } else { + resolve(verify) + } + }) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ -- Gitblit v1.8.0