Commit 26cd1e8f authored by 王李辉's avatar 王李辉

上报风险源可以多选

parent e616b47d
......@@ -23,7 +23,7 @@
data () {
return {
transitionName: 'slide-left',
cachePage:["change-info","affirm-danger","risk-affirm","manager-survey","super-survey","major-survey"]
cachePage:["add-danger","change-info","affirm-danger","risk-affirm","manager-survey","super-survey","major-survey"]
}
},
watch: {
......
......@@ -144,7 +144,6 @@
:rules="[{ required: true, message: '风险源不能为空' }]"
/>
<van-popup v-model="showSource" position="bottom">
<van-picker
show-toolbar
......@@ -155,7 +154,7 @@
/>
</van-popup>
<van-field
<!-- <van-field
readonly
clickable
name="dangerSource"
......@@ -165,7 +164,6 @@
placeholder="请选择"
:rules="[{ required: true, message: '风险源不能为空' }]"
/>
<!-- @click="goSelectTwo" -->
<van-popup v-model="showSource1" position="bottom">
<van-picker
......@@ -175,7 +173,20 @@
@confirm="onConSource1"
@cancel="showSource1 = false"
/>
</van-popup>
</van-popup> -->
<van-field
v-model="source1"
readonly
rows="3"
autosize
label=" "
name="dangerSource"
type="textarea"
@click="goSelectTwo"
placeholder="请选择"
:rules="[{ required: true, message: '隐患描述不能为空' }]"
/>
<van-field
v-model="location"
......@@ -195,10 +206,7 @@
:rules="[{ required: true, message: '隐患描述不能为空' }]"
/>
<van-field
name="hdPicture1"
label="隐患照片"
>
<van-field name="hdPicture1" label="隐患照片">
<template #input>
<van-uploader v-model="uploaderImg" />
</template>
......@@ -270,25 +278,73 @@ import {
postHdRiskSource,
postHdShowPeople,
postHdReportAdd,
dangerReturnEcho,
dangerReturnEcho
} from "@/service/danger";
export default {
name: "add-danger",
components: {
LHeader
},
created() {
this.taskId = this.$route.params.taskId
activated() {
this.taskId = this.$route.params.taskId;
if (this.taskId) {
this.isShowreturnCause = true;
this.text = "隐患上报退回";
this.postReturnEcho()
this.postReturnEcho();
}
this.getList();
this.$bus.$on("sourceAyy", res => {
console.log(res.join(","));
this.source1 = res.join(",");
});
},
beforeRouteLeave(to, from, next) {
if ((to.name != "choose-people")) {
// 如果去的路由是
this.projectId = ""; // 所属工程
this.taskId = "";
this.projectName = "";
this.showProjectName = false;
this.columnsProjectName = [];
this.range = ""; //适用范围
this.showRange = false;
this.columnsRange = [];
this.type = ""; //隐患类型
this.showType = false;
this.columnsType = [];
this.dangerName = ""; //隐患项目名称
this.showDangerName = false;
this.columnsDangerName = [];
this.dangerNum = ""; //隐患项目编号
this.dangerLevel = ""; //隐患项目级别
this.findTime = ""; //隐患发现时间
this.showFindTime = false;
this.source = ""; // 风险源
this.showSource = false;
this.columnsSource = [];
this.source1 = ""; // 风险源第二个字段
this.showSource1 = false;
this.columnsSource1 = [];
this.location = ""; // 检查部位
this.describe = ""; // 隐患描述
this.uploaderImg = []; //图像上传
this.uploaderVideo = []; //视频上传
this.expireTime = ""; // 隐患到期时间
this.showExpireTime = false;
this.recPeople = "";
this.showRecPeople = false;
this.columnsRecPeople = [];
this.isShowreturnCause = false;
this.returnCause = ""; // 退回原因
}
next();
},
data() {
return {
text: "新增隐患",
taskId:"",
taskId: "",
projectId: "", // 所属工程
projectName: "",
showProjectName: false,
......@@ -325,39 +381,35 @@ export default {
returnCause: "" // 退回原因
};
},
mounted(){
this.$bus.$on("sourceAyy", res =>{
console.log(res.join(","));
})
},
methods: {
onSubmit(values) {
console.log("submit", values);
let formdata = new FormData()
formdata.append("proId", this.projectId)
formdata.append("hdRange", values.hdRange)
formdata.append("hdType", values.hdType)
formdata.append("hdProjectName", values.hdProjectName)
formdata.append("hdProjectId", values.hdProjectId)
formdata.append("hdLev", values.hdLev)
formdata.append("hdDiscoveryTime", values.hdDiscoveryTime)
formdata.append("dangerId", values.dangerId)
formdata.append("dangerSource", values.dangerSource)
formdata.append("hdPosition", values.hdPosition)
formdata.append("hdDescribe", values.hdDescribe)
formdata.append("hdPicture1[]", values.hdPicture1)
formdata.append("hdVideo1[]", values.hdVideo1)
formdata.append("hdExpirationTime", values.hdExpirationTime)
formdata.append("rectificationUser", values.rectificationUser)
let formdata = new FormData();
formdata.append("proId", this.projectId);
formdata.append("hdRange", values.hdRange);
formdata.append("hdType", values.hdType);
formdata.append("hdProjectName", values.hdProjectName);
formdata.append("hdProjectId", values.hdProjectId);
formdata.append("hdLev", values.hdLev);
formdata.append("hdDiscoveryTime", values.hdDiscoveryTime);
formdata.append("dangerId", values.dangerId);
formdata.append("dangerSource", values.dangerSource);
formdata.append("hdPosition", values.hdPosition);
formdata.append("hdDescribe", values.hdDescribe);
formdata.append("hdPicture1[]", values.hdPicture1);
formdata.append("hdVideo1[]", values.hdVideo1);
formdata.append("hdExpirationTime", values.hdExpirationTime);
formdata.append("rectificationUser", values.rectificationUser);
this.$toast.loading({
message: "提交中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
let url = "/hdreport/add"
if(this.taskId){
url = `/hdreport/editSave/${this.taskId}`
let url = "/hdreport/add";
if (this.taskId) {
url = `/hdreport/editSave/${this.taskId}`;
}
postHdReportAdd(url, formdata)
......@@ -396,7 +448,7 @@ export default {
},
// 请求已退回详情数据
postReturnEcho(){
postReturnEcho() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
......@@ -406,31 +458,30 @@ export default {
dangerReturnEcho(`/hdreport/edit/${this.taskId}`)
.then(res => {
this.$toast.clear();
let msg = res.data.hdReport
let msg = res.data.hdReport;
// 对数据进行赋值
this.returnCause = res.data.reason;
this.projectId = msg.proId;
// 对所属工程数组筛选出 相同id 的工程名
let name = this.columnsProjectName.filter(item =>{
return item.id == msg.proId
})
this.projectName = name[0].projectName
this.range = msg.hdRange
this.type = msg.hdType
this.dangerName = msg.hdProjectName
this.dangerNum = msg.hdProjectId
this.dangerLevel = msg.hdLev
this.findTime = msg.hdDiscoveryTime
this.source = msg.dangerId
this.source1 = msg.dangerSource
this.location = msg.hdPosition
this.describe = msg.hdDescribe
this.hdPicture1 = msg.hdPicture1
this.hdVideo1 = msg.hdVideo1
this.expireTime = msg.hdExpirationTime
this.recPeople = msg.rectificationUser
let name = this.columnsProjectName.filter(item => {
return item.id == msg.proId;
});
this.projectName = name[0].projectName;
this.range = msg.hdRange;
this.type = msg.hdType;
this.dangerName = msg.hdProjectName;
this.dangerNum = msg.hdProjectId;
this.dangerLevel = msg.hdLev;
this.findTime = msg.hdDiscoveryTime;
this.source = msg.dangerId;
this.source1 = msg.dangerSource;
this.location = msg.hdPosition;
this.describe = msg.hdDescribe;
this.hdPicture1 = msg.hdPicture1;
this.hdVideo1 = msg.hdVideo1;
this.expireTime = msg.hdExpirationTime;
this.recPeople = msg.rectificationUser;
})
.catch(() => {
this.$toast.clear();
......@@ -452,10 +503,10 @@ export default {
onConRange(value) {
this.range = value.hdRange;
this.showRange = false;
this.type = ""
this.dangerName = ""
this.dangerNum = ""
this.dangerLevel = ""
this.type = "";
this.dangerName = "";
this.dangerNum = "";
this.dangerLevel = "";
// 去请求隐患类型的数据
postHdTyp(`/hdreport/showHdType/${this.range}`).then(res => {
this.columnsType = res.data;
......@@ -465,9 +516,9 @@ export default {
onConType(value) {
this.type = value.hdType;
this.showType = false;
this.dangerName = ""
this.dangerNum = ""
this.dangerLevel = ""
this.dangerName = "";
this.dangerNum = "";
this.dangerLevel = "";
// 请求隐患项目名称的数据
console.log(this.range);
postHdName(`/hdreport/showHdName/${this.range}/${this.type}`).then(
......@@ -509,16 +560,16 @@ export default {
this.source1 = value.riskSource;
this.showSource1 = false;
},
goSelectTwo(){
if(this.source){
goSelectTwo() {
if (this.source) {
// 跳转到多选页面
this.$router.push({
name: "choose-people",
params:{
source:this.source
params: {
source: this.source
}
})
}else{
});
} else {
this.$toast("请先选择风险源");
}
},
......@@ -535,8 +586,7 @@ export default {
cancel() {
this.$router.go(-1);
},
}
}
};
</script>
......
......@@ -185,6 +185,7 @@ export default {
let paramsData = to.params.data;
vm.taskId = paramsData.taskId;
vm.messageList.push(paramsData);
vm.radio= "1",
vm.value = "";
vm.rectId = ""; // 隐患整改人
vm.valueRect = "";
......
......@@ -519,7 +519,9 @@ export default {
// 自己定义风险等级点击方法
myRiskRank(){
console.log(this.setRank);
if(this.setRank == "其他定级方式"){
if(this.setRank == ""){
this.$toast("请先选择风险源");
}else if(this.setRank == "其他定级方式"){
this.showRiskRank = true;
}
},
......
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