diff --git a/src/api/qc/qc.js b/src/api/qc/qc.js index 2b16c45..242e80b 100644 --- a/src/api/qc/qc.js +++ b/src/api/qc/qc.js @@ -111,6 +111,7 @@ export const saveFAIInspection = data => createAPI(`/pms/qc/saveFAIInspection`,' export const qcFQCInspectionSearch = data => createAPI(`/pms/qc/qcFQCInspectionSearch`,'post',data) export const fqcDetailSearch = data => createAPI(`/pms/qc/fqcDetailSearch`,'post',data) export const fqcRecordDelete = data => createAPI(`/pms/qc/fqcRecordDelete`,'post',data) +export const markFQCWorkFileRead = data => createAPI(`/pms/qc/markFQCWorkFileRead`,'post',data) export const saveFQCDetailedRecord = data => createAPI(`/pms/qc/saveFQCDetailedRecord`,'post',data) export const saveFQCSubmitResult = data => createAPI(`/pms/qc/saveFQCSubmitResult`,'post',data) export const saveFQCSubDetailed = data => createAPI(`/pms/qc/saveFQCSubDetailed`,'post',data) @@ -158,6 +159,7 @@ export const getColumnDisplayFlagList = data => createAPI(`/pms/pqc/getColumnDis export const qcIPQCInspectionSearch = data => createAPI(`/pms/qc/qcIPQCInspectionSearch`,'post',data) export const ipqcDetailSearch = data => createAPI(`/pms/qc/ipqcDetailSearch`,'post',data) export const ipqcRecordDelete = data => createAPI(`/pms/qc/ipqcRecordDelete`,'post',data) +export const markIPQCWorkFileRead = data => createAPI(`/pms/qc/markIPQCWorkFileRead`,'post',data) export const saveIPQCDetailedRecord = data => createAPI(`/pms/qc/saveIPQCDetailedRecord`,'post',data) export const saveIPQCSubmitResult = data => createAPI(`/pms/qc/saveIPQCSubmitResult`,'post',data) export const saveIPQCSubDetailed = data => createAPI(`/pms/qc/saveIPQCSubDetailed`,'post',data) diff --git a/src/views/modules/qc/FQCResultEntry.vue b/src/views/modules/qc/FQCResultEntry.vue index 84015dd..7dadfb8 100644 --- a/src/views/modules/qc/FQCResultEntry.vue +++ b/src/views/modules/qc/FQCResultEntry.vue @@ -101,6 +101,15 @@ + + + + :query-loading="fileLoading" @file-previewed="onWorkFilePreviewed"> 关闭 @@ -802,6 +811,7 @@ import { fqcDetailSearch, // 查询FAI的检验明细 inspectorSearch, // 查询检验员 fqcRecordDelete, // 删除检验记录 + markFQCWorkFileRead, // 标记工作文件已阅读 saveFQCDetailedRecord, // 新增明细信息 saveFQCSubmitResult, // 审核 saveFQCSubDetailed, // 新增子明细信息 @@ -917,6 +927,7 @@ export default { inspectionNo: '', fileFlag: false, fileContentList: [], + currentWorkFileRow: null, // 是否收藏 favorite: false, // 导出 start @@ -3290,8 +3301,58 @@ export default { this.FAISelections = val }, + resolveWorkFileRow(row) { + if (!row || !row.inspectionNo) { + return row + } + const matched = this.dataList.find(item => + item.site === row.site && item.buNo === row.buNo && item.inspectionNo === row.inspectionNo + ) + return matched || row + }, + + saveWorkFileReadToServer(row) { + const target = this.resolveWorkFileRow(row) + if (!target || !target.inspectionNo || target.workFileRead === 'Y') { + return Promise.resolve() + } + return markFQCWorkFileRead({ + site: target.site, + buNo: target.buNo, + inspectionNo: target.inspectionNo + }).then(({ data }) => { + if (data && data.code === 0) { + this.$set(target, 'workFileRead', 'Y') + } + }) + }, + + onWorkFilePreviewed() { + if (this.currentWorkFileRow) { + this.saveWorkFileReadToServer(this.currentWorkFileRow) + } + }, + + fetchWorkFiles(row) { + const currentData = { + orderRef1: row.site, + orderRef2: row.inspectionNo, + orderRef4: row.buNo, + partNo: row.partNo, + } + return getInspectionFile(currentData) + .then(({ data }) => { + if (data && data.code === 0) { + return data.rows || [] + } + return [] + }) + .catch(() => []) + }, + // 刷新派设备文档的列表 getFileContentData(row) { + this.currentWorkFileRow = this.resolveWorkFileRow(row) let currentData = { orderRef1: row.site, orderRef2: row.inspectionNo, @@ -3307,6 +3368,7 @@ export default { } else { this.fileContentList = [] } + this.$set(this.resolveWorkFileRow(row), 'hasWorkFile', this.fileContentList.length > 0 ? 'Y' : 'N') this.fileLoading = false }) .catch(() => { @@ -3601,6 +3663,29 @@ export default { // 明细记录信息查询 detailModal(row) { + if (row.state === '待检验' && row.workFileRead !== 'Y') { + if (row.hasWorkFile === 'N') { + this.openDetailModal(row) + return + } + this.fetchWorkFiles(row).then(files => { + const target = this.resolveWorkFileRow(row) + this.$set(target, 'hasWorkFile', files.length > 0 ? 'Y' : 'N') + if (files.length > 0 && target.workFileRead !== 'Y') { + this.$message.warning('请先预览工作文件后再进行检验操作') + this.currentWorkFileRow = target + this.fileContentList = files + this.fileFlag = true + return + } + this.openDetailModal(row) + }) + return + } + this.openDetailModal(row) + }, + + openDetailModal(row) { this.detailData.site = row.site this.detailData.buNo = row.buNo this.detailData.inspectionNo = row.inspectionNo diff --git a/src/views/modules/qc/IPQCResultEntry.vue b/src/views/modules/qc/IPQCResultEntry.vue index 03d0de2..bcb0987 100644 --- a/src/views/modules/qc/IPQCResultEntry.vue +++ b/src/views/modules/qc/IPQCResultEntry.vue @@ -133,6 +133,19 @@ + + + 上传文件 - + 关闭 @@ -907,6 +920,7 @@ ipqcDetailSearch, // 查询IPQC的检验明细 inspectorSearch, // 查询检验员 ipqcRecordDelete, // 删除检验记录 + markIPQCWorkFileRead, // 标记工作文件已阅读 saveIPQCDetailedRecord, // 新增明细信息 saveIPQCSubmitResult, // 审核 saveIPQCSubDetailed, // 新增子明细信息 @@ -1010,6 +1024,7 @@ inspectionNo: '', fileFlag: false, fileContentList: [], + currentWorkFileRow: null, // 是否收藏 favorite: false, // 导出 start @@ -3000,8 +3015,56 @@ this.IPQCSelections = val }, + resolveWorkFileRow (row) { + if (!row || !row.inspectionNo) { + return row + } + const matched = this.dataList.find(item => + item.site === row.site && item.buNo === row.buNo && item.inspectionNo === row.inspectionNo + ) + return matched || row + }, + + saveWorkFileReadToServer (row) { + const target = this.resolveWorkFileRow(row) + if (!target || !target.inspectionNo || target.workFileRead === 'Y') { + return Promise.resolve() + } + return markIPQCWorkFileRead({ + site: target.site, + buNo: target.buNo, + inspectionNo: target.inspectionNo + }).then(({data}) => { + if (data && data.code === 0) { + this.$set(target, 'workFileRead', 'Y') + } + }) + }, + + onWorkFilePreviewed () { + if (this.currentWorkFileRow) { + this.saveWorkFileReadToServer(this.currentWorkFileRow) + } + }, + + fetchWorkFiles (row) { + const currentData = { + orderRef1: row.site, + orderRef2: row.inspectionNo, + orderRef4: row.buNo, + partNo: row.partNo + } + return getInspectionFile(currentData).then(({data}) => { + if (data && data.code === 0) { + return data.rows || [] + } + return [] + }).catch(() => []) + }, + //刷新派设备文档的列表 getFileContentData (row) { + this.currentWorkFileRow = this.resolveWorkFileRow(row) let currentData = { orderRef1: row.site, orderRef2: row.inspectionNo, @@ -3016,6 +3079,7 @@ } else { this.fileContentList = [] } + this.$set(this.resolveWorkFileRow(row), 'hasWorkFile', this.fileContentList.length > 0 ? 'Y' : 'N') this.fileLoading = false }).catch(()=>{ this.fileLoading = false @@ -3686,6 +3750,29 @@ // 明细记录信息查询 detailModal (row) { + if (row.state === '待检验' && row.workFileRead !== 'Y') { + if (row.hasWorkFile === 'N') { + this.openDetailModal(row) + return + } + this.fetchWorkFiles(row).then(files => { + const target = this.resolveWorkFileRow(row) + this.$set(target, 'hasWorkFile', files.length > 0 ? 'Y' : 'N') + if (files.length > 0 && target.workFileRead !== 'Y') { + this.$message.warning('请先预览工作文件后再进行检验操作') + this.currentWorkFileRow = target + this.fileContentList = files + this.fileFlag = true + return + } + this.openDetailModal(row) + }) + return + } + this.openDetailModal(row) + }, + + openDetailModal (row) { this.detailData.site = row.site this.detailData.buNo = row.buNo this.detailData.inspectionNo = row.inspectionNo diff --git a/src/views/modules/qc/IQCFileTable.vue b/src/views/modules/qc/IQCFileTable.vue index c0ec993..04dedea 100644 --- a/src/views/modules/qc/IQCFileTable.vue +++ b/src/views/modules/qc/IQCFileTable.vue @@ -18,6 +18,10 @@ export default { } }, methods: { + emitFilePreviewed (row) { + this.$emit('file-previewed', row) + }, + // 预览 previewFile (row) { // 预览文件 @@ -52,7 +56,8 @@ export default { // 创建URL来生成预览 const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览 - const newTab = window.open(fileURL, '_blank') + window.open(fileURL, '_blank') + this.emitFilePreviewed(row) }) }, @@ -90,7 +95,8 @@ export default { // 创建URL来生成预览 const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览 - const newTab = window.open(fileURL, '_blank') + window.open(fileURL, '_blank') + this.emitFilePreviewed(row) }) },