From 44f99c54488f1a31d122977ad5f1b85b26ca3a73 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Mon, 17 Nov 2025 21:12:54 +0800 Subject: [PATCH] =?UTF-8?q?RFQ=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/common/Chooselist_eam.vue | 45 +++++++++++ .../inquiryTechnicalMaterialsNoBuilt.vue | 17 +++- src/views/modules/part/quicklyCreateBom.vue | 79 ++++++++++++++++--- 3 files changed, 128 insertions(+), 13 deletions(-) diff --git a/src/views/modules/common/Chooselist_eam.vue b/src/views/modules/common/Chooselist_eam.vue index 2b91a30..1a417dd 100644 --- a/src/views/modules/common/Chooselist_eam.vue +++ b/src/views/modules/common/Chooselist_eam.vue @@ -240,6 +240,51 @@ export default { getChooselistDataEam({"sqlcode": sql}).then(({data}) => { if (data.code == 0) { this.dataList = data.baseListData; + + // 【安全特性】仅针对计量单位选择框(tagNo === 510)进行排序,不影响其他功能 + if (this.tagNo === 510 && Array.isArray(this.dataList) && this.dataList.length > 0) { + try { + // 创建数据副本,避免修改原始数据 + const originalData = [...this.dataList]; + const priorityList = []; + const otherList = []; + + originalData.forEach(item => { + if (!item) return; // 跳过空数据 + + // 兼容多种字段命名(大小写) + const umid = String(item.UMID || item.umid || item.UmId || ''); + const umName = String(item.UMName || item.umname || item.UMname || item.umName || ''); + + // 判断是否为千张 (编码1002或名称包含"千张") + const isQianZhang = umid === '1002' || umName.includes('千张'); + + // 判断是否为米 (名称为"米"且不是"千米"等) + const isMi = umName === '米' || (umName.includes('米') && umName.length <= 2 && !umName.includes('千')); + + if (isMi || isQianZhang) { + priorityList.push({ item, isMi, isQianZhang }); + } else { + otherList.push(item); + } + }); + + // 按米、千张的顺序排序 + priorityList.sort((a, b) => { + if (a.isMi && !b.isMi) return -1; // 米在前 + if (!a.isMi && b.isMi) return 1; // 米在前 + return 0; + }); + + // 只有在找到优先单位时才重新排序 + if (priorityList.length > 0) { + this.dataList = [...priorityList.map(p => p.item), ...otherList]; + } + } catch (error) { + // 排序失败时不影响原数据,静默处理 + console.warn('计量单位排序失败,使用原始顺序:', error); + } + } } else { this.$message.error(data.msg) } diff --git a/src/views/modules/inquiry/inquiryTechnicalMaterialsNoBuilt.vue b/src/views/modules/inquiry/inquiryTechnicalMaterialsNoBuilt.vue index eba4b36..f3512bb 100644 --- a/src/views/modules/inquiry/inquiryTechnicalMaterialsNoBuilt.vue +++ b/src/views/modules/inquiry/inquiryTechnicalMaterialsNoBuilt.vue @@ -375,7 +375,7 @@ - 保存 + 保存 关闭 @@ -567,6 +567,7 @@ export default { userBuList: [], copyPriceCheckDetail:{}, loading:false, + saveInquiryLoading: false, // 保存询价产品数据的loading状态 attributeDialog:true, noFlag:'Y', priceCheckRule: { @@ -2302,6 +2303,7 @@ export default { this.$alert('该计量单位不存在,请重新输入计量单位编码!', '错误', { confirmButtonText: '确定' }) + return } if (this.inquiryPartModalData.codeNo === '' || this.inquiryPartModalData.codeNo == null) { this.$message.warning('请选择属性模版!') @@ -2311,9 +2313,15 @@ export default { this.$alert('该属性模版不存在,请重新输入属性模版编码!', '错误', { confirmButtonText: '确定' }) + return } + + // 开始保存,显示 loading + this.saveInquiryLoading = true + if (this.inquiryPartModalData.title === '询价产品新增') { addInquiryDetailInfo(this.inquiryPartModalData).then(({data}) => { + this.saveInquiryLoading = false if (data && data.code === 0) { this.refreshCurrentTabTable() this.inquiryPartModalFlag = false @@ -2331,9 +2339,13 @@ export default { confirmButtonText: '确定' }) } + }).catch(error => { + this.saveInquiryLoading = false + this.$message.error('保存异常') }) } else { updateInquiryDetailInfo(this.inquiryPartModalData).then(({data}) => { + this.saveInquiryLoading = false if (data && data.code === 0) { this.refreshCurrentTabTable() this.inquiryPartModalFlag = false @@ -2351,6 +2363,9 @@ export default { confirmButtonText: '确定' }) } + }).catch(error => { + this.saveInquiryLoading = false + this.$message.error('保存异常') }) } }, diff --git a/src/views/modules/part/quicklyCreateBom.vue b/src/views/modules/part/quicklyCreateBom.vue index fd4898a..86f0ff1 100644 --- a/src/views/modules/part/quicklyCreateBom.vue +++ b/src/views/modules/part/quicklyCreateBom.vue @@ -1723,6 +1723,8 @@ export default { codeNo: '', rfqDetailId: null }, + partNoGenerated: false, // 标记产品编码是否已通过"维护"生成 + savedPartData: null, // 保存已生成的产品数据,防止被路由参数覆盖 itemData: { site: this.$store.state.user.site, partNo: '', @@ -3254,6 +3256,34 @@ export default { }, activated() { if (this.$route.query.data) { + console.log('activated 触发 - partNoGenerated 标记:', this.partNoGenerated) + console.log('activated 触发 - 当前 partNo:', this.searchData.partNo) + console.log('activated 触发 - 路由参数 partNo:', this.$route.query.data.partNo) + console.log('activated 触发 - savedPartData:', this.savedPartData) + + // 如果产品编码已通过"维护"生成,从保存的副本恢复数据 + if (this.partNoGenerated && this.savedPartData) { + console.log('产品编码已生成,从 savedPartData 恢复数据:', this.savedPartData.partNo) + + // 从保存的副本恢复数据 + this.searchData.site = this.savedPartData.site + this.searchData.buNo = this.savedPartData.buNo + this.searchData.partNo = this.savedPartData.partNo + this.searchData.partDesc = this.savedPartData.partDesc + this.searchData.testPartId = this.savedPartData.testPartId + this.searchData.codeNo = this.savedPartData.codeNo || this.$route.query.data.partCodeNo + this.searchData.rfqDetailId = this.savedPartData.rfqDetailId || this.$route.query.data.id + + console.log('恢复后的 searchData.partNo:', this.searchData.partNo) + + // 刷新相关数据 + this.getNodeTree(); + this.getPartItem(); + return + } + + // 产品编码未生成时,正常从路由参数加载数据 + console.log('从路由参数加载初始数据') this.searchData = this.$route.query.data this.searchData.partDesc = this.$route.query.data.testPartDesc this.searchData.codeNo = this.$route.query.data.partCodeNo @@ -3569,11 +3599,30 @@ export default { // 获取物料的Bom模板详情 async getInfoByBomTemplate (row) { + console.log('getInfoByBomTemplate 接收到的 row:', row) this.searchData.site = row.site this.searchData.buNo = row.buNo this.searchData.partNo = row.partNo this.searchData.partDesc = row.partDesc this.searchData.testPartId = row.id + + // 标记产品编码已生成(从 * 变成实际编码)并保存数据副本 + if (row.partNo && row.partNo !== '*') { + this.partNoGenerated = true + // 保存完整的产品数据副本,用于页签切换时恢复 + this.savedPartData = { + site: row.site, + buNo: row.buNo, + partNo: row.partNo, + partDesc: row.partDesc, + testPartId: row.id, + rfqDetailId: this.searchData.rfqDetailId + } + console.log('设置 partNoGenerated = true,保存的数据:', this.savedPartData) + } + + console.log('更新后的 searchData.partNo:', this.searchData.partNo) + await this.getNodeTree() let tempData = { site: this.$store.state.user.site, @@ -3585,6 +3634,10 @@ export default { if (data && data.code === 0){ this.$set(this, 'partList1', data.rows) this.searchData.codeNo = this.partList1[0].codeNo + // 同步更新保存的数据 + if (this.savedPartData) { + this.savedPartData.codeNo = this.partList1[0].codeNo + } } }) this.getPartItem(); @@ -5634,7 +5687,7 @@ export default { /** * 打开ProcessTimeMatrix选择对话框 - * 先查询BU下所有商品组1,再查询PTM数据 + * 默认查询且只查询商品组编码为 G1701、G1702、G1703、G1704 的数据 */ openPtmDialog() { if (!this.attributeFlag1) { @@ -5650,14 +5703,9 @@ export default { // 获取第一个物料的信息 const firstPart = this.partList1[0] - if (!firstPart.productGroupId1) { - this.$message.warning('当前物料未设置商品组1,无法查询PTM参数!') - return - } - // 保存当前BU编号和默认商品组ID + // 保存当前BU编号 this.ptmCurrentBuNo = firstPart.buNo - this.ptmSelectedProductGroupId = firstPart.productGroupId1 // 显示加载提示 const loadingInstance = this.$loading({ @@ -5667,9 +5715,7 @@ export default { background: 'rgba(0, 0, 0, 0.3)' }) - // 先查询该BU下所有商品组1 - let buNo = firstPart.buNo || ''; - let result = buNo.includes('-') ? buNo.split('-')[1] : buNo; + // 查询该BU下所有商品组1 const productGroupQuery = { userName: this.$store.state.user.name, type:'1', @@ -5679,14 +5725,23 @@ export default { productGroupInformationSearch(productGroupQuery).then(({data}) => { if (data && data.code === 0) { - this.ptmProductGroupList = data.page.list || [] + const allProductGroups = data.page.list || [] + + // 筛选出商品组编码为 G1701、G1702、G1703、G1704 的商品组 + const targetProductGroupIds = ['G1701', 'G1702', 'G1703', 'G1704'] + this.ptmProductGroupList = allProductGroups.filter(item => + targetProductGroupIds.includes(item.productGroupId) + ) if (this.ptmProductGroupList.length === 0) { loadingInstance.close() - this.$message.warning('该BU下没有配置商品组1!') + this.$message.warning('未找到商品组编码为 G1701、G1702、G1703、G1704 的商品组!') return } + // 默认选中第一个筛选出的商品组 + this.ptmSelectedProductGroupId = this.ptmProductGroupList[0].productGroupId + // 加载默认选中商品组的PTM数据 this.loadPtmDataByProductGroup(this.ptmSelectedProductGroupId, loadingInstance) } else {