| | |
| | | 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')) |
| | |
| | | data: [], |
| | | editingKey: '', |
| | | visible: false, |
| | | editLineId: '', |
| | | columns: [] |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | |
| | | render() { |
| | | const { actions, indexShow } = this.props |
| | | const { editLineId } = this.state |
| | | |
| | | let components = { |
| | | body: { |
| | |
| | | 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, |