瀏覽代碼

keepalive应用

wgl 4 年之前
父節點
當前提交
eea41a6bc8

+ 11 - 1
src/projects/business/views/Common/Health/TemperatureRecord.vue

@@ -201,7 +201,17 @@
 					this.rightLink.title = '异常记录';
 				}
 			}
-		}
+		},
+		//keepalive监控判断
+		beforeRouteLeave(to, from, next) {
+			console.log(to.name);
+			if (['CommonHealthTemperatureInfo'].indexOf(to.name) > -1) {
+				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', ['CommonHealthTemperatureRecord'])
+			} else {
+				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', [])
+			}
+			next()
+		},
 	}
 </script>
 

+ 12 - 2
src/projects/business/views/Master/Attendance/LeaveList.vue

@@ -48,7 +48,8 @@
 		components: {
 			Common,
 			Loading,
-			TopHeader,NullList
+			TopHeader,
+			NullList
 		},
 		data() {
 			return {
@@ -148,7 +149,16 @@
 				token: 'token',
 			})
 		},
-
+		//keepalive监控判断
+		beforeRouteLeave(to, from, next) {
+			console.log(to.name);
+			if (['MasterAttendanceLeaveInfo'].indexOf(to.name) > -1) {
+				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', ['MasterAttendanceLeaveList'])
+			} else {
+				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', [])
+			}
+			next()
+		},
 	}
 </script>
 

+ 1 - 1
src/projects/business/views/Master/Attendance/List.vue

@@ -179,7 +179,7 @@
 		//keepalive监控判断
 		beforeRouteLeave(to, from, next) {
 			console.log(to.name);
-			if (['MasterAttendanceInfo'].indexOf(to.name) > -1) {
+			if (['MasterAttendanceInfo', 'MasterAttendanceApply'].indexOf(to.name) > -1) {
 				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', ['MasterAttendanceList'])
 			} else {
 				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', [])

+ 11 - 1
src/projects/business/views/Master/Company/Organization.vue

@@ -234,7 +234,17 @@
 				immediate: true,
 				deep: true
 			},
-		}
+		},
+		//keepalive监控判断
+		beforeRouteLeave(to, from, next) {
+			console.log(to.name);
+			if (['MasterCompanyOrganizationInfo'].indexOf(to.name) > -1) {
+				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', ['MasterCompanyOrganization'])
+			} else {
+				this.$store.commit('SET_KEEP_ALIVE_COMPONENTS', [])
+			}
+			next()
+		},
 	}
 </script>