Commit ace0f3ba authored by 胡占生's avatar 胡占生 🇨🇳

fix: 新增现状风险 修复固有风险表单,修复缓存id

parent a4fc0ad1
......@@ -40,7 +40,7 @@ export default {
'riskAdd'
],
// 不需要展示底部tabbar的页面
noTab:["login", "login2", 'addInherent','riskInherent',"choose-people","scan",'success','fail','warn','center','reset-pas-two','riskTaskList'],
noTab:["login", "login2", 'addCurrent','addPresent','addInherent','riskInherent',"choose-people","scan",'success','fail','warn','center','reset-pas-two','riskTaskList'],
// cachePage预先定义的缓存页面
otherCache: [],
// 专门处理列表缓存的页面,这些页面缓存逻辑与其他缓存不一样去详情返回列表缓存,但是进入列表必须刷新,如何有需要缓存的列表请放到这里来。
......
......@@ -156,11 +156,16 @@ const routes = [{
name: 'addInherent',
component: () => import('../views/riskProject/add/addInherent.vue'),
},
{
{//编辑固有风险
path: '/addCurrent',
name: 'addCurrent',
component: () => import('../views/riskProject/add/addCurrent.vue'),
},
{//新增现状风险
path: '/addPresent ',
name: 'addPresent',
component: () => import('../views/riskProject/add/addPresent.vue'),
},
]
const router = new VueRouter({
......
<template>
<div>
<LHeader :text="text"></LHeader>
<van-tabs v-model="active" color="#2980f7"
<van-tabs
v-model="active"
@change="tabList"
color="#2980f7"
animated
>
<van-tab title="固有风险信息">
......@@ -18,140 +21,112 @@
<van-field
readonly
required
name="creatBy"
:value="form.creatBy"
label="创建人员"
name="userName"
:value="form.userName"
label="评估人"
placeholder="请输入"
:rules="[{ required: true, message: '创建人员不能为空' }]"
/>
<van-field
readonly
required
name="creatUnit"
:value="form.creatUnit"
label="创建单位"
name="projectId"
:value="form.projectId"
label="所属项目"
placeholder="请输入"
:rules="[{ required: true, message: '创建单位不能为空' }]"
/>
<van-field
readonly
required
name="taskName"
:value="form.taskName"
label="任务名称"
name="buildingName"
:value="form.buildingName"
label="所属建筑物"
placeholder="请输入"
:rules="[{ required: true, message: '任务名称不能为空' }]"
/>
<van-field
readonly
required
clickable
name="source"
:value="form.source"
label="关联项目"
name="floorId"
:value="form.floorId"
label="所属楼层"
placeholder="请选择"
@click="showSource = true"
:rules="[{ required: true, message: '关联项目不能为空' }]"
@click="seletFloor('floor')"
:rules="[{ required: true, message: '所属楼层不能为空' }]"
/>
<van-popup v-model="showSource" position="bottom">
<van-picker
show-toolbar
value-key="sourceName"
:columns="columnsSource"
@confirm="onConSource"
@cancel="showSource = false"
/>
</van-popup>
<van-field
readonly
required
name="taskName"
:value="form.taskName"
label="评估楼栋"
name="roomName"
:value="form.roomName"
label="所属房间"
placeholder="请输入"
:rules="[{ required: true, message: '评估楼栋不能为空' }]"
@click="seletRoom('room')"
:rules="[{ required: true, message: '所属房间不能为空' }]"
/>
<van-field
readonly
required
clickable
name="trouble"
:value="form.trouble"
label="项目负责人"
placeholder="请选择"
@click="showTrouble = true"
:rules="[{ required: true, message: '事故类型不能为空' }]"
/>
<van-popup v-model="showTrouble" position="bottom">
<van-picker
show-toolbar
value-key="accidentType"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
name="name"
v-model="form.name"
label="风险源名称"
placeholder="请输入"
:rules="[{ required: true, message: '风险源名称不能为空' }]"
/>
</van-popup>
<van-field
v-model="form.startTime"
v-model="form.factor"
required
name="location"
label="任务开始时间"
type="textarea"
maxlength="255"
rows="1"
autosize
placeholder="请输入"
:rules="[{ required: true, message: '任务开始时间不能为空' }]"
name="factor"
label="风险因素"
placeholder="请选择"
@click="seletFactor('factor')"
:rules="[{ required: true, message: '风险因素不能为空' }]"
/>
<van-field
v-model="form.endTime"
v-model="form.type"
required
name="location"
label="任务结束时间"
type="textarea"
maxlength="255"
rows="1"
autosize
placeholder="请输入"
:rules="[{ required: true, message: '任务结束时间不能为空' }]"
name="type"
label="准事故类型"
placeholder="请选择"
@click="seletType('type')"
:rules="[{ required: true, message: '准事故类型不能为空' }]"
/>
<van-field
clickable
readonly
v-model="form.level"
required
name="control"
:value="form.control"
label="执行人员"
name="level"
label="风险等级"
placeholder="请选择"
@click="showControl = true"
:rules="[{ required: true, message: '执行人员不能为空' }]"
@click="seletGrade('level')"
:rules="[{ required: true, message: '风险等级不能为空' }]"
/>
<van-popup v-model="showControl" position="bottom">
<van-picker
show-toolbar
:columns="columnsControl"
@confirm="onConControl"
@cancel="showControl = false"
<van-field
required
name="presenceLocation"
v-model="form.presenceLocation"
label="存在部位"
placeholder="请输入"
:rules="[{ required: true, message: '存在部位不能为空' }]"
/>
</van-popup>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
风险源图片
</div>
<van-field name="hdPicture2" label="风险源图片" v-if="isTimely == 1">
<van-field name="hdPicture1" label="风险源图片" >
<template #input>
<van-uploader
@delete="deleteFile(...arguments, 'changePicture')"
@delete="deleteFile(...arguments, 'uploaderImg')"
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="changePicture"
v-model="uploaderImg"
>
<template slot="default">
<!-- 11111111111 -->
......@@ -184,24 +159,24 @@
技术措施
</div>
<van-field
v-model="form.administration"
name="administration"
v-model="form.measuresProject"
name="measuresProject"
label="技术措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="administrationFile" label=" ">
<van-field name="measuresProjectFile[]" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="administrationImg"
v-model="measuresProjectFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'administrationImg')"
@delete="deleteFile(...arguments, 'measuresProjectFile')"
>
<template slot="default">
<!-- 11111111111 -->
......@@ -234,24 +209,24 @@
管理措施
</div>
<van-field
v-model="form.administration"
name="administration"
v-model="form.measuresAdministration"
name="measuresAdministration"
label="管理措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="administrationFile" label=" ">
<van-field name="measuresAdministrationFile[]" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="administrationImg"
v-model="measuresAdministrationFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'administrationImg')"
@delete="deleteFile(...arguments, 'measuresAdministrationFile')"
>
<template slot="default">
<!-- 11111111111 -->
......@@ -284,24 +259,24 @@
应急措施
</div>
<van-field
v-model="form.administration"
name="administration"
v-model="form.measuresEmergency"
name="measuresEmergency"
label="应急措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="administrationFile" label=" ">
<van-field name="measuresEmergencyFile[]" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="administrationImg"
v-model="measuresEmergencyFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'administrationImg')"
@delete="deleteFile(...arguments, 'measuresEmergencyFile')"
>
<template slot="default">
<!-- 11111111111 -->
......@@ -333,7 +308,7 @@
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
参考依据
</div>
<van-field
<!-- <van-field
readonly
required
clickable
......@@ -343,19 +318,8 @@
placeholder="请选择"
@click="showTrouble = true"
:rules="[{ required: true, message: '事故类型不能为空' }]"
/>
<van-popup v-model="showTrouble" position="bottom">
<van-picker
show-toolbar
value-key="accidentType"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
/>
</van-popup>
<van-popup v-model="show" position="bottom" :style="{ height: '100%' }">
<!-- <selectPeople @onClose="onClose" @onSave="onSave"></selectPeople> -->
</van-popup>
/> -->
<div style="margin: 16px 16px 0">
<van-button round block type="info" native-type="submit"
......@@ -417,7 +381,28 @@
</van-tab>
</van-tabs>
<div style="display: flex;
<van-popup v-model="showTrouble" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
/>
</van-popup>
<van-popup v-model="showSource" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="columnsSource"
@confirm="onConSource"
@cancel="showSource = false"
/>
</van-popup>
<div
v-if="active!=0"
style="display: flex;
justify-content: space-around;
background-color: #fff;
border-top: 1px solid #e3e3e3;
......@@ -452,28 +437,6 @@ export default {
components: {
LHeader,
},
activated() {
this.showSetRank = false; // 再次关闭弹出层 以防万一
if (this.$route.params.taskId) {
this.isShowreturnCause = true;
this.text = "风险上报退回";
this.taskId = this.$route.params.taskId;
this.postReturnEcho();
}
this.getList();
this.$bus.$on("riskLevelBus", (res) => {
this.showSetRank = false; // 再次关闭弹出层 以防万一
console.log(Boolean(res));
if (res) {
this.riskRank = res;
} else {
this.setRank = "";
}
// 销毁一下监听事件 不然会越加越多
this.$bus.$off("riskLevelBus");
});
},
beforeRouteLeave(to, from, next) {
if (to.name != "matrix-grad") {
......@@ -482,8 +445,8 @@ export default {
},
data() {
return {
taskId: "",
text: "添加固有风险",
inherentId: "",
text: "编辑固有风险",
id: "",
isTimely:1,
active:0,
......@@ -509,6 +472,7 @@ export default {
}
],
source: "", //风险源
userPrefix: "", //风险源
showSource: false,
columnsSource: [],
trouble: "", //事故类型
......@@ -523,9 +487,10 @@ export default {
showSetRankMode: false, // 是否显示定级方式
setRankMode: "", // 定级方式文字
setRankModeImg: [], // 定级方式图片
changePicture: [], // 定级方式图片
uploaderImg: [], // 定级方式图片
location: "", //风险部位
control: "", //管控层级
riskName: "", //管控层级
showControl: false,
columnsControl: ["项目级", "企业级"],
mainDutyDept: "", // 主责部门
......@@ -539,25 +504,124 @@ export default {
technology: "", //技术措施文字
technologyImg: [], //技术措施图片
administration: "", //管理措施文字
administrationImg: [], //管理措施图片
measuresAdministrationFile: [], //管理措施图片
measuresProjectFile: [], //管理措施图片
measuresEmergencyFile: [], //管理措施图片
urgent: "", //应急措施文字
urgentImg: [], //应急措施图片
returnCause: "", // 退回原因
buildingIds: "", // 退回原因
isShowreturnCause: false,
};
},
created() {
if (this.$route.params.taskId) {
this.isShowreturnCause = true;
this.text = "风险上报退回";
this.taskId = this.$route.params.taskId;
if (this.$route.params.inherentId) {
this.inherentId=this.$route.params.inherentId
this.buildingIds=this.$route.params.buildingIds
this.postReturnEcho();
}
// this.getList();
},
methods: {
tabList(value){
console.log('%c [ value ]-527', 'font-size:13px; background:pink; color:#bf2c9f;', value)
if(value==1){
this.getList();
}
},
seletFloor(name){
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
this.userPrefix=name
getFun(`/risk/plan/floor/list/${this.buildingIds}`).then((res) => {
this.$toast.clear()
this.showSource=true
this.columnsSource=res.data
}).catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
seletRoom(name){
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
this.userPrefix=name
getFun(`/risk/plan/room/list/${this.form.floorId}`).then((res) => {
this.$toast.clear()
this.showSource=true
this.columnsSource=res.data
}).catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
seletFactor(name){
this.showTrouble=true
this.riskName=name
this.columnsTrouble=[
{
name:'人的因素',
},
{
name:'物的因素',
},
{
name:'环境因素',
},
{
name:'管理因素',
},
]
},
seletType(name){
this.showTrouble=true
this.riskName=name
this.columnsTrouble=[
{
name:'物体打击',
},
{
name:'车辆伤害',
},
{
name:'起重伤害',
},
{
name:'机械伤害',
},
]
},
seletGrade(name){
this.showTrouble=true
this.riskName=name
this.columnsTrouble=[
{
name:'重大风险',
},
{
name:'较大风险',
},
{
name:'一般风险',
},
{
name:'较小风险',
},
]
},
performTasks(){
console.log('1233213 :>> ', 1233213);
this.$router.push({
name: "addPresent",
params: {
id:this.inherentId,
// planId:this.planId
},
})
},
// 点击预览图
clickPre(e) {
......@@ -606,21 +670,12 @@ export default {
// 请求表单数据
getList() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
getFormList("/riskMain/add")
getFun(`/risk/plan/existing/list/${this.inherentId}`)
.then((res) => {
this.$toast.clear();
this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories;
this.columnsMainDutyDept = res.data.organizationList;
console.log('%c [ res ]-670', 'font-size:13px; background:pink; color:#bf2c9f;', res)
this.messageList = res.data;
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试");
});
},
......@@ -633,9 +688,41 @@ export default {
loadingType: "spinner",
duration: 0,
});
postriskConiCause(`/riskMain/edit/${this.taskId}`)
getFun(`/risk/plan/inherent/details/${this.inherentId}`)
.then((res) => {
console.log('%c [ res ]-332', 'font-size:13px; background:pink; color:#bf2c9f;', res)
this.form=res.data
this.uploaderImg = (res.data.pictureFile || []).map(
(item) => {
return {
...item,
url: item.filePath,
};
}
);
this.measuresProjectFile = (res.data.measuresProjectFile || []).map(
(item) => {
return {
...item,
url: item.filePath,
};
}
);
this.measuresAdministrationFile = (res.data.measuresAdministrationFile || []).map(
(item) => {
return {
...item,
url: item.filePath,
};
}
);
this.measuresEmergencyFile = (res.data.measuresEmergencyFile || []).map(
(item) => {
return {
...item,
url: item.filePath,
};
}
);
})
.catch(() => {
this.$toast.clear();
......@@ -675,15 +762,9 @@ export default {
this.showSource = false;
return;
}
this.source = value.sourceName;
this.form[this.userPrefix + "Id"] = value.id;
this.form[this.userPrefix + "Name"] = value.name;
this.showSource = false;
this.trouble = "";
// 请求事故类型
postHdType(
`/riskMain/showaccidentType?factorType=${this.factor}&sourceName=${this.source}`
).then((res) => {
this.columnsTrouble = res.data;
});
},
// 事故类型
onConTrouble(value) {
......@@ -691,16 +772,9 @@ export default {
this.showTrouble = false;
return;
}
this.trouble = value.accidentType;
this.form[this.riskName] = value.name;
this.showTrouble = false;
// 请求三个措施
postRiskShowMeasures(
`/riskMain/showmeasures?factorType=${this.factor}&sourceName=${this.source}&accidentType=${this.trouble}`
).then((res) => {
this.technology = res.data[0].measuresProject;
this.administration = res.data[0].measuresAdministration;
this.urgent = res.data[0].measuresEmergency;
});
},
// 风险定级
onConSetRank(value) {
......
......@@ -638,7 +638,7 @@ export default {
message: "提交成功",
duration: 2000,
});
// history.go(-1);
history.go(-1);
})
.catch(() => {
this.$toast.clear();
......
<template>
<div>
<LHeader :text="text"></LHeader>
<van-form
@submit="onSubmit"
:scroll-to-error="true"
:show-error="false"
validate-trigger="onSubmit"
>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
风险信息
</div>
<van-field
readonly
required
name="userName"
:value="form.userName"
label="评估人"
placeholder="请输入"
/>
<van-field
readonly
required
name="projectId"
:value="form.projectId"
label="所属项目"
placeholder="请输入"
/>
<van-field
readonly
required
name="buildingName"
:value="form.buildingName"
label="所属建筑物"
placeholder="请输入"
/>
<van-field
required
clickable
name="floorId"
:value="form.floorId"
label="所属楼层"
placeholder="请选择"
@click="seletFloor('floor')"
:rules="[{ required: true, message: '所属楼层不能为空' }]"
/>
<van-field
readonly
required
name="roomName"
:value="form.roomName"
label="所属房间"
placeholder="请输入"
@click="seletRoom('room')"
:rules="[{ required: true, message: '所属房间不能为空' }]"
/>
<van-field
required
clickable
name="name"
v-model="form.name"
label="风险源名称"
placeholder="请输入"
:rules="[{ required: true, message: '风险源名称不能为空' }]"
/>
<van-field
v-model="form.factor"
required
name="factor"
label="风险因素"
placeholder="请选择"
@click="seletFactor('factor')"
:rules="[{ required: true, message: '风险因素不能为空' }]"
/>
<van-field
v-model="form.type"
required
name="type"
label="准事故类型"
placeholder="请选择"
@click="seletType('type')"
:rules="[{ required: true, message: '准事故类型不能为空' }]"
/>
<van-field
readonly
v-model="form.level"
required
name="level"
label="风险等级"
placeholder="请选择"
@click="seletGrade('level')"
:rules="[{ required: true, message: '风险等级不能为空' }]"
/>
<van-field
required
name="presenceLocation"
v-model="form.presenceLocation"
label="存在部位"
placeholder="请输入"
:rules="[{ required: true, message: '存在部位不能为空' }]"
/>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
风险源图片
</div>
<van-field name="hdPicture1" label="风险源图片" >
<template #input>
<van-uploader
@delete="deleteFile(...arguments, 'uploaderImg')"
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="uploaderImg"
>
<template slot="default">
<!-- 11111111111 -->
<div
style="
width: 2.13333rem;
height: 2.13333rem;
background: #f7f8fa;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
"
>
<img
src="@/assets/upload/pic.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text"
>最多上传五个</span
>
</div>
</template>
</van-uploader>
</template>
</van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
技术措施
</div>
<van-field
v-model="form.measuresProject"
name="measuresProject"
label="技术措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="measuresProjectFile[]" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="measuresProjectFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'measuresProjectFile')"
>
<template slot="default">
<!-- 11111111111 -->
<div
style="
width: 2.13333rem;
height: 2.13333rem;
background: #f7f8fa;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
"
>
<img
src="@/assets/upload/file.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text"
>最多上传五个</span
>
</div>
</template>
</van-uploader>
</template>
</van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
管理措施
</div>
<van-field
v-model="form.measuresAdministration"
name="measuresAdministration"
label="管理措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="measuresAdministrationFile[]" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="measuresAdministrationFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'measuresAdministrationFile')"
>
<template slot="default">
<!-- 11111111111 -->
<div
style="
width: 2.13333rem;
height: 2.13333rem;
background: #f7f8fa;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
"
>
<img
src="@/assets/upload/file.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text"
>最多上传五个</span
>
</div>
</template>
</van-uploader>
</template>
</van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
应急措施
</div>
<van-field
v-model="form.measuresEmergency"
name="measuresEmergency"
label="应急措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="measuresEmergencyFile[]" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="measuresEmergencyFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'measuresEmergencyFile')"
>
<template slot="default">
<!-- 11111111111 -->
<div
style="
width: 2.13333rem;
height: 2.13333rem;
background: #f7f8fa;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
"
>
<img
src="@/assets/upload/file.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text"
>最多上传五个</span
>
</div>
</template>
</van-uploader>
</template>
</van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
参考依据
</div>
<!-- <van-field
readonly
required
clickable
name="trouble"
:value="form.trouble"
label="参考依据"
placeholder="请选择"
@click="showTrouble = true"
:rules="[{ required: true, message: '事故类型不能为空' }]"
/> -->
<van-popup v-model="showTrouble" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
/>
</van-popup>
<van-popup v-model="showSource" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="columnsSource"
@confirm="onConSource"
@cancel="showSource = false"
/>
</van-popup>
<div style="margin: 16px 16px 0">
<van-button round block type="info" native-type="submit"
>上报</van-button
>
</div>
</van-form>
<div style="margin: 10px 16px 0px; padding-bottom: 16px">
<van-button round block type="warning" @click.native="cancel"
>取消</van-button
>
</div>
</div>
</template>
<script>
import LHeader from "@/components/header.vue";
// import selectPeople from "@/views/riskTask/selectPeople/index.vue";
import { getUserInfo, getLocalUserInfo} from '@/utils/userInfo'
import { getFun, postFun } from "@/service/table.js";
// import {
// getFormList,
// postHdSource,
// postHdType,
// postHdPeople,
// postReAdd,
// postriskConiCause,
// postRiskShowMeasures,
// } from "@/service/risk";
export default {
name: "risk-add",
components: {
LHeader,
},
activated() {
this.showSetRank = false; // 再次关闭弹出层 以防万一
if (this.$route.params.taskId) {
this.isShowreturnCause = true;
this.text = "风险上报退回";
this.taskId = this.$route.params.taskId;
this.postReturnEcho();
}
this.getList();
this.$bus.$on("riskLevelBus", (res) => {
this.showSetRank = false; // 再次关闭弹出层 以防万一
console.log(Boolean(res));
if (res) {
this.riskRank = res;
} else {
this.setRank = "";
}
// 销毁一下监听事件 不然会越加越多
this.$bus.$off("riskLevelBus");
});
},
beforeRouteLeave(to, from, next) {
if (to.name != "matrix-grad") {
}
next();
},
data() {
return {
taskId: "",
text: "添加现状风险",
id: "",
isTimely:1,
active:0,
form:{
},
projectId: "", // 所属工程
projectName: "", // 所属工程
projectDirectorName: "", // 所属工程
projectDirector: "", // 所属工程
showProjectName: false,
show: false,
columnsProjectName: [],
factor: "", //风险因素
showFactor: false,
columnsFactor: [],
messageList: [
{
title:'回显风险源名称',
time:'2022-12-12',
name:'Mr.周',
state:1
}
],
source: "", //风险源
userPrefix: "", //风险源
showSource: false,
columnsSource: [],
trouble: "", //事故类型
showTrouble: false,
columnsTrouble: [],
setRank: "", //风险定级
showSetRank: false,
columnsSetRank: ["矩阵式定级", "其他定级方式"],
riskRank: "", // 风险等级
showRiskRank: false,
columnsRiskRank: ["重大风险", "较大风险", "一般风险", "较小风险" ],
showSetRankMode: false, // 是否显示定级方式
setRankMode: "", // 定级方式文字
setRankModeImg: [], // 定级方式图片
uploaderImg: [], // 定级方式图片
location: "", //风险部位
control: "", //管控层级
riskName: "", //管控层级
showControl: false,
columnsControl: ["项目级", "企业级"],
mainDutyDept: "", // 主责部门
mainDutyDeptId: "",
showMainDutyDept: false,
columnsMainDutyDept: [],
mainDutyPeopLe: "", // 主责人员
mainDutyPeopLeId: "",
showMainDutyPeopLe: false,
columnsMainDutyPeopLe: [],
technology: "", //技术措施文字
technologyImg: [], //技术措施图片
administration: "", //管理措施文字
measuresAdministrationFile: [], //管理措施图片
measuresProjectFile: [], //管理措施图片
measuresEmergencyFile: [], //管理措施图片
urgent: "", //应急措施文字
urgentImg: [], //应急措施图片
returnCause: "", // 退回原因
isShowreturnCause: false,
};
},
created() {
var userInfo=getUserInfo()
this.form.buildingIds=this.$route.params.id
this.form.planId=this.$route.params.planId
this.form.buildingName = '1号楼'
this.form.userId=userInfo.userId
this.form.userName=userInfo.userName
this.form.deptName=userInfo.dept.deptName
this.form.projectId='测试项目'
},
methods: {
seletFloor(name){
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
this.userPrefix=name
getFun(`/risk/plan/floor/list/${this.form.buildingIds}`).then((res) => {
this.$toast.clear()
this.showSource=true
this.columnsSource=res.data
}).catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
seletRoom(name){
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
this.userPrefix=name
getFun(`/risk/plan/room/list/${this.form.floorId}`).then((res) => {
this.$toast.clear()
this.showSource=true
this.columnsSource=res.data
}).catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
seletFactor(name){
this.showTrouble=true
this.riskName=name
this.columnsTrouble=[
{
name:'人的因素',
},
{
name:'物的因素',
},
{
name:'环境因素',
},
{
name:'管理因素',
},
]
},
seletType(name){
this.showTrouble=true
this.riskName=name
this.columnsTrouble=[
{
name:'物体打击',
},
{
name:'车辆伤害',
},
{
name:'起重伤害',
},
{
name:'机械伤害',
},
]
},
seletGrade(name){
this.showTrouble=true
this.riskName=name
this.columnsTrouble=[
{
name:'重大风险',
},
{
name:'较大风险',
},
{
name:'一般风险',
},
{
name:'较小风险',
},
]
},
performTasks(){
},
// 点击预览图
clickPre(e) {
console.log(e);
if (e.filePath) {
this.videoUrl = e.filePath;
} else {
this.videoUrl = e.content;
}
},
async deleteFile(val, detail, key) {
// console.log(val,detail)
if (val.fileId) {
let formdata = new FormData();
formdata.append("key", val["fileId"]);
let res = await postFun("/mobile/remove", formdata);
if (res) {
console.log(res);
this.$toast({
title: "提示",
message: "删除成功!",
});
} else {
console.log("删除失败");
this[key].splice(detail.index, 0, val);
}
}
},
jsonToFormData(config) {
const formData = new FormData();
//循环传入的值转换formData
Object.keys(config).forEach((key) => {
formData.append(key, config[key]);
})
return formData;
},
onSubmit(values) {
// console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values)
var formDataJson=this.jsonToFormData(this.form)
let url = "/risk/plan/inherent";
values.hdPicture1.forEach((item) => {
if (item.file) {
formDataJson.append("pictureFile[]", item.file);
}else{
formDataJson.append("pictureFile[]", item.fileId);
}
});
values['measuresProjectFile[]'].forEach((item) => {
if (item.file) {
formDataJson.append("measuresProjectFile[]", item.file);
}else{
formDataJson.append("measuresProjectFile[]", item.fileId);
}
});
values['measuresEmergencyFile[]'].forEach((item) => {
if (item.file) {
formDataJson.append("measuresEmergencyFile[]", item.file);
}else{
formDataJson.append("measuresEmergencyFile[]", item.fileId);
}
});
values['measuresAdministrationFile[]'].forEach((item) => {
if (item.file) {
formDataJson.append("measuresAdministrationFile[]", item.file);
}else{
formDataJson.append("measuresAdministrationFile[]", item.fileId);
}
});
postFun(url, formDataJson)
.then((res) => {
this.$toast.clear();
this.$toast.success({
message: "提交成功",
duration: 2000,
});
history.go(-1);
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("提交失败,请稍后再试");
});
this.$toast.clear();
},
// 请求表单数据
getList() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
getFormList("/riskMain/add")
.then((res) => {
this.$toast.clear();
this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories;
this.columnsMainDutyDept = res.data.organizationList;
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试");
});
},
// 请求已退回详情数据
postReturnEcho() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
postriskConiCause(`/riskMain/edit/${this.taskId}`)
.then((res) => {
console.log('%c [ res ]-332', 'font-size:13px; background:pink; color:#bf2c9f;', res)
})
.catch(() => {
this.$toast.clear();
});
},
// 所属项目
onConProjectName(value) {
if (!value) {
this.showProjectName = false;
return;
}
this.projectId = value.id;
this.projectName = value.projectName;
this.showProjectName = false;
},
// 风险因素
onConFactor(value) {
if (!value) {
this.showFactor = false;
return;
}
this.factor = value.factorType;
this.showFactor = false;
this.source = "";
this.trouble = "";
// 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
(res) => {
this.columnsSource = res.data;
}
);
},
// 风险源
onConSource(value) {
if (!value) {
this.showSource = false;
return;
}
this.form[this.userPrefix + "Id"] = value.id;
this.form[this.userPrefix + "Name"] = value.name;
this.showSource = false;
},
// 事故类型
onConTrouble(value) {
console.log('%c [ value ]-653', 'font-size:13px; background:pink; color:#bf2c9f;', value)
if (!value) {
this.showTrouble = false;
return;
}
this.form[this.riskName] = value.name;
this.showTrouble = false;
},
// 风险定级
onConSetRank(value) {
this.showSetRank = false;
this.setRank = value;
this.riskRank = "";
if (this.setRank == "矩阵式定级") {
this.showSetRank = false;
this.$router.push({
name: "matrix-grad",
});
}
},
// 自己定义风险等级点击方法
myRiskRank() {
if (this.setRank == "") {
this.$toast("请先选择风险定级");
} else if (this.setRank == "其他定级方式") {
this.showRiskRank = true;
}
},
// 风险等级
onConRiskRank(value) {
this.riskRank = value;
this.showRiskRank = false;
},
// 管控层级
onConControl(value) {
this.control = value;
this.showControl = false;
},
// 主责部门
onConMainDutyDept(value) {
this.mainDutyDeptId = value.deptId;
this.mainDutyDept = value.deptName;
this.showMainDutyDept = false;
this.mainDutyPeopLe = "";
// 请求主责人员
let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then((res) => {
this.columnsMainDutyPeopLe = res.data;
});
},
// 主责人员
onConMainDutyPeopLe(value) {
this.mainDutyPeopLeId = value.userId;
this.mainDutyPeopLe = value.userName;
this.showMainDutyPeopLe = false;
},
cancel() {
this.$router.go(-1);
},
// 选择作业人
goSelPeoTwo(val) {
this.peopleName=val
this.show = true;
},
onClose() {
this.show = false;
},
onSave(e) {
this.projectDirector=e[0].loginName
this.projectDirectorName=e[0].userName
this.show = false;
},
},
watch: {
// setRank(newVal, oldVal) {
// if (newVal == "其他定级方式") {
// this.showSetRankMode = true;
// } else {
// this.showSetRankMode = false;
// }
// },
},
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
.con-list {
padding: 0;
background-color: #f0f1f5;
.van-cell-group--inset {
margin: 0;
margin-bottom: 0.26667rem;
padding: 0.25rem;
font-size: 0.4rem;
position: relative;
border-radius: 4%;
box-shadow: 0px 0px 10px 2px #f3f3f3;
width: 90%;
margin: 0.4rem auto;
.van-row {
font-size: 0.4rem;
line-height: 0.8rem;
margin-bottom: 0;
}
.van-overlay {
position: absolute;
.wrapper {
display: flex;
align-items: center;
justify-content: space-evenly;
height: 100%;
}
}
}
}
</style>
......@@ -437,7 +437,7 @@ export default {
message: "提交成功",
duration: 2000,
});
// history.go(-1);
history.go(-1);
})
.catch(() => {
this.$toast.clear();
......
......@@ -31,7 +31,7 @@
<van-col span="17">
<van-row gutter="">
<van-col span="9">发起时间:</van-col>
<van-col span="15">{{ item.createTime}}</van-col>
<van-col span="15">{{ timestampToTimes(item.createTime)}}</van-col>
</van-row>
<van-row gutter="">
<van-col span="9">楼层:</van-col>
......@@ -46,6 +46,17 @@
{{ '●待审批'}}
</van-col>
</van-row>
<van-overlay :show="showIndex == index">
<div class="wrapper" @click.stop="showIndex = null">
<van-button round type="primary" @click="goDetail(item)"
>编辑</van-button
>
<!-- <van-button round type="info" @click="goConfirm(item)" v-show="active==0"
>确认</van-button
> -->
</div>
</van-overlay>
</van-cell-group>
<div
style="
......@@ -83,6 +94,7 @@
<script>
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js";
import { timestampToTime, generateId } from "@/utils/format";
export default {
name:'risk-confirme',
components: {
......@@ -111,11 +123,14 @@
};
},
created() {
this.planId=this.$route.params.id
this.planId=this.$route.params.id || sessionStorage.getItem('planId')
this.getRiskList(this.planId);
// this.postList();
},
methods: {
timestampToTimes(time){
return timestampToTime(new Date(time),"DT2", true)
},
changeData(arr){
var arrList=[]
arr.forEach(item=>{
......@@ -239,9 +254,10 @@
// 详情
goDetail(data) {
this.$router.push({
name: "risk-big-detail",
name: "addCurrent",
params: {
id: data.businessId||data.id,
inherentId: data.businessId||data.id,
buildingIds:this.active,
},
});
this.showIndex = null;
......
......@@ -260,7 +260,7 @@
};
},
created() {
var planId=this.$route.params.id
var planId=this.$route.params.id || sessionStorage.getItem('planId')
this.postList(planId);
},
methods: {
......
......@@ -70,9 +70,9 @@
>详情</van-button
>
<van-button round type="info" @click="goConfirm(item)" v-show="active==0"
<!-- <van-button round type="info" @click="goConfirm(item)" v-show="active==0"
>确认</van-button
>
> -->
</div>
</van-overlay>
</van-cell-group>
......@@ -190,6 +190,7 @@
id: data.businessId ||data.id,
},
});
sessionStorage.setItem('planId',data.id)
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