From c51f5e007a3e03c9d6731ab7f28f0080de009990 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 17 十一月 2021 18:38:32 +0800 Subject: [PATCH] 2021-11-17 --- src/tabviews/custom/components/table/normal-table/index.jsx | 41 +++++++++++++++++++++++------------------ 1 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index bfe5644..2f53d2c 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -56,7 +56,7 @@ * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 */ UNSAFE_componentWillMount () { - const { data, initdata, BID } = this.props + const { data, initdata, BID, BData } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let _data = null @@ -80,11 +80,12 @@ item.key = index item.$$uuid = item[_config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' item.$Index = index + 1 + '' return item }) - if (setting.selected !== 'false') { + if (setting.selected !== 'false' && _data && _data.length > 0) { setTimeout(() => { MKEmitter.emit('mkCheckTopLine', _config.uuid) }, 200) @@ -123,7 +124,9 @@ } this.setState({ + pageSize: setting.pageSize || 10, BID: BID || '', + BData: BData || '', title: _config.wrap.title, sync: _sync, data: _data, @@ -191,7 +194,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (setting.selected !== 'false') { + if (setting.selected !== 'false' && result.data && result.data.length > 0) { setTimeout(() => { MKEmitter.emit('mkCheckTopLine', config.uuid) }, 200) @@ -200,6 +203,9 @@ } } else { MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲 + if (setting.$hasSyncModule) { + MKEmitter.emit('syncBalconyData', config.uuid, [], false) + } } reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆 @@ -222,9 +228,6 @@ total: result.total, loading: false }) - if (setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', config.uuid, [], false) - } } else { this.setState({ loading: false @@ -483,7 +486,7 @@ const { setting } = this.state if (!setting.supModule || setting.supModule !== MenuID) return - if (id !== this.state.BID) { + if (id !== this.state.BID || id !== '') { this.setState({ pageIndex: 1, BID: id, @@ -501,12 +504,16 @@ * @param {*} position // 鍒锋柊浣嶇疆 * @param {*} btn // 鎵ц鐨勬寜閽� */ - refreshByButtonResult = (menuId, position, btn) => { + refreshByButtonResult = (menuId, position, btn, id, lines) => { const { config, BID } = this.state if (config.uuid !== menuId) return - this.reloadtable(btn) // 鏁版嵁鍒锋柊 + if (position === 'line' && lines && lines.length === 1) { + this.loadmainLinedata(lines[0].$$uuid) + } else { + this.reloadtable(btn) // 鏁版嵁鍒锋柊 + } if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { MKEmitter.emit('reloadData', btn.syncComponentId) // 鍚岀骇鏍囩鍒锋柊 @@ -521,7 +528,7 @@ } UNSAFE_componentWillReceiveProps(nextProps) { - const { sync, config, setting, BID } = this.state + const { sync, config, setting, BID, BData } = this.state if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { let _data = [] @@ -531,11 +538,12 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' item.$Index = index + 1 + '' return item }) - if (setting.selected !== 'false') { + if (setting.selected !== 'false' && _data && _data.length > 0) { setTimeout(() => { MKEmitter.emit('mkCheckTopLine', config.uuid) }, 200) @@ -578,7 +586,7 @@ } render() { - const { BID, setting, searchlist, actions, config, columns, selectedData } = this.state + const { BID, setting, searchlist, actions, config, columns, selectedData, BData } = this.state return ( <div className="custom-normal-table" style={config.style}> @@ -591,7 +599,7 @@ BID={BID} setting={setting} actions={actions} - BData={this.state.BData} + BData={BData} columns={config.columns} selectedData={selectedData} /> @@ -620,7 +628,7 @@ BID={BID} setting={setting} actions={actions} - BData={this.state.BData} + BData={BData} columns={config.columns} selectedData={selectedData} /> @@ -647,10 +655,7 @@ const mapStateToProps = (state) => { return { - menuType: state.editLevel, - tabviews: state.tabviews, - permAction: state.permAction, - permMenus: state.permMenus + menuType: state.editLevel } } -- Gitblit v1.8.0