|
|
|
@ -396,10 +396,14 @@ |
|
|
|
label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-link style="cursor: pointer" @click="downloadFile(scope.row)">下载</el-link> |
|
|
|
<el-link style="cursor:pointer" @click="previewFile(scope.row)">预览</el-link> |
|
|
|
<el-link style="cursor: pointer" @click="deleteFile(scope.row)">删除</el-link> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<el-footer style="height:35px;margin-top: 10px;text-align:center"> |
|
|
|
<el-button type="primary" @click="fileFlag=false">关闭</el-button> |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 子明细信息 --> |
|
|
|
@ -558,7 +562,7 @@ |
|
|
|
} from "@/api/qc/qc.js" |
|
|
|
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|
|
|
import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js' |
|
|
|
import {getFileContentList2, downLoadObjectFile} from '@/api/eam/eam_object_list.js' |
|
|
|
import { |
|
|
|
deleteObjectFile, |
|
|
|
getUserRoleList, // 获取用户角色列表 |
|
|
|
@ -1772,11 +1776,13 @@ |
|
|
|
// 刷新派设备文档的列表 |
|
|
|
getFileContentData (row) { |
|
|
|
let currentData = { |
|
|
|
orderRef1: row.site, |
|
|
|
orderRef2: row.inspectionNo, |
|
|
|
orderRef4: row.buNo, |
|
|
|
site: row.site, |
|
|
|
buNo: row.buNo, |
|
|
|
inspectionNo: row.inspectionNo, |
|
|
|
partNo: row.partNo, |
|
|
|
inspectionTypeNo: '108' |
|
|
|
} |
|
|
|
getFileContentList(currentData).then(({data}) => { |
|
|
|
getFileContentList2(currentData).then(({data}) => { |
|
|
|
//区分请求成功和失败的状况 |
|
|
|
if (data && data.code === 200) { |
|
|
|
this.fileContentList = data.rows |
|
|
|
@ -1844,12 +1850,52 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 预览 |
|
|
|
previewFile (row) { |
|
|
|
// 预览文件 |
|
|
|
let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] |
|
|
|
let type = '' |
|
|
|
if (image.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'image/' + row.fileType |
|
|
|
} |
|
|
|
let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] |
|
|
|
if (video.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'video/' + row.fileType |
|
|
|
} |
|
|
|
let txt = ['txt'] |
|
|
|
if (txt.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'text/plain' |
|
|
|
} |
|
|
|
let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] |
|
|
|
if (office.includes(row.fileType.toLowerCase())) { |
|
|
|
this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) |
|
|
|
return |
|
|
|
} |
|
|
|
let pdf = ['pdf'] |
|
|
|
if (pdf.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'application/pdf' |
|
|
|
} |
|
|
|
if (type === ''){ |
|
|
|
this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) |
|
|
|
return; |
|
|
|
} |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除文件 |
|
|
|
deleteFile (row) { |
|
|
|
let tempData = { |
|
|
|
site: row.orderRef1, |
|
|
|
inspectionNo: row.orderRef2, |
|
|
|
buNo: row.orderRef4 |
|
|
|
buNo: row.orderRef4, |
|
|
|
partNo: row.partNo, |
|
|
|
inspectionTypeNo: '108' |
|
|
|
} |
|
|
|
this.$confirm('确定要删除此文件?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
|