king
2024-12-05 4a356e81b1a456f0cb16f61f548c46171c26c1b6
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -20,7 +20,6 @@
class MkSwitch extends Component {
  static propTpyes = {
    autoFocus: PropTypes.bool,
    defaultValue: PropTypes.any,
    config: PropTypes.object,
    onChange: PropTypes.func
@@ -78,12 +77,10 @@
    if (config.$ctrl) {
      MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid)
    }
    this.props.onBlur && this.props.onBlur()
  }
  render() {
    const { config, autoFocus } = this.props
    const { config } = this.props
    const { status } = this.state
    return (
@@ -91,7 +88,6 @@
        ref={ref => this.node = ref}
        checkedChildren={config.openText}
        checked={status}
        autoFocus={autoFocus}
        onFocus={this.onFocus}
        onBlur={this.onBlur}
        unCheckedChildren={config.closeText}
@@ -763,7 +759,7 @@
        content = `${record[col.field]}`
      }
      if (col.editType === 'select' && col.options.length > 0) {
      if (col.editType === 'select' && col.showValue !== 'value' && col.options.length > 0) {
        content = col.map.get(content) || content
      } else if (col.editType === 'switch') {
        if (content === col.openVal) {
@@ -820,16 +816,17 @@
      }
      if (col.editable === 'true' && !disabled) {
        if (editing) {
        if (col.editType === 'switch') {
          let _value = record[col.field] !== undefined ? record[col.field] : ''
          return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
            <MkSwitch config={col} lineId={record.$$uuid} defaultValue={_value} onChange={this.onColChange}/>
          </td>)
        } else if (editing) {
          let _value = record[col.field] !== undefined ? record[col.field] : ''
          if (!col.editType || col.editType === 'text') {
            return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
              <MkInput config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/>
            </td>)
          } else if (col.editType === 'switch') {
            return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
              <MkSwitch config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/>
            </td>)
          } else if (col.editType === 'date') {
            return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
@@ -1099,7 +1096,7 @@
          )
        } else if (col.editType === 'switch') {
          children = (
            <MkSwitch config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={false} onChange={this.onColChange}/>
            <MkSwitch config={col} lineId={record.$$uuid} defaultValue={_value} onChange={this.onColChange}/>
          )
        } else if (col.editType === 'date') {
          children = (
@@ -1125,7 +1122,7 @@
          content = `${record[col.field]}`
        }
        if (col.editType === 'select' && col.options.length > 0) {
        if (col.editType === 'select' && col.showValue !== 'value' && col.options.length > 0) {
          content = col.map.get(content) || content
        } else if (col.editType === 'switch') {
          if (content === col.openVal) {
@@ -2140,6 +2137,12 @@
      delete result.message
      delete result.status
      this.props.columns.forEach(item => {
        if (item.arr_field && result[item.field]) {
          result[item.uuid] = result[item.field]
        }
      })
      this.resetFormList(result)
    })
  }