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

---
 screen_standard/src/views/index.vue |   68 ++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/screen_standard/src/views/index.vue b/screen_standard/src/views/index.vue
index 369bc45..33718ac 100644
--- a/screen_standard/src/views/index.vue
+++ b/screen_standard/src/views/index.vue
@@ -7,18 +7,18 @@
                     <span>褰撴棩鍛樺伐浜ч噺TOP10</span>
                 </div>
                 <div class="content_left_item1_content">
-                    <div class="content_left_item1_content_row" v-for="(item, index) in 10" :key="index">
+                    <div class="content_left_item1_content_row" v-for="(item, index) in data.production" :key="index">
                         <div class="content_left_item1_content_row_name">
                             <div :class="index > 2 ? 'num bg1' : 'num bg2'">{{ index + 1 }}</div>
-                            <span>璧电珛{{ index }}</span>
+                            <span>{{item.userName}}</span>
                         </div>
                         <div class="content_left_item1_content_row_line">
                             <el-progress
                                 :show-text="false"
-                                :percentage="50">
+                                :percentage="item.doneNum">
                             </el-progress>
                         </div>
-                        <div class="content_left_item1_content_row_num">342</div>
+                        <div class="content_left_item1_content_row_num">{{ item.doneNum }}</div>
                     </div>
                 </div>
             </div>
@@ -131,7 +131,7 @@
                     </div>
                     <div @mouseenter="handleMouseEnter3" @mouseleave="handleMouseLeave3" class="main_container">
                         <div ref="scrollContainer3" class="scroll_container">
-                            <div v-for="(item, index) in 15" :key="item.id" :class="index % 2 == 0 ? 'scroll_item scroll_item_bg1' : 'scroll_item scroll_item_bg2'">
+                            <div v-for="(item, index) in 6" :key="item.id" :class="index % 2 == 0 ? 'scroll_item scroll_item_bg1' : 'scroll_item scroll_item_bg2'">
                                 <div class="scroll_item_row">闊╀紵</div>
                                 <div class="scroll_item_row">鐢靛悏浠�</div>
                                 <div class="scroll_item_row">CP003</div>
@@ -185,7 +185,13 @@
 </template>
 
 <script setup>
-    import {reactive, ref, onMounted, onBeforeUnmount, onUnmounted, nextTick} from 'vue'
+    import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted, nextTick, computed } from 'vue'
+    import { getTop, getStockList } from '@/utils/api.js'
+    import { useCounterStore } from '@/stores/counter.js'
+
+    let data = reactive({
+        production: []
+    })
 
     let timer = ref(null)
     let timer1 = ref(null)
@@ -213,6 +219,16 @@
             activeBackground: 'tab_select@2x.png'
         }
     ])
+
+    const enterprise = useCounterStore()
+
+    const companyId = computed(() => {
+        return enterprise.companyId
+    })
+    const departId = computed(() => {
+        return enterprise.departId
+    })
+
     start()
     start1()
     // start2()
@@ -235,9 +251,21 @@
     //     })
     // }
     
-    // onMounted(()=> {
-    //     getSensorData()
-    // })
+    onMounted(()=> {
+        // getSensorData()
+        getTop(companyId.value, departId.value)
+            .then(res => {
+                console.log(res)
+                if (res.length > 0) {
+                    res.forEach((item, index) => {
+                        if (index > 1) {
+                            item.doneNum1 = res[0].doneNum / item.doneNum
+                        }
+                    })
+                    data.production = res
+                }
+            })
+    })
 
     onBeforeUnmount(()=>{
         clearTimeout(timer.value)
@@ -332,7 +360,7 @@
         clearTimeout(timer4.value)
         // 瀹氭椂鍣ㄨЕ鍙戝懆鏈�
         let speed4 = ref(25)
-        timer3.value = setInterval(ListScroll4, speed4.value)
+        timer4.value = setInterval(ListScroll4, speed4.value)
     }
     function ListScroll() {
         let scrollDom = scrollContainer.value
@@ -341,14 +369,14 @@
             scrollDom = scrollContainer.value
         }else {
             // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔�
-            if(scrollDom.children.length < 4) {
+            if(scrollDom.children.length < 8) {
                 clearTimeout(timer.value)
                 return
             }
             // 缁勪欢杩涜婊氬姩
             scrollDom.scrollTop += 1
             // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
-            if(scrollDom.scrollTop == (scrollDom.scrollHeight - scrollDom.clientHeight)) {
+            if(scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
                 // 鑾峰彇缁勪欢绗竴涓妭鐐�
                 let first = scrollDom.children[0]
                 // 鍒犻櫎鑺傜偣
@@ -372,7 +400,7 @@
             // 缁勪欢杩涜婊氬姩
             scrollDom.scrollTop += 1
             // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
-            if(scrollDom.scrollTop == (scrollDom.scrollHeight - scrollDom.clientHeight)) {
+            if(scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
                 // 鑾峰彇缁勪欢绗竴涓妭鐐�
                 let first = scrollDom.children[0]
                 // 鍒犻櫎鑺傜偣
@@ -396,7 +424,7 @@
             // 缁勪欢杩涜婊氬姩
             scrollDom.scrollTop += 1
             // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
-            if(scrollDom.scrollTop == (scrollDom.scrollHeight - scrollDom.clientHeight)) {
+            if(scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
                 // 鑾峰彇缁勪欢绗竴涓妭鐐�
                 let first = scrollDom.children[0]
                 // 鍒犻櫎鑺傜偣
@@ -413,14 +441,14 @@
             scrollDom = scrollContainer3.value
         }else {
             // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔�
-            if(scrollDom.children.length < 7) {
+            if(scrollDom.children.length < 6) {
                 clearTimeout(timer3.value)
                 return
             }
             // 缁勪欢杩涜婊氬姩
             scrollDom.scrollTop += 1
             // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
-            if(scrollDom.scrollTop == (scrollDom.scrollHeight - scrollDom.clientHeight)) {
+            if(scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
                 // 鑾峰彇缁勪欢绗竴涓妭鐐�
                 let first = scrollDom.children[0]
                 // 鍒犻櫎鑺傜偣
@@ -444,7 +472,7 @@
             // 缁勪欢杩涜婊氬姩
             scrollDom.scrollTop += 1
             // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
-            if(scrollDom.scrollTop == (scrollDom.scrollHeight - scrollDom.clientHeight)) {
+            if(scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
                 // 鑾峰彇缁勪欢绗竴涓妭鐐�
                 let first = scrollDom.children[0]
                 // 鍒犻櫎鑺傜偣
@@ -718,7 +746,7 @@
                             }
                             .scroll_item {
                                 width: 100%;
-                                height: 57px;
+                                height: 58px;
                                 display: flex;
                                 align-items: center;
                                 .scroll_item_row {
@@ -897,7 +925,7 @@
                     }
                     .main_container {
                         width: 100%;
-                        height: calc(100% - 34px);
+                        height: calc(100% - 33px);
                         .scroll_container {
                             width: 100%;
                             height: 100%;
@@ -910,7 +938,7 @@
                             }
                             .scroll_item {
                                 width: 100%;
-                                height: 36px;
+                                height: 37px;
                                 display: flex;
                                 align-items: center;
                                 .scroll_item_row {

--
Gitblit v1.9.3