From fdac165a90d301e6c6b2648d14176a1410131901 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 01 十二月 2021 18:32:16 +0800 Subject: [PATCH] 2021-12-01 --- src/menu/components/form/formaction/index.jsx | 10 ++++ src/templates/sharecomponent/actioncomponent/index.jsx | 10 ++++ src/menu/components/card/cardcellcomponent/index.jsx | 10 ++++ src/templates/formtabconfig/index.jsx | 10 ++++ src/templates/zshare/verifycard/index.jsx | 54 ++++++++++++++++++++++++++- src/menu/components/share/actioncomponent/index.jsx | 10 ++++ 6 files changed, 97 insertions(+), 7 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 1d322fd..7686036 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -671,7 +671,15 @@ maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} - onCancel={() => { this.setState({ profVisible: false }) }} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ profVisible: false }) + }) + } else { + this.setState({ profVisible: false }) + } + }} destroyOnClose > {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ? diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx index 86b5ce0..b3a1f9e 100644 --- a/src/menu/components/form/formaction/index.jsx +++ b/src/menu/components/form/formaction/index.jsx @@ -251,7 +251,15 @@ maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} - onCancel={() => { this.setState({ profVisible: false }) }} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ profVisible: false }) + }) + } else { + this.setState({ profVisible: false }) + } + }} destroyOnClose > <VerifyCard diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index ea3fb0c..c7718dc 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -496,7 +496,15 @@ maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} - onCancel={() => { this.setState({ profVisible: false }) }} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ profVisible: false }) + }) + } else { + this.setState({ profVisible: false }) + } + }} destroyOnClose > {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ? diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index fbe82e8..ae8ce10 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -2019,7 +2019,15 @@ maskClosable={false} okText={this.state.dict['model.submit']} onOk={this.verifySubmit} - onCancel={() => { this.setState({ profileVisible: false }) }} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ profileVisible: false }) + }) + } else { + this.setState({ profileVisible: false }) + } + }} destroyOnClose > <VerifyCard diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index f1b2953..635027e 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -912,7 +912,15 @@ maskClosable={false} okText={dict['model.submit']} onOk={this.verifySubmit} - onCancel={() => { this.setState({ profVisible: false }) }} + onCancel={() => { + if (this.verifyRef.handleCancel) { + this.verifyRef.handleCancel().then(() => { + this.setState({ profVisible: false }) + }) + } else { + this.setState({ profVisible: false }) + } + }} destroyOnClose > {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ? diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index ffb2438..eb38446 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { fromJS } from 'immutable' +import { is, fromJS } from 'immutable' import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd' import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' import moment from 'moment' @@ -573,9 +573,20 @@ }) } + _verify.customverifys.forEach((item, i) => { + item.$index = i + 1 + }) + _verify.scripts.forEach((item, i) => { + item.$index = i + 1 + }) + _verify.cbScripts.forEach((item, i) => { + item.$index = i + 1 + }) + this.setState({ setting: config.setting || {}, - verify: _verify + verify: _verify, + oriVerify: fromJS(_verify).toJS() }) if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 鍐呴儴鎴栧閮ㄦ帴鍙� @@ -1398,6 +1409,45 @@ }) } + handleCancel = () => { + const { verify, oriVerify } = this.state + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + let msg = '' + if (this.customForm && this.customForm.state.editItem) { + msg = '鑷畾涔夐獙璇�' + } else if (this.customForm && this.customForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.customForm.props.form.getFieldValue('sql'))) { + msg = '鑷畾涔夐獙璇�' + } else if (this.orderForm && this.orderForm.state.editItem) { + msg = '鍗曞彿鐢熸垚' + } else if (this.scriptsForm && this.scriptsForm.state.editItem) { + msg = '鑷畾涔夎剼鏈�' + } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { + msg = '鑷畾涔夎剼鏈�' + } + + if (!is(fromJS(verify), fromJS(oriVerify))) { + confirm({ + content: '楠岃瘉淇℃伅宸蹭慨鏀癸紝纭畾鍙栨秷鍚楋紵', + onOk() { + resolve() + }, + onCancel() {} + }) + } else if (msg) { + confirm({ + content: msg + '鏈繚瀛橈紝纭畾鍙栨秷鍚楋紵', + onOk() { + resolve() + }, + onCancel() {} + }) + } else { + resolve() + } + }) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ -- Gitblit v1.8.0