Commit cb7fd58a by liuguorong93

从编辑页面保存返回列表页面 保持在当前页

parent 233ebbfc
......@@ -5,21 +5,31 @@ export const getJsonDataApi = (fileName) => {
let datas
if (!fileName) return []
let enumKey = fileName + '_at_jingquanSys'
let options = window.localStorage.getItem(enumKey)
return new Promise((resolve) => {
if (options) {
resolve(JSON.parse(options))
} else {
axios.get(`JsonData/${fileName}.json`).then((res) => {
try {
let result = res.data.data.rows || []
window.localStorage.setItem(enumKey, JSON.stringify(result))
datas = result
resolve(datas)
} catch (e) {
datas = []
window.localStorage.removeItem(enumKey)
resolve(datas)
}
}).catch((e) => {
datas = []
window.localStorage.removeItem(enumKey)
resolve(datas)
})
}
})
}
......
......@@ -264,14 +264,16 @@ export default {
},
};
},
async mounted() {
mounted() {},
async activated() {
this.jwjsxlOptions = await getJsonDataApi("CODE_JWJXXL");
this.shifouOptions = await getJsonDataApi("CODE_YN");
this.shifouOptions.unshift({
id: "",
label: "全部",
});
this.getLists(1);
this.getLists(this.currentPage);
},
methods: {
indexMethod(index) {
......@@ -422,6 +424,13 @@ export default {
this.showImportBox = true;
},
},
beforeRouteLeave(to, form, next) {
let toName = to.name;
if (toName !== "artisanManageEdit") {
this.currentPage = 1;
}
next();
},
watch: {},
};
</script>
......
......@@ -336,12 +336,13 @@ export default {
},
};
},
async mounted() {
mounted() {},
async activated() {
this.zyfxOptions = await getJsonDataApi("CODE_WORKINGDOGCLASSIFICA");
this.gzqdjOptions = await getJsonDataApi("CODE_GZQDJ");
this.jyjqOptions = await getJsonDataApi("CODE_SPECIES");
this.getLists(1);
this.getLists(this.currentPage);
},
methods: {
resetForm() {
......@@ -516,6 +517,13 @@ export default {
});
},
},
beforeRouteLeave(to, form, next) {
let toName = to.name;
if (toName !== "poDogJobManageEdit") {
this.currentPage = 1;
}
next();
},
watch: {},
};
</script>
......
......@@ -204,8 +204,9 @@ export default {
},
};
},
mounted() {
this.getLists(1);
mounted() {},
async activated() {
this.getLists(this.currentPage);
},
methods: {
// 重置
......@@ -336,6 +337,13 @@ export default {
});
},
},
beforeRouteLeave(to, form, next) {
let toName = to.name;
if (toName !== "teUnitManageEdit") {
this.currentPage = 1;
}
next();
},
watch: {},
};
</script>
......
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