From 14125d57941b48bcdd600c7c1af5a7329c7309c6 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Mon, 3 Nov 2025 16:10:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=88=98=E6=98=8A=E7=9A=84?= =?UTF-8?q?=E9=80=89=E6=8B=A9ProcessTimeMatrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/part/quicklyCreateBom.vue | 826 +++----------------- 1 file changed, 128 insertions(+), 698 deletions(-) diff --git a/src/views/modules/part/quicklyCreateBom.vue b/src/views/modules/part/quicklyCreateBom.vue index fba732a..3244ced 100644 --- a/src/views/modules/part/quicklyCreateBom.vue +++ b/src/views/modules/part/quicklyCreateBom.vue @@ -43,29 +43,10 @@ {{ item.columnLabel }} - - - - - - - - - - - @@ -123,7 +104,7 @@ - + @@ -234,8 +215,7 @@ + :before-close="handleBatchUpdateDialogClose">
@@ -501,7 +481,6 @@ 新增 {{ attributeFlag1?'编辑':'保存' }} - 选择ProcessTimeMatrix 韩ProcessTimeMatrix
@@ -1272,7 +1251,7 @@ - + - - - - 商品组名称 - - - - - - - 查询 - - - - - - - - - - - - - - 关闭 - - - - - - - - - - - - - 查询 - - - - - - - - - - - - 关闭 - - -
+ + + + + + - + 筛选 @@ -1483,11 +1354,10 @@ + fixed="left"> { if (data && data.code === 0) { @@ -5891,206 +5425,9 @@ export default { }) }, - // todo - autoCompute() { - const originalData = this.treeData; - const flatList = []; - function flattenData(data) { - data.forEach(item => { - flatList.push(item); - if (item.nodeList && Array.isArray(item.nodeList)) { - flattenData(item.nodeList); - } - }); - } - flattenData(originalData); - console.log(flatList); - for (let i = 0; i < flatList.length; i++) { - this.tempData = { - site: flatList[i].site, - buNo: flatList[i].buNo, - mainPart: this.searchData.partNo, - partNo: flatList[i].partNo, - partDesc: flatList[i].partDesc, - printUnit: flatList[i].printUnit, - printUnitName: flatList[i].printUnitName, - processUnit: flatList[i].processUnit, - bomType: 'Manufacturing', - nodeId: flatList[i].nodeId, - offFlag: '2' - } - } - - }, - - chooseProcessTimeMatrix() { - this.processTimeMatrixFlag = true - }, - - chooseProcessTimeMatrix1(row) { - this.processTimeMatrixFlag = false - if (this.attributeFlag1) { - this.clickSave1() - } - this.partItemList1.forEach(item => { - let value = null; - switch (item.itemDesc) { - case 'Family1': - value = row.family1; - break; - case 'Family2': - value = row.family2; - break; - case 'Lanes0 web': - value = row.lanes0Web; - break; - case 'Lamination width': - value = row.laminationWidth; - break; - case 'Printing lanes': - value = row.printingLanes; - break; - case 'Bonding Pitch': - value = row.bondingPitch; - break; - case '绑定列数': - value = row.bondingLanes; - break; - case 'Dry FG lanes': - value = row.dryFgLanes; - break; - case 'CD': - value = row.cd; - break; - case 'UPH-TAL': - value = row['uph-tal']; - break; - case 'UPH-Paris': - value = row['uph-paris']; - break; - case 'up': - value = row.up; - break; - case 'CL60k-Pitch': - value = row['cl60k-pitch']; - break; - case 'CL60k-CD': - value = row['cl60k-cd']; - break; - default: - return; - } - console.log('row',row) - console.log('value',value) - if (item.valueTypeDb === 'T') { - // 文本类型,赋值给 textValue - item.textValue = value ? value : ''; - } else if (item.valueTypeDb === 'N') { - // 数字类型,赋值给 numValue(转换为数字,避免字符串类型) - item.numValue = value ? Number(value) : null; - } - console.log('item',item) - }); - this.clickSave1() - }, - - queryProductGroup() { - this.productGroupData.limit = this.pageSize5 - this.productGroupData.page = this.pageIndex5 - productGroupInformationSearch(this.productGroupData).then(({data}) => { - if (data.code === 0) { - this.productGroupList = data.page.list - this.pageIndex5 = data.page.currPage - this.pageSize5 = data.page.pageSize - this.totalPage5 = data.page.totalCount - this.productGroupFlag = true - } - }) - }, - - productGroupDbClick(row) { - this.processTimeMatrixData.productGroupName = row.productGroupName - this.processTimeMatrixData.productGroupId = row.productGroupId - this.productGroupFlag = false - }, - - queryProcessTimeMatrix() { - this.processTimeMatrixLoading = true - this.productGroupData.limit = this.pageSize6 - this.productGroupData.page = this.pageIndex6 - searchProductGroupPtmCondition1(this.processTimeMatrixData).then(({data}) => { - if (data && data.code === 0) { - const list = data.rows1.list; - const groupMap = new Map(); - list.forEach(condition => { - const {conditionDesc, ptmConditionItemList} = condition; - if (!groupMap.has(conditionDesc)) { - groupMap.set(conditionDesc, {conditionDesc}); - } - const group = groupMap.get(conditionDesc); - ptmConditionItemList.forEach(item => { - switch (item.itemDesc) { - case 'Family1': - group.family1 = item.numValue || item.textValue; - break; - case 'Family2': - group.family2 = item.numValue || item.textValue; - break; - case 'Lanes0 web': - group.lanes0Web = item.numValue || item.textValue; - break; - case 'Lamination width': - group.laminationWidth = item.numValue || item.textValue; - break; - case 'Printing lanes': - group.printingLanes = item.numValue || item.textValue; - break; - case 'Bonding Pitch': - group.bondingPitch = item.numValue || item.textValue; - break; - case '绑定列数': - group.bondingLanes = item.numValue || item.textValue; - break; - case 'Dry FG lanes': - group.dryFgLanes = item.numValue || item.textValue; - break; - case 'CD': - group.cd = item.numValue || item.textValue; - break; - case 'UPH-TAL': - group['uph-tal'] = item.numValue || item.textValue; - break; - case 'UPH-Paris': - group['uph-paris'] = item.numValue || item.textValue; - break; - case 'up': - group.up = item.numValue || item.textValue; - break; - case 'CL60k-Pitch': - group['cl60k-pitch'] = item.numValue || item.textValue; - break; - case 'CL60k-CD': - group['cl60k-cd'] = item.numValue || item.textValue; - break; - default: - break; - } - this.processTimeMatrixList = Array.from(groupMap.values()); - this.pageIndex6 = data.rows1.currPage - this.pageSize6 = data.rows1.pageSize - this.totalPage6 = data.rows1.totalCount - this.processTimeMatrixFlag = true - this.processTimeMatrixLoading = false - }) - }) - } - }) - }, - /** - * 打开PTM参数选择对话框 - * 展示商品组1下所有ProcessTimeMatrix及其参数(横向展示:53行 × 12列) - * 使用批量查询API,只请求一次后台 + * 打开ProcessTimeMatrix选择对话框 + * 先查询BU下所有商品组1,再查询PTM数据 */ openPtmDialog() { if (!this.attributeFlag1) { @@ -6111,21 +5448,85 @@ export default { return } - // 查询该商品组下所有PTM条件及其参数(一次查询) - const queryData = { - site: this.$store.state.user.site, - buNo: firstPart.buNo, - productGroupId: firstPart.productGroupId1 - } + // 保存当前BU编号和默认商品组ID + this.ptmCurrentBuNo = firstPart.buNo + this.ptmSelectedProductGroupId = firstPart.productGroupId1 // 显示加载提示 const loadingInstance = this.$loading({ lock: true, - text: '正在加载ProcessTimeMatrix数据...', + text: '正在加载商品组数据...', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' }) + // 先查询该BU下所有商品组1 + let buNo = firstPart.buNo || ''; + let result = buNo.includes('-') ? buNo.split('-')[1] : buNo; + const productGroupQuery = { + userName: this.$store.state.user.name, + type:'1', + limit :100, + page :1 + } + + productGroupInformationSearch(productGroupQuery).then(({data}) => { + if (data && data.code === 0) { + this.ptmProductGroupList = data.page.list || [] + + if (this.ptmProductGroupList.length === 0) { + loadingInstance.close() + this.$message.warning('该BU下没有配置商品组1!') + return + } + + // 加载默认选中商品组的PTM数据 + this.loadPtmDataByProductGroup(this.ptmSelectedProductGroupId, loadingInstance) + } else { + loadingInstance.close() + this.$alert(data.msg || '查询商品组失败', '错误', { + confirmButtonText: '确定' + }) + } + }).catch(error => { + loadingInstance.close() + this.$message.error('查询商品组异常') + console.error(error) + }) + }, + + /** + * 根据商品组ID加载PTM数据 + * @param productGroupId 商品组ID + * @param loadingInstance loading实例(可选) + */ + loadPtmDataByProductGroup(productGroupId, loadingInstance) { + if (!productGroupId) { + if (loadingInstance) loadingInstance.close() + this.$message.warning('请选择商品组1!') + return + } + + // 如果没有传入loading实例,创建一个新的 + if (!loadingInstance) { + loadingInstance = this.$loading({ + lock: true, + text: '正在加载ProcessTimeMatrix数据...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + } else { + // 更新loading文本 + loadingInstance.text = '正在加载ProcessTimeMatrix数据...' + } + + // 查询该商品组下所有PTM条件及其参数(一次查询) + const queryData = { + site: this.$store.state.user.site, + buNo: this.ptmCurrentBuNo, + productGroupId: productGroupId + } + batchSearchProductGroupPtmConditionsWithItems(queryData).then(({data}) => { loadingInstance.close() @@ -6135,11 +5536,23 @@ export default { if (ptmConditions.length === 0) { this.$message.info('该商品组下未配置PTM参数') + // 清空数据 + this.ptmDataList = [] + this.filteredPtmDataList = [] + this.ptmColumnList = [] + // 打开对话框(显示空表格) + this.ptmDialogVisible = true return } if (allItems.length === 0) { this.$message.info('该商品组的PTM配置中没有参数') + // 清空数据 + this.ptmDataList = [] + this.filteredPtmDataList = [] + this.ptmColumnList = [] + // 打开对话框(显示空表格) + this.ptmDialogVisible = true return } @@ -6158,6 +5571,23 @@ export default { }) }, + /** + * 处理商品组切换事件 + * @param productGroupId 新选中的商品组ID + */ + handleProductGroupChange(productGroupId) { + if (!productGroupId) { + // 清空数据 + this.ptmDataList = [] + this.filteredPtmDataList = [] + this.ptmColumnList = [] + return + } + + // 重新加载PTM数据 + this.loadPtmDataByProductGroup(productGroupId) + }, + /** * 处理PTM数据(横向展示) * 将后端返回的数据处理成表格展示格式