king
2025-02-12 c8c8bdf0c362ca76253d8e0cbb0dbaa13efad4a3
src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -78,6 +78,8 @@
          { value: 'Decimal(18,2)', text: 'Decimal(18,2)' },
          { value: 'Decimal(18,4)', text: 'Decimal(18,4)' },
          { value: 'Decimal(18,6)', text: 'Decimal(18,6)' },
          { value: 'Decimal(18,8)', text: 'Decimal(18,8)' },
          { value: 'Decimal(18,10)', text: 'Decimal(18,10)' },
          { value: 'date', text: 'date' },
          { value: 'datetime', text: 'datetime' }
        ]
@@ -119,7 +121,7 @@
        unlimit: true,
        editable: true,
        keyVals: ['Int', 'Decimal(18,0)', 'Decimal(18,2)', 'Decimal(18,4)', 'Decimal(18,6)'],
        render: (text, record) => /^Decimal/ig.test(record.type) || /^int/ig.test(record.type) ? text : ''
        render: (text, record) => record.required === 'true' && (/^Decimal/ig.test(record.type) || /^int/ig.test(record.type)) ? text : ''
        
      },
      {
@@ -131,7 +133,7 @@
        unlimit: true,
        editable: true,
        keyVals: ['Int', 'Decimal(18,0)', 'Decimal(18,2)', 'Decimal(18,4)', 'Decimal(18,6)'],
        render: (text, record) => /^Decimal/ig.test(record.type) || /^int/ig.test(record.type) ? text : ''
        render: (text, record) => record.required === 'true' && (/^Decimal/ig.test(record.type) || /^int/ig.test(record.type)) ? text : ''
      }
    ],
    uniqueColumns: [
@@ -259,12 +261,8 @@
          let _sheet = this.props.card.sheet
          if (window.GLOB.externalDatabase !== null) {
            _sheet = _sheet.replace(/@db@/ig, window.GLOB.externalDatabase)
          }
          let database = _sheet.match(/(.*)\.(.*)\./ig)
          let sheet = _sheet.replace(/(.*)\.(.*)\./ig, '')
          let database = _sheet.match(/(.*)\.(.*)\.|@db@/ig) || ''
          let sheet = _sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')
          
          database = database ? (database[0] || '') : ''
@@ -403,6 +401,16 @@
    _verify.columns = _columns
    _verify.scripts = _verify.scripts || []
    _verify.uniques = _verify.uniques || []
    if (window.GLOB.process && card.intertype === 'system') {
      _verify.workFlow = _verify.workFlow || 'false'
      _verify.flowType = 'start'
      _verify.flowSql = _verify.flowSql || 'true'
    } else {
      delete _verify.workFlow
      delete _verify.flowType
      delete _verify.flowSql
    }
    this.setState({
      searchKey: '',
@@ -590,18 +598,18 @@
  clearField = () => {
    const { verify } = this.state
    const _this = this
    const that = this
    confirm({
      content: `确定清空Excel列吗?`,
      onOk() {
        _this.setState({
        that.setState({
          verify: {
            ...verify,
            columns: []
          }
        }, () => {
          _this.resetUniqueColumns()
          that.resetUniqueColumns()
        })
      },
      onCancel() {}
@@ -611,8 +619,8 @@
  columnChange = (values, callback) => {
    let verify = JSON.parse(JSON.stringify(this.state.verify))
    let fields = verify.columns.map(item => item.Column)
    if (fields.includes(values.Column)) {
    let fields = verify.columns.map(item => item.Column.toLowerCase())
    if (fields.includes(values.Column.toLowerCase())) {
      notification.warning({
        top: 92,
        message: values.Column + '字段已存在!',
@@ -879,21 +887,11 @@
    })
  }
  onOptionChange = (e) => {
  onOptionChange = (value, key) => {
    const { verify } = this.state
    let value = e.target.value
    this.setState({
      verify: {...verify, default: value}
    })
  }
  onHandleChange = (e) => {
    const { verify } = this.state
    let value = e.target.value
    this.setState({
      verify: {...verify, excelHandle: value}
      verify: {...verify, [key]: value}
    })
  }
@@ -975,8 +973,8 @@
            <Form {...formItemLayout}>
              <Row gutter={24}>
                {card.intertype === 'system' ? <Col span={8}>
                  <Form.Item label={'默认sql'}>
                    <Radio.Group value={verify.default} onChange={this.onOptionChange}>
                  <Form.Item label="默认sql">
                    <Radio.Group value={verify.default} onChange={(e) => this.onOptionChange(e.target.value, 'default')}>
                      <Radio value="true">执行</Radio>
                      <Radio value="false">不执行</Radio>
                    </Radio.Group>
@@ -992,7 +990,7 @@
                    {getFieldDecorator('excelHandle', {
                      initialValue: verify.excelHandle
                    })(
                    <Radio.Group onChange={this.onHandleChange}>
                    <Radio.Group onChange={(e) => this.onOptionChange(e.target.value, 'excelHandle')}>
                      <Radio value="false">默认</Radio>
                      <Radio value="true">自定义</Radio>
                    </Radio.Group>)}
@@ -1041,6 +1039,27 @@
                    })(<CodeMirror mode="text/javascript" theme="cobalt" />)}
                  </Form.Item>
                </Col> : null}
                {window.GLOB.process && card.intertype === 'system' ? <Col span={8}>
                  <Form.Item label={
                    <Tooltip placement="bottomLeft" title="导入Excel工作流仅支持发起流程。">
                      <QuestionCircleOutlined className="mk-form-tip" />
                      工作流
                    </Tooltip>
                  }>
                    <Radio.Group value={verify.workFlow} onChange={(e) => {this.onOptionChange(e.target.value, 'workFlow')}}>
                      <Radio value="true">开启</Radio>
                      <Radio value="false">不开启</Radio>
                    </Radio.Group>
                  </Form.Item>
                </Col> : null}
                {verify.workFlow === 'true' ? <Col span={8}>
                  <Form.Item label="默认sql(工作流)">
                    <Radio.Group value={verify.flowSql} onChange={(e) => {this.onOptionChange(e.target.value, 'flowSql')}}>
                      <Radio value="true">执行</Radio>
                      <Radio value="false">不执行</Radio>
                    </Radio.Group>
                  </Form.Item>
                </Col> : null}
              </Row>
            </Form>
          </TabPane>
@@ -1057,7 +1076,7 @@
            <Button className="excel-col-add mk-red" title="清空Excel列" onClick={this.clearField}>
              清空Excel列
            </Button>
            <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>注:数值类型(int 或 decimal),内容为必填;最大值和最小值在类型为数值时有效。导入-初始化:用于excel中不存在,导入时需要初始化的字段</Col>
            <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>注:数值类型(int 或 decimal),内容为必填;最大值和最小值在类型为数值时(必填)有效。导入-初始化:用于excel中不存在,导入时需要初始化的字段</Col>
            <EditTable actions={['edit', 'move', 'copy', 'del', 'extra:required:是否必填']} searchKey={searchKey} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
          </TabPane>
          {card.intertype === 'system' ? <TabPane tab={
@@ -1087,6 +1106,7 @@
                btn={this.props.card}
                usefulfields={verify.columns}
                scripts={verify.scripts}
                workFlow={verify.workFlow}
                systemScripts={this.state.systemScripts}
                scriptsChange={this.scriptsChange}
                wrappedComponentRef={(inst) => this.scriptsFullForm = inst}
@@ -1096,6 +1116,7 @@
              btn={this.props.card}
              usefulfields={verify.columns}
              scripts={verify.scripts}
              workFlow={verify.workFlow}
              systemScripts={this.state.systemScripts}
              scriptsChange={this.scriptsChange}
              wrappedComponentRef={(inst) => this.scriptsForm = inst}