From cdd5b449130ea4d7223fde4f414a11a7d0c33d6d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 三月 2024 17:52:16 +0800 Subject: [PATCH] 2024-03-07 --- src/tabviews/custom/components/table/normal-table/index.jsx | 69 ++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 136a42c..92c7018 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -199,6 +199,8 @@ } this.initExec() + + this.autoExec() } /** @@ -301,6 +303,25 @@ } } + autoExec = (times) => { + const { config } = this.state + + if (!config.wrap.autoExec) return + + let btn = document.getElementById('button' + config.wrap.autoExec) + + this.autoTimer && clearTimeout(this.autoTimer) + + if (btn) { + MKEmitter.emit('triggerBtnId', config.wrap.autoExec, []) + } else if (!times || times < 20) { + times = times ? times + 1 : 1 + this.autoTimer = setTimeout(() => { + this.autoExec(times) + }, 1000) + } + } + transferSyncData = (syncId) => { const { config } = this.state @@ -369,6 +390,7 @@ this.setState({ data: [], selectedData: [], + loading: false, total: 0 }) @@ -379,6 +401,7 @@ } this.loaded = true + this.requestId = '' return } @@ -406,8 +429,12 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) - let result = await Api.genericInterface(param) + this.requestId = config.uuid + new Date().getTime() + + let result = await Api.genericInterface(param, '', '', this.requestId) if (result.status) { + if (result.$requestId && this.requestId !== result.$requestId) return + this.loaded = true if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || [], BID) @@ -763,7 +790,9 @@ BID: id, BData: data }, () => { - this.loadmaindata(true, 'true') + if (!setting.checkBid) { + this.loadmaindata(true, 'true') + } }) } } @@ -835,7 +864,7 @@ } let content = <> - {config.search && config.search.length ? + {config.search.length ? <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null } {actions.length > 0 ? <MainAction @@ -845,24 +874,22 @@ BData={BData} columns={config.columns} selectedData={selectedData} - /> : <div className="mk-action-space" style={{height: '25px'}}></div>} - <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}> - <MainTable - setting={setting} - columns={columns} - MenuID={config.uuid} - allSearch={allSearch} - data={this.state.data} - fields={config.columns} - total={this.state.total} - colsCtrls={config.colsCtrls} - lineMarks={config.lineMarks} - loading={this.state.loading} - refreshdata={this.refreshbytable} - statFValue={this.state.statFValue} - chgSelectData={(selects) => this.setState({selectedData: selects})} - /> - </div> + /> : (setting.tableType || config.search.length > 0 ? <div className="mk-action-space" style={{height: '25px'}}></div> : null)} + <MainTable + setting={setting} + columns={columns} + MenuID={config.uuid} + allSearch={allSearch} + data={this.state.data} + fields={config.columns} + total={this.state.total} + colsCtrls={config.colsCtrls} + lineMarks={config.lineMarks} + loading={this.state.loading} + refreshdata={this.refreshbytable} + statFValue={this.state.statFValue} + chgSelectData={(selects) => this.setState({selectedData: selects})} + /> </> return ( -- Gitblit v1.8.0