diff --git a/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue b/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue index 08b0b0b..eeaed5e 100644 --- a/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue +++ b/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue @@ -3139,6 +3139,7 @@ } createNotify(inData).then(({data})=>{ if (data.code === 0) { + const newNotifyNo = data.notifyNo // 获取新创建的单据号 this.$message({ message: '操作成功', type: 'success', @@ -3146,8 +3147,22 @@ onClose: () => {} }) this.createNotifyFlag = false - // 刷新主表数据 - this.searchTable() + // 清空搜索条件中的单据号,设置为新单据号以便精确查询 + this.searchData.notifyNo = newNotifyNo + // 刷新主表数据并定位到新单据 + this.searchTable().then(() => { + const foundRow = this.dataList.find(item => item.notifyNo === newNotifyNo) + if (foundRow) { + this.currentRow = JSON.parse(JSON.stringify(foundRow)) + this.$nextTick(() => { + this.$refs.mainTable.setCurrentRow(foundRow) + // 刷新子表数据 + this.refreshCurrentTabTable() + }) + } + // 清空搜索条件中的单据号,恢复正常查询 + this.searchData.notifyNo = '' + }) }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' diff --git a/src/views/modules/qc/inboundNotification.vue b/src/views/modules/qc/inboundNotification.vue index 615038b..52c097b 100644 --- a/src/views/modules/qc/inboundNotification.vue +++ b/src/views/modules/qc/inboundNotification.vue @@ -1388,9 +1388,43 @@ if (this.modalData.flag === '1') { // 新增 saveInboundNotification(this.modalData).then(({data}) => { if (data && data.code === 0) { - this.getDataList() + const newOrderNo = data.orderNo // 获取新创建的单据号 this.modalFlag = false this.$message.success('操作成功') + // 清空搜索条件,设置为新单据号以便精确查询 + this.searchData.orderNo = newOrderNo + this.searchData.orderStatusList = [] // 清空状态筛选以确保能找到新单据 + // 刷新列表并定位到新单据 + this.searchData.limit = this.pageSize + this.searchData.page = 1 + this.pageIndex = 1 + this.searchData.orderStatus = '' + this.searchLoading = true + searchInboundNotification(this.searchData).then(({data: listData}) => { + if (listData.code === 0) { + this.dataList = listData.page.list + this.pageIndex = listData.page.currPage + this.pageSize = listData.page.pageSize + this.totalPage = listData.page.totalCount + // 找到新创建的单据并定位 + const foundRow = this.dataList.find(item => item.orderNo === newOrderNo) + if (foundRow) { + this.currentRow = JSON.parse(JSON.stringify(foundRow)) + this.$nextTick(() => { + this.$refs.inboundTable.setCurrentRow(foundRow) + this.refreshCurrentTabTable() + }) + } else if (this.dataList.length > 0) { + this.$refs.inboundTable.setCurrentRow(this.dataList[0]) + this.inboundClickRow(this.dataList[0]) + } + } + // 恢复搜索条件 + this.searchData.orderNo = '' + this.searchData.orderStatusList = ['草稿'] + }).finally(() => { + this.searchLoading = false + }) } else { this.$message.error(data.msg) } diff --git a/src/views/modules/qc/outboundNotification.vue b/src/views/modules/qc/outboundNotification.vue index 2cfcb31..e2f0a76 100644 --- a/src/views/modules/qc/outboundNotification.vue +++ b/src/views/modules/qc/outboundNotification.vue @@ -1322,9 +1322,43 @@ if (this.modalData.flag === '1') { // 新增 saveOutboundNotification(this.modalData).then(({data}) => { if (data && data.code === 0) { - this.getDataList() + const newOrderNo = data.orderNo // 获取新创建的单据号 this.modalFlag = false this.$message.success('操作成功') + // 清空搜索条件,设置为新单据号以便精确查询 + this.searchData.orderNo = newOrderNo + this.searchData.orderStatusList = [] // 清空状态筛选以确保能找到新单据 + // 刷新列表并定位到新单据 + this.searchData.limit = this.pageSize + this.searchData.page = 1 + this.pageIndex = 1 + this.searchData.orderStatus = '' + this.searchLoading = true + searchOutboundNotification(this.searchData).then(({data: listData}) => { + if (listData.code === 0) { + this.dataList = listData.page.list + this.pageIndex = listData.page.currPage + this.pageSize = listData.page.pageSize + this.totalPage = listData.page.totalCount + // 找到新创建的单据并定位 + const foundRow = this.dataList.find(item => item.orderNo === newOrderNo) + if (foundRow) { + this.currentRow = JSON.parse(JSON.stringify(foundRow)) + this.$nextTick(() => { + this.$refs.outboundTable.setCurrentRow(foundRow) + this.refreshCurrentTabTable() + }) + } else if (this.dataList.length > 0) { + this.$refs.outboundTable.setCurrentRow(this.dataList[0]) + this.inboundClickRow(this.dataList[0]) + } + } + // 恢复搜索条件 + this.searchData.orderNo = '' + this.searchData.orderStatusList = ['草稿'] + }).finally(() => { + this.searchLoading = false + }) } else { this.$message.error(data.msg) }