diff --git a/src/views/exa/config/index.vue b/src/views/exa/config/index.vue index 037cf23..de823ca 100644 --- a/src/views/exa/config/index.vue +++ b/src/views/exa/config/index.vue @@ -50,16 +50,21 @@ const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] dataIndex: 'action', fixed: 'right', }, + }) async function getNow() { - const params = getDataSource() - params.forEach((item: any) => { - // 对数组中的每个元素执行异步操作 - getExaNow(item.itemName).then((result) => { - updateTableDataRecord(item.serialNumber, Object.assign(item, { value: result })) - }) - }) + const list = getDataSource() + + await Promise.all( + list.map(async (item: any) => { + const result = await getExaNow(item.itemName) + + updateTableDataRecord(item.serialNumber, { + value: result, + }) + }), + ) } let timerId @@ -110,6 +115,11 @@ async function handleDelete(record: Recordable) {