From 3bb266595fbfa9af6b97405737496ed61c6b7c55 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 01 三月 2022 17:10:57 +0800 Subject: [PATCH] 2022-03-01 --- src/templates/zshare/modalform/modaleditable/index.jsx | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/src/templates/zshare/modalform/modaleditable/index.jsx b/src/templates/zshare/modalform/modaleditable/index.jsx index 06714d0..0967940 100644 --- a/src/templates/zshare/modalform/modaleditable/index.jsx +++ b/src/templates/zshare/modalform/modaleditable/index.jsx @@ -115,6 +115,7 @@ class EditTable extends Component { static propTpyes = { type: PropTypes.string, // 琛ㄥ崟绫诲瀷 + module: PropTypes.string, // 鍏冪礌绫诲瀷 linkSubFields: PropTypes.array, // 鍏宠仈瀛楁 transfield: PropTypes.object, // 琛ㄥ崟瀛楁鍚嶇О onChange: PropTypes.func // 鏁版嵁鍙樺寲 @@ -383,6 +384,35 @@ } } + handleEmpty = (e) => { + e.stopPropagation() + const { linkSubFields, module } = this.props + const { dataSource } = this.state + + if (dataSource.filter(item => item.Value === '').length > 0) { + message.warning('Value涓虹┖宸插瓨鍦紒') + return + } + const newData = { + key: Utils.getuuid(), + Value: '', + Text: module === 'form' ? '绌�' : '鍏ㄩ儴', + ParentID: '' + } + + linkSubFields.forEach(m => { + newData[m] = newData[m] || '' + }) + + let _data = [newData, ...dataSource] + + this.setState({ + dataSource: _data, + }, () => { + this.props.onChange(_data) + }) + } + resetColumn = (type, linkSubFields) => { const { columns, dataSource } = this.getColumns(type, linkSubFields, this.state.dataSource) @@ -407,6 +437,7 @@ } render() { + const { module } = this.props const { dataSource } = this.state const components = { body: { @@ -432,6 +463,7 @@ }) return ( <div className="common-modal-edit-table"> + <span className="add-row add-row-empty" onClick={this.handleEmpty}>{module === 'form' ? '绌�' : '鍏ㄩ儴'}</span> <PlusOutlined className="add-row" onClick={this.handleAdd} /> <Table components={components} -- Gitblit v1.8.0