From a30af31a33908dac49a42849cacf36e9903a37e5 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 22 八月 2023 16:09:21 +0800
Subject: [PATCH] 大屏

---
 screen_standard/src/views/index.vue |  180 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 96 insertions(+), 84 deletions(-)

diff --git a/screen_standard/src/views/index.vue b/screen_standard/src/views/index.vue
index 56c8016..ee207a7 100644
--- a/screen_standard/src/views/index.vue
+++ b/screen_standard/src/views/index.vue
@@ -75,12 +75,13 @@
                                     <el-tooltip
                                         v-for="(child, i) in item.procedureList" :key="i"
                                         effect="dark"
-                                        content="宸叉姤宸ヨ壇鍝佹暟1000锛涘伐搴忚鍒掓暟500"
+                                        :content="'宸叉姤宸ヨ壇鍝佹暟' + child.doneNum + '锛涘伐搴忚鍒掓暟' + child.planNum"
                                         placement="top">
                                         <div class="scroll_item_row_item" @click="jump(child.procedureId)">
                                             <div class="scroll_item_row_item_x"></div>
-                                            <img v-if="i == 0 || i == 1" src="@/assets/img/ic_complete@2x.png" alt="" />
-                                            <span v-else>{{ child.rate }}%</span>
+                                            <!-- <img v-if="i == 0 || i == 1" src="@/assets/img/ic_complete@2x.png" alt="" /> -->
+                                            <span v-if="child.rate < 100">{{ child.rate }}%</span>
+                                            <img v-else src="@/assets/img/ic_complete@2x.png" alt="" />
                                         </div>
                                     </el-tooltip>
                                 </div>
@@ -189,7 +190,7 @@
 </template>
 
 <script setup>
-    import { reactive, ref, onBeforeUnmount, onUnmounted, nextTick, computed, watch } from 'vue'
+    import { reactive, ref, onBeforeUnmount, onUnmounted, nextTick, computed, watch, onActivated } from 'vue'
     import { getTop, getStockList, getWorkPlansList, getProcedureProcessList, getRecordLogPage, getDeviceCheckPage, getUnqualified7DayData, getUnqualifiedCateData } from '@/utils/api.js'
     import { useCounterStore } from '@/stores/counter.js'
     import * as echarts from 'echarts'
@@ -251,88 +252,99 @@
 
     watch(() => departId.value, (val) => {
         if (val) {
-            // 褰撴棩鍛樺伐浜ч噺TOP10
-            getTop(companyId.value, departId.value)
-                .then(res => {
-                    if (res.length > 0) {
-                        res.forEach((item, index) => {
-                            if (index > 1) {
-                                item.doneNum1 = res[0].doneNum / item.doneNum
-                            }
-                        })
-                        data.production = res
-                    }
-                })
-            // 浠撳簱瀹炴椂浣欓噺缁熻
-            getStockList(companyId.value, departId.value)
-                .then(res => {
-                    data.marginStatistics = res
-                    nextTick(() => {
-                        start()
-                    })
-                })
-            // 鎴愬搧璁″垝杩涘害
-            getWorkPlansList(companyId.value, departId.value)
-                .then(res => {
-                    data.plannedProgress = res
-                    nextTick(() => {
-                        start1()
-                    })
-                })
-            // 鎶ュ伐鏃ュ織
-            getRecordLogPage(companyId.value, departId.value, {
-                capacity: 9999,
-                model: {},
-                page: 1
-            }).then(res => {
-                data.log = res.records
-                nextTick(() => {
-                    start3()
-                })
-            })
-            // 璁惧宸℃璁板綍
-            getDeviceCheckPage(companyId.value, departId.value, {
-                capacity: 9999,
-                model: {},
-                page: 1
-            }).then(res => {
-                data.patrolInspection = res.records
-                nextTick(() => {
-                    start4()
-                })
-            })
-            // 杩戜竷澶╀笉鑹暟
-            getUnqualified7DayData(companyId.value, departId.value, '')
-                .then(res => {
-                    if (res && res.length > 0) {
-                        data.dayDistribution = res.map(item => {
-                            return {
-                                date: item.createTime,
-                                num: item.unqualifiedNum
-                            }
-                        })
-                        setDayChart()
-                    }
-                })
-            // 杩戜竷澶╀笉鑹」
-            getUnqualifiedCateData(companyId.value, departId.value, '')
-                .then(res => {
-                    if (res && res.length > 0) {
-                        data.num = 0
-                        data.typeDistribution = res.map(item => {
-                            data.num += item.unqualifiedNum
-                            return {
-                                name: item.categoryName,
-                                num: item.unqualifiedNum
-                            }
-                        })
-                        setTypeChart()
-                    }
-                })
+            init()
         }
     })
 
+    onActivated(() => {
+        console.log('departId', departId.value)
+        if (!departId.value) return
+        init()
+        console.log('onActivated')
+    })
+
     start1()
+
+    const init = () => {
+        // 褰撴棩鍛樺伐浜ч噺TOP10
+        getTop(companyId.value, departId.value)
+            .then(res => {
+                if (res.length > 0) {
+                    res.forEach((item, index) => {
+                        if (index > 1) {
+                            item.doneNum1 = res[0].doneNum / item.doneNum
+                        }
+                    })
+                    data.production = res
+                }
+            })
+        // 浠撳簱瀹炴椂浣欓噺缁熻
+        getStockList(companyId.value, departId.value)
+            .then(res => {
+                data.marginStatistics = res
+                nextTick(() => {
+                    start()
+                })
+            })
+        // 鎴愬搧璁″垝杩涘害
+        getWorkPlansList(companyId.value, departId.value)
+            .then(res => {
+                data.plannedProgress = res
+                nextTick(() => {
+                    start1()
+                })
+            })
+        // 鎶ュ伐鏃ュ織
+        getRecordLogPage(companyId.value, departId.value, {
+            capacity: 9999,
+            model: {},
+            page: 1
+        }).then(res => {
+            data.log = res.records
+            nextTick(() => {
+                start3()
+            })
+        })
+        // 璁惧宸℃璁板綍
+        getDeviceCheckPage(companyId.value, departId.value, {
+            capacity: 9999,
+            model: {},
+            page: 1
+        }).then(res => {
+            data.patrolInspection = res.records
+            nextTick(() => {
+                start4()
+            })
+        })
+        // 杩戜竷澶╀笉鑹暟
+        getUnqualified7DayData(companyId.value, departId.value, '')
+            .then(res => {
+                if (res && res.length > 0) {
+                    data.dayDistribution = res.map(item => {
+                        return {
+                            date: item.createTime,
+                            num: item.unqualifiedNum
+                        }
+                    })
+                    setDayChart()
+                }
+            })
+        // 杩戜竷澶╀笉鑹」
+        getUnqualifiedCateData(companyId.value, departId.value, '')
+            .then(res => {
+                if (res && res.length > 0) {
+                    data.num = 0
+                    data.typeDistribution = res.map(item => {
+                        data.num += item.unqualifiedNum
+                        return {
+                            name: item.categoryName,
+                            num: item.unqualifiedNum
+                        }
+                    })
+                    setTypeChart()
+                }
+            })
+    }
 
     /**
      * 涓冩棩鎶樼嚎鍥�
@@ -1248,8 +1260,8 @@
                     position: relative;
                     .content_right_top_nr_bottom_yuan {
                         position: absolute;
-                        top: 299px;
-                        left: 168px;
+                        top: 63%;
+                        left: 37%;
                         z-index: 999;
                         width: 114px;
                         height: 114px;

--
Gitblit v1.9.3