diff --git a/src/api/qc/qc.js b/src/api/qc/qc.js index cc400db..569f7a6 100644 --- a/src/api/qc/qc.js +++ b/src/api/qc/qc.js @@ -77,6 +77,13 @@ export const getOperationDescList = data => createAPI(`/pms/qc/getOperationDescL export const getManufacturerList = data => createAPI(`/pms/qc/getManufacturerList`,'post',data) export const getPartTemplateLists = data => createAPI(`/pms/qc/getPartTemplateLists`,'post',data) export const qcPartAttributeEdit = data => createAPI(`/pms/qc/qcPartAttributeEdit`,'post',data) + +// ===================================== 检验标准维护 ===================================== +export const qcSpecSearch = data => createAPI(`/pms/qc/qcSpecSearch`,'post',data) +export const qcSpecSave = data => createAPI(`/pms/qc/qcSpecSave`,'post',data) +export const qcSpecUpdate = data => createAPI(`/pms/qc/qcSpecUpdate`,'post',data) +export const qcSpecDelete = data => createAPI(`/pms/qc/qcSpecDelete`,'post',data) +export const getQcSpecItemList = data => createAPI(`/pms/qc/getQcSpecItemList`,'post',data) export const queryFileId = data => createAPI(`/pms/qc/queryFileId`,'post',data) export const getPartDefectTracking = data => createAPI(`/pms/qc/getPartDefectTracking`,'post',data) export const saveDefectTracking = data => createAPI(`/pms/qc/saveDefectTracking`,'post',data) diff --git a/src/views/modules/qc/qcPartAttribute.vue b/src/views/modules/qc/qcPartAttribute.vue index e28914a..3eb9727 100644 --- a/src/views/modules/qc/qcPartAttribute.vue +++ b/src/views/modules/qc/qcPartAttribute.vue @@ -730,6 +730,54 @@ + + + + 新增 + 批量编辑 + 批量保存 + + + + + + + + + + + + + + + + + + + + + @@ -1311,6 +1359,63 @@ + + +
+ + + + + + + + + + + + + + + 查询 + + +
+ + + 可选项目: + + + + + + + + + + + +
+ 添加>> +
+
+ 删除<< +
+
+ + 已有项目: + + + + + + + +
+ + 关闭 + +
+ @@ -1352,6 +1457,12 @@ deletePatrolConfig, // 删除巡检特殊配置 getAllOperationDescList, // 查询所有工序列表 patrolConfigUpload, // 巡检配置批量导入 + + qcSpecSearch, + qcSpecSave, + qcSpecUpdate, + qcSpecDelete, + getQcSpecItemList, } from "@/api/qc/qc.js" import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" import Chooselist from '@/views/modules/common/Chooselist_eam' @@ -1378,6 +1489,23 @@ }, data () { return { + // 检验标准维护 + qcSpecList: [], + editQcSpecBatchVisible: false, + batchQcSpecLoading: false, + qcSpecAddFlag: false, + qcSpecSearchData: { + inspectionTypeNo: '', + itemNo: '', + itemDesc: '', + site: '', + buNo: '', + partNo: '' + }, + qcSpecItemList1: [], + qcSpecItemList2: [], + qcSpecItemSelections1: [], + qcSpecItemSelections2: [], columnsProp:['createBy', 'updateBy'], // 是否收藏 favorite: false, @@ -2222,6 +2350,171 @@ }, methods: { + // ================= 检验标准维护相关方法 ================= + refreshQcSpecList() { + if (!this.partCurrentRow || !this.partCurrentRow.partNo) return + qcSpecSearch({ + site: this.partCurrentRow.site, + buNo: this.partCurrentRow.buNo, + partNo: this.partCurrentRow.partNo + }).then(({data}) => { + if (data && data.code === 0) { + this.qcSpecList = data.rows || [] + } + }) + }, + addQcSpecModal() { + this.qcSpecSearchData.site = this.partCurrentRow.site + this.qcSpecSearchData.buNo = this.partCurrentRow.buNo + this.qcSpecSearchData.partNo = this.partCurrentRow.partNo + this.qcSpecSearchData.inspectionTypeNo = '' + this.qcSpecSearchData.itemNo = '' + this.qcSpecSearchData.itemDesc = '' + this.qcSpecItemList1 = [] + this.qcSpecItemList2 = [] + this.qcSpecItemSelections1 = [] + this.qcSpecItemSelections2 = [] + this.getQcSpecItemList() + this.qcSpecAddFlag = true + }, + getQcSpecItemList() { + getQcSpecItemList(this.qcSpecSearchData).then(({data}) => { + if (data && data.code === 0) { + this.qcSpecItemList1 = data.rows || [] + } + }) + qcSpecSearch({ + site: this.partCurrentRow.site, + buNo: this.partCurrentRow.buNo, + partNo: this.partCurrentRow.partNo + }).then(({data}) => { + if (data && data.code === 0) { + this.qcSpecItemList2 = data.rows || [] + } + }) + }, + qcSpecItemClickRow1(row) { + this.$refs.qcSpecItemTable1.toggleRowSelection(row) + }, + qcSpecItemClickRow2(row) { + this.$refs.qcSpecItemTable2.toggleRowSelection(row) + }, + qcSpecSelectionItem1(val) { + this.qcSpecItemSelections1 = val + }, + qcSpecSelectionItem2(val) { + this.qcSpecItemSelections2 = val + }, + addQcSpecItem() { + if (this.qcSpecItemSelections1.length === 0) { + this.$message.warning('请选择可选项目!') + return + } + let inData = { + site: this.partCurrentRow.site, + buNo: this.partCurrentRow.buNo, + partNo: this.partCurrentRow.partNo, + createBy: this.$store.state.user.name, + itemList: this.qcSpecItemSelections1 + } + qcSpecSave(inData).then(({data}) => { + if (data && data.code === 0) { + this.getQcSpecItemList() + this.qcSpecItemSelections1 = [] + } else { + this.$message.error(data.msg) + } + }) + }, + deleteQcSpecItem() { + if (this.qcSpecItemSelections2.length === 0) { + this.$message.warning('请选择已有项目!') + return + } + this.$confirm('是否删除选中的检验标准?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + let count = 0 + let successCount = 0 + this.qcSpecItemSelections2.forEach(item => { + qcSpecDelete({ + site: this.partCurrentRow.site, + buNo: this.partCurrentRow.buNo, + partNo: this.partCurrentRow.partNo, + itemNo: item.itemNo, + inspectionTypeNo: item.inspectionTypeNo + }).then(({data}) => { + count++ + if (data && data.code === 0) { + successCount++ + } + if (count === this.qcSpecItemSelections2.length) { + this.getQcSpecItemList() + this.qcSpecItemSelections2 = [] + this.$message.success(`成功删除 ${successCount} 条数据`) + } + }) + }) + }) + }, + editQcSpecBatchModel() { + this.editQcSpecBatchVisible = true + }, + batchQcSpecModel() { + for (let i = 0; i < this.qcSpecList.length; i++) { + let item = this.qcSpecList[i]; + if (item.maxValue !== '' && item.maxValue !== null && item.minValue !== '' && item.minValue !== null) { + if (Number(item.maxValue) < Number(item.minValue)) { + this.$message.warning(`项目【${item.itemDesc}】的最大值不能小于最小值!`); + return; + } + } + } + + this.batchQcSpecLoading = true + let inData = { + site: this.partCurrentRow.site, + buNo: this.partCurrentRow.buNo, + partNo: this.partCurrentRow.partNo, + itemList: this.qcSpecList + } + qcSpecUpdate(inData).then(({data}) => { + this.batchQcSpecLoading = false + if (data && data.code === 0) { + this.editQcSpecBatchVisible = false + this.refreshQcSpecList() + this.$message.success('批量保存成功') + } else { + this.$message.error(data.msg) + } + }).catch(() => { + this.batchQcSpecLoading = false + }) + }, + deleteQcSpec(row) { + this.$confirm('是否删除该检验标准?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + qcSpecDelete({ + site: this.partCurrentRow.site, + buNo: this.partCurrentRow.buNo, + partNo: this.partCurrentRow.partNo, + itemNo: row.itemNo, + inspectionTypeNo: row.inspectionTypeNo + }).then(({data}) => { + if (data && data.code === 0) { + this.refreshQcSpecList() + this.$message.success('删除成功') + } else { + this.$message.error(data.msg) + } + }) + }) + }, // ================= 巡检特殊配置相关方法 ================= // 打开巡检特殊配置对话框 openPatrolConfigDialog() { @@ -2687,6 +2980,8 @@ this.detailModal() } else if (this.activeTable === 'defectTracking') { this.getPartDefectTracking() + } else if (this.activeTable === 'qcSpec') { + this.refreshQcSpecList() } else if (this.activeTable === 'labelTemplate') { this.getPartLabelTemplate() }