|
|
|
@ -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<countObj>() |
|
|
|
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) { |
|
|
|
<!-- 统计量点击跳转历史曲线 --> |
|
|
|
<template #history="{ record }"> |
|
|
|
<a @click="handleHistory(record)"> |
|
|
|
{{(JSON.parse(record.instantInfo)).model_state}} |
|
|
|
{{record.pointSte}} |
|
|
|
</a> |
|
|
|
<!-- <SlidersOutlined class="click-status" /> --> |
|
|
|
<SlidersOutlined class="click-status" /> |
|
|
|
</template> |
|
|
|
<template #toolbar> |
|
|
|
<span class="runningStatus" @click="getTableData('all')"> |
|
|
|
|