From 31127ef63da3af7511a3b06eb2eaa87238f245da Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 05 三月 2024 10:07:44 +0800
Subject: [PATCH] 1.本地看板开发、发布

---
 src/views/kanbanManager/cj.vue |   96 +++++++++++++++++++++++++++++-------------------
 1 files changed, 58 insertions(+), 38 deletions(-)

diff --git a/src/views/kanbanManager/cj.vue b/src/views/kanbanManager/cj.vue
index d312daf..39484e1 100644
--- a/src/views/kanbanManager/cj.vue
+++ b/src/views/kanbanManager/cj.vue
@@ -6,11 +6,11 @@
 
       <div class="kb_header">
         <div class="kb_headTime" style="top: 35px;left:  20px">
-          <span>姘稿悍甯傚法绔嬮槻鎶ょ敤鍝佹湁闄愬叕鍙�</span>
+          <span>娴欐睙绫宠埅绉戞妧鏈夐檺鍏徃</span>
         </div>
 
-        <div class="kb_headTime kb_header_text" style="top: 35px;left:  765px">
-          <span>{{ title }}鏁板瓧鍖栫湅鏉�</span>
+        <div class="kb_headTime kb_header_text" style="top: 35px;left:  800px">
+          <span>瑁呴厤杞﹂棿鏁板瓧鍖栫湅鏉�</span>
         </div>
 
         <div class="kb_headTime" style="top: 35px;right:  25px">
@@ -186,11 +186,42 @@
     }, 1000 * 60 * 120)
   },
   mounted() {
+    // 鐩戝惉缃戠粶鏄惁鍦ㄧ嚎
+    window.addEventListener('online', this.updateOnlineStatus)
+    window.addEventListener('offline', this.updateOnlineStatus)
+    this.updateOnlineStatus({ type: this.onLine ? 'online' : 'offline', isFirst: true })
+
     this.getAllApi()
   },
+  beforeDestroy() {
+    window.removeEventListener('online', this.updateOnlineStatus)
+    window.removeEventListener('offline', this.updateOnlineStatus)
+  },
   methods: {
+    // 鏇存柊缃戠粶鐘舵��
+    updateOnlineStatus(e) {
+      if (e.isFirst) {
+        // console.log('x')
+      } else {
+        const loading = this.$loading({
+          lock: true,
+          text: '鏂綉浜嗭紝姝e湪鎷煎懡鑱旂綉涓紝璇锋鏌ョ綉缁滄槸鍚︽甯�...',
+          spinner: 'el-icon-loading',
+          customClass: 'osloading',
+          background: 'rgba(0, 0, 0, 0.7)'
+        })
+        const { type } = e
+        this.onLine = type === 'online'
+        if (this.onLine) {
+          loading.close()
+          this.$message.success('缃戠粶杩炴帴鎴愬姛锛�')
+        } else {
+          this.$message.error('缃戠粶鎺夌嚎锛岃鍏虫敞缃戠粶鐘舵�侊紒')
+        }
+      }
+    },
     async getWorkShopProduceTopData() {
-      WorkShopProduceTopData({ wkshopcode: this.wkshopcode.join(',') }).then(res => {
+      WorkShopProduceTopData().then(res => {
         this.tableDataCenterTop = res.data
 
         const divData = this.$refs.tableDataLeftCenterRef.bodyWrapper
@@ -199,7 +230,7 @@
           divData.scrollTop += 1
           if (divData.clientHeight + divData.scrollTop === divData.scrollHeight) {
             divData.scrollTop = 0
-            WorkShopProduceTopData({ wkshopcode: this.wkshopcode.join(',') }).then(res => {
+            WorkShopProduceTopData().then(res => {
               this.tableDataCenterTop = res.data
 
               if (this.tableDataCenterTop.length > 11) {
@@ -208,57 +239,46 @@
               }
             })
           }
-        }, this.tableDataCenterTop.length <= 11 ? 1000 * 15 : 200)
+        }, this.tableDataCenterTop.length <= 11 ? 1000 * 30 : 200)
       })
     },
 
     async getAllApi() {
-      const res = await PrentOrganizationNoCompany()
-      this.wkshopArr = res.data
+      // const res = await PrentOrganizationNoCompany()
+      // this.wkshopArr = res.data
 
-      if (window.location.hash.indexOf('?') !== -1) {
-        const code = window.location.hash.split('?')[1].split('=')[1]
-        this.title = this.wkshopArr.find(i => i.torg_code === code).torg_name
-        this.wkshopcode = [code]
-      }
+      // if (window.location.hash.indexOf('?') !== -1) {
+      //   const code = window.location.hash.split('?')[1].split('=')[1]
+      //   this.title = this.wkshopArr.find(i => i.torg_code === code).torg_name
+      //   this.wkshopcode = [code]
+      // }
+      //
+      // this.wkshopcode.forEach(i => {
+      //   const aa = this.wkshopArr.find(j => j.torg_code === i).torg_name
+      //   this.legendData.push(aa)
+      // })
 
-      this.wkshopcode.forEach(i => {
-        const aa = this.wkshopArr.find(j => j.torg_code === i).torg_name
-        this.legendData.push(aa)
-      })
+      const res4 = await WorkShopProduceBottomLeftData()
+      this.cjzl03_xData = res4.data.map(i => i.click_date)
+      this.cjzl03_yData = res4.data.map(i => i.count)
 
-      const res4 = await WorkShopProduceBottomLeftData({ wkshopcode: this.wkshopcode.join(',') })
-      this.cjzl03_xData = res4.data[this.wkshopcode[0]].map(i => i.click_date)
-      for (const res4Key in res4.data) {
-        if (this.wkshopcode.includes(res4Key)) {
-          const bb = res4.data[res4Key].map(i => i.count)
-          this.cjzl03_yData.push(bb)
-        }
-      }
       loadEcharts('cjzl03', cjzl03_2(this.cjzl03_xData, this.legendData, this.cjzl03_yData, true))
       setInterval(() => {
-        WorkShopProduceBottomLeftData({ wkshopcode: this.wkshopcode.join(',') }).then(res4 => {
-          this.cjzl03_yData = []
-
-          this.cjzl03_xData = res4.data[this.wkshopcode[0]].map(i => i.click_date)
-          for (const res4Key in res4.data) {
-            if (this.wkshopcode.includes(res4Key)) {
-              const bb = res4.data[res4Key].map(i => i.count)
-              this.cjzl03_yData.push(bb)
-            }
-          }
+        WorkShopProduceBottomLeftData().then(res4 => {
+          this.cjzl03_xData = res4.data.map(i => i.click_date)
+          this.cjzl03_yData = res4.data.map(i => i.count)
           loadEcharts('cjzl03', cjzl03_2(this.cjzl03_xData, this.legendData, this.cjzl03_yData, true))
         })
       }, 1000 * 50)
 
-      const res5 = await WorkShopProduceBottomRightData({ wkshopcode: 'CJ001' })
+      const res5 = await WorkShopProduceBottomRightData()
       this.RightBottom = res5.data
       if (this.RightBottom.length > 0) {
         loadEcharts('cjzl04', cjzl04(this.RightBottom.map(i => i.name), this.RightBottom.map(i => i.cont)))
       }
 
       setInterval(() => {
-        WorkShopProduceBottomRightData({ wkshopcode: 'CJ001' }).then(res5 => {
+        WorkShopProduceBottomRightData().then(res5 => {
           this.RightBottom = res5.data
           if (this.RightBottom.length > 0) {
             loadEcharts('cjzl04', cjzl04(this.RightBottom.map(i => i.name), this.RightBottom.map(i => i.cont)))
@@ -266,7 +286,7 @@
         })
       }, 1000 * 60)
 
-      this.getWorkShopProduceTopData()
+      await this.getWorkShopProduceTopData()
     },
 
     // 鑾峰彇褰撳墠鏃堕棿

--
Gitblit v1.9.3