作者 dong

序号列修复

@@ -106,11 +106,6 @@ @@ -106,11 +106,6 @@
106 return res; 106 return res;
107 }, 107 },
108 columns, 108 columns,
109 - indexColumnProps: {  
110 - title: '序号',  
111 - width: 80,  
112 - fixed: 'left',  
113 - },  
114 formConfig: { 109 formConfig: {
115 schemas: searchFormSchema, 110 schemas: searchFormSchema,
116 autoSubmitOnEnter: true, 111 autoSubmitOnEnter: true,
@@ -52,36 +52,6 @@ @@ -52,36 +52,6 @@
52 const queryParam = reactive<any>({}); 52 const queryParam = reactive<any>({});
53 const checkedKeys = ref<Array<string | number>>([]); 53 const checkedKeys = ref<Array<string | number>>([]);
54 const userStore = useUserStore(); 54 const userStore = useUserStore();
55 - // 分页信息  
56 - const pagination = ref({  
57 - current: 1,  
58 - pageSize: 10,  
59 - total: 0,  
60 - });  
61 -  
62 - // 处理表格变化事件(包括分页变化)  
63 - function handleTableChange(pag) {  
64 - if (pag) {  
65 - pagination.value = {  
66 - current: pag.current,  
67 - pageSize: pag.pageSize,  
68 - total: pag.total,  
69 - };  
70 - }  
71 - }  
72 -  
73 - // 创建序号列  
74 - const indexColumn: BasicColumn = {  
75 - title: '序号',  
76 - align: 'center',  
77 - dataIndex: 'index',  
78 - key: 'rowIndex',  
79 - width: 60,  
80 - customRender: ({ index }) => {  
81 - // 使用分页状态计算连续序号  
82 - return (pagination.value.current - 1) * pagination.value.pageSize + index + 1;  
83 - },  
84 - };  
85 // 添加知识库名称映射 55 // 添加知识库名称映射
86 const knowledgeMap = ref<Record<string, string>>({}); 56 const knowledgeMap = ref<Record<string, string>>({});
87 57
@@ -136,7 +106,7 @@ @@ -136,7 +106,7 @@
136 const filteredColumns = defaultColumns.filter((col) => col.dataIndex !== 'name' && col.title !== '知识库名称'); 106 const filteredColumns = defaultColumns.filter((col) => col.dataIndex !== 'name' && col.title !== '知识库名称');
137 107
138 // 添加新的知识库列 108 // 添加新的知识库列
139 - return [indexColumn, ...filteredColumns, knowledgeColumn]; 109 + return [...filteredColumns, knowledgeColumn];
140 }); 110 });
141 111
142 //注册model 112 //注册model
@@ -145,7 +115,18 @@ @@ -145,7 +115,18 @@
145 const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ 115 const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
146 tableProps: { 116 tableProps: {
147 title: 'test', 117 title: 'test',
148 - api: list, 118 + api: async (params) => {
  119 + const res = await list(params);
  120 + // 处理序号 - 关键修改
  121 + if (res?.records && Array.isArray(res.records)) {
  122 + const startIndex = (params.pageNo - 1) * params.pageSize + 1;
  123 + res.records = res.records.map((item, index) => ({
  124 + ...item,
  125 + index: startIndex + index,
  126 + }));
  127 + }
  128 + return res;
  129 + },
149 columns: tableColumns, 130 columns: tableColumns,
150 canResize: false, 131 canResize: false,
151 formConfig: { 132 formConfig: {
@@ -6,6 +6,13 @@ import { listknowledge } from '@/views/super/airag/test/Test.api'; @@ -6,6 +6,13 @@ import { listknowledge } from '@/views/super/airag/test/Test.api';
6 6
7 //列表数据 7 //列表数据
8 export const columns: BasicColumn[] = [ 8 export const columns: BasicColumn[] = [
  9 + {
  10 + title: '序号',
  11 + align: 'center',
  12 + dataIndex: 'index',
  13 + key: 'rowIndex',
  14 + width: 60,
  15 + },
9 /*{ 16 /*{
10 title: 'ID', 17 title: 'ID',
11 align: 'center', 18 align: 'center',