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/templates/zshare/verifycard/callbackcustomscript/index.jsx | 71 +++++++++++++++++++++++------------ 1 files changed, 46 insertions(+), 25 deletions(-) diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx index ce0b0fd..d484478 100644 --- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx +++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select } from 'antd' +import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' @@ -21,7 +21,8 @@ state = { editItem: null, - loading: false + loading: false, + skip: false } edit = (record) => { @@ -36,7 +37,7 @@ } handleConfirm = () => { - const { editItem } = this.state + const { editItem, skip } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { @@ -161,26 +162,38 @@ param.LText = Utils.formatOptions(param.LText) param.secretkey = Utils.encrypt('', param.timestamp) - this.setState({loading: true}) - Api.genericInterface(param).then(res => { - if (res.status) { - this.setState({ - loading: false, - editItem: null - }, () => { - this.props.scriptsChange(values) - }) - this.props.form.setFieldsValue({ - sql: ' ' - }) - } else { - this.setState({loading: false}) - - Modal.error({ - title: res.message - }) - } - }) + if (skip) { + this.setState({ + skip: false, + editItem: null + }, () => { + this.props.scriptsChange(values) + }) + this.props.form.setFieldsValue({ + sql: ' ' + }) + } else { + this.setState({loading: true}) + Api.genericInterface(param).then(res => { + if (res.status) { + this.setState({ + loading: false, + editItem: null + }, () => { + this.props.scriptsChange(values) + }) + this.props.form.setFieldsValue({ + sql: ' ' + }) + } else { + this.setState({loading: false}) + + Modal.error({ + title: res.message + }) + } + }) + } } }) } @@ -198,6 +211,9 @@ selectScript = (value, option) => { if (!value || !option) return let _sql = this.props.form.getFieldValue('sql') + if (/^\s+$/.test(_sql)) { + _sql = '' + } if (_sql) { _sql = _sql + ` @@ -218,6 +234,7 @@ render() { const { usefulfields, systemScripts, btn } = this.props const { getFieldDecorator } = this.props.form + const { skip } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -269,7 +286,7 @@ )} </Form.Item> </Col> - <Col span={10}> + <Col span={8}> <Form.Item label={'蹇嵎娣诲姞'} style={{marginBottom: 0}}> <Select allowClear @@ -285,7 +302,7 @@ </Select> </Form.Item> </Col> - <Col span={6} className="add"> + <Col span={5} className="add" style={{whiteSpace: 'nowrap'}}> <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> 淇濆瓨 </Button> @@ -293,6 +310,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