作者 dong

修复bug,更正需求

@@ -12,6 +12,6 @@ export const toolbar = @@ -12,6 +12,6 @@ export const toolbar =
12 12
13 export const simplePlugins = 'lists image link fullscreen'; 13 export const simplePlugins = 'lists image link fullscreen';
14 14
15 -export const simpleToolbar = ['styles bold italic alignleft aligncenter alignright alignjustify bullist numlist outdent indent lists image link ']; 15 +export const simpleToolbar = ['styles bold italic alignleft aligncenter alignright alignjustify bullist numlist outdent indent lists '];
16 16
17 export const menubar = 'file edit insert view format table'; 17 export const menubar = 'file edit insert view format table';
@@ -6,6 +6,7 @@ const { createConfirm } = useMessage(); @@ -6,6 +6,7 @@ const { createConfirm } = useMessage();
6 enum Api { 6 enum Api {
7 list = '/airaglog/airagLog/list', 7 list = '/airaglog/airagLog/list',
8 listmodelid = '/airaglog/airagLog/listmodelid', 8 listmodelid = '/airaglog/airagLog/listmodelid',
  9 + listKnowledgeName = '/airaglog/airagLog/listKnowledgeName',
9 save = '/airaglog/airagLog/add', 10 save = '/airaglog/airagLog/add',
10 saveToQuestionLibrary = '/airaglog/airagLog/saveToQuestionLibrary', 11 saveToQuestionLibrary = '/airaglog/airagLog/saveToQuestionLibrary',
11 edit = '/airaglog/airagLog/edit', 12 edit = '/airaglog/airagLog/edit',
@@ -29,6 +30,8 @@ export const getImportUrl = Api.importExcel; @@ -29,6 +30,8 @@ export const getImportUrl = Api.importExcel;
29 */ 30 */
30 export const list = (params) => defHttp.get({ url: Api.list, params }); 31 export const list = (params) => defHttp.get({ url: Api.list, params });
31 export const listmodelid = (params) => defHttp.get({ url: Api.listmodelid, params }); 32 export const listmodelid = (params) => defHttp.get({ url: Api.listmodelid, params });
  33 +export const listKnowledgeName = (params) => defHttp.get({ url: Api.listKnowledgeName, params });
  34 +
32 export const saveToQuestionLibrary = (params) => 35 export const saveToQuestionLibrary = (params) =>
33 defHttp.post({ 36 defHttp.post({
34 url: Api.saveToQuestionLibrary, 37 url: Api.saveToQuestionLibrary,
1 import { BasicColumn } from '/@/components/Table'; 1 import { BasicColumn } from '/@/components/Table';
2 import { FormSchema } from '/@/components/Table'; 2 import { FormSchema } from '/@/components/Table';
3 -import { listmodelid } from '@/views/super/airag/airaglog/AiragLog.api'; 3 +import { listKnowledgeName, listmodelid } from '@/views/super/airag/airaglog/AiragLog.api';
4 //列表数据 4 //列表数据
5 export const columns: BasicColumn[] = [ 5 export const columns: BasicColumn[] = [
6 { 6 {
@@ -91,11 +91,11 @@ export const searchFormSchema: FormSchema[] = [ @@ -91,11 +91,11 @@ export const searchFormSchema: FormSchema[] = [
91 options: [ 91 options: [
92 { 92 {
93 label: '未命中', 93 label: '未命中',
94 - value: 1, 94 + value: 3,
95 }, 95 },
96 { 96 {
97 label: '模型回答', 97 label: '模型回答',
98 - value: 1, 98 + value: 2,
99 }, 99 },
100 { 100 {
101 label: '问题库回答', 101 label: '问题库回答',
@@ -126,7 +126,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -126,7 +126,7 @@ export const searchFormSchema: FormSchema[] = [
126 export const formSchema: FormSchema[] = [ 126 export const formSchema: FormSchema[] = [
127 { 127 {
128 label: '模型名称', 128 label: '模型名称',
129 - field: 'name', // 注意:这里使用knowledgeId作为字段名 129 + field: 'modelId', // 注意:这里使用knowledgeId作为字段名
130 component: 'Input', 130 component: 'Input',
131 required: true, 131 required: true,
132 componentProps: { 132 componentProps: {
@@ -157,6 +157,21 @@ export const formSchema: FormSchema[] = [ @@ -157,6 +157,21 @@ export const formSchema: FormSchema[] = [
157 style: { width: '100%' }, // 宽度自适应 157 style: { width: '100%' }, // 宽度自适应
158 }, 158 },
159 }, 159 },
  160 + {
  161 + label: '知识库',
  162 + field: 'knowledgeId', // 注意:这里使用knowledgeId作为字段名
  163 + component: 'ApiSelect',
  164 + required: true,
  165 + componentProps: {
  166 + api: listKnowledgeName,
  167 + labelField: 'name', // 显示知识库名称
  168 + valueField: 'id', // 提交知识库ID
  169 + showSearch: true,
  170 + filterOption: (input: string, option: any) => {
  171 + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
  172 + },
  173 + },
  174 + },
160 // TODO 主键隐藏字段,目前写死为ID 175 // TODO 主键隐藏字段,目前写死为ID
161 { 176 {
162 label: '', 177 label: '',
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> 2 <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
3 <BasicForm @register="registerForm" name="AiragLogForm" /> 3 <BasicForm @register="registerForm" name="AiragLogForm" />
4 <template #footer> 4 <template #footer>
  5 + <a-button @click="closeModal">取消</a-button>
5 <!-- 根据 showSaveButton 决定显示哪个按钮 --> 6 <!-- 根据 showSaveButton 决定显示哪个按钮 -->
6 <template v-if="showSaveButton"> 7 <template v-if="showSaveButton">
7 <a-button @click="handleSubmit">存入</a-button> 8 <a-button @click="handleSubmit">存入</a-button>
@@ -9,7 +10,6 @@ @@ -9,7 +10,6 @@
9 <template v-else> 10 <template v-else>
10 <a-button @click="handleSubmit">确认</a-button> 11 <a-button @click="handleSubmit">确认</a-button>
11 </template> 12 </template>
12 - <a-button @click="closeModal">取消</a-button>  
13 </template> 13 </template>
14 </BasicModal> 14 </BasicModal>
15 </template> 15 </template>
@@ -4,11 +4,26 @@ import { listKnowledge } from '@/views/super/airag/questionembedding/QuestionEmb @@ -4,11 +4,26 @@ import { listKnowledge } from '@/views/super/airag/questionembedding/QuestionEmb
4 4
5 export const columns: BasicColumn[] = [ 5 export const columns: BasicColumn[] = [
6 // { 6 // {
7 - // title: 'ID', 7 + // title: '序号',
8 // align: 'center', 8 // align: 'center',
9 - // dataIndex: 'id',  
10 - // width: 200, 9 + // dataIndex: 'index',
  10 + // key: 'rowIndex',
  11 + // width: 60,
  12 + // customRender: function ({ index }) {
  13 + // // 获取分页参数
  14 + // const pagination = this.$parent.pagination;
  15 + // if (!pagination) return index + 1;
  16 + //
  17 + // // 计算连续序号: (当前页 - 1) * 每页条数 + 当前行索引 + 1
  18 + // return (pagination.current - 1) * pagination.pageSize + index + 1;
11 // }, 19 // },
  20 + // },
  21 + {
  22 + title: 'ID',
  23 + align: 'center',
  24 + dataIndex: 'id',
  25 + width: 200,
  26 + },
12 { 27 {
13 title: '知识库', 28 title: '知识库',
14 align: 'center', 29 align: 'center',
1 <template> 1 <template>
2 <div> 2 <div>
3 - <BasicTable @register="registerTable" :rowSelection="rowSelection"> 3 + <BasicTable @register="registerTable" :rowSelection="rowSelection" @change="handleTableChange">
4 <template #tableTitle> 4 <template #tableTitle>
5 <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button> 5 <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
6 -<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>--> 6 + <!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>-->
7 <a-button type="primary" preIcon="ant-design:import-outlined" @click="handleOpenImportModal">导入ZIP</a-button> 7 <a-button type="primary" preIcon="ant-design:import-outlined" @click="handleOpenImportModal">导入ZIP</a-button>
8 <a-dropdown v-if="selectedRowKeys.length > 0"> 8 <a-dropdown v-if="selectedRowKeys.length > 0">
9 <template #overlay> 9 <template #overlay>
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 </template> 44 </template>
45 45
46 <script lang="ts" setup> 46 <script lang="ts" setup>
47 - import { ref, reactive } from 'vue'; 47 + import { ref, reactive, watch } from 'vue';
48 import { UploadOutlined } from '@ant-design/icons-vue'; 48 import { UploadOutlined } from '@ant-design/icons-vue';
49 import { BasicTable, TableAction } from '/@/components/Table'; 49 import { BasicTable, TableAction } from '/@/components/Table';
50 import { BasicModal } from '/@/components/Modal'; 50 import { BasicModal } from '/@/components/Modal';
@@ -68,6 +68,24 @@ @@ -68,6 +68,24 @@
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 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 +
71 // 知识库选择表单 89 // 知识库选择表单
72 const [registerImportForm] = useForm({ 90 const [registerImportForm] = useForm({
73 labelWidth: 100, 91 labelWidth: 100,
@@ -101,6 +119,7 @@ @@ -101,6 +119,7 @@
101 autoSubmitOnEnter: true, 119 autoSubmitOnEnter: true,
102 showAdvancedButton: true, 120 showAdvancedButton: true,
103 }, 121 },
  122 + pagination: pagination.value, // 传递分页配置
104 actionColumn: { 123 actionColumn: {
105 width: 120, 124 width: 120,
106 fixed: 'right', 125 fixed: 'right',
@@ -113,7 +132,11 @@ @@ -113,7 +132,11 @@
113 }, 132 },
114 }); 133 });
115 134
116 - const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; 135 + const [registerTable, { reload }, { rowSelection, selectedRowKeys, pagination: tablePagination }] = tableContext;
  136 +
  137 + watch(tablePagination, (newVal) => {
  138 + pagination.value = newVal;
  139 + });
117 140
118 function handleOpenImportModal() { 141 function handleOpenImportModal() {
119 importModalVisible.value = true; 142 importModalVisible.value = true;
@@ -146,6 +146,11 @@ function renderMetadataField(record: any, fieldName: string) { @@ -146,6 +146,11 @@ function renderMetadataField(record: any, fieldName: string) {
146 //查询数据 146 //查询数据
147 export const searchFormSchema: FormSchema[] = [ 147 export const searchFormSchema: FormSchema[] = [
148 { 148 {
  149 + label: '文本名称',
  150 + field: 'docName',
  151 + component: 'Input',
  152 + },
  153 + {
149 label: '文本内容', 154 label: '文本内容',
150 field: 'text', 155 field: 'text',
151 component: 'Input', 156 component: 'Input',