编辑查看文件管理上传

This commit is contained in:
zzyuan 2024-11-07 11:21:22 +08:00
parent 6613e9fe16
commit 83a3627af9
2 changed files with 43 additions and 33 deletions

View File

@ -111,7 +111,7 @@
<el-table v-loading="dialogLoading" :data="fileDataList" width="100%" height="350px">
<el-table-column label="序号" type="index" width="55" align="center"/>
<el-table-column label="报告类型" align="center" prop="dictLabel" :show-overflow-tooltip="true"/>
<el-table-column label="文件名称" align="center" prop="fileName" :show-overflow-tooltip="true"/>
<el-table-column label="文件名称" align="center" prop="name" :show-overflow-tooltip="true"/>
<el-table-column label="类型名称" align="center" :show-overflow-tooltip="true">
<template>
<div>{{this.rowData.maTypeName}}</div>
@ -126,8 +126,8 @@
<el-table-column label="截止有效期" align="center" prop="orgName" :show-overflow-tooltip="true"/> -->
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<div style="display: flex;align-items: center;justify-content: space-between;">
<el-upload ref="upload" :limit="1" :headers="upload.headers"
<div style="display: flex;align-items: center;justify-content: center;">
<el-upload ref="upload" :limit="1" :headers="upload.headers" v-show="!isView"
:action="upload.url" :show-file-list="false" accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
:on-success="handleFileSuccess" :auto-upload="true"
>
@ -136,7 +136,7 @@
</el-button>
</el-upload>
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.fileUrl">
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.url" style="margin-left: 10px;">
查看
</el-button>
</div>
@ -192,11 +192,11 @@
open: false,
rowData:{},
fileDataList: [
{dictLabel:"合格证",dictCode:"0",fileName:"",fileUrl:""},
{dictLabel:"型式试验报告",dictCode:"1",fileName:"",fileUrl:""},
{dictLabel:"出厂检测报告",dictCode:"2",fileName:"",fileUrl:""},
{dictLabel:"第三方监测报告",dictCode:"3",fileName:"",fileUrl:""},
{dictLabel:"其他报告",dictCode:"4",fileName:"",fileUrl:""},
{dictLabel:"合格证",fileType:"0",name:"",url:""},
{dictLabel:"型式试验报告",fileType:"1",name:"",url:""},
{dictLabel:"出厂检测报告",fileType:"2",name:"",url:""},
{dictLabel:"第三方监测报告",fileType:"3",name:"",url:""},
{dictLabel:"其他报告",fileType:"4",name:"",url:""},
],
//
queryParams: {
@ -295,24 +295,34 @@
//
openFileDialog(row){
this.rowData=row;
// this.getFileData()
this.fileDataList = [{dictLabel:"合格证",fileType:"0",name:"",url:""},
{dictLabel:"型式试验报告",fileType:"1",name:"",url:""},
{dictLabel:"出厂检测报告",fileType:"2",name:"",url:""},
{dictLabel:"第三方监测报告",fileType:"3",name:"",url:""},
{dictLabel:"其他报告",fileType:"4",name:"",url:""}]
this.getFileData()
this.open=true
},
// getFileData(){
// let param = {
// typeId:this.rowData.typeId,
// taskId:this.rowData.taskId
// }
// this.dialogLoading=true
// getPurchaseFileList(param).then((response) => {
// this.fileDataList=response.data
// this.dialogLoading = false;
// }).catch(() => {this.dialogLoading = false;})
// },
getFileData(){
let param = {
modelId:this.rowData.typeId,
taskType:0,
taskId:this.rowData.taskId
}
getPurchaseFileList(param).then((response) => {
if(response.rows.length>0){
response.rows.forEach(item=>{
let index = this.fileDataList.findIndex(v=>v.fileType==item.fileType)
this.fileDataList[index].name = item.name
this.fileDataList[index].url = item.url
})
}
}).catch(() => {
})
},
beforeFileUpload(row){
this.rowData.dictCode=row.dictCode;
this.rowData.dictLabel=row.dictLabel;
this.rowData.fileType=row.fileType;
// this.rowData.dictLabel=row.dictLabel;
},
//
handleFileSuccess(response, file, fileList) {
@ -323,7 +333,7 @@
"name": response.data.name,
"url": response.data.url,
"modelId": this.rowData.typeId,
"fileType": this.rowData.dictCode,
"fileType": this.rowData.fileType,
}
console.log(param)
uploadPurchaseFile(param).then((response) => {
@ -336,12 +346,12 @@
},
//
picturePreview(file) {
this.dialogImageUrl = file.fileUrl;
const parts = file.fileName.split('.');
this.dialogImageUrl = file.url;
const parts = file.name.split('.');
const extension = parts.pop();
if(extension === 'doc'||extension === 'docx'||extension === 'pdf'){
const windowName = file.fileName;
window.open(file.fileUrl,windowName)
const windowName = file.name;
window.open(file.url,windowName)
}else{
this.dialogVisible = true
}

View File

@ -591,7 +591,7 @@ export default {
},
/** 保存按钮操作 */
handleSave() {
console.log(this.equipmentList)
// console.log(this.equipmentList)
if (this.equipmentList.length > 0) {
this.$refs['maForm'].validate((valid) => {
if (valid) {
@ -621,7 +621,7 @@ export default {
})
} else if (!this.isEdit) {
console.log('新增')
console.log(this.equipmentList)
// console.log(this.equipmentList)
this.loading = true
addPurchaseCheckInfo({purchaseCheckDetailsList: this.equipmentList,purchaseCheckInfo:this.maForm}).then((response) => {
if (response.code == 200) {
@ -652,12 +652,12 @@ export default {
//
openFileDialog(row){
this.rowData=row;
if(this.taskId==""){
this.fileDataList = [{dictLabel:"合格证",fileType:"0",name:"",url:""},
this.fileDataList = [{dictLabel:"合格证",fileType:"0",name:"",url:""},
{dictLabel:"型式试验报告",fileType:"1",name:"",url:""},
{dictLabel:"出厂检测报告",fileType:"2",name:"",url:""},
{dictLabel:"第三方监测报告",fileType:"3",name:"",url:""},
{dictLabel:"其他报告",fileType:"4",name:"",url:""}]
if(this.taskId==""){
// console.log(this.rowData)
// console.log(this.rowData.bmFileInfos)
if(this.rowData.bmFileInfos.length>0){