| | |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | updateloading: false, // 修改中 |
| | | initsql: '', // sql验证时变量声明及赋值 |
| | | verify: {}, |
| | | fields: [], |
| | |
| | | }) |
| | | } |
| | | |
| | | 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)) |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }, () => { |
| | | this.updateChange() |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | }, 10) |
| | | } |
| | | |
| | | this.setState({ |
| | | updateloading: true |
| | | }) |
| | | } |
| | | |
| | | handleStatus = (record, type) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | 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: '不执行默认sql时,必须设置自定义脚本!', |
| | | 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更新 |
| | | */ |