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

上报风险源可以多选

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