king
2023-10-28 256878280129753b95f7a2c89a236f0ebcf616b1
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -15,6 +15,7 @@
const { Paragraph } = Typography
const MkIcon = asyncComponent(() => import('@/components/mk-icon'))
const MKPopSelect = asyncComponent(() => import('./mkPopSelect'))
const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
class CusSwitch extends Component {
@@ -370,6 +371,25 @@
    }, 10)
  }
  onPopChange = (values) => {
    const { col, record } = this.props
    this.setState({editing: false})
    setTimeout(() => {
      if (/\$next/.test(col.enter)) {
        MKEmitter.emit('nextLine', col, record.$$uuid)
      } else if (col.enter === '$sub') {
        MKEmitter.emit('subLine', col, record)
      } else if (col.enter !== '$noAct') {
        let node = document.getElementById(col.enter + record.$$uuid)
        node && node.click()
      }
    }, 50)
    MKEmitter.emit('changeRecord', col.tableId, {...record, ...values})
  }
  render() {
    let { col, config, record, style, className, ...resProps } = this.props
    const { editing, value, err } = this.state
@@ -445,6 +465,12 @@
            return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
              <CusSwitch config={col} defaultValue={_value} autoFocus={true} onChange={this.onSwitchChange} onBlur={this.switchBlur}/>
            </td>)
          } else if (col.editType === 'popSelect') {
            let _value = record[col.field] !== undefined ? record[col.field] : ''
            return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell">
              <MKPopSelect mask={true} defaultValue={_value} config={col} BID={record.$$BID} ID={record.$$uuid} onChange={this.onPopChange} blur={() => this.setState({editing: false})}/>
            </td>)
          } else {
            let _value = record[col.field] !== undefined ? record[col.field] : ''
@@ -833,6 +859,23 @@
    MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: _val})
  }
  onPopChange = (values) => {
    const { col, record } = this.props
    setTimeout(() => {
      if (/\$next/.test(col.enter)) {
        MKEmitter.emit('nextLine', col, record.$$uuid)
      } else if (col.enter === '$sub') {
        MKEmitter.emit('subLine', col, record)
      } else if (col.enter !== '$noAct') {
        let node = document.getElementById(col.enter + record.$$uuid)
        node && node.click()
      }
    }, 50)
    MKEmitter.emit('changeRecord', col.tableId, {...record, ...values})
  }
  render() {
    let { col, config, record, style, className, ...resProps } = this.props
    const { err } = this.state
@@ -862,6 +905,10 @@
        } else if (col.editType === 'date') {
          children = (
            <CusDatePicker config={col} value={record[col.field] || null} onChange={this.onDateChange} blur={() => {}}/>
          )
        } else if (col.editType === 'popSelect') {
          children = (
            <MKPopSelect config={col} defaultValue={record[col.field] || ''} BID={record.$$BID} ID={record.$$uuid} onChange={this.onPopChange}/>
          )
        } else {
          children = (<>
@@ -2030,11 +2077,7 @@
    })
    if (err) {
      notification.warning({
        top: 92,
        message: err,
        duration: 5
      })
      message.warning(err)
      return null
    }