Commit 37ca0095 authored by 王李辉's avatar 王李辉

上传附件

parent 26cd1e8f
......@@ -214,7 +214,7 @@
<van-field name="hdVideo1" label="隐患视频">
<template #input>
<van-uploader v-model="uploaderVideo" />
<van-uploader v-model="uploaderVideo" accept="video/*" />
</template>
</van-field>
<van-field
......@@ -300,44 +300,44 @@ export default {
});
},
beforeRouteLeave(to, from, next) {
if ((to.name != "choose-people")) {
// 如果去的路由是
this.projectId = ""; // 所属工程
this.taskId = "";
this.projectName = "";
this.showProjectName = false;
this.columnsProjectName = [];
this.range = ""; //适用范围
this.showRange = false;
this.columnsRange = [];
this.type = ""; //隐患类型
this.showType = false;
this.columnsType = [];
this.dangerName = ""; //隐患项目名称
this.showDangerName = false;
this.columnsDangerName = [];
this.dangerNum = ""; //隐患项目编号
this.dangerLevel = ""; //隐患项目级别
this.findTime = ""; //隐患发现时间
this.showFindTime = false;
this.source = ""; // 风险源
this.showSource = false;
this.columnsSource = [];
this.source1 = ""; // 风险源第二个字段
this.showSource1 = false;
this.columnsSource1 = [];
this.location = ""; // 检查部位
this.describe = ""; // 隐患描述
this.uploaderImg = []; //图像上传
this.uploaderVideo = []; //视频上传
this.expireTime = ""; // 隐患到期时间
this.showExpireTime = false;
this.recPeople = "";
this.showRecPeople = false;
this.columnsRecPeople = [];
this.isShowreturnCause = false;
this.returnCause = ""; // 退回原因
}
if (to.name != "choose-people") {
// 如果去的路由是
this.projectId = ""; // 所属工程
this.taskId = "";
this.projectName = "";
this.showProjectName = false;
this.columnsProjectName = [];
this.range = ""; //适用范围
this.showRange = false;
this.columnsRange = [];
this.type = ""; //隐患类型
this.showType = false;
this.columnsType = [];
this.dangerName = ""; //隐患项目名称
this.showDangerName = false;
this.columnsDangerName = [];
this.dangerNum = ""; //隐患项目编号
this.dangerLevel = ""; //隐患项目级别
this.findTime = ""; //隐患发现时间
this.showFindTime = false;
this.source = ""; // 风险源
this.showSource = false;
this.columnsSource = [];
this.source1 = ""; // 风险源第二个字段
this.showSource1 = false;
this.columnsSource1 = [];
this.location = ""; // 检查部位
this.describe = ""; // 隐患描述
this.uploaderImg = []; //图像上传
this.uploaderVideo = []; //视频上传
this.expireTime = ""; // 隐患到期时间
this.showExpireTime = false;
this.recPeople = "";
this.showRecPeople = false;
this.columnsRecPeople = [];
this.isShowreturnCause = false;
this.returnCause = ""; // 退回原因
}
next();
},
......@@ -386,6 +386,7 @@ export default {
onSubmit(values) {
console.log("submit", values);
let formdata = new FormData();
formdata.append("proId", this.projectId);
formdata.append("hdRange", values.hdRange);
formdata.append("hdType", values.hdType);
......@@ -397,10 +398,15 @@ export default {
formdata.append("dangerSource", values.dangerSource);
formdata.append("hdPosition", values.hdPosition);
formdata.append("hdDescribe", values.hdDescribe);
formdata.append("hdPicture1[]", values.hdPicture1);
formdata.append("hdVideo1[]", values.hdVideo1);
formdata.append("hdExpirationTime", values.hdExpirationTime);
formdata.append("rectificationUser", values.rectificationUser);
// 放图片路径 因为formdat存数组会自动变成字符串所以次用这种追加字段的方式
values.hdPicture1.forEach(item => {
formdata.append("hdPicture1[]", item.file);
});
values.hdVideo1.forEach(item => {
formdata.append("hdVideo1[]", item.file);
});
this.$toast.loading({
message: "提交中...",
forbidClick: true,
......
......@@ -65,7 +65,7 @@
:rules="[{ required: true, message: '隐患整改详情描述不能为空' }]"
/>
<van-field name="uploader" label="整改照片">
<van-field name="uploader" label="整改照片" :rules="[{ required: true, message: '整改照片不能为空' }]">
<template #input>
<van-uploader v-model="uploaderImg" />
</template>
......@@ -73,7 +73,7 @@
<van-field name="uploader2" label="整改视频">
<template #input>
<van-uploader v-model="uploaderVideo" />
<van-uploader v-model="uploaderVideo" accept="video/*" />
</template>
</van-field>
......@@ -145,8 +145,13 @@ export default {
});
let formdata = new FormData();
formdata.append("details", this.value);
// formdata.append("rePicture[]", values.uploader);
// formdata.append("reVideo[]", values.uploader2);
// 放图片路径 因为formdat存数组会自动变成字符串所以次用这种追加字段的方式
values.uploader.forEach(item => {
formdata.append("rePicture1[]", item.file);
});
values.uploader2.forEach(item => {
formdata.append("reVideo1[]", item.file);
});
// 判断保存的url
let url = `/rectification/add1/${this.taskId}`;
if (this.taskName == "隐患整改(已退回)") {
......
......@@ -74,6 +74,7 @@
<van-field
name="uploader"
label="隐患复查照片"
:rules="[{ required: true, message: '隐患复查照片不能为空' }]"
>
<template #input>
<van-uploader v-model="uploaderImg" />
......@@ -156,8 +157,12 @@ export default {
});
let formdata = new FormData()
formdata.append('reviewResult', this.radio)
// formdata.append('reviewPicture[]', values.uploader)
formdata.append('reviewDetails', values.reviewDetails)
// 放图片路径 因为formdat存数组会自动变成字符串所以次用这种追加字段的方式
values.uploader.forEach(item => {
formdata.append("reviewPicture1[]", item.file);
});
dangerReviewAdd(`/review/add1/${this.taskId}`,formdata)
.then(res => {
this.$toast.clear();
......
This diff is collapsed.
......@@ -67,6 +67,16 @@
>
<van-col span="17">{{ riskMain.gradingMethod }}</van-col>
</van-row>
<van-row gutter="">
<van-col span="7"
><span class="field-title">定级方式(附件):</span></van-col
>
<van-col span="17">
<div class="enclosure" v-for="(item, index) in riskMain.riskFileList1" :key="index">
<a :href="item.filePath" target="_blank">{{item.fileName}}</a>
</div>
</van-col>
</van-row>
<van-row gutter="">
<van-col span="7"
><span class="field-title">技术措施:</span></van-col
......@@ -77,7 +87,11 @@
<van-col span="7"
><span class="field-title">技术措施(附件):</span></van-col
>
<van-col span="17">{{ riskMain.technicalMeasures }}</van-col>
<van-col span="17">
<div class="enclosure" v-for="(item, index) in riskMain.riskFileList2" :key="index">
<a :href="item.filePath" target="_blank">{{item.fileName}}</a>
</div>
</van-col>
</van-row>
<van-row gutter="">
<van-col span="7"
......@@ -89,7 +103,11 @@
<van-col span="7"
><span class="field-title">管理措施(附件):</span></van-col
>
<van-col span="17">{{ riskMain.managementMeasures }}</van-col>
<van-col span="17">
<div class="enclosure" v-for="(item, index) in riskMain.riskFileList3" :key="index">
<a :href="item.filePath" target="_blank">{{item.fileName}}</a>
</div>
</van-col>
</van-row>
<van-row gutter="">
<van-col span="7"
......@@ -101,7 +119,11 @@
<van-col span="7"
><span class="field-title">应急措施(附件):</span></van-col
>
<van-col span="17">{{ riskMain.emergencyMeasure }}</van-col>
<van-col span="17">
<div class="enclosure" v-for="(item, index) in riskMain.riskFileList4" :key="index">
<a :href="item.filePath" target="_blank">{{item.fileName}}</a>
</div>
</van-col>
</van-row>
</div>
</van-cell-group>
......
......@@ -154,9 +154,9 @@
autosize
placeholder="请输入"
/>
<van-field name="定级方式" label=" ">
<van-field name="setRankModeFile" label=" ">
<template #input>
<van-uploader v-model="setRankModeImg" />
<van-uploader v-model="setRankModeImg" accept="file"/>
</template>
</van-field>
......@@ -237,9 +237,9 @@
autosize
placeholder="请输入"
/>
<van-field name="技术措施" label=" ">
<van-field name="technologyFile" label=" ">
<template #input>
<van-uploader v-model="technologyImg" />
<van-uploader v-model="technologyImg" accept="file"/>
</template>
</van-field>
......@@ -252,9 +252,9 @@
autosize
placeholder="请输入"
/>
<van-field name="管理措施" label=" ">
<van-field name="administrationFile" label=" ">
<template #input>
<van-uploader v-model="administrationImg" />
<van-uploader v-model="administrationImg" accept="file"/>
</template>
</van-field>
......@@ -267,9 +267,9 @@
autosize
placeholder="请输入"
/>
<van-field name="应急措施" label=" ">
<van-field name="urgentFile" label=" ">
<template #input>
<van-uploader v-model="urgentImg" />
<van-uploader v-model="urgentImg" accept="file"/>
</template>
</van-field>
......@@ -370,6 +370,20 @@ export default {
formdata.append("managementMeasures", this.administration);
formdata.append("emergencyMeasure", this.urgent);
// 放图片路径 因为formdat存数组会自动变成字符串所以次用这种追加字段的方式
values.setRankModeFile.forEach(item => { // 定级方式
formdata.append("risk1[]", item.file);
});
values.technologyFile.forEach(item => { // 技术措施
formdata.append("risk2[]", item.file);
});
values.administrationFile.forEach(item => { // 管理措施
formdata.append("risk3[]", item.file);
});
values.urgentFile.forEach(item => { // 应急措施
formdata.append("risk4[]", item.file);
});
this.$toast.loading({
message: "提交中...",
......@@ -520,7 +534,7 @@ export default {
myRiskRank(){
console.log(this.setRank);
if(this.setRank == ""){
this.$toast("请先选择风险源");
this.$toast("其他定级方式");
}else if(this.setRank == "其他定级方式"){
this.showRiskRank = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment