From 28d65cf7ebfe0dd30ade6973e0634e1c8f663b63 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 十月 2020 16:12:20 +0800 Subject: [PATCH] 2020-10-28 --- src/tabviews/subtabtable/index.jsx | 47 ++++++++++++++--------------------------------- 1 files changed, 14 insertions(+), 33 deletions(-) diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index fddcf6d..094e150 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -15,6 +15,7 @@ import asyncSpinComponent from '@/utils/asyncSpinComponent' import SubSearch from '@/tabviews/zshare/topSearch' import NotFount from '@/components/404' +import MKEmitter from '@/utils/events.js' import './index.scss' @@ -51,14 +52,12 @@ setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� - resetTable: false, // 琛ㄦ牸閲嶇疆锛屽�煎湪true涓巉alse涔嬮棿鍒囨崲锛屽垏鎹㈡椂琛ㄦ牸閲嶇疆 total: 0, // 鎬绘暟 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� pageIndex: 1, // 椤电爜 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - triggerBtn: null, // 鎸夐挳瑙﹀彂 chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 statFValue: [] // 鍚堣鍊� @@ -357,6 +356,7 @@ return item }), total: result.total, + selectedData: [], loading: false }) } else { @@ -431,11 +431,10 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ pageIndex: 1, - search: searches, - selectedData: [], - resetTable: !this.state.resetTable + search: searches }, () => { this.loadmaindata() this.getStatFieldsValue() @@ -455,7 +454,6 @@ } this.setState({ - selectedData: [], pageIndex: pagination.current, pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' @@ -468,10 +466,9 @@ * @description 琛ㄦ牸鍒锋柊 */ reloadtable = () => { + MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid) // 鍒楄〃閲嶇疆 this.setState({ - pageIndex: 1, - selectedData: [], - resetTable: !this.state.resetTable + pageIndex: 1 }, () => { this.loadmaindata() this.getStatFieldsValue() @@ -490,8 +487,7 @@ */ reloadview = () => { this.setState({ loadingview: true, viewlost: false, lostmsg: '', config: null, searchlist: null, actions: null, columns: null, - arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '', - triggerBtn: null + arr_field: '', setting: null, data: null, total: 0, loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '' }, () => { this.loadconfig() }) @@ -510,20 +506,6 @@ } else if (position === 'trigger') { // 鏃ュ巻瀛愯〃瑙﹀彂鏍囩鐐瑰嚮浜嬩欢 this.props.closeModalView && this.props.closeModalView() } - } - - /** - * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� - */ - buttonTrigger = (btn, record) => { - this.setState({ - triggerBtn: { - uuid: new Date().getTime(), - parentId: this.props.SupMenuID, - button: btn, - data: record - } - }) } /** @@ -572,7 +554,7 @@ } render() { - const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, triggerBtn, chartId, selectedData } = this.state + const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, chartId, selectedData } = this.state return ( <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> @@ -603,7 +585,6 @@ {config.charts.length > 1 ? <p className="chart-table chart-title">{item.title}</p> : null} <div style={{minHeight: '25px'}}> <SubAction - triggerBtn={triggerBtn} setting={setting} actions={actions} BID={this.props.BID} @@ -612,26 +593,27 @@ selectedData={selectedData} MenuID={this.props.SupMenuID} logcolumns={this.state.logcolumns} - operations={config.gridBtn.operations || []} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} /> </div> <SubTable - tableId="" + tableId={this.props.Tab.uuid} config={config} setting={setting} columns={columns} pageSize={pageSize} + BID={this.props.BID} data={this.state.data} dict={this.state.dict} + BData={this.props.BData} total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} - statFValue={this.state.statFValue} refreshdata={this.refreshbytable} - buttonTrigger={this.buttonTrigger} - resetTable={this.state.resetTable} + logcolumns={this.state.logcolumns} + statFValue={this.state.statFValue} + refreshbyaction={this.refreshbyaction} chgSelectData={this.changeSelectedData} handleTableId={() => {}} /> @@ -649,7 +631,6 @@ data={this.state.data} loading={this.state.loading} logcolumns={this.state.logcolumns} - buttonTrigger={this.buttonTrigger} refreshdata={this.refreshbyaction} handleTableId={() => {}} /> -- Gitblit v1.8.0