From 574ea3b532b625456c09f14fc11073aad6b61db7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 八月 2023 12:11:47 +0800 Subject: [PATCH] 2023-08-02 --- src/menu/datasource/verifycard/customscript/index.jsx | 42 ++++++++++++++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx index 8c27284..af82358 100644 --- a/src/menu/datasource/verifycard/customscript/index.jsx +++ b/src/menu/datasource/verifycard/customscript/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Button, notification, Select, Tooltip, Modal } from 'antd' +import { Form, Row, Col, Button, notification, Select, Tooltip, Modal, Switch } from 'antd' import Toast from 'antd-mobile/es/components/toast' import Dialog from 'antd-mobile/es/components/dialog' @@ -22,6 +22,7 @@ } state = { + skip: false, editItem: null, loading: false, usefulFields: '' @@ -100,6 +101,7 @@ } handleConfirm = () => { + const { skip } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { @@ -163,11 +165,10 @@ return } - this.setState({loading: true}) - this.props.scriptsChange(values).then(() => { + if (skip) { this.setState({ editItem: null, - loading: false + skip: false }) if (values.uuid) { @@ -178,11 +179,28 @@ sql: ' ' }) this.props.scriptSubmit(values) - }, () => { - this.setState({ - loading: false + } else { + this.setState({loading: true}) + this.props.scriptsChange(values).then(() => { + this.setState({ + editItem: null, + loading: false + }) + + if (values.uuid) { + MKEmitter.emit('editLineId', values.uuid) + } + + this.props.form.setFieldsValue({ + sql: ' ' + }) + this.props.scriptSubmit(values) + }, () => { + this.setState({ + loading: false + }) }) - }) + } } }) } @@ -258,7 +276,7 @@ render() { const { systemScripts, setting, type } = this.props const { getFieldDecorator } = this.props.form - const { usefulFields } = this.state + const { usefulFields, skip } = this.state let urlFields = window.GLOB.urlFields ? window.GLOB.urlFields.join(', ') : '' @@ -312,7 +330,7 @@ </Select> </Form.Item> </Col> - <Col span={6} className="add"> + <Col span={5} style={{whiteSpace: 'nowrap'}}> <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginTop: 5, marginBottom: 15, marginLeft: 30}}> 淇濆瓨 </Button> @@ -320,6 +338,10 @@ 鍙栨秷 </Button> </Col> + <Col span={3} style={{paddingTop: '15px', fontSize: '12px', whiteSpace: 'nowrap'}}> + 寮哄埗淇濆瓨锛� + <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/> + </Col> <Col span={24} className="sql"> <Form.Item label="sql"> {getFieldDecorator('sql', { -- Gitblit v1.8.0