From 75caf8524a5934b16176764f8d56d77d11cd4d2c Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 04 Dec 2023 15:55:03 +0800
Subject: [PATCH] 校区切换处理---接口传参

---
 src/pcviews/orgnav/directly.vue        |   15 ++++
 src/pcviews/orgnav/ofc.vue             |    9 ++-
 src/components/arcNavBar/index.vue     |   57 +++++++++++++-----
 src/pcviews/orgnav/rest.vue            |    5 +
 src/components/leftNav/index.vue       |   19 ++----
 src/components/map/index.vue           |    4 +
 src/components/serviceNavBar/index.vue |   38 +++++++-----
 src/pcviews/orgnav/masses.vue          |    9 ++-
 src/pcviews/orgnav/teaching.vue        |    5 +
 9 files changed, 107 insertions(+), 54 deletions(-)

diff --git a/src/components/arcNavBar/index.vue b/src/components/arcNavBar/index.vue
index 59e970b..cf41d18 100644
--- a/src/components/arcNavBar/index.vue
+++ b/src/components/arcNavBar/index.vue
@@ -8,12 +8,12 @@
             <img class="close deblurring" :src="publicPath + 'img/navicon/close.png'" alt @click="closeModel" />
         </template>
         <template slot="public-box-content">
-            <div class="tab" v-show="false">
+            <!-- <div class="tab">
                 <ul>
                     <li :class="{ on: item.flag }" v-for="(item, index) in titleList" :key="index"
                         @click="topNavClick(item, index)">{{ item.title }}</li>
                 </ul>
-            </div>
+            </div> -->
             <ul>
                 <li v-for="(item, index) in itemNavList" :key="index" @click="mapPopup(item)">
                     <img :src="item.icon" alt />
@@ -39,6 +39,7 @@
 import { Icon, Style, Fill, Text, Stroke } from 'ol/style.js'
 
 let currentOrgLayer = null
+let time
 
 export default {
     name: 'ArcNavBar',
@@ -50,7 +51,11 @@
             titleList: []
         }
     },
+
+    inject: ["layoutElement"],
+
     props: {},
+
     computed: {
         ...mapGetters([
             'popupBgUrl',
@@ -70,8 +75,10 @@
             'twoOrThree'
         ])
     },
+
     created () {
     },
+
     mounted () {
         this.$nextTick(() => {
             currentOrgLayer = new VectorLayer({
@@ -82,27 +89,36 @@
             this.map2D.addLayer(currentOrgLayer)
         })
     },
+
     watch: {
         arcNavBarCode: {
             immediate: true,
             handler (newCode, oldCode) {
-                this.titleList = []
-                getList().then((res) => {
-                    res.data.data.forEach((item) => {
-                        this.titleList.push({
-                            title: item.dictValue,
-                            flag: false,
-                            key: item.dictKey
-                        })
-                    })
+                // this.titleList = []
+                // getList().then((res) => {
+                //     res.data.data.forEach((item) => {
+                //         this.titleList.push({
+                //             title: item.dictValue,
+                //             flag: false,
+                //             key: item.dictKey
+                //         })
+                //     })
 
-                    this.titleList[0].flag = true
+                //     this.titleList[0].flag = true
 
-                    this.getChilsNavs(this.titleList[0].key)
-                })
+
+                // })
+
+                time = setInterval(() => {
+                    if (this.layoutElement.campusValue) {
+                        this.getChilsNavs(this.layoutElement.campusValue)
+                        clearInterval(time)
+                    }
+                }, 100)
             }
-        }
+        },
     },
+
     methods: {
 
         coordinate (item) {
@@ -129,7 +145,16 @@
 
             this.itemNavList = []
 
-            currentOrgLayer.getSource().clear()
+            if (currentOrgLayer) {
+                currentOrgLayer.getSource().clear()
+            } else {
+                currentOrgLayer = new VectorLayer({
+                    // 图标图层
+                    zIndex: 9,
+                    source: new VectorSource(),
+                })
+                this.map2D.addLayer(currentOrgLayer)
+            }
 
             getChildNavList({ campus: campus, type: this.arcNavBarCode }).then(
                 (res) => {
diff --git a/src/components/leftNav/index.vue b/src/components/leftNav/index.vue
index b614d06..7a6703a 100644
--- a/src/components/leftNav/index.vue
+++ b/src/components/leftNav/index.vue
@@ -152,7 +152,6 @@
         })
     },
 
-    inject: ["layoutElement"],
     watch: {
         calenderShow: {
             handler (newData, oldData) {
@@ -206,12 +205,6 @@
                 }
             },
             immediate: true
-        },
-
-        'layoutElement.campusValue': {
-            handler (newData) {
-                console.log(newData, 99911)
-            }
         }
     },
     methods: {
@@ -273,10 +266,10 @@
             }
         },
 
-        initialize () {
+        initialize (campus) {
             var that = this
 
-            getTagList().then((res) => {
+            getTagList({ campus }).then((res) => {
                 res.data.data.forEach((item, index) => {
                     let obj = {}
                     if (item.x && item.x != '') {
@@ -325,7 +318,7 @@
                 })
             })
 
-            getWayList().then((res) => {
+            getWayList({ campus }).then((res) => {
                 res.data.data.forEach((item) => {
                     let obj = {}
                     if (item.x && item.x != '') {
@@ -403,7 +396,7 @@
             //     })
             // })
 
-            getSceneList().then((res) => {
+            getSceneList({ campus }).then((res) => {
                 res.data.data.records.forEach((item) => {
                     let obj = {}
                     if (item.x && item.x != '') {
@@ -466,7 +459,7 @@
                 })
             })
 
-            getLifeList({ lifetype: 11 }).then((res) => {
+            getLifeList({ lifetype: 11, campus }).then((res) => {
                 res.data.data.forEach((item) => {
                     let obj = {}
                     if (item.x && item.x != '') {
@@ -507,7 +500,7 @@
                 })
             })
 
-            getLifeList({ lifetype: 12 }).then((res) => {
+            getLifeList({ lifetype: 12, campus }).then((res) => {
                 res.data.data.forEach((item) => {
                     let obj = {}
                     if (item.x && item.x != '') {
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 0b36d34..8501a1e 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -157,6 +157,10 @@
         'layoutElement.campusValue': {
             handler (newData) {
                 this.campusCut(newData)
+
+                this.$nextTick(() => {
+                    this.$refs.leftNav.initialize(newData)
+                })
             }
         }
     },
diff --git a/src/components/serviceNavBar/index.vue b/src/components/serviceNavBar/index.vue
index bf48809..9235b89 100644
--- a/src/components/serviceNavBar/index.vue
+++ b/src/components/serviceNavBar/index.vue
@@ -8,12 +8,12 @@
             <img class="close deblurring" :src="publicPath + 'img/navicon/close.png'" alt @click="closeModel" />
         </template>
         <template slot="public-box-content">
-            <div class="tab" v-show="false">
+            <!-- <div class="tab" v-show="false">
                 <ul>
                     <li :class="{ on: item.flag }" v-for="(item, index) in titleList" :key="index"
                         @click="topNavClick(item, index)">{{ item.title }}</li>
                 </ul>
-            </div>
+            </div> -->
             <ul>
                 <li v-for="(item, index) in itemNavList" :key="index" @click="mapPopup(item.details)">
                     <img :src="item.icon" alt />
@@ -46,6 +46,9 @@
             itemNavList: []
         }
     },
+
+    inject: ["layoutElement"],
+
     props: {
         title: {
             type: String
@@ -75,22 +78,21 @@
         ])
     },
     created () {
-        this.titleList = []
+        // this.titleList = []
         // 三江社区//"土木楼"//"科学园"//"黄河路"//"红旗社区"
-        getList().then((res) => {
-            res.data.data.forEach((item) => {
-                // console.log(item, "see");
-                this.titleList.push({
-                    title: item.dictValue,
-                    flag: false,
-                    key: item.dictKey
-                })
-            })
+        // getList().then((res) => {
+        //     res.data.data.forEach((item) => {
+        //         // console.log(item, "see");
+        //         this.titleList.push({
+        //             title: item.dictValue,
+        //             flag: false,
+        //             key: item.dictKey
+        //         })
+        //     })
 
-            this.titleList[0].flag = true
+        //     this.titleList[0].flag = true
 
-            this.getChilsNavs(this.titleList[0].key)
-        })
+        // })
     },
     watch: {
         twoOrThree: {
@@ -100,7 +102,11 @@
             immediate: true
         }
     },
-    mounted () { },
+    mounted () {
+
+        this.getChilsNavs(this.layoutElement.campusValue)
+
+    },
     methods: {
         coordinate (item) {
             const arr = item.split(',')
diff --git a/src/pcviews/orgnav/directly.vue b/src/pcviews/orgnav/directly.vue
index 0b23aa2..42b3b1b 100644
--- a/src/pcviews/orgnav/directly.vue
+++ b/src/pcviews/orgnav/directly.vue
@@ -1,3 +1,13 @@
+<!--
+ * @Author: shuishen 1109946754@qq.com
+ * @Date: 2023-11-22 10:26:22
+ * @LastEditors: shuishen 1109946754@qq.com
+ * @LastEditTime: 2023-12-04 15:32:25
+ * @FilePath: \sd-jg-school-web-ksd\src\pcviews\orgnav\directly.vue
+ * @Description: 
+ * 
+ * Copyright (c) 2023 by shuishen, All Rights Reserved. 
+-->
 <template>
     <div></div>
 </template>
@@ -13,6 +23,9 @@
             list: []
         }
     },
+
+    inject: ["layoutElement"],
+
     computed: {
         ...mapGetters([
             // 校园内导航的显示关闭
@@ -31,7 +44,7 @@
 
         this.$store.commit('SET_ORGNAVBARFLAG', true)
 
-        getList({ type: 3 }).then((res) => {
+        getList({ type: 3, campus: this.layoutElement.campusValue }).then((res) => {
             res.data.data.records.forEach((item) => {
                 this.list.push({
                     navTitle: item.mechanismname,
diff --git a/src/pcviews/orgnav/masses.vue b/src/pcviews/orgnav/masses.vue
index f106323..8bb37d6 100644
--- a/src/pcviews/orgnav/masses.vue
+++ b/src/pcviews/orgnav/masses.vue
@@ -2,8 +2,8 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2022-08-29 09:04:54
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2022-09-09 15:39:12
- * @FilePath: \smart-campus\src\pcviews\orgnav\masses.vue
+ * @LastEditTime: 2023-12-04 15:33:04
+ * @FilePath: \sd-jg-school-web-ksd\src\pcviews\orgnav\masses.vue
  * @Description:
  *
  * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
@@ -23,6 +23,9 @@
             list: []
         }
     },
+
+    inject: ["layoutElement"],
+
     computed: {
         ...mapGetters([
             // 校园内导航的显示关闭
@@ -43,7 +46,7 @@
 
         this.$store.commit('SET_ORGNAVBARFLAG', true)
 
-        getList({ type: 1 }).then((res) => {
+        getList({ type: 1, campus: this.layoutElement.campusValue }).then((res) => {
             res.data.data.records.forEach((item) => {
                 this.list.push({
                     navTitle: item.mechanismname,
diff --git a/src/pcviews/orgnav/ofc.vue b/src/pcviews/orgnav/ofc.vue
index 7620e6a..e9a3e31 100644
--- a/src/pcviews/orgnav/ofc.vue
+++ b/src/pcviews/orgnav/ofc.vue
@@ -2,8 +2,8 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2022-08-29 09:04:54
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2022-08-30 14:21:58
- * @FilePath: \smart-campus\src\pcviews\orgnav\ofc.vue
+ * @LastEditTime: 2023-12-04 15:33:30
+ * @FilePath: \sd-jg-school-web-ksd\src\pcviews\orgnav\ofc.vue
  * @Description:
  *
  * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
@@ -23,6 +23,9 @@
             list: []
         }
     },
+
+    inject: ["layoutElement"],
+
     computed: {
         ...mapGetters([
             // 校园内导航的显示关闭
@@ -41,7 +44,7 @@
 
         this.$store.commit('SET_ORGNAVBARFLAG', true)
 
-        getList({ type: 2 }).then((res) => {
+        getList({ type: 2, campus: this.layoutElement.campusValue }).then((res) => {
             res.data.data.records.forEach((item) => {
                 this.list.push({
                     navTitle: item.mechanismname,
diff --git a/src/pcviews/orgnav/rest.vue b/src/pcviews/orgnav/rest.vue
index 4b93e44..de0bc1c 100644
--- a/src/pcviews/orgnav/rest.vue
+++ b/src/pcviews/orgnav/rest.vue
@@ -13,6 +13,9 @@
             list: []
         }
     },
+
+    inject: ["layoutElement"],
+
     computed: {
         ...mapGetters([
             // 校园内导航的显示关闭
@@ -31,7 +34,7 @@
 
         this.$store.commit('SET_ORGNAVBARFLAG', true)
 
-        getList({ type: 5 }).then((res) => {
+        getList({ type: 5, campus: this.layoutElement.campusValue }).then((res) => {
             res.data.data.records.forEach((item) => {
                 this.list.push({
                     navTitle: item.mechanismname,
diff --git a/src/pcviews/orgnav/teaching.vue b/src/pcviews/orgnav/teaching.vue
index 2f131ab..33e1bcb 100644
--- a/src/pcviews/orgnav/teaching.vue
+++ b/src/pcviews/orgnav/teaching.vue
@@ -13,6 +13,9 @@
             list: []
         }
     },
+
+    inject: ["layoutElement"],
+
     computed: {
         ...mapGetters([
             // 校园内导航的显示关闭
@@ -31,7 +34,7 @@
 
         this.$store.commit('SET_ORGNAVBARFLAG', true)
 
-        getList({ type: 4 }).then((res) => {
+        getList({ type: 4, campus: this.layoutElement.campusValue }).then((res) => {
             res.data.data.records.forEach((item) => {
                 this.list.push({
                     navTitle: item.mechanismname,

--
Gitblit v1.9.3