From deab3ddf1990cd25b4692d1358ac9d50856644f0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 24 三月 2023 14:28:31 +0800 Subject: [PATCH] 2023-03-24 --- src/tabviews/custom/components/table/normal-table/index.jsx | 53 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index b4ec245..0dca1df 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -256,35 +256,44 @@ start = pageSize * (pageIndex - 1) + 1 } - this.setState({ - data: result.data.map((item, index) => { - item.key = index - item.$$uuid = item[setting.primaryKey] || '' - item.$$key = '' + item.key + item.$$uuid - item.$$BID = BID || '' - item.$$BData = BData || '' - item.$Index = start + index + '' + let data = result.data.map((item, index) => { + item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$key = '' + item.key + item.$$uuid + item.$$BID = BID || '' + item.$$BData = BData || '' + item.$Index = start + index + '' - if (config.absFields) { - config.absFields.forEach(f => { - if (!isNaN(item[f])) { - item[f] = Math.abs(item[f]) - } - }) - } - - if (setting.controlField) { - if (setting.controlVal.includes(item[setting.controlField])) { - item.$disabled = true + if (config.absFields) { + config.absFields.forEach(f => { + if (!isNaN(item[f])) { + item[f] = Math.abs(item[f]) } + }) + } + + if (setting.controlField) { + if (setting.controlVal.includes(item[setting.controlField])) { + item.$disabled = true } - - return item - }), + } + + return item + }) + + this.setState({ + data: data, selectedData: [], total: result.total, loading: false }) + + if (config.timer && config.clearField && result.data && result.data[0]) { + let vals = (config.clearValue || '').split(',') + if (vals.includes(result.data[0][config.clearField])) { + this.timer && this.timer.stop() + } + } } else { this.setState({ loading: false -- Gitblit v1.8.0