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

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

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