diff --git a/src/views/modules/sampleTracking/projectProofTracking.vue b/src/views/modules/sampleTracking/projectProofTracking.vue index f1dc6c7..f248098 100644 --- a/src/views/modules/sampleTracking/projectProofTracking.vue +++ b/src/views/modules/sampleTracking/projectProofTracking.vue @@ -185,7 +185,7 @@ }" >{{ processTooltip.content }} - + @@ -217,7 +217,7 @@ - + @@ -234,11 +234,6 @@ - - - - - @@ -895,6 +890,7 @@ export default { pageSize: 20, totalPage: 0, currentRow: null, + manualSelectedTrackingId: null, selectionRows: [], batchEditMode: false, processHistoryMap: {}, @@ -1253,11 +1249,19 @@ export default { this.cancelCommentsEdit() } } - if (this.dataList.length > 0) { - this.currentRow = this.dataList[0] - } else { - this.currentRow = null + const manualSelectedId = this.manualSelectedTrackingId + const previousCurrentId = this.currentRow && this.currentRow.trackingId + let nextCurrentRow = null + if (manualSelectedId != null) { + // 只要用户没有手动点新行,刷新后始终尝试回选上次手动选中的那一行 + nextCurrentRow = this.dataList.find(item => item && item.trackingId === manualSelectedId) || null + } else if (previousCurrentId != null) { + nextCurrentRow = this.dataList.find(item => item && item.trackingId === previousCurrentId) || null + } + if (!nextCurrentRow && manualSelectedId == null && this.dataList.length > 0) { + nextCurrentRow = this.dataList[0] } + this.currentRow = nextCurrentRow this.$nextTick(() => { if (this.$refs.trackingTable && typeof this.$refs.trackingTable.setCurrentRow === 'function') { this.$refs.trackingTable.setCurrentRow(this.currentRow || null) @@ -1366,6 +1370,7 @@ export default { }, rowClick (row) { this.currentRow = row + this.manualSelectedTrackingId = row && row.trackingId ? row.trackingId : null }, sizeChangeHandle (val) { this.pageSize = val