Jelajahi Sumber

问题修改

SunZehao 1 tahun lalu
induk
melakukan
fd515d2d8a
3 mengubah file dengan 23 tambahan dan 8 penghapusan
  1. 14 2
      src/App.vue
  2. 1 0
      src/components/knowledgePage/scoringRulesPage.vue
  3. 8 6
      src/views/homePage.vue

+ 14 - 2
src/App.vue

@@ -1,7 +1,7 @@
 <template>
    <div id="app" v-loading="loading">
     <!-- <img src="./assets/logo.png"> -->
-    <router-view />
+    <router-view v-if="isRouterAlive"/>
   </div>
 </template>
 
@@ -9,13 +9,19 @@
 // import commonHeader from '@/components/commonHeaders.vue'
 export default {
     name: 'App',
+    provide() {
+        return {
+            reload: this.reload
+        }
+    },
     components:{
         // commonHeader
     },
     data() {
         return {
             showHeader:false,
-            loading: true
+            loading: true,
+            isRouterAlive: true
         }
     },
     watch:{
@@ -36,6 +42,12 @@ export default {
             setTimeout(() => {
                 this.loading = false;
             }, 1000);
+        },
+        reload() {
+            this.isRouterAlive = false
+            this.$nextTick(() =>{
+                this.isRouterAlive = true
+            })
         }
     }
 }

+ 1 - 0
src/components/knowledgePage/scoringRulesPage.vue

@@ -166,6 +166,7 @@ export default {
     created() {
         this.getEvalscoringData()
         this.getDataDictionary()
+        this.getEvaluationData()
     },
     methods:{
         // 查询得分规则数据

+ 8 - 6
src/views/homePage.vue

@@ -59,6 +59,7 @@ import { getToken, removeToken } from '../api/auth'
 import {apiPostremoveByToken, apiGetMenuData} from '../api/api'
 export default {
     components: {MenuTree},
+    inject: ['reload'],
     data() {
         return {
             forecastDatas: [],
@@ -336,14 +337,13 @@ export default {
             })
         },
         handleNodeClick(index, indexPath) {
-            let tagsArr = []
             if (indexPath) {
                 this.forecastDatas.forEach(it =>{
                     if (it.index !== '') {
                         if (it.index === indexPath[0]) {
                             if (!it.children) {
                                 let showM = 0
-                                tagsArr.forEach(item =>{
+                                this.routeTags.forEach(item =>{
                                     if (item.name === it.name) {
                                         showM++
                                     }
@@ -353,20 +353,20 @@ export default {
                                         index: it.index,
                                         name: it.name
                                     }
-                                    tagsArr.push(obj)
+                                    this.routeTags.push(obj)
                                 }
                             } else {
                                 it.children.forEach(iv =>{
                                     if (iv.index !== '') {
                                         if (iv.index === indexPath[1]) {
                                             let showM = 0
-                                            tagsArr.forEach(item =>{
+                                            this.routeTags.forEach(item =>{
                                                 if (item.name === iv.name) {
                                                     showM++
                                                 }
                                             })
                                             if (showM === 0) {
-                                                tagsArr.push(iv)
+                                                this.routeTags.push(iv)
                                             }
                                         }
                                     }
@@ -375,9 +375,11 @@ export default {
                         }
                     }
                 })
-                this.routeTags = tagsArr.concat(this.routeTags)
                 window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
             }
+            this.$nextTick(() =>{
+                this.reload()
+            })
         },
         handleClose(tag) {
             if (this.routeTags.length > 1) {