From ff085919d436c198b0810ce8c1befddf219aba89 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 22 八月 2023 16:09:34 +0800
Subject: [PATCH] Merge branch 'master' of ssh://139.186.142.91:29418/productDev/dmMes

---
 screen_standard/src/views/process.vue |  110 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 77 insertions(+), 33 deletions(-)

diff --git a/screen_standard/src/views/process.vue b/screen_standard/src/views/process.vue
index 88ae7a3..0522071 100644
--- a/screen_standard/src/views/process.vue
+++ b/screen_standard/src/views/process.vue
@@ -40,7 +40,7 @@
                   <span>{{ item.userName }}</span>
                 </div>
                 <div class="content_left_item1_content_row_line">
-                  <el-progress :show-text="false" :percentage="item.doneNum/baseNum">
+                  <el-progress :show-text="false" :percentage="item.doneNum / baseNum">
                   </el-progress>
                 </div>
                 <div class="content_left_item1_content_row_num">{{ item.doneNum }}</div>
@@ -55,7 +55,7 @@
                   <span>{{ item.userName }}</span>
                 </div>
                 <div class="content_left_item1_content_row_line">
-                  <el-progress :show-text="false" :percentage="item.doneNum/baseNum">
+                  <el-progress :show-text="false" :percentage="item.doneNum / baseNum">
                   </el-progress>
                 </div>
                 <div class="content_left_item1_content_row_num">{{ item.doneNum }}</div>
@@ -99,7 +99,13 @@
         <div class="header-title">杩�7澶╀笉鑹搧鍒嗗竷</div>
         <div class="bad-content">
           <div id="day-distribution"></div>
-          <div id="type-distribution"></div>
+          <div class="pie">
+            <div class="content_right_top_nr_bottom_yuan">
+              <span>{{ allBad }}</span>
+              <span>涓嶈壇椤瑰垎甯�</span>
+            </div>
+            <div id="type-distribution"></div>
+          </div>
         </div>
       </div>
     </div>
@@ -107,8 +113,8 @@
 </template>
 
 <script setup>
-import { reactive, ref, toRefs, onMounted, onBeforeUnmount, onUnmounted, nextTick } from 'vue'
-import { getProcedurePlanData, getTop, getProcedurePlansList, getRecordLogPage } from '@/utils/api.js'
+import { reactive, ref, toRefs, onMounted, onBeforeUnmount, onUnmounted } from 'vue'
+import { getProcedurePlanData, getTop, getProcedurePlansList, getRecordLogPage, getUnqualified7DayData, getUnqualifiedCateData } from '@/utils/api.js'
 import { useCounterStore } from '@/stores/counter.js'
 import { useRoute } from 'vue-router'
 import * as echarts from 'echarts'
@@ -124,25 +130,18 @@
   top1: [],
   top2: [],
   baseNum: 0,
-  dayDistribution: [
-    { date: '8/1', num: '20' },
-    { date: '8/2', num: '10' },
-    { date: '8/3', num: '20' },
-    { date: '8/4', num: '40' },
-    { date: '8/5', num: '30' },
-    { date: '8/6', num: '10' },
-    { date: '8/7', num: '20' },
-  ],
+  allBad: 0,
+  dayDistribution: [],
   typeDistribution: [
-    { name: '澶栬涓嶈壇', num: 15 },
-    { name: '鏈夋瘺鍒�', num: 12 },
-    { name: '灏哄涓嶈壇', num: 22 },
-    { name: '鏈夊垝鐥�', num: 5 },
-    { name: '鍏朵粬', num: 2 },
+    { categoryName: '澶栬涓嶈壇', unqualifiedNum: 15 },
+    { categoryName: '鏈夋瘺鍒�', unqualifiedNum: 12 },
+    { categoryName: '灏哄涓嶈壇', unqualifiedNum: 22 },
+    { categoryName: '鏈夊垝鐥�', unqualifiedNum: 5 },
+    { categoryName: '鍏朵粬', unqualifiedNum: 2 },
   ]
 })
 
-let { listData, top1, top2, baseNum } = toRefs(data)
+let { listData, top1, top2, baseNum, allBad } = toRefs(data)
 
 // start()
 onBeforeUnmount(() => {
@@ -151,12 +150,6 @@
 })
 onMounted(() => {
   initData()
-  nextTick(() => {
-    start()
-    reportStart()
-    setDayChart()
-    setTypeChart()
-  })
 })
 
 
@@ -196,11 +189,24 @@
   getProcedurePlansList(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId })
     .then(res => {
       data.listData = res
+      start()
     })
   // 鎶ュ伐鏃ュ織鍒嗛〉鏌ヨ 
   getRecordLogPage(enterprise.companyId, enterprise.departId, { capacity: 9999, page: 1, model: { procedureId: route.query.procedureId } })
     .then(res => {
       data.reportListData = res.records
+      reportStart()
+    })
+  getUnqualified7DayData(enterprise.companyId, enterprise.departId, route.query.procedureId)
+    .then(res => {
+      data.dayDistribution = res
+      setDayChart()
+    })
+  getUnqualifiedCateData(enterprise.companyId, enterprise.departId, route.query.procedureId)
+    .then(res => {
+      data.typeDistribution = res
+      data.allBad = res.reduce((accumulator, currentValue) => accumulator + currentValue.unqualifiedNum, 0)
+      setTypeChart()
     })
 }
 
@@ -235,7 +241,7 @@
     scrollDom = planContainer.value
   } else {
     // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔�
-    if (scrollDom.children.length <=10) {
+    if (scrollDom.children.length <= 10) {
       clearTimeout(planTimer.value)
       return
     }
@@ -295,8 +301,8 @@
   let numList = []
 
   data.dayDistribution.forEach(item => {
-    dateList.push(item.date)
-    numList.push(item.num)
+    dateList.push(item.createTime)
+    numList.push(item.unqualifiedNum)
   })
   let option;
   option = {
@@ -386,8 +392,8 @@
   let legendData = []
   let seriesData = []
   data.typeDistribution.forEach(item => {
-    legendData.push(item.name)
-    seriesData.push({name:item.name, value:item.num})
+    legendData.push(item.categoryName)
+    seriesData.push({ name: item.categoryName, value: item.unqualifiedNum })
   })
   let option = {
     legend: {
@@ -416,7 +422,7 @@
           show: false
         },
         label: {
-          formatter:'{dot| } {title|{b} {c}}\n\n{per|{d}%}',
+          formatter: '{dot| } {title|{b} {c}}\n\n{per|{d}%}',
           rich: {
             title: {
               color: '#fff'
@@ -599,9 +605,47 @@
           height: 190px;
         }
 
-        #type-distribution {
+        .pie {
           flex: 0.4;
+          position: relative;
+          #type-distribution {
+            width: 100%;
+            height: 100%;
+          } 
+          .content_right_top_nr_bottom_yuan {
+            position: absolute;
+            top: calc(50% - 50px);
+            left: calc(50% - 50px);;
+            z-index: 999;
+            width: 100px;
+            height: 100px;
+            border-radius: 50%;
+            border: 2px dashed #01D9FE;
+            display: flex;
+            flex-direction: column;
+            align-items: center;
+            justify-content: center;
+
+            span {
+              &:first-child {
+                font-size: 26px;
+                font-family: SourceHanSansSC-Medium, SourceHanSansSC;
+                font-weight: 500;
+                color: #FFFFFF;
+              }
+
+              &:last-child {
+                font-size: 13px;
+                font-family: SourceHanSansSC-Regular, SourceHanSansSC;
+                font-weight: 400;
+                color: rgba(255, 255, 255, 0.8);
+              }
+            }
+          }
+
+          
         }
+
       }
     }
   }

--
Gitblit v1.9.3