king
2022-04-29 eec619b6e3339e9999a7a1c2c5454cef5d763b24
src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -49,15 +49,16 @@
        min: 5,
        max: 200,
        editable: true,
        width: '20%'
        width: '14%',
        render: (text) => text || 20
      },
      {
        title: '类型',
        dataIndex: 'type',
        inputType: 'select',
        inputType: 'radio',
        editable: true,
        required: false,
        width: '20%',
        width: '18%',
        render: (text) => {
          if (text === 'image') {
            return '图片'
@@ -73,12 +74,31 @@
      {
        title: '取绝对值',
        dataIndex: 'abs',
        inputType: 'select',
        inputType: 'radio',
        editable: true,
        required: false,
        width: '20%',
        width: '14%',
        render: (text) => {
          if (text === 'true') {
            return '是'
          } else {
            return '否'
          }
        },
        options: [
          {value: 'true', text: '是'},
          {value: 'false', text: '否'}
        ]
      },
      {
        title: '导出',
        dataIndex: 'output',
        inputType: 'radio',
        editable: true,
        required: false,
        width: '14%',
        render: (text) => {
          if (text !== 'false') {
            return '是'
          } else {
            return '否'
@@ -106,9 +126,10 @@
    if (card.intertype !== 'system') {
      _verify.enable = 'false'
    }
    if (_verify.columns[0] && !_verify.columns[0].type) {
    if (_verify.columns[0] && (!_verify.columns[0].type || !_verify.columns[0].output)) {
      _verify.columns = _verify.columns.map(col => {
        col.type = col.type || 'text'
        col.output = col.output || 'true'
        return col
      })
    }
@@ -117,6 +138,7 @@
    if (!_verify.script && card.intertype === 'system') {
      let search = this.formatSearch(config.search)
      search = Utils.joinMainSearchkey(search)
      search = search.replace(/@\$@/ig, '')
      search = search ? 'where ' + search : ''
      
      defaultscript = `update ${config.setting.tableName || ''} set idefine5= idefine5+1 ,modifydate=getdate(),cdefine5='已导出',modifyuserid=@userid@ ${search}`
@@ -138,36 +160,37 @@
    let newsearches = []
    searches.forEach(search => {
      if (!search.field) return
      let item = {
        key: search.field,
        match: search.match,
        type: search.type,
        label: search.label,
        value: `@${search.field}@`,
        value: search.initval,
        required: search.required === 'true'
      }
      if (item.type === 'group') {
        let copy = fromJS(item).toJS()
        copy.key = search.datefield
        item.key = search.datefield
        item.type = 'daterange'
        item.match = 'between'
        item.value = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')].join(',')
        item.value = `@${search.field}@`
        item.match = '='
        copy.type = 'daterange'
        copy.match = 'between'
        copy.value = [`@${search.datefield}@`, `@${search.datefield}1@`]
        if (search.transfer === 'true') {
          newsearches.push(item)
        }
        newsearches.push(copy)
        newsearches.push(item)
        return
      } else if (item.type === 'date') {
        item.value = moment().format('YYYY-MM-DD')
      } else if (item.type === 'datemonth') {
        item.value = moment().format('YYYY-MM')
      } else if (item.type === 'dateweek') {
        item.value = [`@${search.field}@`, `@${search.field}1@`]
        item.value = moment().format('YYYY-MM-DD')
      } else if (item.type === 'daterange') {
        item.value = [`@${search.field}@`, `@${search.field}1@`]
      } else if (item.type === 'multiselect') {
        item.value = [`@${search.field}@`]
        item.value = [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')].join(',')
      } else if (item.type === 'multiselect' || (item.type === 'checkcard' && search.multiple === 'true')) {
        item.type = 'multi'
        item.value = '@$@'
      } else {
        item.value = '@$@'
      }
      newsearches.push(item)
    })
@@ -189,6 +212,7 @@
    }
    values.uuid = Utils.getuuid()
    values.abs = 'false'
    values.output = 'true'
    verify.columns.push(values)
    this.setState({
@@ -395,6 +419,7 @@
        Text: item.label,
        Width: 20,
        abs: 'false',
        output: 'true',
        type: 'text',
        uuid: Utils.getuuid()
      })
@@ -423,6 +448,28 @@
    })
  }
  changeColumns = (columns) => {
    const { verify } = this.state
    if (columns[0] && (columns[0].type !== 'image' && columns[0].type !== 'text')) {
      columns = columns.map(col => {
        let _cell = {
          uuid: Utils.getuuid(),
          Column: col.Column,
          Text: col.Text,
          Width: 20,
          abs: 'false',
          output: 'true',
          type: 'text',
        }
        return _cell
      })
    }
    this.setState({verify: {...verify, columns}})
  }
  render() {
    const { card } = this.props
    const { verify, excelColumns, defaultscript } = this.state
@@ -440,7 +487,7 @@
    return (
      <div id="verify-excelout-box-tab">
        <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}>
        <Tabs defaultActiveKey="1" className="excelout-verify-card-box" onChange={this.tabchange}>
          <TabPane tab={
            <span>
              Excel导出列
@@ -455,11 +502,11 @@
              清空Excel列
            </Button>
            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index。</div>
            <EditTable actions={['edit', 'move', 'copy', 'del']} type="exceloutcolumn" data={verify.columns} columns={excelColumns} onChange={(columns) => this.setState({verify: {...verify, columns}})}/>
            <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
          </TabPane>
          {card.intertype === 'system' ? <TabPane tab={
            <span>
              自定义脚本
              回调脚本
              {verify.enable === 'true' ? <span className="count-tip">1</span> : null}
            </span>
          } key="6">
@@ -473,6 +520,7 @@
                    </Radio.Group>
                  </Form.Item>
                </Col>
                <div style={{color: '#959595', fontSize: '13px', paddingTop: '30px', float: 'right'}}>执行成功后的回调函数。</div>
                <Col span={24} className="sql">
                  <Form.Item label={'sql'}>
                    {getFieldDecorator('sql', {