Ver código fonte

fix(dm): 导入文件分页页码下拉挂到 body,避免超出窗口无法选择

- 导入文件页用本地 Pagination + Select 替换 AnalysisPagination 的页码下拉
- 页码 Select 指定 body 容器与 topLeft,脱离文件卡片 overflow 裁剪
- 保留“共 N 条 / 跳至 X 页”布局,页大小切换与跳页行为不变
cc 3 semanas atrás
pai
commit
b4eedd8d73
1 arquivos alterados com 81 adições e 11 exclusões
  1. 81 11
      ai-electron/frontend/src/case/views/data/importList.vue

+ 81 - 11
ai-electron/frontend/src/case/views/data/importList.vue

@@ -19,14 +19,39 @@
     </BasicTable>
 
     <div class="pagination-bar">
-      <AnalysisPagination
-        :total="pagination.total"
-        :current="pagination.current"
-        :page-size="pagination.pageSize"
-        :page-size-options="pageSizeOptions"
-        :loading="paginationLoading"
-        @change="handlePaginationChange"
-      />
+      <div class="analysis-pagination">
+        <div class="analysis-pagination__total">共 {{ pagination.total }} 条</div>
+        <Pagination
+          :current="pagination.current"
+          :total="pagination.total"
+          :page-size="pagination.pageSize"
+          :show-size-changer="false"
+          :show-quick-jumper="false"
+          :disabled="paginationLoading"
+          @change="handlePaginationChange"
+        />
+        <Select
+          :value="String(pagination.pageSize)"
+          :options="pageSizeSelectOptions"
+          :disabled="paginationLoading"
+          :get-popup-container="sizeDropdownContainer"
+          placement="topLeft"
+          class="analysis-pagination__size"
+          @change="handlePageSizeChange"
+        />
+        <span v-if="showQuickJumper" class="analysis-pagination__jumper">
+          跳至
+          <Input
+            v-model:value="jumpPageText"
+            size="small"
+            class="analysis-pagination__jump-input"
+            :disabled="paginationLoading"
+            @pressEnter="handleJumpPage"
+            @blur="handleJumpPage"
+          />
+          页
+        </span>
+      </div>
     </div>
 
     <CleanLogModal
@@ -38,10 +63,9 @@
   </div>
 </template>
 <script lang="ts" setup name="ViewsSysEmpUserList">
-  import { h, onBeforeUnmount, onMounted, ref, watch } from 'vue';
+  import { computed, h, onBeforeUnmount, onMounted, ref, watch } from 'vue';
   import type { PropType } from 'vue';
-  import { Popconfirm } from 'ant-design-vue';
-  import AnalysisPagination from '@/core/components/AnalysisPagination/src/AnalysisPagination.vue';
+  import { Input, Pagination, Popconfirm, Select } from 'ant-design-vue';
   import { Icon } from '@/core/components/Icon';
   import { BasicTable, BasicColumn, useTable } from '@/core/components/Table';
   import { useDesign } from '@/core/hooks/web/useDesign';
@@ -96,6 +120,13 @@
     label: value,
     value: Number(value),
   }));
+  const pageSizeSelectOptions = computed(() =>
+    pageSizeOptions.map((item) => ({ label: `${item.value} 条/页`, value: String(item.value) })),
+  );
+  const showQuickJumper = computed(() => pagination.value.total > pagination.value.pageSize);
+  const jumpPageText = ref('');
+  /** 页码下拉挂到 body,避免被文件卡片/分页条的 overflow:hidden 裁剪 */
+  const sizeDropdownContainer = () => document.body;
 
   const normalizeSearchParams = (params: Recordable = {}) => {
     const nextParams: Recordable = { ...params };
@@ -413,6 +444,27 @@
     }
   };
 
+  /** 自定义页码下拉:走 body 容器,避免被卡片 overflow 裁剪 */
+  const handlePageSizeChange = (value: string | number) => {
+    const size = Number(value);
+    if (!Number.isFinite(size) || size === pagination.value.pageSize) return;
+    void handlePaginationChange(1, size);
+  };
+
+  /** 自定义“跳至 X 页”,行为与 Ant Pagination 的 quick jumper 一致 */
+  const handleJumpPage = () => {
+    const raw = jumpPageText.value.trim();
+    jumpPageText.value = '';
+    if (!raw) return;
+    const target = Number(raw);
+    if (!Number.isFinite(target)) return;
+    const maxPage = Math.max(1, Math.ceil(pagination.value.total / pagination.value.pageSize));
+    const page = Math.min(Math.max(1, Math.trunc(target)), maxPage);
+    if (page !== pagination.value.current) {
+      void handlePaginationChange(page, pagination.value.pageSize);
+    }
+  };
+
   const syncTableLayout = () => {
     if (!props.active) return;
     requestAnimationFrame(() => {
@@ -894,5 +946,23 @@
       overflow: hidden;
       box-sizing: border-box;
     }
+
+    .analysis-pagination__size {
+      width: 100px;
+    }
+
+    .analysis-pagination__jumper {
+      display: inline-flex;
+      align-items: center;
+      gap: 4px;
+      color: #6b7280;
+      font-size: 12px;
+      white-space: nowrap;
+    }
+
+    .analysis-pagination__jump-input {
+      width: 44px;
+      text-align: center;
+    }
   }
 </style>