From 6c6e0514283c7ff3016b845b600186b464e616c4 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: Thu, 25 Aug 2022 16:44:56 +0800
Subject: [PATCH] 项目
---
src/views/doublePreventAction/hiddenDanger/hiddenDangerReform/accept/components/acceptDialog.vue | 93 +++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 86 insertions(+), 7 deletions(-)
diff --git a/src/views/doublePreventAction/hiddenDanger/hiddenDangerReform/accept/components/acceptDialog.vue b/src/views/doublePreventAction/hiddenDanger/hiddenDangerReform/accept/components/acceptDialog.vue
index 03c4ebd..0767b4f 100644
--- a/src/views/doublePreventAction/hiddenDanger/hiddenDangerReform/accept/components/acceptDialog.vue
+++ b/src/views/doublePreventAction/hiddenDanger/hiddenDangerReform/accept/components/acceptDialog.vue
@@ -7,6 +7,47 @@
<el-input class="input-add" type="textarea" :rows="2" v-model.trim="checkForm.checkAcceptDesc" placeholder="请输入验收意见" clearable></el-input>
</el-form-item>
</el-col>
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+ <el-form-item label="隐患验收图" prop="img">
+ <el-upload
+ accept=".pdf,.jpg,.png"
+ :action="fileRoad"
+ class="upload-demo"
+ ref="upload"
+ :headers="header"
+ :data="uploadForm"
+ list-type="picture-card"
+ :file-list="fileList"
+ v-model="dataForm.paths"
+ :on-change="handleChangeFile"
+ :on-success="onFileSuccess"
+ :multiple="false"
+ :auto-upload="true">
+ <i slot="default" class="el-icon-plus"></i>
+ <div slot="file" slot-scope="{file}">
+ <img
+ class="el-upload-list__item-thumbnail"
+ :src="file.url" alt=""
+ >
+ <span class="el-upload-list__item-actions">
+ <span
+ class="el-upload-list__item-preview"
+ @click="handleFile(file)"
+ >
+ <i class="el-icon-zoom-in"></i>
+ </span>
+ <span
+ v-if="!disabled"
+ class="el-upload-list__item-delete"
+ @click="handleRemove(file,file.$index)"
+ >
+ <i class="el-icon-delete"></i>
+ </span>
+ </span>
+ </div>
+ </el-upload>
+ </el-form-item>
+ </el-col>
</el-row>
</el-form>
<div align="right" class="dialog-footer">
@@ -21,15 +62,17 @@
import { hiddenDangerAccept,hiddenDangerReject} from '@/api/hiddenDanger';
import { getToken} from "@/utils/auth";
import {checkHiddenDangerReport, submitHiddenDangerReport} from "../../../../../../api/hiddenDanger";
+ import Cookies from "_js-cookie@2.2.0@js-cookie";
export default {
name: "acceptDialog",
data(){
return {
- headers: {
- 'Authorization': getToken()
+ disabled:false,
+ fileRoad:process.env.BASE_API + '/task/web/upload',
+ uploadForm:{
},
- baseUrl: process.env.BASE_API + 'hiddenDanger/report',
+ header:{Authorization:''},
imgUrls:[],
imgUrls2:[],
fileList:[],
@@ -67,7 +110,8 @@
},
checkInfoForm: {
rectifyDepId: null,
- liablePersonId: null
+ liablePersonId: null,
+ acceptImages:[]
},
checkFormRules: {
checkAcceptDesc: [{ required: true, message: '请填写整改说明', trigger: 'blur' }]
@@ -85,11 +129,14 @@
submitCheck() {
this.$refs['checkFormRef'].validate(async (valid) => {
if (valid) {
+ this.checkForm.acceptImages = this.fileList.map(item => {
+ return item.url.substring(process.env.IMG_API.length)
+ })
let res = await checkHiddenDangerReport(this.checkForm);
if (res.data.code === '200') {
this.$message({
type: 'success',
- message: '整改提交成功',
+ message: '验收成功',
duration: 2000
});
this.isShowCheckDialog = false;
@@ -137,8 +184,40 @@
this.submiting = false
})
},
- handleChange(file, fileList) {
- this.fileList = fileList
+ handleChangeFile(){
+ this.header.Authorization = Cookies.get('token')
+ },
+ onFileSuccess(response){
+ if(response.code === '200'){
+ this.fileList.push({url:process.env.IMG_API + response.result.path})
+ this.$notify({
+ type:'success',
+ duration:2000,
+ message:'上传成功',
+ title:'成功',
+ })
+ }else{
+ this.$message({
+ message:res.data.message,
+ type:'warning'
+ })
+ }
+ },
+ handleFile(file){
+ this.dialogImageUrl = file.url;
+ this.dialogVisible = true;
+ },
+ showImg(file){
+ window.open(file, '_blank')
+ },
+ handleRemove(file,value){
+ return this.$confirm(`确定移除 ${ file.uid }?`,'提示',{
+ confirmButtonText:'确定',
+ cancelButtonText:'取消',
+ type:'warning',
+ }).then(()=> {
+ this.fileList.splice(value,1)
+ })
},
}
}
--
Gitblit v1.9.2