king
2023-10-19 5e1ff4dc1c6d384af39cac1d3fbe6bf4b58566f2
src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -71,6 +71,8 @@
        if (this.record.editType === 'switch') {
          _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText', 'editField')
        } else if (this.record.editType === 'date') {
          _options.push('required', 'precision', 'enter', 'declareType')
        } else if (this.record.editType === 'select') {
          _options.push('required', 'enter', 'resourceType', 'linkSubField', 'editField', 'dropdown')
@@ -382,8 +384,19 @@
        className = 'text-area'
        let linkSubFields = this.record.linkSubField || []
        let columns = []
        columns.push({ title: 'Value', key: 'Value', strict: true })
        columns.push({ title: 'Text', key: 'Text' })
        linkSubFields.forEach(field => {
          if (field === 'Value' || field === 'Text') return
          columns.push({ title: transfield[field] || field, key: field })
        })
      
        content = <EditTable type={'select'} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
        content = <EditTable columns={columns} module="form" onChange={this.changeOptions}/>
      }
      fields.push(
@@ -403,6 +416,29 @@
      )
    })
    return fields
  }
  transfer = (options) => {
    if (options.length === 0) return options
    let isNumber = true
    options.forEach(item => {
      if (!item.Value || isNaN(item.Value)) {
        isNumber = false
      }
    })
    if (isNumber) {
      return options.map(item => {
        item.Value = +item.Value
        return item
      })
    } else {
      return options.map(item => {
        item.Value = item.Value + ''
        return item
      })
    }
  }
  handleSubmit = () => {
@@ -431,6 +467,32 @@
          cols.forEach(col => {
            values.formula = values.formula.replace(col.reg, col.value)
          })
        } else if (values.type === 'text' && values.editable === 'true' && values.editType === 'select') {
          if (values.resourceType === '0') {
            values.options = values.options || []
            values.options = this.transfer(values.options)
            if (values.options.filter(op => op.Text === '').length > 0) {
              notification.warning({
                top: 92,
                message: '提示文本(Text)不可为空!',
                duration: 5
              })
              return
            } else {
              let arr = values.options.map(m => m.Value)
              let _arr = Array.from(new Set(arr))
              if (arr.length > _arr.length) {
                notification.warning({
                  top: 92,
                  message: 'Value值不可重复!',
                  duration: 5
                })
                return
              }
            }
          }
        }
        if (values.dataSource && /\s/.test(values.dataSource)) {