diff --git a/src/views/modules/dm/DMFAIResultEntry.vue b/src/views/modules/dm/DMFAIResultEntry.vue index e715200..844d871 100644 --- a/src/views/modules/dm/DMFAIResultEntry.vue +++ b/src/views/modules/dm/DMFAIResultEntry.vue @@ -690,14 +690,53 @@ - - - - - 上传文件 + + + + + + + + + + + + 查询 - + + + + + + + + 关闭 @@ -813,9 +852,6 @@ - - - @@ -868,31 +904,24 @@ cancelDMFAIApproval, queryDmTemplateList, } from "@/api/qc/dmFai.js" - import { dmToolInfoSearch, dmAttributeTemplateFirstByTool } from "@/api/qc/dmBasic.js"; + import { dmToolInfoSearch, dmAttributeTemplateFirstByTool, dmMesToolDrawingList, dmMesToolDrawingPreview, dmMesToolDrawingDownload } from "@/api/qc/dmBasic.js"; import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" import Chooselist from '@/views/modules/common/Chooselist_eam' - import {getInspectionFile} from '@/api/eam/eam_object_list.js' import { - deleteObjectFile, getUserRoleList, // 获取用户角色列表 getOperatorList } from '@/api/eam/eam.js' import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js' import {qcPrint} from '@/api/qc/qcPrint.js' - import qcFAIUploadFile from "../qc/qc_FAI_upload_file" import comQcItemImageUploadFile from "../qc/com_qc_itemImage_upload_file" import subDetailUpload from "../qc/sub_detail_upload"; - import QrCode from "../common/QrCode.vue"; - import IqcFileTable from './IQCFileTable.vue' - /*上传文件的組件*/ + import QrCode from "../common/QrCode.vue"; export default { components: { QrCode, Chooselist, - qcFAIUploadFile, comQcItemImageUploadFile, subDetailUpload, - IqcFileTable }, computed: { templateTableData () { @@ -941,7 +970,58 @@ transferLoadFlag: false, inspectionNo: '', fileFlag: false, - fileContentList: [], + sopData: { site: '', buNo: '', partNo: '', inspectionTypeNo: '' }, + sopList: [], + sopColumnList: [ + { + columnProp: 'fileName', + headerAlign: 'center', + align: 'center', + columnLabel: '文件名称', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + }, + { + columnProp: 'createdBy', + headerAlign: 'center', + align: 'center', + columnLabel: '上传人', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: false, + }, + { + columnProp: 'createDate', + headerAlign: 'center', + align: 'center', + columnLabel: '上传时间', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: false, + }, + { + columnProp: 'orderRef3', + headerAlign: 'center', + align: 'center', + columnLabel: '文档类别', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: false, + }, + ], // 是否收藏 favorite: false, // 导出 start @@ -1815,56 +1895,6 @@ columnWidth: 100, }, ], - fileColumnList: [ - { - columnProp: 'fileName', - headerAlign: "center", - align: "center", - columnLabel: '文件名称', - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '', - }, - { - columnProp: 'createdBy', - headerAlign: "center", - align: 'center', - columnLabel: '上传人', - columnHidden: false, - columnImage: false, - columnSortable: true, - sortLv: 0, - status: true, - fixed: false - }, - { - columnProp: 'createDate', - headerAlign: "center", - align: 'center', - columnLabel: '上传时间', - columnHidden: false, - columnImage: false, - columnSortable: true, - sortLv: 0, - status: true, - fixed: false - }, - { - columnProp: 'orderRef3', - headerAlign: "center", - align: 'center', - columnLabel: '备注', - columnHidden: false, - columnImage: false, - columnSortable: true, - sortLv: 0, - status: true, - fixed: false - }, - ], // 派工单号 seqInfoList: [], seqDetailFlag: false, @@ -2897,44 +2927,104 @@ this.IPQCSelections = val }, - //刷新派设备文档的列表 + // MES 刀模图纸列表(与 DMQcPartAttribute 图纸一致) getFileContentData (row) { - let currentData = { - orderRef1: row.site, - orderRef2: row.inspectionNo, - orderRef4: row.buNo, - partNo: row.partNo + this.sopData = { + site: row.site, + buNo: row.buNo, + partNo: row.partNo, + inspectionTypeNo: '823', + } + this.getMesDrawingFileList() + this.fileFlag = true + }, + getMesDrawingFileList () { + const tempData = { + site: this.sopData.site, + partNo: this.sopData.partNo, + inspectionTypeNo: this.sopData.inspectionTypeNo, } this.fileLoading = true - getInspectionFile(currentData).then(({data}) => { - //区分请求成功和失败的状况 - if (data && data.code === 0) { - this.fileContentList = data.rows - } else { - this.fileContentList = [] - } + dmMesToolDrawingList(tempData).then(({ data }) => { + this.sopList = data && data.code === 200 ? data.rows : [] this.fileLoading = false - }).catch(()=>{ + }).catch(() => { + this.sopList = [] this.fileLoading = false }) - this.fileFlag = true }, - - /*新增文件的modal*/ - addUploadFileModal () { - let currentData = { - titleCon: 'IPQC文件上传', - site: this.detailData.site, - buNo: this.detailData.buNo, - createBy: this.$store.state.user.name, - inspectionNo: this.detailData.inspectionNo, - remark: '', - folder: 'qcIPQC', + previewDrawingFile (row) { + if (!row.id) { + this.$message.warning('文件标识无效') + return } - //打开组件 去做新增业务 - this.$nextTick(() => { - this.$refs.qcFAIUploadFile.init(currentData) - }) + 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 鉴权或网络') + }) + }, + downloadDrawingFile (row) { + 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 服务或网络') + }) }, // 上传项目图片 diff --git a/src/views/modules/dm/DMQcItem.vue b/src/views/modules/dm/DMQcItem.vue index bf8b13d..baffe15 100644 --- a/src/views/modules/dm/DMQcItem.vue +++ b/src/views/modules/dm/DMQcItem.vue @@ -157,6 +157,12 @@ + + + + + + @@ -982,6 +988,7 @@ export default { minValue: row.minValue, itemRemark: row.itemRemark, itemType: "D", + valueChooseFlag: row.valueChooseFlag, methodNo: row.methodNo, methodName: row.methodName, updateBy: this.$store.state.user.name,