From d17368d4a5bdec6db2d8a85c7901cdb25cc59cd4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 11 十月 2021 15:16:25 +0800 Subject: [PATCH] 2021-10-11 --- src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 55 ++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 58d0e67..30e8586 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -192,6 +192,7 @@ tdFocus = (id) => { const { col, record } = this.props + if (id !== col.uuid + record.$Index) return this.focus() } @@ -419,7 +420,8 @@ fields: [], pickup: false, // 鏀惰捣鏈�夋嫨椤� orderfields: {}, // 鎺掑簭id涓巉ield杞崲 - loading: false + loading: false, + editable: 'false' } UNSAFE_componentWillMount () { @@ -474,22 +476,28 @@ if (item.type !== 'action') { let _copy = fromJS(_item).toJS() _copy.sorter = false + + if (item.editable === 'true') { + _copy.title = <span>{item.label}<Icon className="system-color" style={{position: 'absolute', bottom: 0, right: 0}} type="edit" /></span> + } edColumns.push(_copy) } _columns.push(_item) }) - edColumns.push({ - align: 'center', - dataIndex: 'mkoperation', - title: '鎿嶄綔', - sorter: false, - width: 100, - onCell: record => ({ - record, - col: {type: 'operation', tableId: tableId}, + if (setting.delable !== 'false') { + edColumns.push({ + align: 'center', + dataIndex: 'mkoperation', + title: '鎿嶄綔', + sorter: false, + width: 100, + onCell: record => ({ + record, + col: {type: 'operation', tableId: tableId}, + }) }) - }) + } if (setting.borderColor) { // 杈规棰滆壊 let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${setting.borderColor}}` @@ -504,7 +512,8 @@ edColumns, tableId, orderfields, - initEditLine + initEditLine, + editable: setting.editable }) } @@ -514,6 +523,7 @@ componentDidMount () { const { fields, columns } = this.props + const { data, editable } = this.state let _fields = [] @@ -531,6 +541,12 @@ this.setState({ fields: _fields, }) + + if (editable === 'true' && data && data.length > 0) { + setTimeout(() => { + this.pickupChange() + }, 200) + } MKEmitter.addListener('nextLine', this.nextLine) MKEmitter.addListener('delRecord', this.delRecord) @@ -554,6 +570,11 @@ UNSAFE_componentWillReceiveProps(nextProps) { if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { this.setState({data: nextProps.data || []}) + if (this.state.editable === 'true') { + setTimeout(() => { + this.pickupChange() + }, 200) + } } } @@ -844,6 +865,9 @@ loading: false }) + if (submit.closetab === 'true') { + MKEmitter.emit('popclose') + } if (submit.execSuccess !== 'never') { this.repick() MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) @@ -961,7 +985,8 @@ data: [], edData: [], pickup, - loading: false + loading: false, + editable: 'false' }, () => { this.setState({ data: data, @@ -972,7 +997,7 @@ } render() { - const { setting, statFValue, lineMarks } = this.props + const { setting, statFValue, lineMarks, submit } = this.props const { pickup, tableId, data, edData, columns, edColumns, loading } = this.state const components = { @@ -1015,7 +1040,7 @@ return ( <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}> <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> - {pickup ? <Button onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null} + {pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null} <Table components={components} style={setting.style} -- Gitblit v1.8.0