Commit dc2277f7 authored by 罗新东's avatar 罗新东

修改了视屏文件不能回显名称的bug

parent f9807f1e
Pipeline #7546 passed with stage
in 12 seconds
...@@ -672,6 +672,7 @@ export default { ...@@ -672,6 +672,7 @@ export default {
return { return {
...item, ...item,
url: item.filePath, url: item.filePath,
file:new File([],item['fileName'],{})
}; };
} }
); );
......
<template> <template>
<div> <div>
<LHeader :text="text"></LHeader> <LHeader :text="text"></LHeader>
<van-form <van-form
@submit="onSubmit" @submit="onSubmit"
:scroll-to-error="true" :scroll-to-error="true"
:show-error="false" :show-error="false"
validate-trigger="onSubmit" validate-trigger="onSubmit"
> >
<van-field <van-field
v-if="isShowreturnCause" v-if="isShowreturnCause"
v-model="returnCause" v-model="returnCause"
required required
readonly readonly
rows="1" rows="1"
autosize="" autosize=""
label="退回原因" label="退回原因"
name="returnCause" name="returnCause"
type="textarea" type="textarea"
/> />
<van-field <van-field
v-if="!isShowreturnCause" v-if="!isShowreturnCause"
required required
readonly readonly
clickable clickable
name="projectName" name="projectName"
:value="projectName" :value="projectName"
label="所属项目" label="所属项目"
placeholder="请选择" placeholder="请选择"
@click="showProjectName = true" @click="showProjectName = true"
:rules="[{ required: true, message: '所属项目不能为空' }]" :rules="[{ required: true, message: '所属项目不能为空' }]"
/> />
<!-- {{headH}} --> <!-- {{headH}} -->
<van-popup v-model="showProjectName" position="bottom"> <van-popup v-model="showProjectName" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
value-key="projectName" value-key="projectName"
:columns="columnsProjectName" :columns="columnsProjectName"
@confirm="onConProjectName" @confirm="onConProjectName"
@cancel="showProjectName = false" @cancel="showProjectName = false"
/> />
</van-popup> </van-popup>
<van-field <van-field
readonly readonly
required required
clickable clickable
name="factor" name="factor"
:value="factor" :value="factor"
label="风险因素" label="风险因素"
placeholder="请选择" placeholder="请选择"
@click="showFactor = true" @click="showFactor = true"
:rules="[{ required: true, message: '风险因素不能为空' }]" :rules="[{ required: true, message: '风险因素不能为空' }]"
/> />
<van-popup v-model="showFactor" position="bottom"> <van-popup v-model="showFactor" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
value-key="factorType" value-key="factorType"
:columns="columnsFactor" :columns="columnsFactor"
@confirm="onConFactor" @confirm="onConFactor"
@cancel="showFactor = false" @cancel="showFactor = false"
/> />
</van-popup> </van-popup>
<van-field <van-field
readonly readonly
required required
clickable clickable
name="source" name="source"
:value="source" :value="source"
label="风险源" label="风险源"
placeholder="请选择" placeholder="请选择"
@click="showSource = true" @click="showSource = true"
: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
value-key="sourceName" value-key="sourceName"
:columns="columnsSource" :columns="columnsSource"
@confirm="onConSource" @confirm="onConSource"
@cancel="showSource = false" @cancel="showSource = false"
/> />
</van-popup> </van-popup>
<van-field <van-field
readonly readonly
required required
clickable clickable
name="trouble" name="trouble"
:value="trouble" :value="trouble"
label="事故类型" label="事故类型"
placeholder="请选择" placeholder="请选择"
@click="showTrouble = true" @click="showTrouble = true"
:rules="[{ required: true, message: '事故类型不能为空' }]" :rules="[{ required: true, message: '事故类型不能为空' }]"
/> />
<van-popup v-model="showTrouble" position="bottom"> <van-popup v-model="showTrouble" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
value-key="accidentType" value-key="accidentType"
:columns="columnsTrouble" :columns="columnsTrouble"
@confirm="onConTrouble" @confirm="onConTrouble"
@cancel="showTrouble = false" @cancel="showTrouble = false"
/> />
</van-popup> </van-popup>
<van-field <van-field
readonly readonly
clickable clickable
required required
label="事故定级" label="事故定级"
name="setRank" name="setRank"
:value="setRank" :value="setRank"
placeholder="请选择" placeholder="请选择"
@click="showSetRank = true" @click="showSetRank = true"
v-if="!isShowreturnCause" v-if="!isShowreturnCause"
/> />
<van-popup v-model="showSetRank" position="bottom"> <van-popup v-model="showSetRank" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="columnsSetRank" :columns="columnsSetRank"
@confirm="onConSetRank" @confirm="onConSetRank"
@cancel="showSetRank = false" @cancel="showSetRank = false"
/> />
</van-popup> </van-popup>
<van-field <van-field
readonly readonly
required required
clickable clickable
name="riskRank" name="riskRank"
:value="riskRank" :value="riskRank"
label="风险等级" label="风险等级"
placeholder="请选择" placeholder="请选择"
@click="myRiskRank" @click="myRiskRank"
:rules="[{ required: true, message: '风险等级不能为空' }]" :rules="[{ required: true, message: '风险等级不能为空' }]"
/> />
<van-popup v-model="showRiskRank" position="bottom"> <van-popup v-model="showRiskRank" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="columnsRiskRank" :columns="columnsRiskRank"
@confirm="onConRiskRank" @confirm="onConRiskRank"
@cancel="showRiskRank = false" @cancel="showRiskRank = false"
/> />
</van-popup> </van-popup>
<!-- <van-field <!-- <van-field
v-model="riskRank" v-model="riskRank"
readonly readonly
name="riskRank" name="riskRank"
...@@ -153,737 +153,762 @@ ...@@ -153,737 +153,762 @@
:rules="[{ required: true, message: '风险等级不能为空' }]" :rules="[{ required: true, message: '风险等级不能为空' }]"
/> --> /> -->
<van-field <van-field
v-show="setRank=='其他定级方式'" v-show="setRank == '其他定级方式'"
v-model="setRankMode" v-model="setRankMode"
name="setRankMode" name="setRankMode"
label="定级方式" label="定级方式"
type="textarea" type="textarea"
rows="1" rows="1"
autosize autosize
placeholder="请输入" placeholder="请输入"
/> />
<van-field name="setRankModeFile" label=" " v-show="setRank=='其他定级方式'"> <van-field
<template #input> name="setRankModeFile"
<van-uploader label=" "
multiple v-show="setRank == '其他定级方式'"
:max-count="5" >
upload-text="最多上传五个" <template #input>
v-model="setRankModeImg" <van-uploader
accept="file" multiple
result-type="file" :max-count="5"
@delete="deleteFile(...arguments, 'setRankModeImg')" upload-text="最多上传五个"
> v-model="setRankModeImg"
<template slot="default"> accept="file"
<!-- 11111111111 --> result-type="file"
<div @delete="deleteFile(...arguments, 'setRankModeImg')"
style=" >
width: 2.13333rem; <template slot="default">
height: 2.13333rem; <!-- 11111111111 -->
background: #f7f8fa; <div
display: flex; style="
align-items: center; width: 2.13333rem;
justify-content: center; height: 2.13333rem;
flex-direction: column; background: #f7f8fa;
" display: flex;
> align-items: center;
<img justify-content: center;
src="@/assets/upload/file.png" flex-direction: column;
alt="" "
style="width: 0.64rem; height: 0.64rem" >
/> <img
<span class="van-uploader__upload-text">最多上传五个</span> src="@/assets/upload/file.png"
</div> alt=""
</template> style="width: 0.64rem; height: 0.64rem"
</van-uploader> />
</template> <span class="van-uploader__upload-text"
</van-field> >最多上传五个</span
>
</div>
</template>
</van-uploader>
</template>
</van-field>
<van-field <van-field
v-model="location" v-model="location"
required required
name="location" name="location"
label="风险部位" label="风险部位"
type="textarea" type="textarea"
rows="1" rows="1"
autosize autosize
placeholder="请输入" placeholder="请输入"
:rules="[{ required: true, message: '风险部位不能为空' }]" :rules="[{ required: true, message: '风险部位不能为空' }]"
/> />
<van-field <van-field
readonly readonly
clickable clickable
required required
name="control" name="control"
:value="control" :value="control"
label="管控层级" label="管控层级"
placeholder="请选择" placeholder="请选择"
@click="showControl = true" @click="showControl = true"
:rules="[{ required: true, message: '管控层级不能为空' }]" :rules="[{ required: true, message: '管控层级不能为空' }]"
/> />
<van-popup v-model="showControl" position="bottom"> <van-popup v-model="showControl" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="columnsControl" :columns="columnsControl"
@confirm="onConControl" @confirm="onConControl"
@cancel="showControl = false" @cancel="showControl = false"
/> />
</van-popup> </van-popup>
<van-field
readonly
clickable
required
name="mainDutyDept"
:value="mainDutyDept"
label="主责部门"
:rules="[{ required: true, message: '主责部门不能为空' }]"
placeholder="请选择"
@click="showMainDutyDept = true"
/>
<van-popup v-model="showMainDutyDept" position="bottom">
<van-picker
show-toolbar
value-key="deptName"
:columns="columnsMainDutyDept"
@confirm="onConMainDutyDept"
@cancel="showMainDutyDept = false"
/>
</van-popup>
<van-field
readonly
clickable
required
name="mainDutyPeopLe"
:value="mainDutyPeopLe"
label="主责人员"
:rules="[{ required: true, message: '主责人员不能为空' }]"
placeholder="请选择"
@click="showMainDutyPeopLe = true"
/>
<van-popup v-model="showMainDutyPeopLe" position="bottom">
<van-picker
show-toolbar
value-key="userName"
:columns="columnsMainDutyPeopLe"
@confirm="onConMainDutyPeopLe"
@cancel="showMainDutyPeopLe = false"
/>
</van-popup>
<van-field <van-field
v-model="technology" readonly
name="technology" clickable
label="技术措施" required
type="textarea" name="mainDutyDept"
rows="1" :value="mainDutyDept"
autosize label="主责部门"
placeholder="请输入" :rules="[{ required: true, message: '主责部门不能为空' }]"
/> placeholder="请选择"
<van-field name="technologyFile" label=" "> @click="showMainDutyDept = true"
<template #input> />
<van-uploader <van-popup v-model="showMainDutyDept" position="bottom">
multiple <van-picker
:max-count="5" show-toolbar
upload-text="最多上传五个" value-key="deptName"
v-model="technologyImg" :columns="columnsMainDutyDept"
accept="file" @confirm="onConMainDutyDept"
result-type="file" @cancel="showMainDutyDept = false"
@delete="deleteFile(...arguments, 'technologyImg')"
>
<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> </van-popup>
</div>
</template>
</van-uploader>
</template>
</van-field>
<van-field <van-field
v-model="administration" readonly
name="administration" clickable
label="管理措施" required
type="textarea" name="mainDutyPeopLe"
rows="1" :value="mainDutyPeopLe"
autosize label="主责人员"
placeholder="请输入" :rules="[{ required: true, message: '主责人员不能为空' }]"
/> placeholder="请选择"
<van-field name="administrationFile" label=" "> @click="showMainDutyPeopLe = true"
<template #input> />
<van-uploader <van-popup v-model="showMainDutyPeopLe" position="bottom">
multiple <van-picker
:max-count="5" show-toolbar
upload-text="最多上传五个" value-key="userName"
v-model="administrationImg" :columns="columnsMainDutyPeopLe"
accept="file" @confirm="onConMainDutyPeopLe"
result-type="file" @cancel="showMainDutyPeopLe = false"
@delete="deleteFile(...arguments, 'administrationImg')"
>
<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> </van-popup>
</div>
</template>
</van-uploader>
</template>
</van-field>
<van-field <van-field
v-model="urgent" v-model="technology"
name="urgent" name="technology"
label="应急措施" label="技术措施"
type="textarea" type="textarea"
rows="1" rows="1"
autosize autosize
placeholder="请输入" placeholder="请输入"
/> />
<van-field name="technologyFile" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="technologyImg"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'technologyImg')"
>
<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>
<van-field name="urgentFile" label=" "> <van-field
<template #input> v-model="administration"
<van-uploader name="administration"
multiple label="管理措施"
:max-count="5" type="textarea"
upload-text="最多上传五个" rows="1"
v-model="urgentImg" autosize
accept="file" placeholder="请输入"
result-type="file" />
@delete="deleteFile(...arguments, 'urgentImg')" <van-field name="administrationFile" label=" ">
> <template #input>
<template slot="default"> <van-uploader
<!-- 11111111111 --> multiple
<div :max-count="5"
style=" upload-text="最多上传五个"
width: 88px; v-model="administrationImg"
height: 88px; accept="file"
background: #f7f8fa; result-type="file"
display: flex; @delete="deleteFile(...arguments, 'administrationImg')"
align-items: center; >
justify-content: center; <template slot="default">
flex-direction: column; <!-- 11111111111 -->
" <div
> style="
<img width: 2.13333rem;
src="@/assets/upload/file.png" height: 2.13333rem;
alt="" background: #f7f8fa;
style="width: 0.64rem; height: 0.64rem" display: flex;
/> align-items: center;
<span class="van-uploader__upload-text">最多上传五个</span> justify-content: center;
</div> flex-direction: column;
</template> "
</van-uploader> >
</template> <img
</van-field> 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="margin: 16px 16px 0"> <van-field
<van-button round block type="info" native-type="submit" v-model="urgent"
>上报</van-button name="urgent"
> label="应急措施"
</div> type="textarea"
</van-form> rows="1"
<div style="margin: 10px 16px 0px; padding-bottom: 16px"> autosize
<van-button round block type="warning" @click.native="cancel" placeholder="请输入"
>取消</van-button />
>
<van-field name="urgentFile" label=" ">
<template #input>
<van-uploader
multiple
:max-count="5"
upload-text="最多上传五个"
v-model="urgentImg"
accept="file"
result-type="file"
@delete="deleteFile(...arguments, 'urgentImg')"
>
<template slot="default">
<!-- 11111111111 -->
<div
style="
width: 88px;
height: 88px;
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="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> </div>
</div>
</template> </template>
<script> <script>
import LHeader from "@/components/header.vue"; import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js"; import { getFun, postFun } from "@/service/table.js";
import { import {
getFormList, getFormList,
postHdSource, postHdSource,
postHdType, postHdType,
postHdPeople, postHdPeople,
postReAdd, postReAdd,
postriskConiCause, postriskConiCause,
postRiskShowMeasures, postRiskShowMeasures,
} from "@/service/risk"; } from "@/service/risk";
export default { export default {
name: "risk-add", name: "risk-add",
components: { components: {
LHeader, LHeader,
}, },
activated() { activated() {
this.showSetRank = false; // 再次关闭弹出层 以防万一 this.showSetRank = false; // 再次关闭弹出层 以防万一
if (this.$route.params.status) { if (this.$route.params.status) {
this.isShowreturnCause = true; this.isShowreturnCause = true;
this.text = "风险上报退回"; this.text = "风险上报退回";
this.taskId = this.$route.params.taskId; this.taskId = this.$route.params.taskId;
this.postReturnEcho(); this.postReturnEcho();
} }
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) {
this.riskRank = res; this.riskRank = res;
} else { } else {
this.setRank = ""; this.setRank = "";
} }
// 销毁一下监听事件 不然会越加越多 // 销毁一下监听事件 不然会越加越多
this.$bus.$off("riskLevelBus"); this.$bus.$off("riskLevelBus");
}); });
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (to.name != "matrix-grad") { if (to.name != "matrix-grad") {
(this.text = "新增风险"), (this.text = "新增风险"),
(this.taskId = ""), (this.taskId = ""),
(this.id = ""), (this.id = ""),
(this.projectId = ""), // 所属工程 (this.projectId = ""), // 所属工程
(this.projectName = ""), // 所属工程 (this.projectName = ""), // 所属工程
(this.showProjectName = false), (this.showProjectName = false),
(this.columnsProjectName = []), (this.columnsProjectName = []),
(this.factor = ""), //风险因素 (this.factor = ""), //风险因素
(this.showFactor = false), (this.showFactor = false),
(this.columnsFactor = []), (this.columnsFactor = []),
(this.source = ""), //风险源 (this.source = ""), //风险源
(this.showSource = false), (this.showSource = false),
(this.columnsSource = []), (this.columnsSource = []),
(this.trouble = ""), //事故类型 (this.trouble = ""), //事故类型
(this.showTrouble = false), (this.showTrouble = false),
(this.columnsTrouble = []), (this.columnsTrouble = []),
(this.setRank = ""), //风险定级 (this.setRank = ""), //风险定级
(this.showSetRank = false), (this.showSetRank = false),
(this.columnsSetRank = ["矩阵式定级", "其他定级方式"]), (this.columnsSetRank = ["矩阵式定级", "其他定级方式"]),
(this.riskRank = ""), // 风险等级 (this.riskRank = ""), // 风险等级
(this.showRiskRank = false), (this.showRiskRank = false),
(this.columnsRiskRank = [ (this.columnsRiskRank = [
"一般风险", "一般风险",
"较小风险", "较小风险",
"较大风险", "较大风险",
"重大风险", "重大风险",
]), ]),
(this.setRankMode = ""), // 定级方式文字 (this.setRankMode = ""), // 定级方式文字
(this.setRankModeImg = []), // 定级方式图片 (this.setRankModeImg = []), // 定级方式图片
(this.location = ""), //风险部位 (this.location = ""), //风险部位
(this.control = ""), //管控层级 (this.control = ""), //管控层级
(this.showControl = false), (this.showControl = false),
(this.columnsControl = ["项目级", "企业级"]), (this.columnsControl = ["项目级", "企业级"]),
(this.mainDutyDept = ""), // 主责部门 (this.mainDutyDept = ""), // 主责部门
(this.mainDutyDeptId = ""), (this.mainDutyDeptId = ""),
(this.showMainDutyDept = false), (this.showMainDutyDept = false),
(this.columnsMainDutyDept = []), (this.columnsMainDutyDept = []),
(this.mainDutyPeopLe = ""), // 主责人员 (this.mainDutyPeopLe = ""), // 主责人员
(this.mainDutyPeopLeId = ""), (this.mainDutyPeopLeId = ""),
(this.showMainDutyPeopLe = false), (this.showMainDutyPeopLe = false),
(this.columnsMainDutyPeopLe = []), (this.columnsMainDutyPeopLe = []),
(this.technology = ""), //技术措施文字 (this.technology = ""), //技术措施文字
(this.technologyImg = []), //技术措施图片 (this.technologyImg = []), //技术措施图片
(this.administration = ""), //管理措施文字 (this.administration = ""), //管理措施文字
(this.administrationImg = []), //管理措施图片 (this.administrationImg = []), //管理措施图片
(this.urgent = ""), //应急措施文字 (this.urgent = ""), //应急措施文字
(this.urgentImg = []), //应急措施图片 (this.urgentImg = []), //应急措施图片
(this.returnCause = ""), // 退回原因 (this.returnCause = ""), // 退回原因
(this.isShowreturnCause = false); (this.isShowreturnCause = false);
} }
next(); next();
}, },
data() { data() {
return { return {
taskId: "", taskId: "",
text: "新增风险", text: "新增风险",
id: "", id: "",
projectId: "", // 所属工程 projectId: "", // 所属工程
projectName: "", // 所属工程 projectName: "", // 所属工程
showProjectName: false, showProjectName: false,
columnsProjectName: [], columnsProjectName: [],
factor: "", //风险因素 factor: "", //风险因素
showFactor: false, showFactor: false,
columnsFactor: [], columnsFactor: [],
source: "", //风险源 source: "", //风险源
showSource: false, showSource: false,
columnsSource: [], columnsSource: [],
trouble: "", //事故类型 trouble: "", //事故类型
showTrouble: false, showTrouble: false,
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: [], // 定级方式图片
location: "", //风险部位 location: "", //风险部位
control: "", //管控层级 control: "", //管控层级
showControl: false, showControl: false,
columnsControl: ["项目级", "企业级"], columnsControl: ["项目级", "企业级"],
mainDutyDept: "", // 主责部门 mainDutyDept: "", // 主责部门
mainDutyDeptId: "", mainDutyDeptId: "",
showMainDutyDept: false, showMainDutyDept: false,
columnsMainDutyDept: [], columnsMainDutyDept: [],
mainDutyPeopLe: "", // 主责人员 mainDutyPeopLe: "", // 主责人员
mainDutyPeopLeId: "", mainDutyPeopLeId: "",
showMainDutyPeopLe: false, showMainDutyPeopLe: false,
columnsMainDutyPeopLe: [], columnsMainDutyPeopLe: [],
technology: "", //技术措施文字 technology: "", //技术措施文字
technologyImg: [], //技术措施图片 technologyImg: [], //技术措施图片
administration: "", //管理措施文字 administration: "", //管理措施文字
administrationImg: [], //管理措施图片 administrationImg: [], //管理措施图片
urgent: "", //应急措施文字 urgent: "", //应急措施文字
urgentImg: [], //应急措施图片 urgentImg: [], //应急措施图片
returnCause: "", // 退回原因 returnCause: "", // 退回原因
isShowreturnCause: false, isShowreturnCause: false,
}; };
}, },
created() { created() {
if (this.$route.params.status) { if (this.$route.params.status) {
this.isShowreturnCause = true; this.isShowreturnCause = true;
this.text = "风险上报退回"; this.text = "风险上报退回";
this.taskId = this.$route.params.taskId; this.taskId = this.$route.params.taskId;
this.postReturnEcho(); this.postReturnEcho();
}
this.getList();
},
methods: {
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);
} }
} this.getList();
}, },
onSubmit(values) { methods: {
async deleteFile(val, detail, key) {
let formdata = new FormData(); // console.log(val,detail)
formdata.append('id',this.id); if (val.fileId) {
formdata.append("pId", this.projectId); let formdata = new FormData();
formdata.append("riskFactor", this.factor); formdata.append("key", val["fileId"]);
formdata.append("riskSource", this.source); let res = await postFun("/mobile/remove", formdata);
formdata.append("accidentType", this.trouble); if (res) {
formdata.append("level", values.setRank); console.log(res);
formdata.append("riskLevel", this.riskRank); this.$toast({
formdata.append("gradingMethod", this.setRankMode); title: "提示",
formdata.append("riskPosition", this.location); message: "删除成功!",
formdata.append("controlLevel", this.control); });
formdata.append("responsibilityDept", this.mainDutyDeptId); } else {
formdata.append("responsibilityMember", this.mainDutyPeopLeId); console.log("删除失败");
formdata.append("technicalMeasures", this.technology); this[key].splice(detail.index, 0, val);
formdata.append("managementMeasures", this.administration); }
formdata.append("emergencyMeasure", this.urgent); }
},
onSubmit(values) {
let formdata = new FormData();
formdata.append("id", this.id);
formdata.append("pId", this.projectId);
formdata.append("riskFactor", this.factor);
formdata.append("riskSource", this.source);
formdata.append("accidentType", this.trouble);
formdata.append("level", values.setRank);
formdata.append("riskLevel", this.riskRank);
formdata.append("gradingMethod", this.setRankMode);
formdata.append("riskPosition", this.location);
formdata.append("controlLevel", this.control);
formdata.append("responsibilityDept", this.mainDutyDeptId);
formdata.append("responsibilityMember", this.mainDutyPeopLeId);
formdata.append("technicalMeasures", this.technology);
formdata.append("managementMeasures", this.administration);
formdata.append("emergencyMeasure", this.urgent);
// 放图片路径 因为formdat存数组会自动变成字符串所以次用这种追加字段的方式 // 放图片路径 因为formdat存数组会自动变成字符串所以次用这种追加字段的方式
console.log(values) console.log(values);
values.setRankModeFile.forEach((item) => { values.setRankModeFile.forEach((item) => {
// 定级方式 // 定级方式
formdata.append("risk4[]", item.file); formdata.append("risk4[]", item.file);
}); });
// values.setRankModeFile.file // values.setRankModeFile.file
values.technologyFile.forEach((item) => { values.technologyFile.forEach((item) => {
// 技术措施 // 技术措施
formdata.append("risk1[]", item.file); formdata.append("risk1[]", item.file);
}); });
values.administrationFile.forEach((item) => { values.administrationFile.forEach((item) => {
// 管理措施 // 管理措施
formdata.append("risk2[]", item.file); formdata.append("risk2[]", item.file);
}); });
values.urgentFile.forEach((item) => { values.urgentFile.forEach((item) => {
// 应急措施 // 应急措施
formdata.append("risk3[]", item.file); formdata.append("risk3[]", item.file);
}); });
this.$toast.loading({ this.$toast.loading({
message: "提交中...", message: "提交中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0,
}); });
let url = "/riskMain/add"; let url = "/riskMain/add";
if (this.taskId) { if (this.taskId) {
formdata.append("id", this.id); formdata.append("id", this.id);
url = `/riskMain/editSave/${this.taskId}`; url = `/riskMain/editSave/${this.taskId}`;
} }
postReAdd(url, formdata) postReAdd(url, formdata)
.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);
}) })
.catch(() => { .catch(() => {
this.$toast.clear(); this.$toast.clear();
this.$toast.fail("提交失败,请稍后再试"); this.$toast.fail("提交失败,请稍后再试");
}); });
this.$toast.clear(); this.$toast.clear();
}, },
// 请求表单数据 // 请求表单数据
getList() { getList() {
this.$toast.loading({ this.$toast.loading({
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;
this.columnsMainDutyDept = res.data.organizationList; this.columnsMainDutyDept = res.data.organizationList;
}) })
.catch(() => { .catch(() => {
this.$toast.clear(); this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}, },
// 请求已退回详情数据 // 请求已退回详情数据
postReturnEcho() { postReturnEcho() {
this.$toast.loading({ this.$toast.loading({
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) => {
let data = res.data.riskMain; let data = res.data.riskMain;
let data1 = res.data.ResponsibilityMember; let data1 = res.data.ResponsibilityMember;
this.id=data.id; this.id = data.id;
this.projectId = data.pId; this.projectId = data.pId;
this.riskRank = data.riskLevel; this.riskRank = data.riskLevel;
this.factor = data.riskFactor; this.factor = data.riskFactor;
this.source = data.riskSource; this.source = data.riskSource;
this.trouble = data.accidentType; this.trouble = data.accidentType;
this.setRank = data.level; this.setRank = data.level;
this.setRankMode = data.grapingMethod; this.setRankMode = data.grapingMethod;
this.location = data.riskPosition; this.location = data.riskPosition;
this.control = data.controlLevel; this.control = data.controlLevel;
this.mainDutyDeptId = data.responsibilityDept; this.mainDutyDeptId = data.responsibilityDept;
this.mainDutyPeopLeId = data.responsibilityMember; this.mainDutyPeopLeId = data.responsibilityMember;
this.administration = data.managementMeasures; this.administration = data.managementMeasures;
this.urgent = data.emergencyMeasure; this.urgent = data.emergencyMeasure;
this.mainDutyPeopLe = data.mainDutyPeopLe; this.mainDutyPeopLe = data.mainDutyPeopLe;
this.mainDutyDept = data1.dept.deptName; this.mainDutyDept = data1.dept.deptName;
this.technology = data.technicalMeasures; this.technology = data.technicalMeasures;
// urgentImg administrationImg technologyImg setRankModeImg // urgentImg administrationImg technologyImg setRankModeImg
// 定级方式 // 定级方式
this.urgentImg = (res.data.imgsysFiles2 || []).map(item=>{return {...item,url:item.filePath}}); this.urgentImg = (res.data.imgsysFiles2 || []).map(
this.administrationImg = (res.data.imgsysFiles1 || []).map(item=>{return {...item,url:item.filePath}}); (item) => {
this.technologyImg = (res.data.imgsysFiles0 || []).map(item=>{return {...item,url:item.filePath}}); return {
this.setRankModeImg = (res.data.imgsysFiles3 || []).map(item=>{return {...item,url:item.filePath}}); ...item,
url: item.filePath,
// this.technologyFile = res.data.riskFileList1.map(() => { file: new File([], item["fileName"], {}),
// return { };
// ...item, }
// url: item.filePath, );
// }; this.administrationImg = (res.data.imgsysFiles1 || []).map(
// }); (item) => {
// this.urgentImg = data.riskFileList4.map(() => { return {
// console.log(111) ...item,
// return { url: item.filePath,
// ...item, file: new File([], item["fileName"], {}),
// url: item.filePath, };
// }; }
// }); );
// this.administrationImg = data.riskFileList3.map(() => { this.technologyImg = (res.data.imgsysFiles0 || []).map(
// return { (item) => {
// ...item, return {
// url: item.filePath, ...item,
// }; url: item.filePath,
// }); file: new File([], item["fileName"], {}),
// this.technologyImg = data.riskFileList2.map(() => { };
// return { }
// ...item, );
// url: item.filePath, this.setRankModeImg = (res.data.imgsysFiles3 || []).map(
// }; (item) => {
// }); return {
console.log("结果"); ...item,
// 请求人员列表 url: item.filePath,
let formdata = new FormData(); file: new File([], item["fileName"], {}),
formdata.append("organizationId", data.responsibilityDept); };
postHdPeople(`/riskMain/getUserList`, formdata).then((res) => { }
this.columnsMainDutyPeopLe = res.data; );
this.mainDutyPeopLe = this.columnsMainDutyPeopLe.filter((item) => {
return item["userId"] == data.responsibilityMember;
})[0]["userName"];
});
// console.log(data)
this.$toast.clear();
this.returnCause = res.data.reason;
})
.catch(() => {
this.$toast.clear();
});
},
// 所属项目 // 请求人员列表
onConProjectName(value) { let formdata = new FormData();
if (!value) { formdata.append("organizationId", data.responsibilityDept);
this.showProjectName = false; postHdPeople(`/riskMain/getUserList`, formdata).then(
return; (res) => {
} this.columnsMainDutyPeopLe = res.data;
this.projectId = value.id; this.mainDutyPeopLe =
this.projectName = value.projectName; this.columnsMainDutyPeopLe.filter((item) => {
this.showProjectName = false; return (
}, item["userId"] ==
// 风险因素 data.responsibilityMember
onConFactor(value) { );
if (!value) { })[0]["userName"];
this.showFactor = false; }
return; );
} // console.log(data)
this.factor = value.factorType; this.$toast.clear();
this.showFactor = false; this.returnCause = res.data.reason;
this.source = ""; })
this.trouble = ""; .catch(() => {
// 请求风险源 this.$toast.clear();
postHdSource(`/riskMain/showSourceName/${this.factor}`).then((res) => { });
this.columnsSource = res.data; },
});
},
// 风险源
onConSource(value) {
if (!value) {
this.showSource = false;
return;
}
this.source = value.sourceName;
this.showSource = false;
this.trouble = "";
// 请求事故类型
postHdType(
`/riskMain/showaccidentType/${this.factor}/${this.source}`
).then((res) => {
this.columnsTrouble = res.data;
});
},
// 事故类型
onConTrouble(value) {
if (!value) {
this.showTrouble = false;
return;
}
this.trouble = value.accidentType;
this.showTrouble = false;
// 请求三个措施
postRiskShowMeasures(
`/riskMain/showmeasures/${this.factor}/${this.source}/${this.trouble}`
).then((res) => {
this.technology = res.data[0].measuresProject;
this.administration = res.data[0].measuresAdministration;
this.urgent = res.data[0].measuresEmergency;
});
},
// 风险定级
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) { onConProjectName(value) {
this.control = value; if (!value) {
this.showControl = false; this.showProjectName = false;
}, return;
// 主责部门 }
onConMainDutyDept(value) { this.projectId = value.id;
this.mainDutyDeptId = value.deptId; this.projectName = value.projectName;
this.mainDutyDept = value.deptName; this.showProjectName = false;
this.showMainDutyDept = false; },
this.mainDutyPeopLe = ""; // 风险因素
// 请求主责人员 onConFactor(value) {
let formdata = new FormData(); if (!value) {
formdata.append("organizationId", this.mainDutyDeptId); this.showFactor = false;
postHdPeople(`/riskMain/getUserList`, formdata).then((res) => { return;
this.columnsMainDutyPeopLe = res.data; }
}); this.factor = value.factorType;
}, this.showFactor = false;
// 主责人员 this.source = "";
onConMainDutyPeopLe(value) { this.trouble = "";
this.mainDutyPeopLeId = value.userId; // 请求风险源
this.mainDutyPeopLe = value.userName; postHdSource(`/riskMain/showSourceName/${this.factor}`).then(
this.showMainDutyPeopLe = false; (res) => {
}, this.columnsSource = res.data;
}
);
},
// 风险源
onConSource(value) {
if (!value) {
this.showSource = false;
return;
}
this.source = value.sourceName;
this.showSource = false;
this.trouble = "";
// 请求事故类型
postHdType(
`/riskMain/showaccidentType/${this.factor}/${this.source}`
).then((res) => {
this.columnsTrouble = res.data;
});
},
// 事故类型
onConTrouble(value) {
if (!value) {
this.showTrouble = false;
return;
}
this.trouble = value.accidentType;
this.showTrouble = false;
// 请求三个措施
postRiskShowMeasures(
`/riskMain/showmeasures/${this.factor}/${this.source}/${this.trouble}`
).then((res) => {
this.technology = res.data[0].measuresProject;
this.administration = res.data[0].measuresAdministration;
this.urgent = res.data[0].measuresEmergency;
});
},
// 风险定级
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() { cancel() {
this.$router.go(-1); this.$router.go(-1);
},
}, },
}, watch: {
watch: { setRank(newVal, oldVal) {
setRank(newVal, oldVal) { if (newVal == "其他定级方式") {
if (newVal == "其他定级方式") { this.showSetRankMode = true;
this.showSetRankMode = true; } else {
} else { this.showSetRankMode = false;
this.showSetRankMode = false; }
} },
}, },
},
}; };
</script> </script>
<style scoped> <style scoped>
......
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