From 5f303821bd4052317db4b3e71342fb300ce5c3c9 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 22 八月 2023 10:56:01 +0800
Subject: [PATCH] 大屏

---
 screen_standard/src/App.vue           |   11 ++++++++++-
 screen_standard/src/stores/counter.js |   19 ++++++++++++++-----
 screen_standard/src/views/index.vue   |   17 +++++++++++------
 3 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/screen_standard/src/App.vue b/screen_standard/src/App.vue
index 043ed5b..117e1ba 100644
--- a/screen_standard/src/App.vue
+++ b/screen_standard/src/App.vue
@@ -1,6 +1,15 @@
 <script setup>
-
 import AppLayout from './components/AppLayout.vue'
+import { useCounterStore } from '@/stores/counter.js'
+import { useRoute } from 'vue-router'
+
+const enterprise = useCounterStore()
+const route = useRoute()
+
+console.log(route.query)
+
+// enterprise.setCompanyId(8)
+// enterprise.setDepartId(111)
 </script>
 
 <template>
diff --git a/screen_standard/src/stores/counter.js b/screen_standard/src/stores/counter.js
index 42f01ba..d4b3256 100644
--- a/screen_standard/src/stores/counter.js
+++ b/screen_standard/src/stores/counter.js
@@ -2,14 +2,23 @@
 import { defineStore } from 'pinia';
 
 export const useCounterStore = defineStore('enterprise', {
+
   state: () => {
-    return { count: 0 }
+    // 678
+    return { companyId: '8', departId: '132' };
   },
-  // 涔熷彲浠ュ畾涔変负
-  // state: () => ({ count: 0 })
+
   actions: {
-    increment() {
-      this.count++
+    // 璁剧疆浼佷笟id
+    setCompanyId(companyId) {
+      this.companyId = companyId;
+      window.sessionStorage.setItem('companyId', companyId);
     },
+    // 璁剧疆缁勭粐id
+    setDepartId(departId) {
+      this.departId = departId;
+      window.sessionStorage.setItem('departId', departId);
+    }
   }
+
 })
diff --git a/screen_standard/src/views/index.vue b/screen_standard/src/views/index.vue
index 7c4172d..122010e 100644
--- a/screen_standard/src/views/index.vue
+++ b/screen_standard/src/views/index.vue
@@ -185,7 +185,7 @@
 </template>
 
 <script setup>
-    import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted, nextTick } from 'vue'
+    import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted, nextTick, computed } from 'vue'
     import { getTop } from '@/utils/api.js'
     import { useCounterStore } from '@/stores/counter.js'
 
@@ -218,7 +218,12 @@
 
     const enterprise = useCounterStore()
 
-    console.log(enterprise.count++)
+    const companyId = computed(() => {
+        return enterprise.companyId
+    })
+    const departId = computed(() => {
+        return enterprise.departId
+    })
 
     start()
     start1()
@@ -244,10 +249,10 @@
     
     onMounted(()=> {
         // getSensorData()
-        getTop(8, 36)
-            .then(res => {
-                console.log(res)
-            })
+        // getTop(8, 36)
+        //     .then(res => {
+        //         console.log(res)
+        //     })
     })
 
     onBeforeUnmount(()=>{

--
Gitblit v1.9.3