king
2024-05-20 8f9f9322f32e0553cb58068b39ae57e3d997ec65
src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -66,6 +66,8 @@
  getOptions = () => {
    let _options = fromJS(columnTypeOptions[this.record.type]).toJS()
    let reLabel = {}
    if (['number', 'text'].includes(this.record.type) && this.record.editable === 'true') {
      _options.push('ctrlField')
      if (this.record.ctrlField) {
@@ -91,8 +93,12 @@
        } else {
          _options.push('required', 'enter')
        }
        reLabel.required = '必填'
      } else if (this.record.type === 'number') {
        _options.push('max', 'min', 'enter', 'clearField')
        _options.push('max', 'min', 'required', 'enter', 'clearField')
        reLabel.required = '不等于0'
      }
    } else if (this.record.type === 'extend') {
      if (this.record.colUnit === 'day') {
@@ -115,7 +121,7 @@
      }
    }
    return _options
    return {options: _options, reLabel}
  }
  editColumn = (column) => {
@@ -131,12 +137,16 @@
      this.record[item.key] = item.initVal
    })
    
    let _options = this.getOptions()
    let { options, reLabel } = this.getOptions()
    this.setState({
      visible: true,
      formlist: formlist.map(item => {
        item.hidden = !_options.includes(item.key)
        item.hidden = !options.includes(item.key)
        if (reLabel[item.key]) {
          item.label = reLabel[item.key]
        }
        if (item.key === 'formula') {
          item.fields = this.props.fields.map(col => col.field)
@@ -166,7 +176,7 @@
        this.record.IsSort = 'false'
      }
      let _options = this.getOptions()
      let { options, reLabel } = this.getOptions()
      let _field = ''
      if (value === 'formula') {
@@ -180,7 +190,10 @@
          }
          item.initVal = this.record[item.key]
          item.hidden = !_options.includes(item.key)
          item.hidden = !options.includes(item.key)
          if (reLabel[item.key]) {
            item.label = reLabel[item.key]
          }
          return item
        })
@@ -212,12 +225,15 @@
      this.record.type = values.type
      if (values.type !== _type) {
        let _options = this.getOptions()
        let { options, reLabel } = this.getOptions()
        this.setState({
          formlist: this.state.formlist.map(item => {
            item.initVal = this.record[item.key]
            item.hidden = !_options.includes(item.key)
            item.hidden = !options.includes(item.key)
            if (reLabel[item.key]) {
              item.label = reLabel[item.key]
            }
            return item
          })
@@ -230,7 +246,7 @@
    } else if (key === 'format' && value === 'percent') {
      this.props.form.setFieldsValue({postfix: '%'})
    } else if (key === 'editType') {
      let _options = this.getOptions()
      let { options, reLabel } = this.getOptions()
      this.setState({
        formlist: this.state.formlist.map(item => {
@@ -239,18 +255,24 @@
          }
          item.initVal = this.record[item.key]
          item.hidden = !_options.includes(item.key)
          item.hidden = !options.includes(item.key)
          if (reLabel[item.key]) {
            item.label = reLabel[item.key]
          }
          return item
        })
      })
    } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort', 'textFormat'].includes(key)) {
      let _options = this.getOptions()
      let { options, reLabel } = this.getOptions()
      this.setState({
        formlist: this.state.formlist.map(item => {
          item.initVal = this.record[item.key]
          item.hidden = !_options.includes(item.key)
          item.hidden = !options.includes(item.key)
          if (reLabel[item.key]) {
            item.label = reLabel[item.key]
          }
          return item
        })