riku
2025-06-09 38ff09bd2a638bc43a365efe0390cc3510d62e68
src/views/management/TaskStats.vue
@@ -1,7 +1,9 @@
<template>
  <BaseCard>
    <div>任务监控</div>
    <el-scrollbar ref="scrollbarRef" :height="height">
  <BaseCard title="任务监控">
    <!-- <template #expand> -->
    <!-- <SupervisionVisual></SupervisionVisual> -->
    <!-- </template> -->
    <el-scrollbar ref="scrollbarRef">
      <!-- <el-row justify="space-evenly">
        <el-statistic title="今日完成" :value="10"> </el-statistic>
        <el-statistic title="本周完成" :value="10"> </el-statistic>
@@ -25,8 +27,11 @@
<script setup>
import { inject, ref, onMounted, computed } from 'vue'
import { unCalc } from '@/utils/css-util'
import SelfInspection from '@/views/inspection/SelfInspection.vue'
import JointEnforcement from '@/views/inspection/JointEnforcement.vue'
import SupervisionVisual from '@/views/visualization/SupervisionVisual.vue'
import { useSubtaskStore } from '@/stores/subtask.js'
/**
@@ -39,21 +44,31 @@
const tasks = ref([])
const sceneTaskMap = ref(new Map())
function onGetTaskInfo(tInfo) {
function onGetTaskInfo(tInfoList) {
  const resList = []
  sceneTaskMap.value.clear()
  const total = tInfo.totaltask
  tInfo.subTaskSummary.forEach((s) => {
    if (!sceneTaskMap.value.has(s.scene.type)) {
      sceneTaskMap.value.set(s.scene.type, {
        sceneType: s.scene.type,
        total: total,
        finish: 0
  tInfoList.forEach((tInfo) => {
    const _sceneTaskMap = new Map()
    for (const key in tInfo.totaltaskByScene) {
      const e = tInfo.totaltaskByScene[key]
      _sceneTaskMap.set(key, {
        sceneType: key,
        total: e,
        finish: tInfo.completetaskByScene[key] ? tInfo.completetaskByScene[key] : 0
      })
    }
    const st = sceneTaskMap.value.get(s.scene.type)
    st.finish++
  })
    // const total = tInfo.totaltask
    // tInfo.subTaskSummary.forEach((s) => {
    //   if (!_sceneTaskMap.has(s.scene.type)) {
    //     _sceneTaskMap.set(s.scene.type, {
    //       sceneType: s.scene.type,
    //       total: total,
    //       finish: 0
    //     })
    //   }
    //   const st = _sceneTaskMap.get(s.scene.type)
    //   st.finish++
    // })
  const task = {
    name: tInfo.name,
@@ -64,16 +79,18 @@
    count: []
  }
  for (const key of sceneTaskMap.value.keys()) {
    const value = sceneTaskMap.value.get(key)
    for (const key of _sceneTaskMap.keys()) {
      const value = _sceneTaskMap.get(key)
    task.count.push(value)
  }
  resList.push(task)
  })
  tasks.value = resList
}
function cal() {
  subtaskStore.getTaskInfo(onGetTaskInfo)
  subtaskStore.onAllTaskRefreshed(onGetTaskInfo)
}
onMounted(() => {