From f9bc0059785cb1b1583e6f7a3a501f667338e672 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 21 十二月 2023 14:59:52 +0800 Subject: [PATCH] 2023-12-21 --- src/components/normalform/modalform/mkTable/index.jsx | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/components/normalform/modalform/mkTable/index.jsx b/src/components/normalform/modalform/mkTable/index.jsx index 3fdd300..1baf22f 100644 --- a/src/components/normalform/modalform/mkTable/index.jsx +++ b/src/components/normalform/modalform/mkTable/index.jsx @@ -153,8 +153,9 @@ class EditTable extends Component { static propTpyes = { - columns: PropTypes.array, // 鏄剧ず鍒� - onChange: PropTypes.func // 鏁版嵁鍙樺寲 + actions: PropTypes.array, + columns: PropTypes.array, + onChange: PropTypes.func } state = { @@ -166,7 +167,7 @@ } UNSAFE_componentWillMount () { - let actions = this.props.actions || [] + const { actions } = this.props let columns = fromJS(this.props.columns).toJS() let operation = { @@ -189,16 +190,16 @@ </div> ) : ( <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px', whiteSpace: 'nowrap'}}> - <span className="primary" onClick={() => {editingKey === '' && this.edit(record)}}><EditOutlined /></span> - {editingKey === '' ? <Popconfirm + {actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record)}}><EditOutlined /></span> : null} + {actions.includes('del') && editingKey === '' ? <Popconfirm overlayClassName="popover-confirm" title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.handleDelete(record.uuid) }> <span className="danger"><DeleteOutlined /></span> </Popconfirm> : null} - {editingKey !== '' ? <span className="danger"><DeleteOutlined /></span> : null} - {actions.includes('view') ? <span className="copy" onClick={() => {editingKey === '' && this.changeMenu(record.menu)}}><ArrowRightOutlined /></span> : null} + {actions.includes('del') && editingKey !== '' ? <span className="danger"><DeleteOutlined /></span> : null} + {actions.includes('view') ? <span className="copy" onClick={() => {editingKey === '' && this.changeMenu(record)}}><ArrowRightOutlined /></span> : null} </div> ) } @@ -217,7 +218,8 @@ // return !is(fromJS(this.state), fromJS(nextState)) // } - changeMenu = (MenuId) => { + changeMenu = (record) => { + let MenuId = record.menu if (MenuId === 'IM') { if (!sessionStorage.getItem('instantMessage')) return @@ -231,7 +233,7 @@ MKEmitter.emit('changeEditMenu', {routerUrl: '/imdesign/' + param}) } else { - MKEmitter.emit('changeEditMenu', {MenuID: MenuId}) + MKEmitter.emit('changeEditMenu', { ...record, MenuID: MenuId}) } } @@ -392,7 +394,7 @@ } render() { - const { fixed } = this.props + const { actions } = this.props let components = { body: { cell: EditableCell @@ -401,8 +403,11 @@ let moveprops = {} components.body.row = DragableBodyRow - moveprops.moveAble = !this.state.editingKey - moveprops.moveRow = this.moveRow + + if (actions.includes('move')) { + moveprops.moveAble = !this.state.editingKey + moveprops.moveRow = this.moveRow + } let columns = this.state.columns.map(col => { if (col.copy) { @@ -437,7 +442,7 @@ return ( <EditableContext.Provider value={this.props.form}> <div className="modal-editable-table"> - {!fixed ? <Button disabled={!!this.state.editingKey} type="link" onClick={this.addline}><PlusOutlined style={{}}/></Button> : null} + {actions.includes('add') ? <Button disabled={!!this.state.editingKey} type="link" onClick={this.addline}><PlusOutlined style={{}}/></Button> : null} <DndProvider> <Table bordered -- Gitblit v1.8.0