diff --git a/src/views/modules/qc/FAIResultEntry.vue b/src/views/modules/qc/FAIResultEntry.vue index de8669a..b581a93 100644 --- a/src/views/modules/qc/FAIResultEntry.vue +++ b/src/views/modules/qc/FAIResultEntry.vue @@ -291,9 +291,9 @@ - + @@ -1146,24 +1146,6 @@ export default { fixed: '', columnWidth: 120, }, - { - userId: this.$store.state.user.name, - functionId: 301007, - serialNumber: '301007Table1BatchRollNo', - tableId: "301007Table1", - tableName: "FQC检验记录表", - columnProp: 'batchRollNo', - headerAlign: "center", - align: "center", - columnLabel: '老卷号', - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '', - columnWidth: 150, - }, { userId: this.$store.state.user.name, functionId: 301007, diff --git a/src/views/modules/qc/FQCResultEntry.vue b/src/views/modules/qc/FQCResultEntry.vue index 37c12f3..a3c5ad4 100644 --- a/src/views/modules/qc/FQCResultEntry.vue +++ b/src/views/modules/qc/FQCResultEntry.vue @@ -274,9 +274,6 @@ - - - @@ -1119,24 +1116,6 @@ fixed: '', columnWidth: 120, }, - { - userId: this.$store.state.user.name, - functionId: 301015, - serialNumber: '301015Table1BatchRollNo', - tableId: "301015Table1", - tableName: "FQC检验记录表", - columnProp: 'batchRollNo', - headerAlign: "center", - align: "center", - columnLabel: '老卷号', - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '', - columnWidth: 150, - }, { userId: this.$store.state.user.name, functionId: 301015, diff --git a/src/views/modules/qc/IPQCResultEntry.vue b/src/views/modules/qc/IPQCResultEntry.vue index 362223c..8167c72 100644 --- a/src/views/modules/qc/IPQCResultEntry.vue +++ b/src/views/modules/qc/IPQCResultEntry.vue @@ -293,11 +293,6 @@ - - - - - @@ -1147,24 +1142,6 @@ fixed: '', columnWidth: 120, }, - { - userId: this.$store.state.user.name, - functionId: 301014, - serialNumber: '301014Table1BatchRollNo', - tableId: "301014Table1", - tableName: "IPQC检验记录表", - columnProp: 'batchRollNo', - headerAlign: "center", - align: "center", - columnLabel: '老卷号', - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '', - columnWidth: 150, - }, { userId: this.$store.state.user.name, functionId: 301014, diff --git a/src/views/modules/qc/IQCFileTable.vue b/src/views/modules/qc/IQCFileTable.vue index 25fcbd8..c44b14c 100644 --- a/src/views/modules/qc/IQCFileTable.vue +++ b/src/views/modules/qc/IQCFileTable.vue @@ -18,52 +18,59 @@ export default { } }, methods: { - // 预览 + // 预览(sys_oss:downLoadObjectFile 返回文件流;图片/视频/PDF 用 blob URL,纯文本用读文本) previewFile (row) { - // 预览文件 - let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] - let type = '' - if (image.includes(row.fileType.toLowerCase())) { - type = 'image/' + row.fileType + const ft = (row.fileType || '').toLowerCase() + const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'] + const imageMime = { jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', gif: 'image/gif', bmp: 'image/bmp', webp: 'image/webp' } + let mime = '' + if (imageExts.includes(ft)) { + mime = imageMime[ft] || ('image/' + ft) } - let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] - if (video.includes(row.fileType.toLowerCase())) { - type = 'video/' + row.fileType + const video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] + if (video.includes(ft)) { + mime = 'video/' + ft } - let txt = ['txt'] - if (txt.includes(row.fileType.toLowerCase())) { - type = 'text/plain' + const txt = ['txt'] + if (txt.includes(ft)) { + mime = 'text/plain' } - let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] - if (office.includes(row.fileType.toLowerCase())) { - this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) + const office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] + if (office.includes(ft)) { + this.$message.warning(`暂不支持预览${ft}文件`) return } - let pdf = ['pdf'] - if (pdf.includes(row.fileType.toLowerCase())) { - type = 'application/pdf' + const pdf = ['pdf'] + if (pdf.includes(ft)) { + mime = 'application/pdf' } - if (type === ''){ - this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) - return; + if (mime === '') { + this.$message.warning(ft ? `暂不支持预览${ft}文件` : '缺少文件类型,无法预览') + return } - downLoadObjectFile(row).then(({data}) => { - // const blob = new Blob([data], { type: type }); - // // 创建URL来生成预览 - // const fileURL = URL.createObjectURL(blob); - // // 在新标签页中打开文件预览 - // const newTab = window.open(fileURL, '_blank') - - const type = 'text/plain;charset=utf-8'; // 指定编码 - const blob = new Blob([data], { type }); - const reader = new FileReader(); - reader.onload = function(e) { - const content = e.target.result; - // 新窗口展示内容 - const newTab = window.open(); - newTab.document.write('
' + content + '
'); - }; - reader.readAsText(blob, 'utf-8'); + downLoadObjectFile(row).then(({ data }) => { + if (mime === 'text/plain') { + const blob = new Blob([data], { type: 'text/plain;charset=utf-8' }) + const reader = new FileReader() + reader.onload = function (e) { + const content = e.target.result + const newTab = window.open() + if (newTab) { + newTab.document.write('
' + content + '
') + } + } + reader.readAsText(blob, 'utf-8') + return + } + const blob = new Blob([data], { type: mime }) + const fileURL = URL.createObjectURL(blob) + const newTab = window.open(fileURL, '_blank') + if (!newTab) { + URL.revokeObjectURL(fileURL) + this.$message.warning('请允许弹出窗口后再预览') + return + } + newTab.addEventListener('beforeunload', () => URL.revokeObjectURL(fileURL)) }) }, diff --git a/src/views/modules/qc/SQCResultEntry.vue b/src/views/modules/qc/SQCResultEntry.vue index 023e502..319e60e 100644 --- a/src/views/modules/qc/SQCResultEntry.vue +++ b/src/views/modules/qc/SQCResultEntry.vue @@ -49,7 +49,6 @@ -
@@ -92,7 +91,7 @@ 审核 取消审核 删除 - 任务重载 + 打印 + + + + + + + + + + + + + + + + + + + + + + + 协同人员 + 协同人员 + + + + 责任人 + 责任人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + 应用 + 保存 + 关闭 + +
+ + + + 添加 + 删除 + 批量新增 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 保存 + 关闭 + +
+ + + +
+ + + + + + + + + + + + + + + 查询 + + + + + + + + +
+ + 确认 + 关闭 + +
+ + + +
+ + + + + + + + +
+ + 保存 + 关闭 + +
+ + + + + + + + + + + + + + + + 保存 + 关闭 + + + @@ -205,7 +604,6 @@ sqcDetailSearch, inspectorSearch, selectSQCSubDetailedRecord, - checkSQCSubDetailValue, saveSQCDetailedRecord, checkSQCIsSubmit, saveSQCSubDetailed, @@ -213,33 +611,23 @@ sqcRecordDelete, disposalMeasuresSearch, sqcRecordOverLoad, - getSiteAndBuByUserName, - getSiteAndBuByUserName2, - orderTypeSearch, actionSQCInspection, - dataAcquisition, getResponsibleOperatorList, getSQCItemObjectList, - dataAcquisitionByItem, cancelSQCApproval, - overLoadSearchPartInfo, } from "@/api/qc/qc.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_FAI_upload_file" import comQcItemImageUploadFile from "./com_qc_itemImage_upload_file" import subDetailUpload from "./sub_detail_upload" import QrCode from "../common/QrCode.vue"; import SqcFileTable from "./SQCFileTable.vue"; - import {getManufacturerList, searchPartAttributeDetails} from "../../../api/qc/qc"; export default { components: { SqcFileTable, @@ -259,6 +647,41 @@ return this.tableData.slice(start,end) } }, + watch: { + detailData: { + deep: true, + handler: function () { + const roll = Number(this.detailData.rollQty) || 0 + const samp = Number(this.detailData.samplingQty) || 0 + const pass = Number(this.detailData.passQty) || 0 + this.detailData.notPassQty = samp - pass + if (this.detailData.inspectionResult === '不合格') { + if (this.detailData.disposalMeasures === '让步接收' || this.detailData.disposalMeasures === '') { + this.detailData.batchQualifiedQty = roll + } else if (this.detailData.disposalMeasures === '挑选使用') { + this.detailData.batchQualifiedQty = roll - (Number(this.detailData.notPassQty) || 0) + } else { + this.detailData.batchQualifiedQty = 0 + } + } else { + this.detailData.batchQualifiedQty = roll + } + this.detailData.notbatchQualifiedQty = roll - (Number(this.detailData.batchQualifiedQty) || 0) + } + }, + detailList: { + deep: true, + handler: function () { + let num2 = 0 + for (let i = 0; i < this.detailList.length; i++) { + if (this.detailList[i].itemResult === 'N') { + num2++ + } + } + this.detailData.unqualifiedQty = num2 + } + } + }, data () { return { exportData: [], @@ -292,9 +715,113 @@ }, dataList: [], detailList: [], - detailData: {}, + detailData: { + site: '', + buNo: '', + inspectionNo: '', + partNo: '', + partDesc: '', + rollQty: '', + samplingQty: 0, + unqualifiedQty: 0, + unqualifiedQuantity: '', + disposalMeasures: '', + disposalRemark: '', + inspectionResult: '', + inspectorNo: '', + inspectorName: '', + inspectionRemark: '', + submitFlag: '', + cinvSourceCode: '', + sku: '', + invdefinetype: '', + umId: '', + umName: '', + operator: '', + operatorName: '', + responsiblePerson: '', + responsiblePersonName: '', + state: '', + passQty: 0, + notPassQty: 0, + batchQualifiedQty: 0, + notbatchQualifiedQty: 0 + }, + saveInformationData: { + site: '', + buNo: '', + inspectionNo: '', + disposalMeasures: '', + disposalRemark: '', + inspectorNo: '', + inspectionRemark: '', + samplingQty: '', + rollQty: '', + itemList: [], + unqualifiedQty: '', + partNo: '', + partDesc: '', + operator: '', + operatorName: '', + responsiblePerson: '', + responsiblePersonName: '', + subDetailList: [], + type: '', + passQty: '', + notPassQty: '', + batchQualifiedQty: '' + }, fileFlag: false, - fileColumnList: [], + 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 + } + ], fileContentList: [], fileLoading: false, detailInformationFlag: false, @@ -341,24 +868,6 @@ fixed: '', columnWidth: 120, }, - { - userId: this.$store.state.user.name, - functionId: 301015, - serialNumber: '301015Table1BatchRollNo', - tableId: "301015Table1", - tableName: "SQC检验记录表", - columnProp: 'batchRollNo', - headerAlign: "center", - align: "center", - columnLabel: '老卷号', - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '', - columnWidth: 150, - }, { userId: this.$store.state.user.name, functionId: 301015, @@ -774,7 +1283,390 @@ columnWidth: 200, }, ], - detailColumnList: [], + detailColumnList: [ + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2ItemNo', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'itemNo', + headerAlign: 'center', + align: 'center', + columnLabel: '检验项目编码', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2ItemDesc', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'itemDesc', + headerAlign: 'center', + align: 'left', + columnLabel: '检验项目名称', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 150 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2SamplingLevelDesc', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'samplingLevelDesc', + headerAlign: 'center', + align: 'left', + columnLabel: '检验水平', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2SamplingProgrammeDesc', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'samplingProgrammeDesc', + headerAlign: 'center', + align: 'left', + columnLabel: '检验方案', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2MethodName', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'methodName', + headerAlign: 'center', + align: 'left', + columnLabel: '检验方法', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2MethodRemark', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'methodRemark', + headerAlign: 'center', + align: 'left', + columnLabel: '检验方法说明', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 200 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2ObjectDesc', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'objectDesc', + headerAlign: 'center', + align: 'center', + columnLabel: '检测仪器', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2Aql', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'aql', + headerAlign: 'center', + align: 'right', + columnLabel: 'AQL', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2Ac', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'ac', + headerAlign: 'center', + align: 'right', + columnLabel: 'AC', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2Re', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 're', + headerAlign: 'center', + align: 'right', + columnLabel: 'RE', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2DefaultValue', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'defaultValue', + headerAlign: 'center', + align: 'right', + columnLabel: '标准值', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2MaxValue', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'maxValue', + headerAlign: 'center', + align: 'right', + columnLabel: '上限值', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2MinValue', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'minValue', + headerAlign: 'center', + align: 'right', + columnLabel: '下限值', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 301015, + serialNumber: '301015Table2ValueType', + tableId: '301015Table2', + tableName: '检验单明细表', + columnProp: 'valueType', + headerAlign: 'center', + align: 'center', + columnLabel: '检测值类型', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + } + ], + loadFlag: false, + transferLoadFlag: false, + menuId: this.$route.meta.menuId, + submitData: { + site: '', + inspectionNo: '', + submit_flag: '', + inspectionResult: '', + submitList: [], + updateBy: this.$store.state.user.name, + type: 'sqc' + }, + subDetailFlag: false, + subDetailData: { + site: '', + buNo: '', + inspectionNo: '', + itemNo: '', + itemDesc: '', + defaultValue: '', + maxValue: '', + minValue: '', + valueTypeDb: '', + subDetailValues: [], + page: 1, + limit: 10 + }, + checkedDetail: [], + subDetailVisiable: false, + subDetailLoading: false, + batchHandleAddModalFlag: false, + batchAddData: { + samplingLocation: '', + samplingLocationB: '', + samplingNumber: '' + }, + operatorModelFlag: false, + operatorData: { + flag: '', + site: '', + bu: '', + adminID: '', + adminName: '', + roleName: '', + roleId: '', + userName: this.$store.state.user.name + }, + operatorList: [], + roleList: [], + dataListSelections2: [], + operatorDetailList: [ + { + columnProp: 'adminID', + headerAlign: 'center', + align: 'center', + columnLabel: '用户账号', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '' + }, + { + columnProp: 'adminName', + headerAlign: 'center', + align: 'center', + columnLabel: '用户名称', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '' + }, + { + columnProp: 'email', + headerAlign: 'center', + align: 'center', + columnLabel: '邮箱', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '' + }, + { + columnProp: 'phone', + headerAlign: 'center', + align: 'center', + columnLabel: '手机号', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '' + } + ], + ItemObjectModelFlag: false, + itemObjectList: [], + itemObjectColumnList: [ + { + columnProp: 'itemNo', + headerAlign: 'center', + align: 'center', + columnLabel: '项目编码', + columnHidden: false, + columnImage: false, + status: true, + columnWidth: 120 + }, + { + columnProp: 'itemDesc', + headerAlign: 'center', + align: 'left', + columnLabel: '项目名称', + columnHidden: false, + columnImage: false, + status: true, + columnWidth: 200 + } + ], + actionData: { + site: '', + buNo: '', + inspectionNo: '' + }, + options: [], height: 500, searchLoading: false, disposalMeasuresOptions: [], @@ -814,59 +1706,579 @@ }, SQCClickRow (row) { this.detailData = row + this.$refs.SQCTable.toggleRowSelection(row) }, selectionSQC (rows) { this.submitList = rows }, detailModal (row) { - this.detailData = row - this.detailInformationFlag = true + this.detailData.site = row.site + this.detailData.buNo = row.buNo + this.detailData.inspectionNo = row.inspectionNo + this.detailData.partNo = row.partNo + this.detailData.partDesc = row.partDesc + this.detailData.rollQty = row.rollQty + this.detailData.samplingQty = row.samplingQty + this.detailData.unqualifiedQty = row.unqualifiedQty + this.detailData.unqualifiedQuantity = row.unqualifiedQuantity + this.detailData.submitFlag = row.submitFlag + this.detailData.disposalMeasures = row.disposalMeasures + this.detailData.disposalRemark = row.disposalRemark + this.detailData.inspectionResult = row.inspectionResult + this.detailData.inspectorNo = row.inspectorNo + this.detailData.inspectorName = row.inspectorName + this.detailData.inspectionRemark = row.inspectionRemark + this.detailData.cinvSourceCode = row.cinvSourceCode + this.detailData.sku = row.sku + this.detailData.invdefinetype = row.invdefinetype + this.detailData.umId = row.umId + this.detailData.umName = row.umName + this.detailData.operator = row.operator + this.detailData.operatorName = row.operatorName + this.detailData.responsiblePerson = row.responsiblePerson + this.detailData.responsiblePersonName = row.responsiblePersonName + this.detailData.state = row.state + if (row.state === '待检验') { + this.detailData.passQty = row.samplingQty + } else { + this.detailData.passQty = row.passQty != null ? row.passQty : 0 + this.detailData.notPassQty = row.notPassQty != null ? row.notPassQty : 0 + } + this.detailData.batchQualifiedQty = row.batchQualifiedQty != null ? row.batchQualifiedQty : 0 this.getInspectionFormData() + this.inspectorSearch() + this.detailInformationFlag = true }, getInspectionFormData () { sqcDetailSearch(this.detailData).then(({data}) => { if (data && data.code === 0) { this.detailList = data.rows || [] + } else { + this.detailList = [] } }) }, actionModal (row) { - this.detailData = row - // 先取项目设备(与 IQC 行为一致:有配置则带上 equipmentList) - let actionData = { + this.actionData = { site: row.site, buNo: row.buNo, inspectionNo: row.inspectionNo } - getSQCItemObjectList(actionData).then(({data}) => { - let equipmentList = [] - if (data && data.code === 0 && Array.isArray(data.rows)) { - equipmentList = data.rows + getSQCItemObjectList(this.actionData).then(({data}) => { + if (data && data.code === 0) { + if (!data.rows || data.rows.length === 0) { + this.itemObjectList = [] + this.actionModal2() + } else { + this.itemObjectList = data.rows + this.ItemObjectModelFlag = true + } + } else { + this.$message.warning((data && data.msg) || '获取检验项目失败') } - this.$confirm(`确认开始检验?`, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - let tempData = { - site: row.site, - buNo: row.buNo, - inspectionNo: row.inspectionNo, - state: "待检验", - actionBy: this.$store.state.user.name, - equipmentList + }) + }, + actionModal2 () { + this.$confirm(`确认开始检验?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + let tempData = { + site: this.actionData.site, + buNo: this.actionData.buNo, + inspectionNo: this.actionData.inspectionNo, + actionBy: this.$store.state.user.name, + state: '待检验', + equipmentList: this.itemObjectList || [] + } + actionSQCInspection(tempData).then(({data}) => { + if (data && data.code === 0) { + this.getDataList() + this.$message.success('操作成功') + this.ItemObjectModelFlag = false + } else { + this.$message.warning(data.msg || '操作失败') + } + }) + }).catch(() => {}) + }, + Transfer (type) { + if (type === '2') { + if (this.detailData.inspectionResult === '' || this.detailData.inspectionResult == null) { + this.$message.warning('请选择检验结论!') + return + } + if (this.detailData.inspectionResult === '不合格' && (this.detailData.disposalMeasures == null || this.detailData.disposalMeasures === '')) { + this.$message.warning('请选择处置措施!') + return + } + if (this.detailList.length > 0 && this.detailData.inspectionResult === '不合格') { + const flag = this.detailList.some(item => item.itemResult === 'N') + if (!flag) { + this.$message.warning('请选择不合格项目!') + return } - actionSQCInspection(tempData).then(({data}) => { - if (data && data.code === 0) { - this.getDataList() - this.$message.success('操作成功') - } else { - this.$message.warning(data.msg || '操作失败') + } + if (this.detailData.inspectionResult !== '不合格') { + this.detailData.disposalMeasures = '' + this.detailData.disposalRemark = '' + } + } + if (this.detailData.passQty > this.detailData.rollQty) { + this.$message.warning('合格数量不能大于送检数量!') + return + } + this.saveDetailInformation(type) + }, + saveDetailInformation (type) { + this.saveInformationData.site = this.detailData.site + this.saveInformationData.buNo = this.detailData.buNo + this.saveInformationData.inspectionNo = this.detailData.inspectionNo + this.saveInformationData.disposalMeasures = this.detailData.disposalMeasures + this.saveInformationData.disposalRemark = this.detailData.disposalRemark + this.saveInformationData.inspectorNo = this.$store.state.user.name + this.saveInformationData.inspectionResult = this.detailData.inspectionResult + this.saveInformationData.inspectionRemark = this.detailData.inspectionRemark + this.saveInformationData.rollQty = this.detailData.rollQty + this.saveInformationData.samplingQty = this.detailData.samplingQty + this.saveInformationData.unqualifiedQty = this.detailData.unqualifiedQty + this.saveInformationData.partNo = this.detailData.partNo + this.saveInformationData.partDesc = this.detailData.partDesc + this.saveInformationData.operator = this.detailData.operator + this.saveInformationData.responsiblePerson = this.detailData.responsiblePerson + this.saveInformationData.itemList = JSON.parse(JSON.stringify(this.detailList)) + this.saveInformationData.passQty = this.detailData.passQty == null ? 0 : this.detailData.passQty + this.saveInformationData.notPassQty = this.detailData.notPassQty == null ? 0 : this.detailData.notPassQty + this.saveInformationData.batchQualifiedQty = this.detailData.batchQualifiedQty == null ? 0 : this.detailData.batchQualifiedQty + this.saveInformationData.type = type + this.transferLoadFlag = true + saveSQCDetailedRecord(this.saveInformationData).then(({data}) => { + if (data && data.code === 0) { + this.getDataList() + this.detailInformationFlag = false + this.$message.success('操作成功') + } else { + this.$message.warning((data && data.msg) || '操作失败') + } + this.transferLoadFlag = false + }).catch(() => { + this.transferLoadFlag = false + }) + }, + disposalMeasuresSearch () { + disposalMeasuresSearch({ inspectionTypeNo: '105' }).then(({data}) => { + if (data && data.code === 0) { + this.disposalMeasuresOptions = data.rows + } + }) + }, + getButtonAuthData () { + let searchFlag = this.isAuth(this.menuId + ':search') + let checkFlag = this.isAuth(this.menuId + ':check') + let deleteFlag = this.isAuth(this.menuId + ':delete') + let detailFlag = this.isAuth(this.menuId + ':detail') + let fileFlag = this.isAuth(this.menuId + ':file') + let cancelCheckFlag = this.isAuth(this.menuId + ':cancelCheck') + this.authSearch = !searchFlag + this.authCheck = !checkFlag + this.authDelete = !deleteFlag + this.authDetail = !detailFlag + this.authFile = !fileFlag + this.authCancelCheck = !cancelCheckFlag + }, + getUserRoleList () { + getUserRoleList().then(({data}) => { + if (data && data.code === 0) { + this.roleList = data.rows + } else { + this.roleList = [] + } + }) + }, + getOperatorList () { + this.operatorData.flag = '1' + this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo + this.$nextTick(() => { + if (this.$refs.operatorTable) { + this.$refs.operatorTable.clearSelection() + } + }) + let tempDataList = (this.detailData.operator == null ? '' : this.detailData.operator).split(';') + getOperatorList(this.operatorData).then(({data}) => { + if (data && data.code === 0) { + this.operatorList = data.rows + this.operatorList.forEach(val => { + if (tempDataList.includes(val.adminID)) { + this.$nextTick(() => this.$refs.operatorTable && this.$refs.operatorTable.toggleRowSelection(val, true)) } }) - }).catch(() => {}) + this.operatorModelFlag = true + } else { + this.$message.warning((data && data.msg) || '加载人员失败') + } + }) + }, + getResponsiblePersonList () { + this.operatorData.flag = '2' + this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo + this.$nextTick(() => { + if (this.$refs.operatorTable) { + this.$refs.operatorTable.clearSelection() + } + }) + let tempDataList = (this.detailData.responsiblePerson == null ? '' : this.detailData.responsiblePerson).split(';') + getResponsibleOperatorList(this.operatorData).then(({data}) => { + if (data && data.code === 0) { + this.operatorList = data.rows + this.operatorList.forEach(val => { + if (tempDataList.includes(val.adminID)) { + this.$nextTick(() => this.$refs.operatorTable && this.$refs.operatorTable.toggleRowSelection(val, true)) + } + }) + this.operatorModelFlag = true + } else { + this.$message.warning((data && data.msg) || '加载责任人失败') + } + }) + }, + getOperatorList2 () { + if (this.operatorData.flag === '1') { + let tempDataList = (this.detailData.operator == null ? '' : this.detailData.operator).split(';') + getOperatorList(this.operatorData).then(({data}) => { + if (data && data.code === 0) { + this.operatorList = data.rows + this.operatorList.forEach(val => { + if (tempDataList.includes(val.adminID)) { + this.$nextTick(() => this.$refs.operatorTable && this.$refs.operatorTable.toggleRowSelection(val, true)) + } + }) + } else { + this.operatorList = [] + } + }) + } else { + let tempDataList = (this.detailData.responsiblePerson == null ? '' : this.detailData.responsiblePerson).split(';') + getResponsibleOperatorList(this.operatorData).then(({data}) => { + if (data && data.code === 0) { + this.operatorList = data.rows + this.operatorList.forEach(val => { + if (tempDataList.includes(val.adminID)) { + this.$nextTick(() => this.$refs.operatorTable && this.$refs.operatorTable.toggleRowSelection(val, true)) + } + }) + } else { + this.operatorList = [] + } + }) + } + }, + operatorClickRow (row) { + this.$refs.operatorTable.toggleRowSelection(row) + }, + selectionChangeHandle2 (val) { + this.dataListSelections2 = val + }, + confirmOperator () { + if (this.dataListSelections2.length === 0) { + this.$message.warning('请勾选人员!') + return + } + if (this.operatorData.flag === '1') { + this.detailData.operator = '' + this.detailData.operatorName = '' + for (let i = 0; i < this.dataListSelections2.length; i++) { + this.detailData.operatorName = this.detailData.operatorName + ';' + this.dataListSelections2[i].adminName + this.detailData.operator = this.detailData.operator + ';' + this.dataListSelections2[i].adminID + } + if (this.detailData.operator.charAt(0) === ';') { + this.detailData.operator = this.detailData.operator.substring(1) + this.detailData.operatorName = this.detailData.operatorName.substring(1) + } + } else { + this.detailData.responsiblePerson = '' + this.detailData.responsiblePersonName = '' + for (let i = 0; i < this.dataListSelections2.length; i++) { + this.detailData.responsiblePersonName = this.detailData.responsiblePersonName + ';' + this.dataListSelections2[i].adminName + this.detailData.responsiblePerson = this.detailData.responsiblePerson + ';' + this.dataListSelections2[i].adminID + } + if (this.detailData.responsiblePerson.charAt(0) === ';') { + this.detailData.responsiblePerson = this.detailData.responsiblePerson.substring(1) + this.detailData.responsiblePersonName = this.detailData.responsiblePersonName.substring(1) + } + } + this.operatorData = { + flag: '', + site: '', + bu: '', + adminID: '', + adminName: '', + roleName: '', + roleId: '', + userName: this.$store.state.user.name + } + this.operatorModelFlag = false + }, + openSubDetailImport () { + let currentData = { + flag: 'SQC', + site: this.detailData.site, + buNo: this.detailData.buNo, + inspectionNo: this.detailData.inspectionNo + } + this.$nextTick(() => { + this.$refs.subDetailUpload.init(currentData) + }) + }, + subDetailModal (row) { + this.subDetailLoading = true + this.subDetailData = row + this.pageIndex2 = 1 + selectSQCSubDetailedRecord(this.subDetailData).then(({data}) => { + if (data && data.code === 0) { + this.tableData = data.rows || [] + } + this.subDetailLoading = false + }).catch(() => { + this.subDetailLoading = false + }) + this.batchAddData = { + samplingLocation: '', + samplingLocationB: '', + samplingNumber: '' + } + this.subDetailFlag = true + }, + rowClassName ({ row, rowIndex }) { + row.xh = rowIndex + 1 + row.num = this.tableData.indexOf(row) + 1 + }, + handleDetailSelectionChange (selection) { + this.checkedDetail = selection + }, + handleAddBtn (td) { + checkSQCIsSubmit(td).then(({data}) => { + if (data && data.flag !== 1) { + this.tableData.push({ + subDetailValue: '', + samplingLocation: '', + samplingLocationB: '', + subDetailValueB: '', + subDetailValueC: '', + subDetailValueD: '', + subDetailValueE: '' + }) + } else { + this.$message.warning('记录已提交!') + } }) }, + batchHandleAdd (td) { + checkSQCIsSubmit(td).then(({data}) => { + if (data && data.flag !== 1) { + this.batchHandleAddModalFlag = true + } else { + this.$message.warning('记录已提交!') + } + }) + }, + batchHandleAddModal () { + const n = parseInt(this.batchAddData.samplingNumber, 10) || 0 + for (let i = 0; i < n; i++) { + this.tableData.push({ + samplingLocation: this.batchAddData.samplingLocation, + samplingLocationB: this.batchAddData.samplingLocationB, + subDetailValue: '', + subDetailValueB: '', + subDetailValueC: '', + subDetailValueD: '', + subDetailValueE: '' + }) + } + this.batchHandleAddModalFlag = false + }, + handleDeleteBtn (td) { + checkSQCIsSubmit(td).then(({data}) => { + if (data && data.flag !== 1) { + if (this.checkedDetail.length === 0) { + this.$message.warning('请先选择要删除的数据') + } else { + this.$confirm('是否确认删除该子明细记录?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.checkedDetail.forEach((val) => { + this.tableData.splice(this.tableData.indexOf(val), 1) + if (this.templateTableData.length === 0) { + this.pageIndex2-- + } + }) + this.$message.success('删除成功!') + }).catch(() => {}) + } + } else { + this.$message.warning('记录已提交!') + } + }) + }, + saveSubDetailResult () { + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].subDetailValue === '' || this.tableData[i].subDetailValue == null) { + this.$message.warning('序号' + (i + 1) + '未填写实测值!') + return + } + } + this.subDetailData.subDetailValues = this.tableData + this.subDetailVisiable = true + saveSQCSubDetailed(this.subDetailData).then(({data}) => { + if (data && data.code === 0) { + if (data.count > 0) { + this.subDetailData.itemResult = 'N' + this.subDetailData.unqualifiedQuantity = data.count + } + if (this.subDetailData.subDetailValues.length > 0) { + this.subDetailData.subDetailRecordNum = 1 + } else { + this.subDetailData.subDetailRecordNum = -1 + this.subDetailData.unqualifiedQuantity = 0 + this.subDetailData.itemResult = 'Y' + } + this.subDetailFlag = false + this.tableData = [] + this.$message.success('操作成功') + } else { + this.$message.warning((data && data.msg) || '操作失败') + } + }).finally(() => { + this.subDetailVisiable = false + }) + }, + resultChange () { + if (this.detailData.inspectionResult === '不合格') { + this.detailData.passQty = 0 + } + }, + uploadImageModal (row) { + let currentData = { + site: this.detailData.site, + buNo: this.detailData.buNo, + createBy: this.$store.state.user.name, + inspectionNo: this.detailData.inspectionNo, + itemNo: row.itemNo, + folder: 'SQCItemImageFile' + } + this.$nextTick(() => { + this.$refs.comQcItemImageUploadFile.init(currentData) + }) + }, + inspectorSearch () { + inspectorSearch().then(({data}) => { + if (data && data.code === 0) { + this.options = data.rows + } + }) + }, + nextFocus1 (index) { + let a = `${index + 1}` + `a` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + nextFocus2 (index) { + let a = `${index + 1}` + `b` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + nextFocus3 (index) { + let a = `${index + 1}` + `c` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + nextFocus4 (index) { + let a = `${index + 1}` + `d` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + nextFocus5 (index) { + let a = `${index + 1}` + `e` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + nextFocus6 (index) { + let a = `${index + 1}` + `f` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + nextFocus7 (index) { + let a = `${index + 1}` + `g` + this.$nextTick(() => { + this.$refs[a] && this.$refs[a].focus() + }) + }, + focusNextInput (index, type) { + let aaa = '' + if (this.detailList.length - 1 === index) { + aaa = `${type}0` + } else { + aaa = `${type}${index + 1}` + } + this.$nextTick(() => { + this.$refs[aaa] && this.$refs[aaa].focus() + }) + }, + updateItemResult (row) { + if (row.maxValue == null && row.minValue == null && row.defaultValue == null) { + return + } + if (row.maxValue == null && row.minValue == null) { + if (row.numberValue != row.defaultValue) { + row.itemResult = 'N' + } + } else if (row.maxValue != null && row.minValue != null) { + if (row.numberValue > row.maxValue || row.numberValue < row.minValue) { + row.itemResult = 'N' + } else { + row.itemResult = 'Y' + } + } else if (row.maxValue != null) { + if (row.numberValue > row.maxValue) { + row.itemResult = 'N' + } else { + row.itemResult = 'Y' + } + } else if (row.minValue != null) { + if (row.numberValue < row.minValue) { + row.itemResult = 'N' + } else { + row.itemResult = 'Y' + } + } + }, + sizeChangeHandle2 (val) { + this.pageSize2 = val + }, + currentChangeHandle2 (val) { + this.pageIndex2 = val + }, + changeMyString (val) { + for (let i = 0; i < this.detailList.length; i++) { + if (val[this.detailList[i].itemNo] !== undefined) { + this.detailList[i].unqualifiedQuantity = val[this.detailList[i].itemNo] + if (val[this.detailList[i].itemNo] != null) { + this.detailList[i].subDetailRecordNum = 1 + } + if (val[this.detailList[i].itemNo] > 0) { + this.detailList[i].itemResult = 'N' + } + } + } + }, // 每页数 sizeChangeHandle (val) { @@ -887,34 +2299,26 @@ return true }, - // 导出字段(简版:按主表列导出) fields () { - // 如果用户有维护列配置,就使用配置列;否则至少导出常用字段 - const base = { - '工厂': 'site', - 'BU': 'buNo', - '检验单号': 'inspectionNo', - '状态': 'state', - '物料编码': 'partNo', - '物料名称': 'partDesc', - '供应商': 'supplierDesc', - '检验结论': 'inspectionResult', - '送检数量': 'rollQty', - '抽样数量': 'samplingQty', - '质检员': 'inspectorName', - '送检日期': 'taskDate' - } - return base + let json = '{' + this.columnList1.forEach((item, index) => { + if (index === this.columnList1.length - 1) { + json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + } else { + json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ',' + } + }) + json += '}' + return eval('(' + json + ')') }, async createExportData () { - // 取当前查询条件,拉取较大的数据量用于导出 const q = JSON.parse(JSON.stringify(this.searchData || {})) q.page = 1 - q.limit = 5000 - const {data} = await qcSQCInspectionSearch(q) - if (data && data.code === 0) { - this.exportData = (data.page && data.page.list) ? data.page.list : [] + q.limit = -1 + const { data } = await qcSQCInspectionSearch(q) + if (data && data.code === 0 && data.page && data.page.list) { + this.exportData = data.page.list return this.exportData } this.exportData = [] @@ -924,16 +2328,16 @@ startDownload () {}, finishDownload () {}, - // 审核/提交 + // 审核(与 IPQC 一致:仅「待审核」可审) submitResult () { if (!this.submitList || this.submitList.length === 0) { this.$message.warning('请勾选要审核的检验单!') return } - let tempData1 = '' // 记录不是待检验状态的单号 - let tempData2 = '' // 记录处置措施未填写的单号 + let tempData1 = '' + let tempData2 = '' for (let i = 0; i < this.submitList.length; i++) { - if (this.submitList[i].state !== '待检验') { + if (this.submitList[i].state !== '待审核') { tempData1 = tempData1 + this.submitList[i].inspectionNo + '、' } if (this.submitList[i].inspectionResult === '不合格' && (this.submitList[i].disposalMeasures === '' || this.submitList[i].disposalMeasures == null)) { @@ -942,7 +2346,7 @@ } if (tempData1 !== '') { tempData1 = tempData1.substring(0, tempData1.length - 1) - this.$message.warning('检验单号 ' + tempData1 + ' ,不是待检验状态!') + this.$message.warning('检验单号 ' + tempData1 + ' 不是待审核状态!') return } if (tempData2 !== '') { @@ -950,18 +2354,19 @@ this.$message.warning('检验单号 ' + tempData2 + ' 的处置措施未选择!') return } - this.$confirm(`确认审核选中的检验单?`, '提示', { + this.$confirm(`已确认单据信息无误,确定审核该 ` + this.submitList.length + ` 条记录`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { - saveSQCSubmitResult({ submitList: this.submitList }).then(({data}) => { + this.submitData.submitList = this.submitList + saveSQCSubmitResult(this.submitData).then(({data}) => { if (data && data.code === 0) { - this.$message.success('操作成功') this.getDataList() this.submitList = [] + this.$message.success('操作成功') } else { - this.$message.warning(data.msg || '操作失败') + this.$message.warning((data && data.msg) || '操作失败') } }) }).catch(() => {}) @@ -989,7 +2394,8 @@ cancelButtonText: '取消', type: 'warning' }).then(() => { - cancelSQCApproval({ submitList: this.submitList }).then(({data}) => { + this.submitData.submitList = this.submitList + cancelSQCApproval(this.submitData).then(({data}) => { if (data && data.code === 0) { this.getDataList() this.submitList = [] @@ -1050,9 +2456,16 @@ }).catch(() => {}) }, - // 打印(当前简版页面未接入打印参数,先避免报错) printList () { - this.$message.warning('SQC打印功能待接入') + if (!this.submitList || this.submitList.length === 0) { + this.$message.warning('请勾选要打印的检验单!') + return + } + const inspectionNos = this.$refs.qrCode.init(this.submitList.map(item => item.inspectionNo)) + for (let i = 0; i < inspectionNos.length; i++) { + this.submitList[i].qrCode = inspectionNos[i] + } + qcPrint(this.submitList) }, // 文件清单 @@ -1094,16 +2507,36 @@ }) }, - // Chooselist 回调(本简版页面未使用,先提供空实现避免报错) getBaseData () {}, - changeMyString () {}, + }, + created () { + this.getButtonAuthData() + this.disposalMeasuresSearch() + if (!this.authSearch) { + this.getDataList() + } + this.getUserRoleList() }, mounted () { - this.getDataList() + this.$nextTick(() => { + this.height = window.innerHeight - 250 + }) } } diff --git a/src/views/modules/qc/com_qc_itemImage_upload_file.vue b/src/views/modules/qc/com_qc_itemImage_upload_file.vue index 390b697..ff8452b 100644 --- a/src/views/modules/qc/com_qc_itemImage_upload_file.vue +++ b/src/views/modules/qc/com_qc_itemImage_upload_file.vue @@ -17,8 +17,9 @@
    -
  • - +
  • +
    +
    @@ -49,6 +50,7 @@