Browse Source

Merge branch 'master' of http://git.fmode.cn:3000/nkkj/yss-project

徐福静0235668 20 hours ago
parent
commit
d4622a8b8e
1 changed files with 27 additions and 39 deletions
  1. 27 39
      src/app/pages/customer-service/case-library/case-library.ts

+ 27 - 39
src/app/pages/customer-service/case-library/case-library.ts

@@ -237,35 +237,35 @@ export class CaseLibrary implements OnInit {
     });
   }
   // 智能页码生成
-pageNumbers = computed(() => {
-  const pages = [];
-  const total = this.totalPages();
-  const current = this.currentPage();
-  
-  // 显示当前页及前后2页,加上第一页和最后一页
-  const start = Math.max(1, current - 2);
-  const end = Math.min(total, current + 2);
-  
-  if (start > 1) {
-    pages.push(1);
-    if (start > 2) {
-      pages.push(-1); // 用-1表示省略号
+  pageNumbers = computed(() => {
+    const pages = [];
+    const total = this.totalPages();
+    const current = this.currentPage();
+    
+    // 显示当前页及前后2页,加上第一页和最后一页
+    const start = Math.max(1, current - 2);
+    const end = Math.min(total, current + 2);
+    
+    if (start > 1) {
+      pages.push(1);
+      if (start > 2) {
+        pages.push(-1); // 用-1表示省略号
+      }
     }
-  }
-  
-  for (let i = start; i <= end; i++) {
-    pages.push(i);
-  }
-  
-  if (end < total) {
-    if (end < total - 1) {
-      pages.push(-1); // 用-1表示省略号
+    
+    for (let i = start; i <= end; i++) {
+      pages.push(i);
     }
-    pages.push(total);
-  }
-  
-  return pages;
-});
+    
+    if (end < total) {
+      if (end < total - 1) {
+        pages.push(-1); // 用-1表示省略号
+      }
+      pages.push(total);
+    }
+    
+    return pages;
+  });
   // 格式化样式显示的辅助方法
   getStyleDisplay(caseItem: CaseItem | null | undefined): string {
     if (!caseItem || !caseItem.style) {
@@ -279,18 +279,6 @@ pageNumbers = computed(() => {
     return this.getStyleDisplay(this.selectedCase());
   }
 
-  // 删除重复的简单分页逻辑
-  // 保留智能分页逻辑(第251-270行)
-  // 移除下面这段代码:
-  //  // 在组件类中添加这个计算属性
-  //  pageNumbers = computed(() => {
-  //    const pages = [];
-  //    for (let i = 1; i <= this.totalPages(); i++) {
-  //      pages.push(i);
-  //    }
-  //    return pages;
-  //  });
-  
   // 修复 onStyleChange 方法中的类型安全问题
   onStyleChange(style: string, isChecked: boolean): void {
     const currentStyles = (this.filterForm.get('style')?.value || []) as string[];