diff --git a/src/views/modules/inspection/myInspectionList.vue b/src/views/modules/inspection/myInspectionList.vue index cf94d5b..d8e4aeb 100644 --- a/src/views/modules/inspection/myInspectionList.vue +++ b/src/views/modules/inspection/myInspectionList.vue @@ -138,8 +138,8 @@ export default { // 跳转到 IQCResultEntry 页面 goToIQCResult (row) { - // 使用检验单号进行跳转,字段可能是 inspectNo 或 inspectionNo - const inspectionNo = row.inspectNo || row.inspectionNo || '' + // 使用检验单号进行跳转 + const inspectionNo = row.inspectNo || '' if (!inspectionNo) { this.$message.warning('未找到检验单号') return diff --git a/src/views/modules/qc/IQCResultEntry.vue b/src/views/modules/qc/IQCResultEntry.vue index e37f652..5a5c93b 100644 --- a/src/views/modules/qc/IQCResultEntry.vue +++ b/src/views/modules/qc/IQCResultEntry.vue @@ -2021,6 +2021,24 @@ }) }, + // 🔑 监听路由参数变化,处理组件复用的情况 + watch: { + '$route.query.inspectionNo': { + handler (newVal) { + if (newVal) { + // 将检验单号放入筛选条件的检验单号输入框中 + this.searchData.inspectionNo = newVal + + // 自动执行查询 + this.$nextTick(() => { + this.getDataList() + }) + } + }, + immediate: false // 不立即执行,由 created 处理首次加载 + } + }, + created () { // 按钮控制 this.getButtonAuthData() @@ -2035,41 +2053,16 @@ this.getTableUserColumn(this.$route.meta.menuId+'table1',1) this.getTableUserColumn(this.$route.meta.menuId+'table2',2) - // 接收路由参数,如果有 inspectionNo 则设置为查询条件,并清空其他筛选条件 + // 接收路由参数,如果有 inspectionNo 则设置为检验单号筛选条件 if (this.$route.query.inspectionNo) { - // 重置 searchData,只保留必要的字段和 inspectionNo - this.searchData = { - site: '', - userName: this.$store.state.user.name, - inspectionNo: this.$route.query.inspectionNo, - inspectionTypeNo: '105', - isQualified: '', - buNo: '', - startDate: '', - endDate: '', - startDate2: '', - endDate2: '', - partNo: '', - partDesc: '', - cinvSourceCode: '', - sku: '', - state: '', - inspectionResult: '', - supplierDesc: '', - disposalMeasures: '', - inspectorName: '', - page: 1, - limit: 10, - poOrderNo: '', - poItemNo: '', - orderType: '', - states: ['未开始', '待检验'], - submissionType: '', - invdefinetype: '' - } - } - - if (!this.authSearch) { + // 🔑 将检验单号放入筛选条件的检验单号输入框中 + this.searchData.inspectionNo = this.$route.query.inspectionNo + + // 🔑 重要:当有路由参数时,需要自动执行查询 + this.$nextTick(() => { + this.getDataList() + }) + } else if (!this.authSearch) { // 获取数据列表 this.getDataList() }