正在显示
7 个修改的文件
包含
56 行增加
和
142 行删除
| @@ -8,11 +8,10 @@ export const columns: BasicColumn[] = [ | @@ -8,11 +8,10 @@ export const columns: BasicColumn[] = [ | ||
| 8 | { | 8 | { |
| 9 | title: '序号', | 9 | title: '序号', |
| 10 | align: 'center', | 10 | align: 'center', |
| 11 | - dataIndex: 'index', | ||
| 12 | - key: 'rowIndex', | 11 | + dataIndex: 'index', // 使用数据中的index字段 |
| 12 | + key: 'index', | ||
| 13 | width: 60, | 13 | width: 60, |
| 14 | - // 这里只需简单的序号,实际计算在组件内完成 | ||
| 15 | - customRender: ({ index }) => index + 1, | 14 | + // 移除原有的customRender |
| 16 | }, | 15 | }, |
| 17 | { | 16 | { |
| 18 | title: '按钮名称', | 17 | title: '按钮名称', |
| @@ -98,10 +97,7 @@ export const formSchema: FormSchema[] = [ | @@ -98,10 +97,7 @@ export const formSchema: FormSchema[] = [ | ||
| 98 | field: 'buttonValues', | 97 | field: 'buttonValues', |
| 99 | component: 'InputTextArea', // 替换为文本域组件 | 98 | component: 'InputTextArea', // 替换为文本域组件 |
| 100 | componentProps: { | 99 | componentProps: { |
| 101 | - autoSize: { | ||
| 102 | - minRows: 1, // 最小行数 | ||
| 103 | - maxRows: 6, // 最大行数 | ||
| 104 | - }, | 100 | + rows: 6, |
| 105 | style: { width: '100%' }, // 宽度自适应 | 101 | style: { width: '100%' }, // 宽度自适应 |
| 106 | }, | 102 | }, |
| 107 | required: true, | 103 | required: true, |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | <!--引用表格--> | 3 | <!--引用表格--> |
| 4 | - <BasicTable @register="registerTable" :rowSelection="rowSelection" @change="handleTableChange"> | 4 | + <BasicTable @register="registerTable" :rowSelection="rowSelection"> |
| 5 | <!--插槽:table标题--> | 5 | <!--插槽:table标题--> |
| 6 | <template #tableTitle> | 6 | <template #tableTitle> |
| 7 | <a-button type="primary" v-auth="'airagbutton:airag_button:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | 7 | <a-button type="primary" v-auth="'airagbutton:airag_button:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> |
| @@ -41,60 +41,37 @@ | @@ -41,60 +41,37 @@ | ||
| 41 | </template> | 41 | </template> |
| 42 | 42 | ||
| 43 | <script lang="ts" name="airagbutton-airagButton" setup> | 43 | <script lang="ts" name="airagbutton-airagButton" setup> |
| 44 | -import {ref, reactive, computed} from 'vue'; | 44 | + import { ref, reactive } from 'vue'; |
| 45 | import { BasicTable, TableAction } from '/@/components/Table'; | 45 | import { BasicTable, TableAction } from '/@/components/Table'; |
| 46 | import { useModal } from '/@/components/Modal'; | 46 | import { useModal } from '/@/components/Modal'; |
| 47 | import { useListPage } from '/@/hooks/system/useListPage'; | 47 | import { useListPage } from '/@/hooks/system/useListPage'; |
| 48 | import AiragButtonModal from './components/AiragButtonModal.vue'; | 48 | import AiragButtonModal from './components/AiragButtonModal.vue'; |
| 49 | import { columns, searchFormSchema, superQuerySchema } from './AiragButton.data'; | 49 | import { columns, searchFormSchema, superQuerySchema } from './AiragButton.data'; |
| 50 | - import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './AiragButton.api'; | 50 | + import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './AiragButton.api'; |
| 51 | import { useUserStore } from '/@/store/modules/user'; | 51 | import { useUserStore } from '/@/store/modules/user'; |
| 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 | 55 | ||
| 56 | - // 分页信息 | ||
| 57 | - const pagination = ref({ | ||
| 58 | - current: 1, | ||
| 59 | - pageSize: 10, | ||
| 60 | - total: 0, | ||
| 61 | - }); | ||
| 62 | - | ||
| 63 | - // 处理表格变化事件(包括分页变化) | ||
| 64 | - function handleTableChange(pag) { | ||
| 65 | - if (pag) { | ||
| 66 | - pagination.value = { | ||
| 67 | - current: pag.current, | ||
| 68 | - pageSize: pag.pageSize, | ||
| 69 | - total: pag.total, | ||
| 70 | - }; | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - // 创建带序号列的列配置 | ||
| 75 | - const tableColumns = computed(() => { | ||
| 76 | - return columns.map((col) => { | ||
| 77 | - if (col.dataIndex === 'index') { | ||
| 78 | - // 序号列特殊处理 | ||
| 79 | - return { | ||
| 80 | - ...col, | ||
| 81 | - customRender: ({ index }) => { | ||
| 82 | - return (pagination.value.current - 1) * pagination.value.pageSize + index + 1; | ||
| 83 | - }, | ||
| 84 | - }; | ||
| 85 | - } | ||
| 86 | - return col; | ||
| 87 | - }); | ||
| 88 | - }); | ||
| 89 | - | ||
| 90 | //注册model | 56 | //注册model |
| 91 | const [registerModal, { openModal }] = useModal(); | 57 | const [registerModal, { openModal }] = useModal(); |
| 92 | //注册table数据 | 58 | //注册table数据 |
| 93 | const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ | 59 | const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ |
| 94 | tableProps: { | 60 | tableProps: { |
| 95 | title: '按钮表单', | 61 | title: '按钮表单', |
| 96 | - api: list, | ||
| 97 | - columns: tableColumns.value, | 62 | + api: async (params) => { |
| 63 | + const res = await list(params); | ||
| 64 | + // 处理序号 - 关键修改 | ||
| 65 | + if (res?.records && Array.isArray(res.records)) { | ||
| 66 | + const startIndex = (params.pageNo - 1) * params.pageSize + 1; | ||
| 67 | + res.records = res.records.map((item, index) => ({ | ||
| 68 | + ...item, | ||
| 69 | + index: startIndex + index, | ||
| 70 | + })); | ||
| 71 | + } | ||
| 72 | + return res; | ||
| 73 | + }, | ||
| 74 | + columns, | ||
| 98 | canResize: false, | 75 | canResize: false, |
| 99 | formConfig: { | 76 | formConfig: { |
| 100 | //labelWidth: 120, | 77 | //labelWidth: 120, |
| @@ -104,13 +81,6 @@ import {ref, reactive, computed} from 'vue'; | @@ -104,13 +81,6 @@ import {ref, reactive, computed} from 'vue'; | ||
| 104 | fieldMapToNumber: [], | 81 | fieldMapToNumber: [], |
| 105 | fieldMapToTime: [], | 82 | fieldMapToTime: [], |
| 106 | }, | 83 | }, |
| 107 | - pagination: { | ||
| 108 | - current: 1, | ||
| 109 | - pageSize: 10, | ||
| 110 | - showSizeChanger: true, | ||
| 111 | - pageSizeOptions: ['10', '20', '30'], | ||
| 112 | - showTotal: (total) => `共 ${total} 条`, | ||
| 113 | - }, | ||
| 114 | actionColumn: { | 84 | actionColumn: { |
| 115 | width: 120, | 85 | width: 120, |
| 116 | fixed: 'right', | 86 | fixed: 'right', |
| @@ -131,7 +101,6 @@ import {ref, reactive, computed} from 'vue'; | @@ -131,7 +101,6 @@ import {ref, reactive, computed} from 'vue'; | ||
| 131 | }); | 101 | }); |
| 132 | 102 | ||
| 133 | const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; | 103 | const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; |
| 134 | - | ||
| 135 | // 高级查询配置 | 104 | // 高级查询配置 |
| 136 | const superQueryConfig = reactive(superQuerySchema); | 105 | const superQueryConfig = reactive(superQuerySchema); |
| 137 | 106 |
| @@ -6,11 +6,10 @@ export const columns: BasicColumn[] = [ | @@ -6,11 +6,10 @@ export const columns: BasicColumn[] = [ | ||
| 6 | { | 6 | { |
| 7 | title: '序号', | 7 | title: '序号', |
| 8 | align: 'center', | 8 | align: 'center', |
| 9 | - dataIndex: 'index', | ||
| 10 | - key: 'rowIndex', | 9 | + dataIndex: 'index', // 使用数据中的index字段 |
| 10 | + key: 'index', | ||
| 11 | width: 60, | 11 | width: 60, |
| 12 | - // 这里只需简单的序号,实际计算在组件内完成 | ||
| 13 | - customRender: ({ index }) => index + 1, | 12 | + // 移除原有的customRender |
| 14 | }, | 13 | }, |
| 15 | { | 14 | { |
| 16 | title: '问题', | 15 | title: '问题', |
| @@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
| 39 | </template> | 39 | </template> |
| 40 | 40 | ||
| 41 | <script lang="ts" name="airaglog-airagLog" setup> | 41 | <script lang="ts" name="airaglog-airagLog" setup> |
| 42 | -import {ref, reactive, computed} from 'vue'; | 42 | + import { ref, reactive } from 'vue'; |
| 43 | import { BasicTable, TableAction } from '/@/components/Table'; | 43 | import { BasicTable, TableAction } from '/@/components/Table'; |
| 44 | import { useModal } from '/@/components/Modal'; | 44 | import { useModal } from '/@/components/Modal'; |
| 45 | import { useListPage } from '/@/hooks/system/useListPage'; | 45 | import { useListPage } from '/@/hooks/system/useListPage'; |
| @@ -51,47 +51,25 @@ import {ref, reactive, computed} from 'vue'; | @@ -51,47 +51,25 @@ import {ref, reactive, computed} from 'vue'; | ||
| 51 | const queryParam = reactive<any>({}); | 51 | const queryParam = reactive<any>({}); |
| 52 | const checkedKeys = ref<Array<string | number>>([]); | 52 | const checkedKeys = ref<Array<string | number>>([]); |
| 53 | const userStore = useUserStore(); | 53 | const userStore = useUserStore(); |
| 54 | - // 分页信息 | ||
| 55 | - const pagination = ref({ | ||
| 56 | - current: 1, | ||
| 57 | - pageSize: 10, | ||
| 58 | - total: 0, | ||
| 59 | - }); | ||
| 60 | - | ||
| 61 | - // 处理表格变化事件(包括分页变化) | ||
| 62 | - function handleTableChange(pag) { | ||
| 63 | - if (pag) { | ||
| 64 | - pagination.value = { | ||
| 65 | - current: pag.current, | ||
| 66 | - pageSize: pag.pageSize, | ||
| 67 | - total: pag.total, | ||
| 68 | - }; | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - // 创建带序号列的列配置 | ||
| 73 | - const tableColumns = computed(() => { | ||
| 74 | - return columns.map((col) => { | ||
| 75 | - if (col.dataIndex === 'index') { | ||
| 76 | - // 序号列特殊处理 | ||
| 77 | - return { | ||
| 78 | - ...col, | ||
| 79 | - customRender: ({ index }) => { | ||
| 80 | - return (pagination.value.current - 1) * pagination.value.pageSize + index + 1; | ||
| 81 | - }, | ||
| 82 | - }; | ||
| 83 | - } | ||
| 84 | - return col; | ||
| 85 | - }); | ||
| 86 | - }); | ||
| 87 | //注册model | 54 | //注册model |
| 88 | const [registerModal, { openModal }] = useModal(); | 55 | const [registerModal, { openModal }] = useModal(); |
| 89 | //注册table数据 | 56 | //注册table数据 |
| 90 | const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ | 57 | const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ |
| 91 | tableProps: { | 58 | tableProps: { |
| 92 | title: '日志管理', | 59 | title: '日志管理', |
| 93 | - api: list, | ||
| 94 | - columns: tableColumns.value, | 60 | + api: async (params) => { |
| 61 | + const res = await list(params); | ||
| 62 | + // 处理序号 - 关键修改 | ||
| 63 | + if (res?.records && Array.isArray(res.records)) { | ||
| 64 | + const startIndex = (params.pageNo - 1) * params.pageSize + 1; | ||
| 65 | + res.records = res.records.map((item, index) => ({ | ||
| 66 | + ...item, | ||
| 67 | + index: startIndex + index, | ||
| 68 | + })); | ||
| 69 | + } | ||
| 70 | + return res; | ||
| 71 | + }, | ||
| 72 | + columns, | ||
| 95 | canResize: false, | 73 | canResize: false, |
| 96 | formConfig: { | 74 | formConfig: { |
| 97 | //labelWidth: 120, | 75 | //labelWidth: 120, |
| @@ -108,13 +86,6 @@ import {ref, reactive, computed} from 'vue'; | @@ -108,13 +86,6 @@ import {ref, reactive, computed} from 'vue'; | ||
| 108 | ], | 86 | ], |
| 109 | ], | 87 | ], |
| 110 | }, | 88 | }, |
| 111 | - pagination: { | ||
| 112 | - current: 1, | ||
| 113 | - pageSize: 10, | ||
| 114 | - showSizeChanger: true, | ||
| 115 | - pageSizeOptions: ['10', '20', '30'], | ||
| 116 | - showTotal: (total) => `共 ${total} 条`, | ||
| 117 | - }, | ||
| 118 | actionColumn: { | 89 | actionColumn: { |
| 119 | width: 120, | 90 | width: 120, |
| 120 | fixed: 'right', | 91 | fixed: 'right', |
| @@ -9,8 +9,6 @@ export const columns: BasicColumn[] = [ | @@ -9,8 +9,6 @@ export const columns: BasicColumn[] = [ | ||
| 9 | dataIndex: 'index', | 9 | dataIndex: 'index', |
| 10 | key: 'rowIndex', | 10 | key: 'rowIndex', |
| 11 | width: 60, | 11 | width: 60, |
| 12 | - // 这里只需简单的序号,实际计算在组件内完成 | ||
| 13 | - customRender: ({ index }) => index + 1, | ||
| 14 | }, | 12 | }, |
| 15 | { | 13 | { |
| 16 | title: 'ID', | 14 | title: 'ID', |
| @@ -67,41 +67,6 @@ | @@ -67,41 +67,6 @@ | ||
| 67 | const uploadProgress = ref(0); | 67 | const uploadProgress = ref(0); |
| 68 | const progressColor = ref('#1890ff'); | 68 | const progressColor = ref('#1890ff'); |
| 69 | const uploadStatus = ref<'normal' | 'exception' | 'active' | 'success'>('normal'); | 69 | const uploadStatus = ref<'normal' | 'exception' | 'active' | 'success'>('normal'); |
| 70 | - | ||
| 71 | - // 分页信息 | ||
| 72 | - const pagination = ref({ | ||
| 73 | - current: 1, | ||
| 74 | - pageSize: 10, | ||
| 75 | - total: 0, | ||
| 76 | - }); | ||
| 77 | - | ||
| 78 | - // 处理表格变化事件(包括分页变化) | ||
| 79 | - function handleTableChange(pag) { | ||
| 80 | - if (pag) { | ||
| 81 | - pagination.value = { | ||
| 82 | - current: pag.current, | ||
| 83 | - pageSize: pag.pageSize, | ||
| 84 | - total: pag.total, | ||
| 85 | - }; | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - // 创建带序号列的列配置 | ||
| 90 | - const tableColumns = computed(() => { | ||
| 91 | - return columns.map((col) => { | ||
| 92 | - if (col.dataIndex === 'index') { | ||
| 93 | - // 序号列特殊处理 | ||
| 94 | - return { | ||
| 95 | - ...col, | ||
| 96 | - customRender: ({ index }) => { | ||
| 97 | - return (pagination.value.current - 1) * pagination.value.pageSize + index + 1; | ||
| 98 | - }, | ||
| 99 | - }; | ||
| 100 | - } | ||
| 101 | - return col; | ||
| 102 | - }); | ||
| 103 | - }); | ||
| 104 | - | ||
| 105 | // 知识库选择表单 | 70 | // 知识库选择表单 |
| 106 | const [registerImportForm] = useForm({ | 71 | const [registerImportForm] = useForm({ |
| 107 | labelWidth: 100, | 72 | labelWidth: 100, |
| @@ -128,8 +93,24 @@ | @@ -128,8 +93,24 @@ | ||
| 128 | const { tableContext, onExportXls } = useListPage({ | 93 | const { tableContext, onExportXls } = useListPage({ |
| 129 | tableProps: { | 94 | tableProps: { |
| 130 | title: '问答向量库', | 95 | title: '问答向量库', |
| 131 | - api: list, | ||
| 132 | - columns: tableColumns.value, | 96 | + api: async (params) => { |
| 97 | + const res = await list(params); | ||
| 98 | + // 处理序号 - 关键修改 | ||
| 99 | + if (res?.records && Array.isArray(res.records)) { | ||
| 100 | + const startIndex = (params.pageNo - 1) * params.pageSize + 1; | ||
| 101 | + res.records = res.records.map((item, index) => ({ | ||
| 102 | + ...item, | ||
| 103 | + index: startIndex + index, | ||
| 104 | + })); | ||
| 105 | + } | ||
| 106 | + return res; | ||
| 107 | + }, | ||
| 108 | + columns, | ||
| 109 | + indexColumnProps: { | ||
| 110 | + title: '序号', | ||
| 111 | + width: 80, | ||
| 112 | + fixed: 'left', | ||
| 113 | + }, | ||
| 133 | formConfig: { | 114 | formConfig: { |
| 134 | schemas: searchFormSchema, | 115 | schemas: searchFormSchema, |
| 135 | autoSubmitOnEnter: true, | 116 | autoSubmitOnEnter: true, |
| @@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
| 24 | </a-button> | 24 | </a-button> |
| 25 | </a-dropdown> | 25 | </a-dropdown> |
| 26 | <!-- 高级查询 --> | 26 | <!-- 高级查询 --> |
| 27 | - <!-- <super-query :config="superQueryConfig" @search="handleSuperQuery" />--> | 27 | +<!-- <super-query :config="superQueryConfig" @search="handleSuperQuery" />--> |
| 28 | </template> | 28 | </template> |
| 29 | <!--操作栏--> | 29 | <!--操作栏--> |
| 30 | <template #action="{ record }"> | 30 | <template #action="{ record }"> |
-
请 注册 或 登录 后发表评论