zhuliu 9 月之前
父節點
當前提交
44fe382f38

+ 1 - 0
src/views/backStageManage/application/vipType/addVipType.vue

@@ -7,6 +7,7 @@
 <script>
 import vipTypeForm from './components/form/vipType.vue';
 export default {
+    name:'Administrator_addVipType',
     components: {
         vipTypeForm
     },

+ 1 - 0
src/views/backStageManage/application/vipType/editVipType.vue

@@ -7,6 +7,7 @@
 <script>
 import vipTypeForm from './components/form/vipType.vue';
 export default {
+    name:'Administrator_editVipType',
     components: {
         vipTypeForm
     },

+ 1 - 0
src/views/backStageManage/application/vision/addVersion.vue

@@ -7,6 +7,7 @@
 <script>
 import VersionForm from './components/form/versionForm.vue';
 export default {
+    name:'Administrator_addVersion',
     components: {
         'version-form': VersionForm
     },

+ 1 - 0
src/views/backStageManage/application/vision/editVersion.vue

@@ -7,6 +7,7 @@
 <script>
 import VersionForm from './components/form/versionForm.vue';
 export default {
+    name:'Administrator_editVersion',
     components: {
         'version-form': VersionForm
     },

+ 17 - 10
src/views/backStageManage/layout/components/AppMain.vue

@@ -1,8 +1,8 @@
 <template>
   <section class="app-main">
     <transition name="fade" mode="out-in">
-      <keep-alive>
-          <router-view :key="getKey()" v-if="$route.meta.keepAlive"></router-view>
+      <keep-alive :include="include">
+          <router-view v-if="$route.meta.keepAlive"></router-view>
       </keep-alive>
     </transition>
       <transition name="fade" mode="out-in">
@@ -31,19 +31,26 @@ export default {
     }
   },
   watch:{
-    // destroyPath(){
-    //   this.destroyComponent()
-    // }
+    $route(to, from) {
+      if (to.meta.keepAlive) {
+        if(!this.include.includes(to.name)){
+          this.include.push(to.name);
+        }
+      }
+    },
+    destroyPath(){
+      this.destroyComponent()
+    },
   },
   data() {
     return {
+      include:[]
     }
   },
   created(){
     // if(this.userId){
     //   this.connectWebSocket(this.userId)
     // }
-    this.destroyComponent()
   },
   methods: {
     getKey(){
@@ -51,10 +58,10 @@ export default {
     },
     destroyComponent(){
       if(this.destroyPath){
-        var dom = this.$refs[this.destroyPath]
-        console.log(dom)
-        if(dom){
-          dom.$history()
+        var index = this.include.indexOf(this.destroyPath)
+        if(index !=-1){
+          this.include.splice(index, 1);
+          this.$store.commit('addDestroyPath',null)
         }
       }
     },

+ 5 - 3
src/views/backStageManage/layout/components/history.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="tabs">
     <div class="tab-header">
-      <div  v-for="item in history" :key="item.path" @click="tabClick(item)" :class="['tab_item',item.path==currentPath?'tab_item_active':'']">{{ item.name }} <span @click.stop="tabRemove(item.path)" class="el-icon-close"></span></div>
+      <div  v-for="item in history" :key="item.path" @click="tabClick(item)" :class="['tab_item',item.path==currentPath?'tab_item_active':'']">{{ item.name }} <span @click.stop="tabRemove(item)" class="el-icon-close"></span></div>
     </div>
   </div>
   
@@ -37,11 +37,13 @@ export default {
         this.$router.push(name);
       }
     },
-    tabRemove(path){
+    tabRemove(item){
+      var path = item.path
+      var name = item.route.name
       var sign = this.currentPath == path
       this.$store.commit('removeHistoryPath',path);
       this.$store.commit('removeHistory',path);
-      this.$store.commit('addDestroyPath',path);
+      this.$store.commit('addDestroyPath',name);
       if(sign){
         this.tabClick(this.history[this.history.length-1])
       }

+ 1 - 0
src/views/backStageManage/organization/department/addDepartment.vue

@@ -7,6 +7,7 @@
 <script>
 import departmentFrom from './components/form/department.vue';
 export default {
+    name:'Administrator_addDepartment',
     components: {
         departmentFrom
     },

+ 1 - 0
src/views/backStageManage/organization/department/editDepartment.vue

@@ -7,6 +7,7 @@
 <script>
 import departmentForm from './components/form/department.vue';
 export default {
+    name:'Administrator_editDepartment',
     components: {
         departmentForm
     },

+ 1 - 0
src/views/backStageManage/organization/position/addPosition.vue

@@ -7,6 +7,7 @@
 <script>
 import positionForm from './components/form/position.vue';
 export default {
+    name: 'Administrator_addPosition',
     components: {
         positionForm
     },

+ 1 - 0
src/views/backStageManage/organization/position/editPosition.vue

@@ -7,6 +7,7 @@
 <script>
 import positionForm from './components/form/position.vue';
 export default {
+    name: 'Administrator_editPosition',
     components: {
         positionForm
     },

+ 1 - 0
src/views/backStageManage/organization/tenant/editTenant.vue

@@ -7,6 +7,7 @@
 <script>
 import tenantForm from './components/form/tenant.vue';
 export default {
+    name: 'Administrator_editTenant',
     components: {
         tenantForm
     },

+ 1 - 0
src/views/backStageManage/paymentCode/paymentCode/addPaymentCode.vue

@@ -7,6 +7,7 @@
 <script>
 import paymentCodeForm from './components/form/paymentCode.vue';
 export default {
+    name:'Administrator_addPaymentCode',
     components: {
         paymentCodeForm
     },

+ 1 - 0
src/views/backStageManage/paymentCode/paymentCode/editPaymentCode.vue

@@ -7,6 +7,7 @@
 <script>
 import paymentCodeForm from './components/form/paymentCode.vue';
 export default {
+    name:'Administrator_editPaymentCode',
     components: {
         paymentCodeForm
     },