Commit 0e99bda0 authored by 胡占生's avatar 胡占生 🇨🇳

fix: 固有风险、新建完房间和评估完等级 清空表单问题

parent 4ef48267
...@@ -162,7 +162,7 @@ const routes = [{ ...@@ -162,7 +162,7 @@ const routes = [{
component: () => import('../views/riskProject/add/addCurrent.vue'), component: () => import('../views/riskProject/add/addCurrent.vue'),
}, },
{//新增现状风险 {//新增现状风险
path: '/addPresent ', path: '/addPresent',
name: 'addPresent', name: 'addPresent',
component: () => import('../views/riskProject/add/addPresent.vue'), component: () => import('../views/riskProject/add/addPresent.vue'),
}, },
......
<template> <template>
<div> <div>
<LHeader :text="text"></LHeader> <LHeader :text="text"></LHeader>
<van-form @submit="onSubmit" :scroll-to-error="true" :show-error="false" validate-trigger="onSubmit"> <van-form
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"> @submit="onSubmit"
<img src="@/assets/accidentIcon/bookmark.svg" alt="" :scroll-to-error="true"
style="position: relative;top: 32%;transform: translateY(-50%);"> :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> </div>
<van-field readonly required name="userName" :value="form.userName" label="评估人" placeholder="请输入" /> <van-field
<van-field readonly required name="projectId" :value="form.projectId" label="所属项目" placeholder="请输入" /> readonly
<van-field readonly required name="buildingName" :value="form.buildingName" label="所属建筑物" placeholder="请输入" /> 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="请选择" <van-field
@click="seletFloor('floor')" :rules="[{ required: true, message: '所属楼层不能为空' }]" /> required
clickable
name="floorId"
:value="form.floorId"
label="所属楼层"
placeholder="请选择"
@click="seletFloor('floor')"
:rules="[{ required: true, message: '所属楼层不能为空' }]"
/>
<div style="display: flex;"> <div style="display: flex;">
<van-field readonly required name="roomName" :value="form.roomName" label="所属房间" placeholder="请输入" <van-field
@click="seletRoom('room')" :rules="[{ required: true, message: '所属房间不能为空' }]" /> readonly
<van-button style="color: #cccc;background-color: #f0f1f5;" icon="plus" type="info" @click="tjfjClcik"/> required
name="roomName"
:value="form.roomName"
label="所属房间"
placeholder="请输入"
@click="seletRoom('room')"
:rules="[{ required: true, message: '所属房间不能为空' }]"
/>
<van-button
style="color: #cccc;background-color: #f0f1f5;"
icon="plus"
type="info"
native-type="button"
@click="tjfjClcik"
/>
</div> </div>
<van-field required clickable name="name" v-model="form.name" label="风险源名称" placeholder="请输入" <van-field
:rules="[{ required: true, message: '风险源名称不能为空' }]" /> required
<van-field v-model="form.factor" required name="factor" label="风险因素" placeholder="请选择" clickable
@click="seletFactor('factor')" :rules="[{ required: true, message: '风险因素不能为空' }]" /> 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')" <van-field
:rules="[{ required: true, message: '准事故类型不能为空' }]" /> 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="请选择" <van-field
@click="seletGrade" :rules="[{ required: true, message: '风险等级不能为空' }]" /> readonly
v-model="form.level"
required
name="level"
label="风险等级"
placeholder="请选择"
@click="seletGrade"
:rules="[{ required: true, message: '风险等级不能为空' }]"
/>
<!-- <van-field readonly v-model="form.level" required name="level" label="风险等级" placeholder="请选择" <!-- <van-field readonly v-model="form.level" required name="level" label="风险等级" placeholder="请选择"
@click="seletGrade('level')" :rules="[{ required: true, message: '风险等级不能为空' }]" /> --> @click="seletGrade('level')" :rules="[{ required: true, message: '风险等级不能为空' }]" /> -->
<van-field required name="presenceLocation" v-model="form.presenceLocation" label="存在部位" placeholder="请输入" <van-field
:rules="[{ required: true, message: '存在部位不能为空' }]" /> 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;"> <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
style="position: relative;top: 32%;transform: translateY(-50%);"> >
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
风险源图片 风险源图片
</div> </div>
<van-field name="hdPicture1" label="风险源图片"> <van-field name="hdPicture1" label="风险源图片">
<template #input> <template #input>
<van-uploader @delete="deleteFile(...arguments, 'uploaderImg')" multiple :max-count="5" <van-uploader
upload-text="最多上传五个" v-model="uploaderImg"> @delete="deleteFile(...arguments, 'uploaderImg')"
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="uploaderImg"
>
<template slot="default"> <template slot="default">
<!-- 11111111111 --> <!-- 11111111111 -->
<div style=" <div
style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
...@@ -55,28 +154,53 @@ ...@@ -55,28 +154,53 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
"> "
<img src="@/assets/upload/pic.png" alt="" style="width: 0.64rem; height: 0.64rem" /> >
<img
src="@/assets/upload/pic.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text">最多上传五个</span> <span class="van-uploader__upload-text">最多上传五个</span>
</div> </div>
</template> </template>
</van-uploader> </van-uploader>
</template> </template>
</van-field> </van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"> <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
style="position: relative;top: 32%;transform: translateY(-50%);"> >
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
技术措施 技术措施
</div> </div>
<van-field v-model="form.measuresProject" name="measuresProject" label="技术措施" type="textarea" rows="1" autosize <van-field
placeholder="请输入" /> v-model="form.measuresProject"
name="measuresProject"
label="技术措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="measuresProjectFile[]" label=" "> <van-field name="measuresProjectFile[]" label=" ">
<template #input> <template #input>
<van-uploader multiple :max-count="5" upload-text="最多上传五个" v-model="measuresProjectFile" accept="file" <van-uploader
result-type="file" @delete="deleteFile(...arguments, 'measuresProjectFile')"> multiple
:max-count="5"
upload-text="最多上传五个"
v-model="measuresProjectFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'measuresProjectFile')"
>
<template slot="default"> <template slot="default">
<!-- 11111111111 --> <!-- 11111111111 -->
<div style=" <div
style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
...@@ -84,28 +208,53 @@ ...@@ -84,28 +208,53 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
"> "
<img src="@/assets/upload/file.png" alt="" style="width: 0.64rem; height: 0.64rem" /> >
<img
src="@/assets/upload/file.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text">最多上传五个</span> <span class="van-uploader__upload-text">最多上传五个</span>
</div> </div>
</template> </template>
</van-uploader> </van-uploader>
</template> </template>
</van-field> </van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"> <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
style="position: relative;top: 32%;transform: translateY(-50%);"> >
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
管理措施 管理措施
</div> </div>
<van-field v-model="form.measuresAdministration" name="measuresAdministration" label="管理措施" type="textarea" <van-field
rows="1" autosize placeholder="请输入" /> v-model="form.measuresAdministration"
name="measuresAdministration"
label="管理措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="measuresAdministrationFile[]" label=" "> <van-field name="measuresAdministrationFile[]" label=" ">
<template #input> <template #input>
<van-uploader multiple :max-count="5" upload-text="最多上传五个" v-model="measuresAdministrationFile" <van-uploader
accept="file" result-type="file" @delete="deleteFile(...arguments, 'measuresAdministrationFile')"> multiple
:max-count="5"
upload-text="最多上传五个"
v-model="measuresAdministrationFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'measuresAdministrationFile')"
>
<template slot="default"> <template slot="default">
<!-- 11111111111 --> <!-- 11111111111 -->
<div style=" <div
style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
...@@ -113,28 +262,53 @@ ...@@ -113,28 +262,53 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
"> "
<img src="@/assets/upload/file.png" alt="" style="width: 0.64rem; height: 0.64rem" /> >
<img
src="@/assets/upload/file.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text">最多上传五个</span> <span class="van-uploader__upload-text">最多上传五个</span>
</div> </div>
</template> </template>
</van-uploader> </van-uploader>
</template> </template>
</van-field> </van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"> <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
style="position: relative;top: 32%;transform: translateY(-50%);"> >
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
应急措施 应急措施
</div> </div>
<van-field v-model="form.measuresEmergency" name="measuresEmergency" label="应急措施" type="textarea" rows="1" <van-field
autosize placeholder="请输入" /> v-model="form.measuresEmergency"
name="measuresEmergency"
label="应急措施"
type="textarea"
rows="1"
autosize
placeholder="请输入"
/>
<van-field name="measuresEmergencyFile[]" label=" "> <van-field name="measuresEmergencyFile[]" label=" ">
<template #input> <template #input>
<van-uploader multiple :max-count="5" upload-text="最多上传五个" v-model="measuresEmergencyFile" accept="file" <van-uploader
result-type="file" @delete="deleteFile(...arguments, 'measuresEmergencyFile')"> multiple
:max-count="5"
upload-text="最多上传五个"
v-model="measuresEmergencyFile"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'measuresEmergencyFile')"
>
<template slot="default"> <template slot="default">
<!-- 11111111111 --> <!-- 11111111111 -->
<div style=" <div
style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
...@@ -142,17 +316,27 @@ ...@@ -142,17 +316,27 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
"> "
<img src="@/assets/upload/file.png" alt="" style="width: 0.64rem; height: 0.64rem" /> >
<img
src="@/assets/upload/file.png"
alt=""
style="width: 0.64rem; height: 0.64rem"
/>
<span class="van-uploader__upload-text">最多上传五个</span> <span class="van-uploader__upload-text">最多上传五个</span>
</div> </div>
</template> </template>
</van-uploader> </van-uploader>
</template> </template>
</van-field> </van-field>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"> <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
style="position: relative;top: 32%;transform: translateY(-50%);"> >
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
参考依据 参考依据
</div> </div>
<!-- <van-field <!-- <van-field
...@@ -166,50 +350,112 @@ ...@@ -166,50 +350,112 @@
@click="showTrouble = true" @click="showTrouble = true"
:rules="[{ required: true, message: '事故类型不能为空' }]" :rules="[{ required: true, message: '事故类型不能为空' }]"
/> --> /> -->
<van-dialog v-model="showGradeDialog" title="风险评测配置" :show-cancel-button="false" :show-confirm-button="false" > <van-dialog
v-model="showGradeDialog"
title="风险评测配置"
:show-cancel-button="false"
:show-confirm-button="false"
>
<div class="dialogContain"> <div class="dialogContain">
<van-collapse v-model="activeNames"> <van-collapse v-model="activeNames">
<van-collapse-item title="风险模型" name="1"> <van-collapse-item title="风险模型" name="1">
<van-field readonly required name="level" label="当前风险模型" placeholder="LS风险矩阵评估模型" /> <van-field
readonly
required
name="level"
label="当前风险模型"
placeholder="LS风险矩阵评估模型"
/>
</van-collapse-item> </van-collapse-item>
<van-collapse-item title="风险模型配置" name="2"> <van-collapse-item title="风险模型配置" name="2">
<van-popover v-model="showPopover" trigger="click" :actions="columnsRiskRank" <van-popover
@select="onSelect"> v-model="showPopover"
trigger="click"
:actions="columnsRiskRank"
@select="onSelect"
>
<template #reference> <template #reference>
<van-field v-model="possibleValue" readonly required name="level" label="发生的可能性" <van-field
placeholder="请选择" /> v-model="possibleValue"
readonly
required
name="level"
label="发生的可能性"
placeholder="请选择"
/>
</template> </template>
</van-popover> </van-popover>
<van-popover v-model="showPopoveSetRank" trigger="click" :actions="columnsSetRank" <van-popover
@select="onSelectSetRank"> v-model="showPopoveSetRank"
trigger="click"
:actions="columnsSetRank"
@select="onSelectSetRank"
>
<template #reference> <template #reference>
<van-field v-model="severityValue" readonly required name="level" label="后果严重程度" <van-field
placeholder="请选择" /> v-model="severityValue"
readonly
required
name="level"
label="后果严重程度"
placeholder="请选择"
/>
</template> </template>
</van-popover> </van-popover>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
<van-row type="flex" justify="center" style="margin-top:10px"> <van-row type="flex" justify="center" style="margin-top:10px">
<van-col span="6"><van-button size="small" plain native-type="button" type="info" @click="showGradeDialog = false">取消</van-button></van-col> <van-col span="6"
<van-col span="6"><van-button size="small" type="info" native-type="button" @click="goResultPage">开始测评</van-button></van-col> ><van-button
size="small"
plain
native-type="button"
type="info"
@click="showGradeDialog = false"
>取消</van-button
></van-col
>
<van-col span="6"
><van-button
size="small"
type="info"
native-type="button"
@click="goResultPage"
>开始测评</van-button
></van-col
>
</van-row> </van-row>
</div> </div>
</van-dialog> </van-dialog>
<van-popup v-model="showTrouble" position="bottom"> <van-popup v-model="showTrouble" position="bottom">
<van-picker show-toolbar value-key="name" :columns="columnsTrouble" @confirm="onConTrouble" <van-picker
@cancel="showTrouble = false" /> show-toolbar
value-key="name"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
/>
</van-popup> </van-popup>
<van-popup v-model="showSource" position="bottom"> <van-popup v-model="showSource" position="bottom">
<van-picker show-toolbar value-key="name" :columns="columnsSource" @confirm="onConSource" <van-picker
@cancel="showSource = false" /> show-toolbar
value-key="name"
:columns="columnsSource"
@confirm="onConSource"
@cancel="showSource = false"
/>
</van-popup> </van-popup>
<div style="margin: 16px 16px 0"> <div style="margin: 16px 16px 0">
<van-button round block type="info" native-type="submit">上报</van-button> <van-button round block type="info" native-type="submit"
>上报</van-button
>
</div> </div>
</van-form> </van-form>
<div style="margin: 10px 16px 0px; padding-bottom: 16px"> <div style="margin: 10px 16px 0px; padding-bottom: 16px">
<van-button round block type="warning" @click.native="cancel">取消</van-button> <van-button round block type="warning" @click.native="cancel"
>取消</van-button
>
</div> </div>
</div> </div>
</template> </template>
...@@ -217,7 +463,7 @@ ...@@ -217,7 +463,7 @@
<script> <script>
import LHeader from "@/components/header.vue"; import LHeader from "@/components/header.vue";
// import selectPeople from "@/views/riskTask/selectPeople/index.vue"; // import selectPeople from "@/views/riskTask/selectPeople/index.vue";
import { getUserInfo, getLocalUserInfo } from '@/utils/userInfo' import { getUserInfo, getLocalUserInfo } from "@/utils/userInfo";
import { getFun, postFun } from "@/service/table.js"; import { getFun, postFun } from "@/service/table.js";
// import { // import {
// getFormList, // getFormList,
...@@ -229,9 +475,9 @@ import { getFun, postFun } from "@/service/table.js"; ...@@ -229,9 +475,9 @@ import { getFun, postFun } from "@/service/table.js";
// postRiskShowMeasures, // postRiskShowMeasures,
// } from "@/service/risk"; // } from "@/service/risk";
export default { export default {
name: "risk-add", name: "addInherent",
components: { components: {
LHeader, LHeader
}, },
activated() { activated() {
this.showSetRank = false; // 再次关闭弹出层 以防万一 this.showSetRank = false; // 再次关闭弹出层 以防万一
...@@ -243,7 +489,7 @@ export default { ...@@ -243,7 +489,7 @@ export default {
} }
this.getList(); this.getList();
this.$bus.$on("riskLevelBus", (res) => { this.$bus.$on("riskLevelBus", res => {
this.showSetRank = false; // 再次关闭弹出层 以防万一 this.showSetRank = false; // 再次关闭弹出层 以防万一
console.log(Boolean(res)); console.log(Boolean(res));
if (res) { if (res) {
...@@ -255,9 +501,16 @@ export default { ...@@ -255,9 +501,16 @@ export default {
this.$bus.$off("riskLevelBus"); this.$bus.$off("riskLevelBus");
}); });
}, },
beforeRouteEnter(to, from, next){
if(from.name=='riskInherent'){
sessionStorage.setItem('inherenForm','')
sessionStorage.setItem('level','')
}
next()
},
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (to.name != "matrix-grad") { if (to.name != "riskInherent") {
sessionStorage.setItem('inherenForm',JSON.stringify(this.form))
} }
next(); next();
}, },
...@@ -272,9 +525,7 @@ export default { ...@@ -272,9 +525,7 @@ export default {
id: "", id: "",
isTimely: 1, isTimely: 1,
active: 0, active: 0,
form: { form: {},
},
projectId: "", // 所属工程 projectId: "", // 所属工程
projectName: "", // 所属工程 projectName: "", // 所属工程
projectDirectorName: "", // 所属工程 projectDirectorName: "", // 所属工程
...@@ -287,9 +538,9 @@ export default { ...@@ -287,9 +538,9 @@ export default {
columnsFactor: [], columnsFactor: [],
messageList: [ messageList: [
{ {
title: '回显风险源名称', title: "回显风险源名称",
time: '2022-12-12', time: "2022-12-12",
name: 'Mr.周', name: "Mr.周",
state: 1 state: 1
} }
], ],
...@@ -302,10 +553,10 @@ export default { ...@@ -302,10 +553,10 @@ export default {
columnsTrouble: [], columnsTrouble: [],
setRank: "", //风险定级 setRank: "", //风险定级
showSetRank: false, showSetRank: false,
columnsSetRank: ["矩阵式定级", "其他定级方式"],//严重程度 columnsSetRank: ["矩阵式定级", "其他定级方式"], //严重程度
riskRank: "", // 风险等级 riskRank: "", // 风险等级
showRiskRank: false, showRiskRank: false,
columnsRiskRank: [],//发生可能性 columnsRiskRank: [], //发生可能性
showSetRankMode: false, // 是否显示定级方式 showSetRankMode: false, // 是否显示定级方式
setRankMode: "", // 定级方式文字 setRankMode: "", // 定级方式文字
setRankModeImg: [], // 定级方式图片 setRankModeImg: [], // 定级方式图片
...@@ -334,21 +585,29 @@ export default { ...@@ -334,21 +585,29 @@ export default {
returnCause: "", // 退回原因 returnCause: "", // 退回原因
isShowreturnCause: false, isShowreturnCause: false,
possibleValue: "", possibleValue: "",
possibleScore:0, possibleScore: 0,
severityValue: "", severityValue: "",
severityScore:0, severityScore: 0
}; };
}, },
created() { created() {
var userInfo = getUserInfo() var userInfo = getUserInfo();
this.form.buildingIds = this.$route.params.buildingId ||sessionStorage.getItem("buildingId") this.form.buildingIds =
this.form.planId = this.$route.params.planId||sessionStorage.getItem("planId") this.$route.params.buildingId || sessionStorage.getItem("buildingId");
this.form.buildingName = this.$route.params.buildingName||sessionStorage.getItem("buildingName") this.form.planId =
this.form.userId = userInfo.userId this.$route.params.planId || sessionStorage.getItem("planId");
this.form.userName = userInfo.userName this.form.buildingName =
this.form.deptName = userInfo.dept.deptName this.$route.params.buildingName || sessionStorage.getItem("buildingName");
this.form.projectId = '测试项目', this.form.userId = userInfo.userId;
this.form.level = this.$route.params.level ? this.$route.params.level :'' this.form.userName = userInfo.userName;
this.form.deptName = userInfo.dept.deptName;
(this.form.projectId = "测试项目")
},
mounted(){
if(sessionStorage.getItem('inherenForm')!=''){
this.form=JSON.parse(sessionStorage.getItem('inherenForm'))
this.form.level = sessionStorage.getItem('level')
}
}, },
methods: { methods: {
seletFloor(name) { seletFloor(name) {
...@@ -356,14 +615,16 @@ export default { ...@@ -356,14 +615,16 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
this.userPrefix = name this.userPrefix = name;
getFun(`/risk/plan/floor/list/${this.form.buildingIds}`).then((res) => { getFun(`/risk/plan/floor/list/${this.form.buildingIds}`)
this.$toast.clear() .then(res => {
this.showSource = true this.$toast.clear();
this.columnsSource = res.data this.showSource = true;
}).catch(() => { this.columnsSource = res.data;
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}, },
...@@ -372,29 +633,31 @@ export default { ...@@ -372,29 +633,31 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
this.userPrefix = name this.userPrefix = name;
getFun(`/risk/plan/room/list/${this.form.floorId}`).then((res) => { getFun(`/risk/plan/room/list/${this.form.floorId}`)
this.$toast.clear() .then(res => {
this.showSource = true this.$toast.clear();
this.columnsSource = res.data this.showSource = true;
}).catch(() => { this.columnsSource = res.data;
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}, },
//风险因素 //风险因素
seletFactor(name) { seletFactor(name) {
this.showTrouble = true this.showTrouble = true;
this.riskName = name this.riskName = name;
getFun(`/risk/plan/dict/data/list?dictType=risk_plan_factor`) getFun(`/risk/plan/dict/data/list?dictType=risk_plan_factor`)
.then(res => { .then(res => {
console.log(res.data) console.log(res.data);
const arr = [] const arr = [];
res.data.forEach(item => { res.data.forEach(item => {
arr.push({ name: item.dictLabel }) arr.push({ name: item.dictLabel });
}) });
this.columnsTrouble = arr this.columnsTrouble = arr;
}) })
.catch(() => { .catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
...@@ -402,15 +665,15 @@ export default { ...@@ -402,15 +665,15 @@ export default {
}, },
//准事故类型 //准事故类型
seletType(name) { seletType(name) {
this.showTrouble = true this.showTrouble = true;
this.riskName = name this.riskName = name;
getFun(`/risk/plan/dict/data/list?dictType=risk_plan_type`) getFun(`/risk/plan/dict/data/list?dictType=risk_plan_type`)
.then(res => { .then(res => {
const arr = [] const arr = [];
res.data.forEach(item => { res.data.forEach(item => {
arr.push({ name: item.dictLabel }) arr.push({ name: item.dictLabel });
}) });
this.columnsTrouble = arr this.columnsTrouble = arr;
}) })
.catch(() => { .catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
...@@ -434,25 +697,29 @@ export default { ...@@ -434,25 +697,29 @@ export default {
// name: '较小风险', // name: '较小风险',
// }, // },
// ] // ]
this.getGradeList('possibility') this.getGradeList("possibility");
this.getGradeList('severity') this.getGradeList("severity");
this.showGradeDialog = true this.showGradeDialog = true;
}, },
//风险模型配置 //风险模型配置
getGradeList(type) { getGradeList(type) {
// possibility 可能性 severity 严重性 // possibility 可能性 severity 严重性
getFun(`/risk/plan/matrix/${type}/list`).then(res => { getFun(`/risk/plan/matrix/${type}/list`).then(res => {
let arr = [] let arr = [];
res.data.forEach(item => { res.data.forEach(item => {
arr.push({ text: item.title, type: item.type, sort: item.sort, score: item.score }) arr.push({
}) text: item.title,
if (type === 'possibility') { type: item.type,
this.columnsRiskRank = arr sort: item.sort,
score: item.score
});
});
if (type === "possibility") {
this.columnsRiskRank = arr;
} else { } else {
this.columnsSetRank = arr this.columnsSetRank = arr;
} }
});
})
}, },
// //后果严重程度 // //后果严重程度
// getConsequence(){ // getConsequence(){
...@@ -461,24 +728,24 @@ export default { ...@@ -461,24 +728,24 @@ export default {
// }) // })
// }, // },
onSelect(data) { onSelect(data) {
this.possibleValue = data.text this.possibleValue = data.text;
this.possibleScore = data.score this.possibleScore = data.score;
}, },
onSelectSetRank(data) { onSelectSetRank(data) {
this.severityValue = data.text this.severityValue = data.text;
this.severityScore = data.score this.severityScore = data.score;
}, },
//开始测评 //开始测评
goResultPage(){ goResultPage() {
this.$router.push({ this.$router.push({
name:'resultPage', name: "resultPage",
params:{ params: {
score:this.severityScore * this.possibleScore score: this.severityScore * this.possibleScore
} }
}) });
}, },
performTasks() { performTasks() {
console.log('1233213 :>> ', 1233213); console.log("1233213 :>> ", 1233213);
}, },
// 点击预览图 // 点击预览图
clickPre(e) { clickPre(e) {
...@@ -499,7 +766,7 @@ export default { ...@@ -499,7 +766,7 @@ export default {
console.log(res); console.log(res);
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "删除成功!", message: "删除成功!"
}); });
} else { } else {
console.log("删除失败"); console.log("删除失败");
...@@ -510,37 +777,37 @@ export default { ...@@ -510,37 +777,37 @@ export default {
jsonToFormData(config) { jsonToFormData(config) {
const formData = new FormData(); const formData = new FormData();
//循环传入的值转换formData //循环传入的值转换formData
Object.keys(config).forEach((key) => { Object.keys(config).forEach(key => {
formData.append(key, config[key]); formData.append(key, config[key]);
}) });
return formData; return formData;
}, },
onSubmit(values) { onSubmit(values) {
// console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values) // console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values)
var formDataJson = this.jsonToFormData(this.form) var formDataJson = this.jsonToFormData(this.form);
let url = "/risk/plan/inherent"; let url = "/risk/plan/inherent";
values.hdPicture1.forEach((item) => { values.hdPicture1.forEach(item => {
if (item.file) { if (item.file) {
formDataJson.append("pictureFile[]", item.file); formDataJson.append("pictureFile[]", item.file);
} else { } else {
formDataJson.append("pictureFile[]", item.fileId); formDataJson.append("pictureFile[]", item.fileId);
} }
}); });
values['measuresProjectFile[]'].forEach((item) => { values["measuresProjectFile[]"].forEach(item => {
if (item.file) { if (item.file) {
formDataJson.append("measuresProjectFile[]", item.file); formDataJson.append("measuresProjectFile[]", item.file);
} else { } else {
formDataJson.append("measuresProjectFile[]", item.fileId); formDataJson.append("measuresProjectFile[]", item.fileId);
} }
}); });
values['measuresEmergencyFile[]'].forEach((item) => { values["measuresEmergencyFile[]"].forEach(item => {
if (item.file) { if (item.file) {
formDataJson.append("measuresEmergencyFile[]", item.file); formDataJson.append("measuresEmergencyFile[]", item.file);
} else { } else {
formDataJson.append("measuresEmergencyFile[]", item.fileId); formDataJson.append("measuresEmergencyFile[]", item.fileId);
} }
}); });
values['measuresAdministrationFile[]'].forEach((item) => { values["measuresAdministrationFile[]"].forEach(item => {
if (item.file) { if (item.file) {
formDataJson.append("measuresAdministrationFile[]", item.file); formDataJson.append("measuresAdministrationFile[]", item.file);
} else { } else {
...@@ -548,11 +815,11 @@ export default { ...@@ -548,11 +815,11 @@ export default {
} }
}); });
postFun(url, formDataJson) postFun(url, formDataJson)
.then((res) => { .then(res => {
this.$toast.clear(); this.$toast.clear();
this.$toast.success({ this.$toast.success({
message: "提交成功", message: "提交成功",
duration: 2000, duration: 2000
}); });
history.go(-1); history.go(-1);
}) })
...@@ -569,10 +836,10 @@ export default { ...@@ -569,10 +836,10 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
getFormList("/riskMain/add") getFormList("/riskMain/add")
.then((res) => { .then(res => {
this.$toast.clear(); this.$toast.clear();
this.columnsProjectName = res.data.projectInformations; this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories; this.columnsFactor = res.data.riskInventories;
...@@ -590,11 +857,15 @@ export default { ...@@ -590,11 +857,15 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
postriskConiCause(`/riskMain/edit/${this.taskId}`) postriskConiCause(`/riskMain/edit/${this.taskId}`)
.then((res) => { .then(res => {
console.log('%c [ res ]-332', 'font-size:13px; background:pink; color:#bf2c9f;', res) console.log(
"%c [ res ]-332",
"font-size:13px; background:pink; color:#bf2c9f;",
res
);
}) })
.catch(() => { .catch(() => {
this.$toast.clear(); this.$toast.clear();
...@@ -623,7 +894,7 @@ export default { ...@@ -623,7 +894,7 @@ export default {
this.trouble = ""; this.trouble = "";
// 请求风险源 // 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then( postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
(res) => { res => {
this.columnsSource = res.data; this.columnsSource = res.data;
} }
); );
...@@ -640,14 +911,17 @@ export default { ...@@ -640,14 +911,17 @@ export default {
}, },
// 事故类型 // 事故类型
onConTrouble(value) { onConTrouble(value) {
console.log('%c [ value ]-653', 'font-size:13px; background:pink; color:#bf2c9f;', value) console.log(
"%c [ value ]-653",
"font-size:13px; background:pink; color:#bf2c9f;",
value
);
if (!value) { if (!value) {
this.showTrouble = false; this.showTrouble = false;
return; return;
} }
this.form[this.riskName] = value.name; this.form[this.riskName] = value.name;
this.showTrouble = false; this.showTrouble = false;
}, },
// 风险定级 // 风险定级
onConSetRank(value) { onConSetRank(value) {
...@@ -657,7 +931,7 @@ export default { ...@@ -657,7 +931,7 @@ export default {
if (this.setRank == "矩阵式定级") { if (this.setRank == "矩阵式定级") {
this.showSetRank = false; this.showSetRank = false;
this.$router.push({ this.$router.push({
name: "matrix-grad", name: "matrix-grad"
}); });
} }
}, },
...@@ -689,7 +963,7 @@ export default { ...@@ -689,7 +963,7 @@ export default {
// 请求主责人员 // 请求主责人员
let formdata = new FormData(); let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId); formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then((res) => { postHdPeople(`/riskMain/getUserList`, formdata).then(res => {
this.columnsMainDutyPeopLe = res.data; this.columnsMainDutyPeopLe = res.data;
}); });
}, },
...@@ -700,14 +974,14 @@ export default { ...@@ -700,14 +974,14 @@ export default {
this.showMainDutyPeopLe = false; this.showMainDutyPeopLe = false;
}, },
//添加房间 //添加房间
tjfjClcik(){ tjfjClcik() {
this.$router.push({ this.$router.push({
name:"riskView", name: "riskView",
params:{ params: {
floorId:18, floorId: 18,
isView:false isView: false
} }
}) });
}, },
cancel() { cancel() {
...@@ -716,17 +990,17 @@ export default { ...@@ -716,17 +990,17 @@ export default {
// 选择作业人 // 选择作业人
goSelPeoTwo(val) { goSelPeoTwo(val) {
this.peopleName = val this.peopleName = val;
this.show = true; this.show = true;
}, },
onClose() { onClose() {
this.show = false; this.show = false;
}, },
onSave(e) { onSave(e) {
this.projectDirector = e[0].loginName this.projectDirector = e[0].loginName;
this.projectDirectorName = e[0].userName this.projectDirectorName = e[0].userName;
this.show = false; this.show = false;
}, }
}, },
watch: { watch: {
// setRank(newVal, oldVal) { // setRank(newVal, oldVal) {
...@@ -736,7 +1010,7 @@ export default { ...@@ -736,7 +1010,7 @@ export default {
// this.showSetRankMode = false; // this.showSetRankMode = false;
// } // }
// }, // },
}, }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
...@@ -781,5 +1055,4 @@ export default { ...@@ -781,5 +1055,4 @@ export default {
padding: 10px; padding: 10px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>
...@@ -297,7 +297,8 @@ ...@@ -297,7 +297,8 @@
</van-uploader> </van-uploader>
</template> </template>
</van-field> </van-field>
<div v-if="this.$route.params.isView" style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" > <!-- v-if="this.$route.params.isView" -->
<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%);" > <img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
参考依据 参考依据
</div> </div>
...@@ -331,8 +332,8 @@ ...@@ -331,8 +332,8 @@
@cancel="showSource = false" @cancel="showSource = false"
/> />
</van-popup> </van-popup>
<!-- v-if="this.$route.params.isView" -->
<div style="margin: 16px 16px 0" v-if="this.$route.params.isView" > <div style="margin: 16px 16px 0" >
<van-button round block type="info" native-type="submit" <van-button round block type="info" native-type="submit"
>上报</van-button >上报</van-button
> >
...@@ -367,7 +368,8 @@ ...@@ -367,7 +368,8 @@
</van-row> </van-row>
</div> </div>
</van-dialog> </van-dialog>
<div v-if="this.$route.params.isView" style="margin: 10px 16px 0px; padding-bottom: 16px"> <!-- v-if="this.$route.params.isView" -->
<div style="margin: 10px 16px 0px; padding-bottom: 16px">
<van-button round block type="warning" @click.native="cancel" <van-button round block type="warning" @click.native="cancel"
>取消</van-button >取消</van-button
> >
...@@ -390,35 +392,23 @@ import { getFun, postFun } from "@/service/table.js"; ...@@ -390,35 +392,23 @@ import { getFun, postFun } from "@/service/table.js";
// postRiskShowMeasures, // postRiskShowMeasures,
// } from "@/service/risk"; // } from "@/service/risk";
export default { export default {
name: "risk-add", name: "addPresent",
components: { components: {
LHeader, LHeader,
}, },
activated() { 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; // 再次关闭弹出层 以防万一 beforeRouteEnter(to, from, next){
console.log(Boolean(res)); if(from.name=='addCurrent'){
if (res) { sessionStorage.setItem('presentForm','')
this.riskRank = res; sessionStorage.setItem('level','')
} else {
this.setRank = "";
} }
// 销毁一下监听事件 不然会越加越多 next()
this.$bus.$off("riskLevelBus");
});
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (to.name != "matrix-grad") { if (to.name != "riskInherent") {
sessionStorage.setItem('presentForm',JSON.stringify(this.form))
} }
next(); next();
}, },
...@@ -445,15 +435,6 @@ export default { ...@@ -445,15 +435,6 @@ export default {
columnsProjectName: [], columnsProjectName: [],
factor: "", //风险因素 factor: "", //风险因素
showFactor: false, showFactor: false,
columnsFactor: [],
messageList: [
{
title:'回显风险源名称',
time:'2022-12-12',
name:'Mr.周',
state:1
}
],
source: "", //风险源 source: "", //风险源
userPrefix: "", //风险源 userPrefix: "", //风险源
showSource: false, showSource: false,
...@@ -515,6 +496,12 @@ export default { ...@@ -515,6 +496,12 @@ export default {
this.form.projectId='测试项目' this.form.projectId='测试项目'
}, },
mounted(){
if(sessionStorage.getItem('presentForm')!=''){
this.form=JSON.parse(sessionStorage.getItem('presentForm'))
this.form.level = sessionStorage.getItem('level')
}
},
methods: { methods: {
seletFloor(name){ seletFloor(name){
this.$toast.loading({ this.$toast.loading({
...@@ -709,27 +696,6 @@ export default { ...@@ -709,27 +696,6 @@ export default {
this.$toast.clear(); 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() { postReturnEcho() {
this.$toast.loading({ this.$toast.loading({
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<van-col span="15">{{ item.roomName }}</van-col> <van-col span="15">{{ item.roomName }}</van-col>
</van-row> </van-row>
</van-col> </van-col>
<van-col span="7" :style="{ color: item.state == 1 ? '#0069e5' : '#03b615' }"> <!-- <van-col span="7" :style="{ color: item.state == 1 ? '#0069e5' : '#03b615' }">
{{ "●待审批" }} {{ "●待审批" }}
</van-col> </van-col> -->
</van-row> </van-row>
<van-overlay :show="showIndex == index"> <van-overlay :show="showIndex == index">
<div class="wrapper" @click.stop="showIndex = null"> <div class="wrapper" @click.stop="showIndex = null">
......
...@@ -47,15 +47,12 @@ import LHeader from "@/components/header.vue"; ...@@ -47,15 +47,12 @@ import LHeader from "@/components/header.vue";
}) })
}, },
resetClose(){ resetClose(){
this.$router.push({ sessionStorage.setItem('level','')
name:'addInherent', history.go(-1)
params:{
level:''
}
})
}, },
sureClose(){ sureClose(){
// this.$emit('',) // this.$emit('',)
sessionStorage.setItem('level',this.level)
history.go(-1) history.go(-1)
// this.$router.push({ // this.$router.push({
// name:'addInherent', // name:'addInherent',
......
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
/> />
<van-field <van-field
readonly
clickable clickable
name="workUserNames" name="workUserNames"
:value="form.workUserNames" :value="form.workUserNames"
......
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
goDetail(item){ goDetail(item){
console.log(item,'???') console.log(item,'???')
this.$router.push({ this.$router.push({
name:'addPresent', name:'taskDetail',
params:{ params:{
isView:false, isView:false,
// buildingId:, // buildingId:,
......
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