Commit 20bc6f63 authored by kaitly205422@163.com's avatar kaitly205422@163.com

修改风险等级后内容丢失问题

parent 75013f21
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
<div id="app"> <div id="app">
<!-- :style="{ height: showTab ?appHeight:'100%' }" 之前是给id为app-content 设置的内联样式 id="app-content" --> <!-- :style="{ height: showTab ?appHeight:'100%' }" 之前是给id为app-content 设置的内联样式 id="app-content" -->
<div> <div>
<span v-for="item in cachePage" :key="item">{{ item }}</span>
<transition :name="transitionName"> <transition :name="transitionName">
<keep-alive :include="cachePage"> <keep-alive :include="cachePage">
<router-view class="router-view" /> <router-view class="router-view" />
...@@ -90,7 +89,6 @@ export default { ...@@ -90,7 +89,6 @@ export default {
// 'report-return', 'risk-return', 风险和隐患的上报退回不需要缓存 // 'report-return', 'risk-return', 风险和隐患的上报退回不需要缓存
}; };
}, },
mounted() { mounted() {
// 这个配合列表路由使用缓存初始缓存页面 // 这个配合列表路由使用缓存初始缓存页面
this.otherCache = [...this.cachePage]; this.otherCache = [...this.cachePage];
...@@ -132,6 +130,7 @@ export default { ...@@ -132,6 +130,7 @@ export default {
}, },
watch: { watch: {
$route(to, from) { $route(to, from) {
console.log(this.cachePage);
// 列表操作去除缓存,刷新列表页 // 列表操作去除缓存,刷新列表页
if (from.name == "confirme-danger" || to.name == "confirme-danger") { if (from.name == "confirme-danger" || to.name == "confirme-danger") {
// 隐患整改页面缓存处理 // 隐患整改页面缓存处理
...@@ -150,14 +149,18 @@ export default { ...@@ -150,14 +149,18 @@ export default {
this.handleCache("risk-confirme", to.name, "risk-affirm"); this.handleCache("risk-confirme", to.name, "risk-affirm");
} else if (to.name == 'taskLedger' || from.name == 'taskLedger') { } else if (to.name == 'taskLedger' || from.name == 'taskLedger') {
this.handleCache("riskTaskList", to.name, "taskLedger"); this.handleCache("riskTaskList", to.name, "taskLedger");
} else if (to.name == 'riskView' || from.name == 'riskInherent') { } else if ((from.name == 'riskInherent' && to.name === 'addInherent') || (to.name == 'riskInherent' && from.name == 'addInherent')) {
this.handleCache("addInherent", to.name, "riskInherent"); this.handleCache('addInherent', to.name, 'riskInherent')
} else if (to.name === 'resultPage') {
this.handleCache("addCurrent", to.name, "addCurrent");
} else if (to.name === 'resultPage') {
this.handleCache("addInherent", to.name, "addInherent");
} }
// else if (to.name == 'riskView' || from.name == 'riskInherent') {
// this.handleCache("addInherent", to.name, "riskInherent");
// }
// else if (to.name == 'addInherent' || from.name == 'addInherent') {
// this.handleCache("addInherent", to.name, "addInherent");
// }
// else if (to.name === 'resultPage') {
// this.handleCache("addCurrent", to.name, "addCurrent");
// }
// 列表页面动态添加缓存 // 列表页面动态添加缓存
if (from.name == "save-workbench") { if (from.name == "save-workbench") {
// 如何使从工作台进入列表页面在cachePage里添加页面 // 如何使从工作台进入列表页面在cachePage里添加页面
......
...@@ -380,11 +380,10 @@ export default { ...@@ -380,11 +380,10 @@ export default {
this.taskId = this.$route.params.taskId; this.taskId = this.$route.params.taskId;
this.postReturnEcho(); this.postReturnEcho();
} }
}, },
deactivated() { deactivated() {
console.log(124);
this.$store.commit("SET_INHERENT_TEMPLATE", {}); this.$store.commit("SET_INHERENT_TEMPLATE", {});
this.form = {}
}, },
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
if (from.name == "riskInherent") { if (from.name == "riskInherent") {
...@@ -396,6 +395,8 @@ export default { ...@@ -396,6 +395,8 @@ export default {
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (to.name == "resultPage") { if (to.name == "resultPage") {
sessionStorage.setItem("inherenForm", JSON.stringify(this.form)); sessionStorage.setItem("inherenForm", JSON.stringify(this.form));
} else if (to.name == 'riskInherent') {
this.form = {}
} }
next(); next();
}, },
...@@ -506,7 +507,6 @@ export default { ...@@ -506,7 +507,6 @@ export default {
} else if (this.$store.state.inherentTemplate) { } else if (this.$store.state.inherentTemplate) {
this.form = { ...this.form, ...this.$store.state.inherentTemplate }; this.form = { ...this.form, ...this.$store.state.inherentTemplate };
} }
this.getFloor(); this.getFloor();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment