From aedfc5d8e3eabf419a6dbe51944ee48902464a39 Mon Sep 17 00:00:00 2001 From: zhx Date: Sat, 9 May 2026 11:19:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E5=B8=81=E6=94=B6=E6=94=AF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/src/views/gm/gold-operation.vue | 22 ++++++++++-- apps/src/views/operate/gold-running-water.vue | 36 ++++++++++++++++--- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/apps/src/views/gm/gold-operation.vue b/apps/src/views/gm/gold-operation.vue index 9b0104e..4b80d29 100644 --- a/apps/src/views/gm/gold-operation.vue +++ b/apps/src/views/gm/gold-operation.vue @@ -67,6 +67,7 @@ const query = reactive>({ backOperationUser: undefined, context: '', endTime: '', + lastId: '', limit: DEFAULT_PAGE_SIZE, startTime: '', type: undefined, @@ -281,6 +282,7 @@ async function loadData(reset = false) { list.value = []; notMore.value = false; query.context = ''; + query.lastId = ''; currentPage.value = 1; } @@ -295,6 +297,7 @@ async function loadData(reset = false) { backOperationUser: query.backOperationUser || undefined, context: query.context || undefined, endTime: query.endTime, + lastId: query.lastId || undefined, limit: query.limit, queryBackOperationUser: true, startTime: query.startTime, @@ -302,9 +305,13 @@ async function loadData(reset = false) { userId: query.userId || undefined, }); const waters = result?.waters || []; - list.value = reset ? waters : [...list.value, ...waters]; + const nextList = reset ? waters : [...list.value, ...waters]; + list.value = nextList; query.context = result?.context || ''; - notMore.value = Boolean(result?.listOver) || !query.context; + query.lastId = String(getRunningWater(nextList[nextList.length - 1] || {}).id || ''); + notMore.value = + Boolean(result?.listOver) || + (!query.context && waters.length < Number(query.limit || DEFAULT_PAGE_SIZE)); } finally { loading.value = false; loadMoreLoading.value = false; @@ -325,7 +332,13 @@ async function ensurePageLoaded(page: number) { } } -async function handlePageChange(page: number) { +async function handlePageChange(page: number, pageSize?: number) { + if (pageSize && pageSize !== Number(query.limit || DEFAULT_PAGE_SIZE)) { + query.limit = pageSize; + await loadData(true); + return; + } + await ensurePageLoaded(page); if (notMore.value) { const maxPage = Math.max(1, Math.ceil(list.value.length / Number(query.limit || DEFAULT_PAGE_SIZE))); @@ -463,9 +476,12 @@ void loadData(true); :current="currentPage" :disabled="loading || loadMoreLoading" :page-size="query.limit" + :page-size-options="['20', '50', '100', '200']" + :show-size-changer="true" :total="paginationTotal" show-less-items @change="handlePageChange" + @showSizeChange="handlePageChange" /> diff --git a/apps/src/views/operate/gold-running-water.vue b/apps/src/views/operate/gold-running-water.vue index d146ba1..a4f2193 100644 --- a/apps/src/views/operate/gold-running-water.vue +++ b/apps/src/views/operate/gold-running-water.vue @@ -67,6 +67,7 @@ const query = reactive>({ context: '', endTime: '', id: '', + lastId: '', limit: DEFAULT_PAGE_SIZE, origin: '', startTime: '', @@ -115,6 +116,19 @@ const paginationTotal = computed(() => { return Math.max(list.value.length + pageSize, (currentPage.value + 1) * pageSize); }); +function getRunningWater(record: Record) { + return record.runningWater || record; +} + +function getRowKey(record: Record) { + return getRunningWater(record).id || record.id; +} + +function getLastRunningWaterId(records = list.value) { + const lastRecord = records[records.length - 1]; + return lastRecord ? String(getRunningWater(lastRecord).id || '') : ''; +} + watch( rangeDate, (value) => { @@ -202,6 +216,7 @@ async function loadData(reset = false) { list.value = []; notMore.value = false; query.context = ''; + query.lastId = ''; currentPage.value = 1; } @@ -220,9 +235,13 @@ async function loadData(reset = false) { try { const result = await getClsGoldRunningWater({ ...query }); const waters = result?.waters || []; - list.value = reset ? waters : [...list.value, ...waters]; + const nextList = reset ? waters : [...list.value, ...waters]; + list.value = nextList; query.context = result?.context || ''; - notMore.value = Boolean(result?.listOver) || !query.context; + query.lastId = getLastRunningWaterId(nextList); + notMore.value = + Boolean(result?.listOver) || + (!query.context && waters.length < Number(query.limit || DEFAULT_PAGE_SIZE)); } finally { loading.value = false; loadMoreLoading.value = false; @@ -243,7 +262,13 @@ async function ensurePageLoaded(page: number) { } } -async function handlePageChange(page: number) { +async function handlePageChange(page: number, pageSize?: number) { + if (pageSize && pageSize !== Number(query.limit || DEFAULT_PAGE_SIZE)) { + query.limit = pageSize; + await loadData(true); + return; + } + await ensurePageLoaded(page); if (notMore.value) { const maxPage = Math.max(1, Math.ceil(list.value.length / Number(query.limit || DEFAULT_PAGE_SIZE))); @@ -339,7 +364,7 @@ void loadData(true); :data-source="currentPageList" :loading="loading" :pagination="false" - row-key="id" + :row-key="getRowKey" :scroll="{ x: 1280 }" @row-click="openUserDetails" > @@ -391,9 +416,12 @@ void loadData(true); :current="currentPage" :disabled="loading || loadMoreLoading" :page-size="query.limit" + :page-size-options="['20', '50', '100', '200']" + :show-size-changer="true" :total="paginationTotal" show-less-items @change="handlePageChange" + @showSizeChange="handlePageChange" />