From da7068bd48791cdee966c786ce0dfd46f6e03df9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 一月 2021 19:02:24 +0800 Subject: [PATCH] 2021-01-08 --- src/tabviews/subtable/index.jsx | 75 +++++++++++++++++++++---------------- 1 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 0652a25..dabe4b3 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -428,6 +428,9 @@ }) } item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$BID = _BID || '' + return item }), total: result.total, @@ -489,6 +492,9 @@ data = data.map(item => { if (item[setting.primaryKey] === _data[setting.primaryKey]) { _data.key = item.key + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' + return _data } else { return item @@ -642,31 +648,6 @@ } /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (position, btn) => { - const { Tab, SupMenuID, BID } = this.props - - if (position === 'grid' || position === 'view') { - this.reloadtable(btn) - } else if (position === 'maingrid' || position === 'mainline') { - this.reloadtable(btn) - if (Tab.supMenu === 'mainTable') { - MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 涓昏〃閲嶇疆 - } else if (Tab.supMenu) { - MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 涓昏〃閲嶇疆 - } else if (!Tab.supMenu && Tab.level === 0) { - MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 鏍戝舰缁撴瀯锛�0绾ф爣绛� - } - } else if (position === 'equaltab') { - this.reloadtable(btn) - if (Tab.equalTab && Tab.equalTab.length > 0) { - MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 鍚岀骇鏍囩閲嶇疆 - } - } - } - - /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ getexceloutparam = (menuId, btnId) => { @@ -720,7 +701,7 @@ this.setState({chartId: uuid}) } - reloadData = (menuId, id) => { + reloadData = (menuId, id) => { // Id瀛樺湪鏃讹紝鍒锋柊琛� const { MenuID } = this.props if (menuId.indexOf(MenuID) === -1) return @@ -730,6 +711,38 @@ this.reloadtable() } else { this.loadmainLinedata(id) + } + } + + /** + * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� + * @param {*} menuId // 鑿滃崟Id + * @param {*} position // 鍒锋柊浣嶇疆 + * @param {*} btn // 鎵ц鐨勬寜閽� + */ + refreshByButtonResult = (menuId, position, btn) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + + const { Tab, SupMenuID, BID } = this.props + + if (position === 'grid' || position === 'view') { + this.reloadtable(btn) + } else if (position === 'maingrid' || position === 'mainline') { + this.reloadtable(btn) + if (Tab.supMenu === 'mainTable') { + MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 涓昏〃閲嶇疆 + } else if (Tab.supMenu) { + MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 涓昏〃閲嶇疆 + } else if (!Tab.supMenu && Tab.level === 0) { + MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 鏍戝舰缁撴瀯锛�0绾ф爣绛� + } + } else if (position === 'equaltab') { + this.reloadtable(btn) + if (Tab.equalTab && Tab.equalTab.length > 0) { + MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 鍚岀骇鏍囩閲嶇疆 + } } } @@ -745,6 +758,7 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -756,6 +770,7 @@ } MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } render() { @@ -790,7 +805,6 @@ BData={this.props.BData} MenuID={this.props.MenuID} selectedData={selectedData} - refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} /> </div> @@ -804,18 +818,16 @@ setting={setting} columns={columns} pageSize={pageSize} - BID={this.props.BID} dict={this.state.dict} data={this.state.data} BData={this.props.BData} total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} - refreshdata={this.refreshbytable} statFValue={this.state.statFValue} - handleTableId={this.handleTableId} ContainerId={this.props.ContainerId} - refreshbyaction={this.refreshbyaction} + refreshdata={this.refreshbytable} + handleTableId={this.handleTableId} chgSelectData={this.changeSelectedData} /> </div> @@ -835,7 +847,6 @@ MenuID={this.props.MenuID} loading={this.state.loading} tableId={this.props.Tab.uuid} - refreshdata={this.refreshbyaction} handleTableId={this.handleTableId} /> </Col> -- Gitblit v1.8.0