From 2ff464f30d94235b3ad04475593b75a74a354de9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 四月 2020 19:04:01 +0800 Subject: [PATCH] 2020-04-09 --- src/templates/zshare/verifycard/customscript/index.jsx | 43 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 549ba8c..3802050 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -1,6 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Button, notification } from 'antd' +import moment from 'moment' + +import Utils from '@/utils/utils.js' +import Api from '@/api' import './index.scss' const { TextArea } = Input @@ -9,11 +13,13 @@ static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� usefulfields: PropTypes.string, // 鍙敤瀛楁 + initsql: PropTypes.string, // 鍙敤瀛楁 scriptsChange: PropTypes.func // 琛ㄥ崟 } state = { - editItem: null + editItem: null, + loading: false } edit = (record) => { @@ -64,12 +70,33 @@ return } - this.props.scriptsChange(values) - this.setState({ - editItem: null - }) - this.props.form.setFieldsValue({ - sql: '' + let param = { + func: 's_debug_sql', + LText: this.props.initsql + values.sql + } + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + this.setState({loading: true}) + Api.getLocalConfig(param).then(res => { + if (res.status) { + this.props.scriptsChange(values) + this.setState({ + loading: false, + editItem: null + }) + this.props.form.setFieldsValue({ + sql: '' + }) + } else { + this.setState({loading: false}) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } }) } }) @@ -111,7 +138,7 @@ </Form.Item> </Col> <Col span={3} className="add"> - <Button onClick={this.handleConfirm} type="primary" className="add-row"> + <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row"> 纭畾 </Button> </Col> -- Gitblit v1.8.0