Browse Source

fix: 任务状态更新修正

main
betaqi 1 day ago
parent
commit
44e4204b1f
  1. 5
      src/views/taskList/index.vue
  2. 4
      src/views/taskList/infoDrawer.vue

5
src/views/taskList/index.vue

@ -110,6 +110,7 @@ function onTaskFinish(id: string, status: 0 | 1 | 3) {
} }
function zmqTaskCb(msg: SubMsgData) { function zmqTaskCb(msg: SubMsgData) {
console.log('rootPage', msg)
const { feedback } = msg const { feedback } = msg
const taskId = feedback[0] const taskId = feedback[0]
const deviceSN = feedback[1] const deviceSN = feedback[1]
@ -131,10 +132,10 @@ function zmqTaskCb(msg: SubMsgData) {
onMounted(async () => { onMounted(async () => {
await getList() await getList()
worker.subscribe(getSubTopic('server', 'event', 'task'), zmqTaskCb) worker.subscribe(getSubTopic('server', 'event', 'task'), zmqTaskCb, 'rootPage')
}) })
onUnmounted(() => { onUnmounted(() => {
worker.unsubscribe(getSubTopic('server', 'event', 'task')) worker.unsubscribe(getSubTopic('server', 'event', 'task'), 'rootPage')
}) })
</script> </script>

4
src/views/taskList/infoDrawer.vue

@ -7,7 +7,7 @@
<template v-for="detail in detailList"> <template v-for="detail in detailList">
<el-descriptions border :title="`${detail.sn}任务详情`" style="margin-top: 20px"> <el-descriptions border :title="`${detail.sn}任务详情`" style="margin-top: 20px">
<el-descriptions-item :label-width="60" label="状态"> <el-descriptions-item :label-width="60" label="状态">
<el-tag size="small" :type="statusTypeMap[detail.status]" >{{ <el-tag size="small" :type="statusTypeMap[detail.status]">{{
statusList.find(r => r.value === statusList.find(r => r.value ===
detail.status)?.label || '--' detail.status)?.label || '--'
}} }}
@ -73,6 +73,7 @@ async function open(row: TaskList) {
worker.subscribe(getSubTopic('server', 'event', 'task'), zmqTaskCb) worker.subscribe(getSubTopic('server', 'event', 'task'), zmqTaskCb)
} }
function zmqTaskCb(msg: SubMsgData) { function zmqTaskCb(msg: SubMsgData) {
console.log('info', msg)
const { feedback } = msg const { feedback } = msg
const taskId = feedback[0] const taskId = feedback[0]
const deviceSN = feedback[1] const deviceSN = feedback[1]
@ -90,6 +91,7 @@ function zmqTaskCb(msg: SubMsgData) {
function handleBeforeClose(done: () => void) { function handleBeforeClose(done: () => void) {
isShowDrawer.value = false isShowDrawer.value = false
currentTaskId.value = '' currentTaskId.value = ''
worker.unsubscribe(getSubTopic('server', 'event', 'task'))
done() done()
} }

Loading…
Cancel
Save