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; } }