| | |
| | | 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' |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | skip: false, |
| | | editItem: null, |
| | | loading: false, |
| | | usefulFields: '' |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { skip } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | |
| | | return |
| | | } |
| | | |
| | | if (skip) { |
| | | this.setState({ |
| | | editItem: null, |
| | | skip: false |
| | | }) |
| | | |
| | | if (values.uuid) { |
| | | MKEmitter.emit('editLineId', values.uuid) |
| | | } |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: ' ' |
| | | }) |
| | | this.props.scriptSubmit(values) |
| | | } else { |
| | | this.setState({loading: true}) |
| | | this.props.scriptsChange(values).then(() => { |
| | | this.setState({ |
| | |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | 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(', ') : '' |
| | | |
| | |
| | | </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> |
| | |
| | | 取消 |
| | | </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', { |