Commit 69683737 authored by 王李辉's avatar 王李辉

隐患上报退回保存接口出错

parent 08cd0978
...@@ -287,8 +287,8 @@ export default { ...@@ -287,8 +287,8 @@ export default {
components: { components: {
LHeader, LHeader,
}, },
activated() { activated(){
this.taskId = this.$route.params.taskId; this.taskId = this.$route.params.taskId || localStorage.getItem('dangerAddTaskId');
console.log(this.taskId ); console.log(this.taskId );
if (this.taskId) { if (this.taskId) {
this.isShowreturnCause = true; this.isShowreturnCause = true;
...@@ -296,9 +296,13 @@ export default { ...@@ -296,9 +296,13 @@ export default {
this.postReturnEcho(); this.postReturnEcho();
} }
this.getList(); this.getList();
},
mounted() {
this.$bus.$on("sourceAyy", res => { this.$bus.$on("sourceAyy", res => {
this.source1 = res.join(","); this.source1 = res.join(",");
// 销毁一下监听事件 不然会越加越多
this.$bus.$off('riskLevelBus')
}); });
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
...@@ -340,6 +344,8 @@ export default { ...@@ -340,6 +344,8 @@ export default {
this.isShowreturnCause = false; this.isShowreturnCause = false;
this.returnCause = ""; // 退回原因 this.returnCause = ""; // 退回原因
this.currentDate = new Date() this.currentDate = new Date()
// 清空 localStorage
localStorage.removeItem('dangerAddTaskId')
} }
next(); next();
}, },
...@@ -385,13 +391,10 @@ export default { ...@@ -385,13 +391,10 @@ export default {
currentDate : new Date() currentDate : new Date()
}; };
}, },
created() {
},
methods: { methods: {
onSubmit(values) { onSubmit(values) {
let formdata = new FormData(); let formdata = new FormData();
formdata.append("proId", this.projectId); formdata.append("proId", this.projectId);
formdata.append("hdRange", values.hdRange); formdata.append("hdRange", values.hdRange);
formdata.append("hdType", values.hdType); formdata.append("hdType", values.hdType);
...@@ -422,6 +425,7 @@ export default { ...@@ -422,6 +425,7 @@ export default {
if (this.taskId) { if (this.taskId) {
url = `/hdreport/editSave/${this.taskId}`; url = `/hdreport/editSave/${this.taskId}`;
} }
console.log(url);
postHdReportAdd(url, formdata) postHdReportAdd(url, formdata)
.then((res) => { .then((res) => {
......
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
this.showIndex = index; this.showIndex = index;
}, },
// 提交 // 上报
goSubmit(data) { goSubmit(data) {
this.$router.push({ this.$router.push({
name: "add-danger", name: "add-danger",
...@@ -120,6 +120,8 @@ export default { ...@@ -120,6 +120,8 @@ export default {
taskId: data.taskId taskId: data.taskId
} }
}); });
// 存到缓存里 如果路由跳转或者是缓存中有 就是隐患上报退回
localStorage.setItem('dangerAddTaskId',data.taskId)
this.showIndex = null; this.showIndex = null;
}, },
// 删除 // 删除
......
...@@ -323,7 +323,7 @@ export default { ...@@ -323,7 +323,7 @@ export default {
this.setRank = "" this.setRank = ""
} }
// 销毁一下监听事件 不然会越加越多 // 销毁一下监听事件 不然会越加越多
this.$bus.$off('riskLevelBus', this.myhandle) this.$bus.$off('riskLevelBus')
}); });
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
...@@ -480,7 +480,6 @@ export default { ...@@ -480,7 +480,6 @@ export default {
formdata.append("id", this.id); formdata.append("id", this.id);
url = `/riskMain/editSave/${this.taskId}`; url = `/riskMain/editSave/${this.taskId}`;
} }
postReAdd(url, formdata) postReAdd(url, formdata)
.then(res => { .then(res => {
this.$toast.clear(); this.$toast.clear();
...@@ -494,6 +493,7 @@ export default { ...@@ -494,6 +493,7 @@ export default {
this.$toast.clear(); this.$toast.clear();
this.$toast.fail("提交失败,请稍后再试"); this.$toast.fail("提交失败,请稍后再试");
}); });
this.$toast.clear();
}, },
// 请求表单数据 // 请求表单数据
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
inset inset
v-for="(item, index) in messageList" v-for="(item, index) in messageList"
:key="index" :key="index"
@change="touchstart(index, item)" @click="touchstart(index, item)"
> >
<van-row gutter=""> <van-row gutter="">
<van-col span="5">所属项目:</van-col> <van-col span="5">所属项目:</van-col>
...@@ -131,6 +131,8 @@ export default { ...@@ -131,6 +131,8 @@ export default {
taskId: data.taskId taskId: data.taskId
} }
}); });
// 存到缓存里 如果路由跳转或者是缓存中有 就是隐患上报退回
localStorage.setItem('riskAddTaskId',data.taskId)
this.showIndex = null; this.showIndex = null;
}, },
// 删除 // 删除
......
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