From 4593a5c6ef4549a519681fa44d94fa242d15bec4 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 30 Dec 2021 11:57:28 +0800
Subject: [PATCH] 完善

---
 src/components/arcNavBar/index.vue |   63 ++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/src/components/arcNavBar/index.vue b/src/components/arcNavBar/index.vue
index 8ec562e..1e66117 100644
--- a/src/components/arcNavBar/index.vue
+++ b/src/components/arcNavBar/index.vue
@@ -10,7 +10,7 @@
                          src="/img/icon/xyjz.png"
                          alt="">
                     <span>
-                        {{title}}
+                        {{arcNavBarTitle}}
                     </span>
                 </div>
                 <img class="close"
@@ -53,16 +53,12 @@
         return {
             moveFlag: false,
             itemNavList: [],
+            titleList: [],
             DC: null
         }
     },
     props: {
-        title: {
-            type: String
-        },
-        arcCode: {
-            type: Number
-        }
+
     },
     computed: {
         ...mapGetters([
@@ -78,23 +74,33 @@
             // 介绍
             'introduceText',
             // 全景地址
-            'panoramaUrl'
+            'panoramaUrl',
+            'arcNavBarTitle',
+            'arcNavBarCode'
         ])
     },
     created () {
         this.DC = global.DC
-        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.getChilsNavs(this.titleList[0].key)
-        })
     },
     mounted () {
+
+    },
+    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[0].flag = true
+
+                    this.getChilsNavs(this.titleList[0].key)
+                })
+            }
+        }
     },
     methods: {
         move (e) {
@@ -143,9 +149,7 @@
                 document.onmouseup = null
             }
         },
-        closeModel () {
-            this.$parent.closeModel()
-        },
+
         topNavClick (item, index) {
             this.titleList.forEach(item => {
                 item.flag = false
@@ -155,10 +159,11 @@
 
             this.getChilsNavs(item.key)
         },
+
         getChilsNavs (campus) {
             this.itemNavList = []
 
-            getChildNavList({ campus: campus, type: this.arcCode }).then(res => {
+            getChildNavList({ campus: campus, type: this.arcNavBarCode }).then(res => {
                 res.data.data.forEach(item => {
                     this.itemNavList.push({
                         navTitle: item.mechanismname,
@@ -168,6 +173,7 @@
                 })
             })
         },
+
         mapPopup (param) {
             getChildNavDetail({ id: param.id }).then(res => {
                 var result = res.data.data[0].list
@@ -207,6 +213,7 @@
                 )
             })
         },
+
         newPopup (item) {
             const position = this.DC.Transform.transformWGS84ToCartesian(new this.DC.Position(Number(item.jd), Number(item.wd), Number(item.gd), Number(item.heading), Number(item.pitch), Number(item.roll)))
             // eslint-disable-next-line no-unused-vars
@@ -219,6 +226,18 @@
 
             this.$store.commit('SET_PANORAMAPOPUP', false)
             this.$store.commit('SET_DETAILSPOPUP', true)
+        },
+
+        closeModel () {
+            var path = this.$route.path
+            if (path.indexOf('/arc') != -1) {
+                this.$store.dispatch('delVisitedViews', this.$route)
+                this.$router.push('/pcLayout/default')
+            }
+
+            this.$store.commit('SET_ARCNAVBARTITLE', '')
+            this.$store.commit('SET_ARCNAVBARCODE', '')
+            this.$store.commit('SET_ARCNAVBARFLAG', false)
         }
     }
 }

--
Gitblit v1.9.3