|
|
|
@ -373,10 +373,10 @@ |
|
|
|
<!-- sop文件清单 --> |
|
|
|
<el-dialog title="图纸清单" :close-on-click-modal="false" v-drag :visible.sync="sopFileModelFlag" width="800px"> |
|
|
|
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> |
|
|
|
<el-form-item :label="' '"> |
|
|
|
<!-- <el-form-item :label="' '"> |
|
|
|
<el-button type="primary" @click="uploadSopFile">上传文件</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="检验类型" style="margin-left: 448px"> |
|
|
|
</el-form-item> --> |
|
|
|
<el-form-item label="检验类型"> |
|
|
|
<el-select v-model="sopData.inspectionTypeNo" placeholder="请选择"> |
|
|
|
<el-option label="全部" value=""></el-option> |
|
|
|
<el-option |
|
|
|
@ -411,10 +411,11 @@ |
|
|
|
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column fixed="right" header-align="center" align="center" width="100" label="操作"> |
|
|
|
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a @click="downloadFile(scope.row)">下载</a> |
|
|
|
<a type="text" size="small" @click="deleteFile(scope.row)">删除</a> |
|
|
|
<a style="margin-right: 8px" href="javascript:void(0)" @click="previewDrawingFile(scope.row)">预览</a> |
|
|
|
<a href="javascript:void(0)" @click="downloadFile(scope.row)">下载</a> |
|
|
|
<!-- <a type="text" size="small" @click="deleteFile(scope.row)">删除</a> --> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
@ -453,12 +454,14 @@ import { |
|
|
|
getSiteAndBuByUserName, |
|
|
|
dmToolInfoSearch, |
|
|
|
dmsearchToolHeader, |
|
|
|
dmMesToolDrawingList, |
|
|
|
dmMesToolDrawingDelete, |
|
|
|
dmMesToolDrawingPreview, |
|
|
|
dmMesToolDrawingDownload, |
|
|
|
} from "@/api/qc/dmBasic.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 { userFavoriteList, saveUserFavorite, removeUserFavorite } from "@/api/userFavorite.js"; |
|
|
|
import { deleteObjectFile } from "@/api/eam/eam.js"; |
|
|
|
import dmUpload from "./dm_upload.vue"; |
|
|
|
import dmSOPUploadFile from "./dm_SOP_upload_file.vue"; |
|
|
|
|
|
|
|
@ -917,7 +920,7 @@ export default { |
|
|
|
columnProp: "orderRef3", |
|
|
|
headerAlign: "center", |
|
|
|
align: "center", |
|
|
|
columnLabel: "检验类型", |
|
|
|
columnLabel: "文档类别", |
|
|
|
columnHidden: false, |
|
|
|
columnImage: false, |
|
|
|
columnSortable: true, |
|
|
|
@ -1443,14 +1446,17 @@ export default { |
|
|
|
this.authDetail = !detailFlag; |
|
|
|
this.authFile = !fileFlag; |
|
|
|
}, |
|
|
|
// SOP 文件列表相关:仍复用 EAM 文件接口 |
|
|
|
sopFileList(row) { |
|
|
|
this.sopData = { site: row.site, buNo: row.buNo, partNo: row.partNo, inspectionTypeNo: "" }; |
|
|
|
this.getFileContentList(); |
|
|
|
}, |
|
|
|
getFileContentList() { |
|
|
|
const tempData = { orderRef1: this.sopData.site, orderRef2: this.sopData.partNo, orderRef3: this.sopData.inspectionTypeNo, orderRef4: this.sopData.buNo }; |
|
|
|
getFileContentList(tempData).then(({ data }) => { |
|
|
|
const tempData = { |
|
|
|
site: this.sopData.site, |
|
|
|
partNo: this.sopData.partNo, |
|
|
|
inspectionTypeNo: this.sopData.inspectionTypeNo, |
|
|
|
}; |
|
|
|
dmMesToolDrawingList(tempData).then(({ data }) => { |
|
|
|
this.sopList = data && data.code === 200 ? data.rows : []; |
|
|
|
}); |
|
|
|
this.sopFileModelFlag = true; |
|
|
|
@ -1467,24 +1473,83 @@ export default { |
|
|
|
}; |
|
|
|
this.$nextTick(() => this.$refs.qcSOPUploadFile.init(currentData)); |
|
|
|
}, |
|
|
|
previewDrawingFile(row) { |
|
|
|
if (!row.id) { |
|
|
|
this.$message.warning("文件标识无效"); |
|
|
|
return; |
|
|
|
} |
|
|
|
dmMesToolDrawingPreview(row.id,false) |
|
|
|
.then(({ data, headers }) => { |
|
|
|
if (!data || !data.size) { |
|
|
|
this.$message.warning("未获取到文件内容"); |
|
|
|
return; |
|
|
|
} |
|
|
|
const contentType = (headers && (headers["content-type"] || headers["Content-Type"])) || ""; |
|
|
|
if (contentType.includes("text/html")) { |
|
|
|
this.$message.error("登录已过期或无权访问,请刷新后重试"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (contentType.includes("application/json")) { |
|
|
|
const reader = new FileReader(); |
|
|
|
reader.onload = () => { |
|
|
|
try { |
|
|
|
const j = JSON.parse(reader.result); |
|
|
|
this.$message.error((j && j.msg) || "预览失败"); |
|
|
|
} catch (e) { |
|
|
|
this.$message.error("预览失败"); |
|
|
|
} |
|
|
|
}; |
|
|
|
reader.readAsText(data); |
|
|
|
return; |
|
|
|
} |
|
|
|
const blob = new Blob([data], { type: contentType || "application/octet-stream" }); |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
window.open(fileURL, "_blank"); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
this.$message.error("预览失败,请检查 MES 鉴权或网络"); |
|
|
|
}); |
|
|
|
}, |
|
|
|
downloadFile(row) { |
|
|
|
downLoadObjectFile(row).then(({ data }) => { |
|
|
|
const blob = new Blob([data], { type: "application/octet-stream" }); |
|
|
|
const fileName = row.fileName; |
|
|
|
const linkNode = document.createElement("a"); |
|
|
|
linkNode.download = fileName; |
|
|
|
linkNode.style.display = "none"; |
|
|
|
linkNode.href = URL.createObjectURL(blob); |
|
|
|
document.body.appendChild(linkNode); |
|
|
|
linkNode.click(); |
|
|
|
URL.revokeObjectURL(linkNode.href); |
|
|
|
document.body.removeChild(linkNode); |
|
|
|
}); |
|
|
|
if (!row.id) { |
|
|
|
this.$message.warning("文件标识无效"); |
|
|
|
return; |
|
|
|
} |
|
|
|
dmMesToolDrawingDownload(row.id,true) |
|
|
|
.then(({ data, headers }) => { |
|
|
|
const contentType = (headers && (headers["content-type"] || headers["Content-Type"])) || ""; |
|
|
|
if (contentType.includes("application/json")) { |
|
|
|
const reader = new FileReader(); |
|
|
|
reader.onload = () => { |
|
|
|
try { |
|
|
|
const j = JSON.parse(reader.result); |
|
|
|
this.$message.error((j && j.msg) || "下载失败"); |
|
|
|
} catch (e) { |
|
|
|
this.$message.error("下载失败"); |
|
|
|
} |
|
|
|
}; |
|
|
|
reader.readAsText(data); |
|
|
|
return; |
|
|
|
} |
|
|
|
const blob = new Blob([data], { type: contentType || "application/octet-stream" }); |
|
|
|
const fileName = row.fileName || "download"; |
|
|
|
const linkNode = document.createElement("a"); |
|
|
|
linkNode.download = fileName; |
|
|
|
linkNode.style.display = "none"; |
|
|
|
linkNode.href = URL.createObjectURL(blob); |
|
|
|
document.body.appendChild(linkNode); |
|
|
|
linkNode.click(); |
|
|
|
URL.revokeObjectURL(linkNode.href); |
|
|
|
document.body.removeChild(linkNode); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
this.$message.error("下载失败,请检查 MES 服务或网络"); |
|
|
|
}); |
|
|
|
}, |
|
|
|
deleteFile(row) { |
|
|
|
this.$confirm("确定要删除此文件?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }) |
|
|
|
.then(() => { |
|
|
|
deleteObjectFile(row).then(({ data }) => { |
|
|
|
dmMesToolDrawingDelete({ id: row.id }).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.getFileContentList(); |
|
|
|
this.$message({ message: "操作成功", type: "success", duration: 1500, onClose: () => {} }); |
|
|
|
|