riku
2024-09-11 89ab2ec7f8790c5cc184de98682af032c69c2afc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
  <BaseCard>
    <div>任务监控</div>
    <el-scrollbar ref="scrollbarRef" :height="height">
      <!-- <el-row justify="space-evenly">
        <el-statistic title="今日完成" :value="10"> </el-statistic>
        <el-statistic title="本周完成" :value="10"> </el-statistic>
      </el-row> -->
      <!-- <el-row> -->
      <TaskItem v-for="item in tasks" :key="item.guid" v-bind="item"></TaskItem>
      <!-- </el-row> -->
 
      <!-- <el-row>
      <el-col :span="12">
        <SelfInspection></SelfInspection>
      </el-col>
      <el-col :span="12">
        <JointEnforcement></JointEnforcement>
      </el-col>
    </el-row> -->
    </el-scrollbar>
  </BaseCard>
</template>
 
<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 { useSubtaskStore } from '@/stores/subtask.js'
 
/**
 * 任务完成情况
 */
const excludeMapHeight = inject('excludeMapHeight')
const height = ref(`calc(${unCalc(excludeMapHeight)} - 36px)`)
 
const subtaskStore = useSubtaskStore()
const tasks = ref([])
const sceneTaskMap = ref(new Map())
 
function onGetTaskInfo(tInfo) {
  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
      })
    }
    const st = sceneTaskMap.value.get(s.scene.type)
    st.finish++
  })
 
  const task = {
    name: tInfo.name,
    province: tInfo.provinceName,
    district: tInfo.districtName,
    totaltask: tInfo.totaltask,
    completetask: tInfo.completetask,
    count: []
  }
 
  for (const key of sceneTaskMap.value.keys()) {
    const value = sceneTaskMap.value.get(key)
    task.count.push(value)
  }
  resList.push(task)
  tasks.value = resList
}
 
function cal() {
  subtaskStore.getTaskInfo(onGetTaskInfo)
}
 
onMounted(() => {
  cal()
})
</script>
 
<style scoped>
.text {
  background-color: aliceblue;
}
</style>