king
2023-08-02 574ea3b532b625456c09f14fc11073aad6b61db7
src/templates/sharecomponent/actioncomponent/verifyexcelin/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, 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'
@@ -23,6 +23,7 @@
    editItem: null,
    usefulfields: null,
    loading: false,
    skip: false,
    verifySql: ''
  }
@@ -81,7 +82,7 @@
  handleConfirm = () => {
    const { type } = this.props
    const { editItem } = this.state
    const { editItem, skip } = this.state
    // 表单提交时检查输入值是否正确
    this.props.form.validateFieldsAndScroll((err, values) => {
@@ -215,7 +216,7 @@
        }
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`)
        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${param.timestamp}'`)
        param.LText = param.LText.replace(/\n/g, ' ')
        
        // 外联数据库替换
@@ -226,26 +227,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
              })
            }
          })
        }
      }
    })
  }
@@ -305,7 +318,7 @@
  render() {
    const { systemScripts, btn, type } = this.props
    const { usefulfields, editItem } = this.state
    const { usefulfields, editItem, skip } = this.state
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
@@ -356,7 +369,7 @@
              )}
            </Form.Item>
          </Col> : null}
          {!type ? <Col span={10}>
          {!type ? <Col span={8}>
            <Form.Item style={{marginBottom: 0}} label={'快捷添加'}>
              <Select
                showSearch
@@ -378,7 +391,7 @@
              </Select>
            </Form.Item>
          </Col> : null}
          <Col span={6} className="add">
          <Col span={5} className="add" style={{paddingTop: '2px', whiteSpace: 'nowrap'}}>
            <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}>
            {type === 'fullscreen' && !editItem ? '添加' : '保存'}
            </Button>
@@ -386,6 +399,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', {