riku
2024-11-21 af5a8d80bca9b8c08543238a370ea3c70c8c59b1
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
  <el-space>
    <el-descriptions :column="3" size="small" border direction="vertical">
      <el-descriptions-item label="问题数">{{
        summary.proCount
      }}</el-descriptions-item>
      <el-descriptions-item label="整改数">{{
        summary.changeCount
      }}</el-descriptions-item>
      <el-descriptions-item label="整改率">{{
        summary.changePer
      }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions :column="8" size="small" border direction="vertical">
      <el-descriptions-item label="巡查点次">{{
        summary.total
      }}</el-descriptions-item>
      <el-descriptions-item label="问题未审核">{{
        summary.proUnCheck
      }}</el-descriptions-item>
      <el-descriptions-item label="部分审核">{{
        summary.proPartCheck
      }}</el-descriptions-item>
      <el-descriptions-item label="全部审核">{{
        summary.proAllCheck
      }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions :column="8" size="small" border direction="vertical">
      <el-descriptions-item label="未整改">{{
        summary.UnChange
      }}</el-descriptions-item>
      <el-descriptions-item label="整改未审核">{{
        summary.changeUnCheck
      }}</el-descriptions-item>
      <el-descriptions-item label="部分审核">{{
        summary.changePartCheck
      }}</el-descriptions-item>
      <el-descriptions-item label="全部审核">{{
        summary.changeAllCheck
      }}</el-descriptions-item>
    </el-descriptions>
  </el-space>
  <!-- <el-space>
    <el-tag v-for="(s, i) in summary" :key="i" :type="s.type" size="small">
      <el-icon v-if="s.icon" color="">
        <component :is="s.icon"></component>
      </el-icon>
      {{ s.name + ': ' + s.value }}
    </el-tag>
  </el-space> -->
</template>
<script>
export default {
  props: {
    subtasks: Array
  },
  computed: {
    //任务问题审核情况统计信息
    summary() {
      const _summary = {
        total: 0,
        proUnCheck: 0,
        proPartCheck: 0,
        proAllCheck: 0,
        UnChange: 0,
        changeUnCheck: 0,
        changePartCheck: 0,
        changeAllCheck: 0,
        proCount: 0,
        changeCount: 0,
        changePer: '0%'
      };
      this.subtasks.forEach((s) => {
        _summary.total++;
        _summary.proCount += s.data.proNum;
        _summary.changeCount += s.data.changeNum;
 
        // 问题审核情况
        if (s.data.proNum == 0) {
          _summary.proAllCheck++;
        } else if (s.data.proCheckedNum == 0) {
          _summary.proUnCheck++;
        } else if (s.data.proCheckedNum < s.data.proNum) {
          _summary.proPartCheck++;
        } else {
          _summary.proAllCheck++;
        }
 
        // 是否有未整改
        if (s.data.changeNum < s.data.proNum) {
          _summary.UnChange++;
        }
 
        // 整改审核情况
        if (s.data.proNum == 0) {
          _summary.changeAllCheck++;
        } else if (s.data.changeNum > 0) {
          if (s.data.changeCheckedNum == 0) {
            _summary.changeUnCheck++;
          } else if (s.data.changeCheckedNum < s.data.changeNum) {
            _summary.changePartCheck++;
          } else {
            _summary.changeAllCheck++;
          }
        }
      });
 
      if (_summary.proCount != 0) {
        _summary.changePer =
          Math.round((_summary.changeCount / _summary.proCount) * 1000) / 10 +
          '%';
      }
      // _summary.forEach((s, i) => {
      //   if (i > 0) {
      //     let per = Math.round((s.value / _summary[0].value) * 1000) / 10
      //     if (isNaN(per)) per = 0
      //     s.value = `${s.value}(${per}%)`
      //   }
      // })
 
      return _summary;
    }
  }
};
</script>
<style scoped>
:deep(.el-descriptions__cell) {
  padding: 0px 4px !important;
  /* font-size: 13px !important; */
}
</style>