Browse Source

fix:实例列表增加读取实时值

pull/113/head
肖晋飞 2 weeks ago
parent
commit
2c9b8936f3
  1. 35
      src/views/run/instant/index.vue

35
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<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')">

Loading…
Cancel
Save