From dce5fd232b347d9287a187bdd28702a17125dc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E6=B0=94=E6=BB=A1=E6=BB=A1=28jgy=29?= Date: Thu, 9 Jan 2025 11:03:10 +0800 Subject: [PATCH] =?UTF-8?q?2025-01-09=20MES=20-=20=E8=87=AA=E6=A3=80/?= =?UTF-8?q?=E9=A6=96=E6=A3=80=E4=B8=A4=E4=B8=AA=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/firstInspection/index.vue | 17 +++++++++++++++-- src/views/mes/selfMutualInspection/index.vue | 19 +++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/views/mes/firstInspection/index.vue b/src/views/mes/firstInspection/index.vue index 5b2f98f..6bcd8a9 100644 --- a/src/views/mes/firstInspection/index.vue +++ b/src/views/mes/firstInspection/index.vue @@ -445,7 +445,7 @@ export default { // 监听lineCode和checkDate的变化 headerParameters: { handler(newVal) { - if (newVal.lineCode && newVal.checkDate) { + if (newVal.lineCode || newVal.checkDate) { this.getProductList(); //监听产品和检查日期 } }, @@ -464,7 +464,7 @@ export default { } }, - //在选择设备时候,存设备名称 + //在选择产品时候,存产品名称 handleSelectProductChange(value) { const selectedOption = this.productCodeOption.find( (option) => option.id === value @@ -559,6 +559,19 @@ export default { getProductList() { getProductList(this.headerParameters).then((response) => { this.productCodeOption = response; + + if (response.length === 0) { + this.headerParameters.id = null; + // this.productCodeOption = null; + } else { + const found = this.productCodeOption.some( + (item) => item.id === this.headerParameters.id + ); + + if (!found) { + this.headerParameters.id = null; + } + } }); }, diff --git a/src/views/mes/selfMutualInspection/index.vue b/src/views/mes/selfMutualInspection/index.vue index 77f6566..0426872 100644 --- a/src/views/mes/selfMutualInspection/index.vue +++ b/src/views/mes/selfMutualInspection/index.vue @@ -445,7 +445,7 @@ export default { // 监听lineCode和checkDate的变化 headerParameters: { handler(newVal) { - if (newVal.lineCode && newVal.checkDate) { + if (newVal.lineCode || newVal.checkDate) { this.getProductList(); //监听产品和检查日期 } }, @@ -559,6 +559,19 @@ export default { getProductList() { getProductList(this.headerParameters).then((response) => { this.productCodeOption = response; + + if (response.length === 0) { + this.headerParameters.id = null; + // this.productCodeOption = null; + } else { + const found = this.productCodeOption.some( + (item) => item.id === this.headerParameters.id + ); + + if (!found) { + this.headerParameters.id = null; + } + } }); }, @@ -722,7 +735,9 @@ export default { checkTimeS === null || checkTimeS === "" ) { - this.$modal.msg("您填入的检查时间存在开始时间为空的情况,请再次进行填写!"); + this.$modal.msg( + "您填入的检查时间存在开始时间为空的情况,请再次进行填写!" + ); return; } }