diff --git a/src/api/qc/qc.js b/src/api/qc/qc.js index c9162a5..b4db556 100644 --- a/src/api/qc/qc.js +++ b/src/api/qc/qc.js @@ -205,6 +205,10 @@ export const getFQCItemObjectList = data => createAPI(`/pms/qc/getFQCItemObjectL export const getIPQCItemObjectList = data => createAPI(`/pms/qc/getIPQCItemObjectList`,'post',data) export const getInspectionStandards = data => createAPI(`/pms/qc/getInspectionStandards`,'post',data) export const saveInspectionStandard = data => createAPI(`/pms/qc/saveInspectionStandard`,'post',data) +// IPQC检验项目操作 +export const getIPQCItemList = data => createAPI(`/pms/qc/getIPQCItemList`,'post',data) +export const addIPQCItemDetails = data => createAPI(`/pms/qc/addIPQCItemDetails`,'post',data) +export const deleteIPQCItemDetails = data => createAPI(`/pms/qc/deleteIPQCItemDetails`,'post',data) export const dataAcquisitionByItem = data => createAPI(`/pms/qc/dataAcquisitionByItem`,'post',data) export const getSiteAndBuByUserName2 = data => createAPI(`/pms/qc/getSiteAndBuByUserName2`,'post',data) export const cancelApproval = data => createAPI(`/pms/qc/cancelApproval`,'post',data) diff --git a/src/views/modules/qc/IPQCResultEntry.vue b/src/views/modules/qc/IPQCResultEntry.vue index 9a3bff2..944f6a5 100644 --- a/src/views/modules/qc/IPQCResultEntry.vue +++ b/src/views/modules/qc/IPQCResultEntry.vue @@ -548,6 +548,9 @@ + + 项目操作 + @@ -1044,6 +1047,123 @@ + + +
+ + + + + + + + + 查询 + + +
+ + + 可选项目: + + + + + + + + + + + + + + + + +
+ 添加>> +
+
+ 删除<< +
+
+ + 已有项目: + + + + + + + + + +
+ + 关闭 + +
+ @@ -1093,7 +1213,10 @@ dataAcquisitionByItem, // 根据项目数据采集 cancelApproval2, // 取消审核 getUserRoleList, // 获取用户角色列表 - getOperatorList + getOperatorList, + getIPQCItemList, // 获取IPQC检验项目列表 + addIPQCItemDetails, // 添加IPQC检验项目 + deleteIPQCItemDetails // 删除IPQC检验项目 } from "@/api/qc/qc.js" import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" import Chooselist from '@/views/modules/common/Chooselist_eam' @@ -2580,6 +2703,16 @@ acquisitionList: [], ItemObjectModelFlag: false, itemObjectList: [], + // 项目操作对话框相关 + itemOperationDialogFlag: false, + itemOperationQuery: { + itemNo: '', + itemDesc: '', + }, + availableItemList: [], + selectedItemList: [], + availableItemSelections: [], + selectedItemSelections: [], itemObjectColumnList: [ { columnProp: 'itemNo', @@ -4241,6 +4374,129 @@ this.authFile = !fileFlag this.authCancelCheck = !cancelCheckFlag }, + + // ======================== 项目操作相关方法 ======================== + // 打开项目操作对话框 + openItemOperationDialog() { + this.itemOperationQuery = { + itemNo: '', + itemDesc: '', + } + this.searchIPQCItems() + this.itemOperationDialogFlag = true + }, + + // 查询IPQC类型的检验项目 + async searchIPQCItems() { + try { + const {data} = await getIPQCItemList({ + site: this.detailData.site, + buNo: this.detailData.buNo, + inspectionNo: this.detailData.inspectionNo, + templateId: this.detailData.templateId, + itemNo: this.itemOperationQuery.itemNo, + itemDesc: this.itemOperationQuery.itemDesc, + }) + if (data && data.code === 0) { + this.availableItemList = data.row1 || [] + this.selectedItemList = data.row2 || [] + } else { + this.$message.error(data.msg || '查询失败') + } + } catch (error) { + this.$message.error('查询失败,请检查') + } + }, + + // 可选项目行点击 + availableItemClickRow(row) { + this.$refs.availableItemTable.toggleRowSelection(row) + }, + + // 可选项目选择变化 + availableItemSelectionChange(selection) { + this.availableItemSelections = selection + }, + + // 已有项目行点击 + selectedItemClickRow(row) { + this.$refs.selectedItemTable.toggleRowSelection(row) + }, + + // 已有项目选择变化 + selectedItemSelectionChange(selection) { + this.selectedItemSelections = selection + }, + + // 添加检验项目 + async addInspectionItems() { + if (!this.availableItemSelections || this.availableItemSelections.length === 0) { + this.$message.warning('请选择可选项目!') + return + } + + try { + const {data} = await addIPQCItemDetails({ + site: this.detailData.site, + buNo: this.detailData.buNo, + inspectionNo: this.detailData.inspectionNo, + templateId: this.detailData.templateId, + orderNo: this.detailData.orderNo, + itemList: this.availableItemSelections, + }) + if (data && data.code === 0) { + this.$message.success('添加成功') + this.searchIPQCItems() + this.availableItemSelections = [] + } else { + this.$message.error(data.msg || '添加失败') + } + } catch (error) { + this.$message.error('添加失败,请检查') + } + }, + + // 删除检验项目 + async deleteInspectionItems() { + if (!this.selectedItemSelections || this.selectedItemSelections.length === 0) { + this.$message.warning('请选择已有项目!') + return + } + + this.$confirm('确定删除选中的检验项目吗?删除后将同时删除该项目的子明细数据。', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + try { + const {data} = await deleteIPQCItemDetails({ + site: this.detailData.site, + buNo: this.detailData.buNo, + inspectionNo: this.detailData.inspectionNo, + templateId: this.detailData.templateId, + itemList: this.selectedItemSelections, + }) + if (data && data.code === 0) { + this.$message.success('删除成功') + this.searchIPQCItems() + this.selectedItemSelections = [] + } else { + this.$message.error(data.msg || '删除失败') + } + } catch (error) { + this.$message.error('删除失败,请检查') + } + }).catch(() => { + this.$message.info('已取消删除') + }) + }, + + // 刷新检验明细列表 + refreshInspectionDetailList() { + if (this.detailInformationFlag) { + this.getInspectionFormData() + } + }, } }