From 440886b1808d19071b90856b0e32310eea39cda6 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Sat, 10 Oct 2026 15:51:09 +0800 Subject: [PATCH] =?UTF-8?q?2026-10-10=20=E4=BC=98=E5=8C=96=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=92=8C=E9=85=8D=E6=96=B9BOM=EF=BC=8C=E3=80=90Copy?= =?UTF-8?q?=E3=80=91=E5=92=8C=E3=80=90=E7=B2=98=E8=B4=B4=E3=80=91=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E2=80=9C=E4=B8=8D=E8=83=BD=E5=B0=86=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E5=AD=90=E7=89=A9=E6=96=99=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/part/bomManagement.vue | 32 +++++++++++++++++++-- src/views/modules/part/recipeManagement.vue | 23 +++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/views/modules/part/bomManagement.vue b/src/views/modules/part/bomManagement.vue index a24bc9d..dea079c 100644 --- a/src/views/modules/part/bomManagement.vue +++ b/src/views/modules/part/bomManagement.vue @@ -4536,6 +4536,17 @@ export default { this.componentData.componentPart = normalizedComponentPart return normalizedComponentPart }, + normalizePartNo (partNo) { + return (partNo || '').toString().trim().toUpperCase() + }, + isSelfAsComponent (parentPartNo, componentPart) { + const parent = this.normalizePartNo(parentPartNo) + const child = this.normalizePartNo(componentPart) + return parent !== '' && parent === child + }, + findSelfAsComponent (parentPartNo, list) { + return (list || []).find(item => this.isSelfAsComponent(parentPartNo, item && item.componentPart)) + }, // 子物料编码失焦事件 componentPartBlur () { @@ -4743,8 +4754,12 @@ export default { if (this.checkedPasteBar.length === 0) { this.$message.warning('请选择要复制的信息!') return - } else { - this.$confirm("是否确认复制信息?", "提示", { + } + if (this.findSelfAsComponent(this.detailData.partNo, this.checkedPasteBar)) { + this.$message.warning('不能将自己作为子物料!') + return + } + this.$confirm("是否确认复制信息?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" @@ -4786,7 +4801,6 @@ export default { this.saveComponentLoading = false }) }) - } }, // 删除粘贴栏 @@ -4932,6 +4946,10 @@ export default { this.$message.warning('请选择子物料编码!') return } + if (this.isSelfAsComponent(this.componentData.partNo, normalizedComponentPart)) { + this.$message.warning('不能将自己作为子物料!') + return + } if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) { this.$message.warning('请选择消耗项目!') return @@ -5159,6 +5177,10 @@ export default { this.$message.warning('失效日期必须大于生效日期!') return } + if (this.findSelfAsComponent(this.copyBomData.partNo, [...(this.subDetailList || []), ...(this.byProductList || [])])) { + this.$message.warning('不能将自己作为子物料!') + return + } this.copyBomData.previousVersion = this.modalData this.copyLoading = true // 新增主表信息 @@ -5232,6 +5254,10 @@ export default { this.$message.warning('请填写替代编码!') return } + if (this.findSelfAsComponent(this.copyAlternativeData.partNo, [...(this.subDetailList || []), ...(this.byProductList || [])])) { + this.$message.warning('不能将自己作为子物料!') + return + } // if (this.copyAlternativeData.alternativeDescription === '' || this.copyAlternativeData.alternativeDescription == null) { // this.$message.warning('请填写替代名称!') // return diff --git a/src/views/modules/part/recipeManagement.vue b/src/views/modules/part/recipeManagement.vue index 842f7d4..7df7de2 100644 --- a/src/views/modules/part/recipeManagement.vue +++ b/src/views/modules/part/recipeManagement.vue @@ -3978,6 +3978,17 @@ export default { this.componentData.componentPart = normalizedComponentPart return normalizedComponentPart }, + normalizePartNo (partNo) { + return (partNo || '').toString().trim().toUpperCase() + }, + isSelfAsComponent (parentPartNo, componentPart) { + const parent = this.normalizePartNo(parentPartNo) + const child = this.normalizePartNo(componentPart) + return parent !== '' && parent === child + }, + findSelfAsComponent (parentPartNo, list) { + return (list || []).find(item => this.isSelfAsComponent(parentPartNo, item && item.componentPart)) + }, // 子物料编码失焦事件 componentPartBlur () { @@ -4222,6 +4233,10 @@ export default { this.$message.warning('请选择子物料编码!') return } + if (this.isSelfAsComponent(this.componentData.partNo, normalizedComponentPart)) { + this.$message.warning('不能将自己作为子物料!') + return + } if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) { this.$message.warning('请选择消耗项目!') return @@ -4428,6 +4443,10 @@ export default { this.$message.warning('失效日期必须大于生效日期!') return } + if (this.findSelfAsComponent(this.copyRecipeData.partNo, [...(this.subDetailList || []), ...(this.byProductList || [])])) { + this.$message.warning('不能将自己作为子物料!') + return + } this.copyRecipeData.previousVersion = this.modalData this.copyLoading = true // 新增主表信息 @@ -4505,6 +4524,10 @@ export default { this.$message.warning('请填写替代名称!') return } + if (this.findSelfAsComponent(this.copyAlternativeData.partNo, [...(this.subDetailList || []), ...(this.byProductList || [])])) { + this.$message.warning('不能将自己作为子物料!') + return + } this.copyAlternativeData.previousVersion = this.detailData this.copyLoading = true copyAlternative(this.copyAlternativeData).then(({data}) => {