<template>
|
<div>
|
<el-form ref="form" :model="fileForm" label-width="160px" label-position="right">
|
<!-- <el-form-item label="事故救援预案:">-->
|
<!-- <el-upload-->
|
<!-- accept=".pdf,.jpg,.png"-->
|
<!-- :action="fileRoad"-->
|
<!-- class="upload-demo"-->
|
<!-- ref="upload"-->
|
<!-- :headers="header"-->
|
<!-- :data="uploadForm"-->
|
<!-- :on-change="handleChangeOne"-->
|
<!-- :auto-upload="true"-->
|
<!-- :on-remove="onRemove"-->
|
<!-- :on-success="onSuccess"-->
|
<!-- :on-preview="onPreview"-->
|
<!-- :file-list="fileListOne">-->
|
<!-- <el-button size="small" type="primary">点击上传</el-button>-->
|
<!-- </el-upload>-->
|
<!-- </el-form-item>-->
|
<el-form-item label="作业人员身体健康:">
|
<el-upload
|
accept=".pdf,.jpg,.png"
|
:action="fileRoad"
|
class="upload-demo"
|
ref="upload"
|
:headers="header"
|
:data="uploadForm"
|
:on-preview="onPreview"
|
:file-list="fileListTwo">
|
<el-button size="small" type="primary" v-if="false">点击上传</el-button>
|
</el-upload>
|
</el-form-item>
|
<el-form-item label="作业资质证书:" v-if="false">
|
<el-upload
|
accept=".pdf,.jpg,.png"
|
:action="fileRoad"
|
class="upload-demo"
|
ref="upload"
|
:data="uploadForm"
|
:on-preview="onPreview"
|
:file-list="fileListThree">
|
<el-button size="small" type="primary" v-if="false">点击上传</el-button>
|
</el-upload>
|
</el-form-item>
|
<el-form-item label="事故救援预案:" v-if="false">
|
<el-upload
|
accept=".pdf,.jpg,.png"
|
:action="fileRoad"
|
class="upload-demo"
|
ref="upload"
|
:headers="header"
|
:data="uploadForm"
|
:on-preview="onPreview"
|
:file-list="fileListOne">
|
</el-upload>
|
</el-form-item>
|
<!-- <el-form-item label="作业人员身体健康:" v-if="ifConstruction">-->
|
<!-- <el-upload-->
|
<!-- accept=".pdf,.jpg,.png"-->
|
<!-- :action="fileRoad"-->
|
<!-- class="upload-demo"-->
|
<!-- ref="upload"-->
|
<!-- :headers="header"-->
|
<!-- :data="uploadForm"-->
|
<!-- :on-change="handleChangeTwo"-->
|
<!-- :auto-upload="true"-->
|
<!-- :on-remove="onRemove"-->
|
<!-- :on-success="onSuccess"-->
|
<!-- :on-preview="onPreview"-->
|
<!-- :file-list="fileListTwo">-->
|
<!-- <el-button size="small" type="primary">点击上传</el-button>-->
|
<!-- </el-upload>-->
|
<!-- </el-form-item>-->
|
<!-- <el-form-item label="作业资质证书:" v-if="ifConstruction">-->
|
<!-- <el-upload-->
|
<!-- accept=".pdf,.jpg,.png"-->
|
<!-- :action="fileRoad"-->
|
<!-- class="upload-demo"-->
|
<!-- ref="upload"-->
|
<!-- :headers="header"-->
|
<!-- :data="uploadForm"-->
|
<!-- :on-change="handleChangeThree"-->
|
<!-- :on-remove="onRemove"-->
|
<!-- :on-success="onSuccess"-->
|
<!-- :auto-upload="true"-->
|
<!-- :on-preview="onPreview"-->
|
<!-- :file-list="fileListThree">-->
|
<!-- <el-button size="small" type="primary">点击上传</el-button>-->
|
<!-- </el-upload>-->
|
<!-- </el-form-item>-->
|
</el-form>
|
<el-dialog :visible.sync="dialogVisible">
|
<img width="100%" :src="dialogImageUrl" alt="">
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import Cookies from 'js-cookie'
|
import { deleteFile, getFileData } from '../../../../../api/task'
|
|
export default {
|
props:['basicInformation','title'],
|
name: 'index',
|
data(){
|
return{
|
ifApply:'',
|
ifCompany:'',
|
ifConstruction:'',
|
ifApplyButton:'',
|
ifCompanyButton:'',
|
disabled:'',
|
fileForm:{},
|
header:{Authorization:''},
|
fileRoad:process.env.BASE_API + '/task/upload',
|
dialogVisible:false,
|
dialogImageUrl:'',
|
riskAndDanger:[],
|
safetyOrganizeAction:[],
|
workSecurityAction:[],
|
fileList:[],
|
fileListOne:[],
|
fileListTwo:[],
|
fileListThree:[],
|
uploadForm:{
|
taskcode:'',
|
type:'',
|
}
|
}
|
},
|
mounted(){
|
this.getFileList()
|
},
|
methods:{
|
async onPreview(file){
|
window.open( process.env.IMG_API + file.fileurl,'_blank')
|
},
|
async getFileList(){
|
let params = {}
|
params["taskCode"] = this.basicInformation.code
|
let res = await getFileData(params)
|
if(res.data.code === '200'){
|
this.fileList = []
|
this.fileListOne = []
|
this.fileListTwo = []
|
this.fileListThree = []
|
this.fileList = res.data.result
|
this.fileList.map(item =>{
|
return Object.assign(item,{name:item.originalname})
|
})
|
for(let i in this.fileList){
|
if(this.fileList[i].type === '事故救援预案'){
|
this.fileListOne.push(this.fileList[i])
|
}
|
}
|
for(let i in this.fileList){
|
if(this.fileList[i].type === '作业人员身体健康'){
|
this.fileListTwo.push(this.fileList[i])
|
}
|
}
|
for(let i in this.fileList){
|
if(this.fileList[i].type === '作业资质证书'){
|
this.fileListThree.push(this.fileList[i])
|
}
|
}
|
}
|
},
|
submit(){
|
this.uploadForm.type = "事故救援预案"
|
this.uploadForm.taskcode = this.basicInformation.code
|
this.header.Authorization = Cookies.get('token')
|
this.$refs.upload.submit()
|
},
|
handlePictureCardPreview(file) {
|
this.dialogImageUrl = file.url;
|
this.dialogVisible = true;
|
},
|
handleChangeOne(file, fileList) {
|
this.uploadForm.type = '事故救援预案'
|
this.uploadForm.taskcode = this.basicInformation.code
|
this.header.Authorization = Cookies.get('token')
|
},
|
handleChangeTwo(file, fileList) {
|
this.uploadForm.type = '作业人员身体健康';
|
this.uploadForm.taskcode = this.basicInformation.code
|
this.header.Authorization = Cookies.get('token')
|
},
|
handleChangeThree(file, fileList) {
|
this.uploadForm.type = '作业资质证书';
|
this.uploadForm.taskcode = this.basicInformation.code
|
this.header.Authorization = Cookies.get('token')
|
},
|
onSuccess(response){
|
if(response.code === '200'){
|
this.$notify({
|
type:'success',
|
duration:2000,
|
message:'上传成功',
|
title:'成功',
|
})
|
this.getFileList()
|
}
|
},
|
onRemove(file,fileList){
|
return this.$confirm(`确定移除 ${ file.name }?`,'提示',{
|
confirmButtonText:'确定',
|
cancelButtonText:'取消',
|
type:'warning',
|
}).then(() =>{
|
let params = {}
|
params["id"] = file.id
|
deleteFile(params).then(res =>{
|
if(res.data.code === '200'){
|
this.$notify({
|
type:'success',
|
duration:2000,
|
message:'删除成功',
|
title:'成功',
|
})
|
this.getFileList()
|
}else{
|
this.$message({
|
type:'warning',
|
message:res.data.message
|
})
|
}
|
})
|
})
|
},
|
goNext(){
|
if(this.title === '施工单位确认'){
|
this.$emit('changeToConstructionConfirm')
|
}else{
|
this.$emit('confirmConstruction')
|
}
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|