<template>
|
<el-dialog title="验收" :visible.sync="isShowCheckDialog" width="600px">
|
<el-form :model="checkForm" :rules="checkFormRules" ref="checkFormRef" size="default" label-width="120px">
|
<el-row :gutter="35">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-form-item label="验收意见" prop="checkAcceptDesc">
|
<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">
|
<el-button @click="isShowCheckDialog = !isShowCheckDialog" size="default">取 消</el-button>
|
<el-button type="primary" @click="submitCheck" size="default">确 定</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
|
|
<script>
|
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 {
|
disabled:false,
|
fileRoad:process.env.BASE_API + '/task/web/upload',
|
uploadForm:{
|
},
|
header:{Authorization:''},
|
imgUrls:[],
|
imgUrls2:[],
|
fileList:[],
|
imgPreviewUrls:[],
|
imgPreviewUrls2:[],
|
isView:false,
|
isReject:false,
|
submiting:false,
|
levels:[
|
{"key":"URGENT","value":"重大隐患"},
|
{"key":"COMMON","value":"一般隐患"},
|
],
|
dataForm: {
|
id:'',
|
note: '',
|
level:'',
|
rejectnote:'',
|
},
|
dialogFormVisible: false,
|
dialogStatus:'',
|
dataFormRules: {},
|
checkTypeList: [],
|
rectifyTypeList: [
|
{ id: 1, name: '即查即改' },
|
{ id: 2, name: '限期整改' }
|
],
|
departmentList: [],
|
userList: [],
|
isShowCheckDialog: false,
|
isShowCheckInfoDialog: false,
|
checkForm: {
|
id: null,
|
dangerManagerId: null,
|
checkAcceptDesc: null
|
},
|
checkInfoForm: {
|
rectifyDepId: null,
|
liablePersonId: null,
|
acceptImages:[]
|
},
|
checkFormRules: {
|
checkAcceptDesc: [{ required: true, message: '请填写整改说明', trigger: 'blur' }]
|
}
|
}
|
},
|
methods:{
|
showDialog(row){
|
this.isShowCheckDialog = true;
|
const checkForm = JSON.parse(JSON.stringify(row));
|
this.checkForm.id = checkForm.id;
|
this.checkForm.dangerManagerId = checkForm.dangerManagerId;
|
},
|
|
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: '验收成功',
|
duration: 2000
|
});
|
this.isShowCheckDialog = false;
|
this.$emit('refreshCheck');
|
} else {
|
this.$message({
|
type: 'warning',
|
message: res.data.message
|
});
|
}
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '请完善基本信息'
|
});
|
}
|
});
|
},
|
|
rejectSubmit(){
|
let params = {}
|
params['id'] = this.dataForm.id
|
params['rejectnote'] = this.dataForm.rectifynote
|
this.submit(params,hiddenDangerReject)
|
},
|
|
submit(params,func){
|
this.submiting = true
|
func(params)
|
.then(res=>{
|
if (res.data.code === '200') {
|
this.dialogFormVisible = false
|
this.$message({message: '操作成功', type: 'success'});
|
this.$emit("refresh")
|
}else{
|
this.$message({message: res.data.message, type: 'success'});
|
}
|
this.fileList = []
|
})
|
.catch(err=>{
|
console.log(err);
|
this.$message({message: '接口错误', type: 'warning'});
|
})
|
.finally(()=>{
|
this.submiting = false
|
})
|
},
|
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)
|
})
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|