From 2c9b8936f391a545ba565d3ea1429548997237a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=96=E6=99=8B=E9=A3=9E?= <378266566@qq.com> Date: Tue, 30 Dec 2025 11:31:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=AE=9E=E4=BE=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BB=E5=8F=96=E5=AE=9E=E6=97=B6=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/run/instant/index.vue | 35 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/views/run/instant/index.vue b/src/views/run/instant/index.vue index e483859..f8d35ea 100644 --- a/src/views/run/instant/index.vue +++ b/src/views/run/instant/index.vue @@ -31,6 +31,18 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] rowKey: 'mpId', immediate: true, columns, + afterFetch: async (data) => { + // data 就是表格当前页的数据数组 + for (const row of data) { + // 解析获取点号 + const pointCode = (JSON.parse(row.instantInfo)).model_state + //读取实时值 + const realValue = await getExaNow(pointCode); + // 更新当前行 + updateTableDataRecord(row.mpId, Object.assign(row, { pointSte: realValue })) + + } + }, formConfig: { labelWidth: 80, schemas: searchSchema.value, @@ -100,10 +112,6 @@ interface countObj { const countData = ref() onMounted(async () => { countData.value = await getInstantCount() - console.log(countData.value) - const { setFieldsValue } = getForm() - await setFieldsValue({ system: null }) - getNow() }) async function getTableData(type) { const { getFieldsValue, setFieldsValue } = getForm() @@ -129,21 +137,6 @@ async function getTableData(type) { } reload() } -async function getNow() { - const params = getDataSource() - params.forEach((item: any) => { - const pointCode = (JSON.parse(item.instantInfo)).model_state - // 对数组中的每个元素执行异步操作 - getExaNow(pointCode).then((result) => { - updateTableDataRecord(item.id, Object.assign(item, { pointSte: result })) - }) - .catch((error) => { - console.error('Error:', error) - updateTableDataRecord(item.id, Object.assign(item, { pointSte: pointCode })) - }) - }) -} - function handleWarnConfig(record: Recordable) { router.push(`/run/instant/warn/config?mpId=${record.mpId}`) } @@ -168,9 +161,9 @@ function handleWarnConfig(record: Recordable) {