king
2022-01-30 3f79b6ee9f7159f92d468185f2460cb19d20ece2
src/templates/zshare/editTable/index.jsx
@@ -12,6 +12,7 @@
import CusSwitch from './cusSwitch'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import MKEmitter from '@/utils/events.js'
import './index.scss'
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
@@ -171,6 +172,7 @@
    data: [],
    editingKey: '',
    visible: false,
    editLineId: '',
    columns: []
  }
@@ -268,6 +270,21 @@
        this.setState({columns})
      }
    }
  }
  componentDidMount () {
    MKEmitter.addListener('editLineId', this.getEditLineId)
  }
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('editLineId', this.getEditLineId)
  }
  getEditLineId = (id) => {
    this.setState({ editLineId: id })
  }
  isEditing = record => record.uuid === this.state.editingKey
@@ -508,6 +525,7 @@
  render() {
    const { actions, indexShow } = this.props
    const { editLineId } = this.state
    let components = {
      body: {
@@ -570,7 +588,7 @@
              components={components}
              dataSource={data}
              columns={columns}
              rowClassName="editable-row"
              rowClassName={record => !editLineId || editLineId !== record.uuid ? 'editable-row' : 'editable-row active'}
              pagination={false}
              onRow={(record, index) => ({
                index,