作者 dong

修复bug,更正需求

... ... @@ -12,6 +12,6 @@ export const toolbar =
export const simplePlugins = 'lists image link fullscreen';
export const simpleToolbar = ['styles bold italic alignleft aligncenter alignright alignjustify bullist numlist outdent indent lists image link '];
export const simpleToolbar = ['styles bold italic alignleft aligncenter alignright alignjustify bullist numlist outdent indent lists '];
export const menubar = 'file edit insert view format table';
... ...
... ... @@ -6,6 +6,7 @@ const { createConfirm } = useMessage();
enum Api {
list = '/airaglog/airagLog/list',
listmodelid = '/airaglog/airagLog/listmodelid',
listKnowledgeName = '/airaglog/airagLog/listKnowledgeName',
save = '/airaglog/airagLog/add',
saveToQuestionLibrary = '/airaglog/airagLog/saveToQuestionLibrary',
edit = '/airaglog/airagLog/edit',
... ... @@ -29,6 +30,8 @@ export const getImportUrl = Api.importExcel;
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
export const listmodelid = (params) => defHttp.get({ url: Api.listmodelid, params });
export const listKnowledgeName = (params) => defHttp.get({ url: Api.listKnowledgeName, params });
export const saveToQuestionLibrary = (params) =>
defHttp.post({
url: Api.saveToQuestionLibrary,
... ...
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { listmodelid } from '@/views/super/airag/airaglog/AiragLog.api';
import { listKnowledgeName, listmodelid } from '@/views/super/airag/airaglog/AiragLog.api';
//列表数据
export const columns: BasicColumn[] = [
{
... ... @@ -91,11 +91,11 @@ export const searchFormSchema: FormSchema[] = [
options: [
{
label: '未命中',
value: 1,
value: 3,
},
{
label: '模型回答',
value: 1,
value: 2,
},
{
label: '问题库回答',
... ... @@ -126,7 +126,7 @@ export const searchFormSchema: FormSchema[] = [
export const formSchema: FormSchema[] = [
{
label: '模型名称',
field: 'name', // 注意:这里使用knowledgeId作为字段名
field: 'modelId', // 注意:这里使用knowledgeId作为字段名
component: 'Input',
required: true,
componentProps: {
... ... @@ -157,6 +157,21 @@ export const formSchema: FormSchema[] = [
style: { width: '100%' }, // 宽度自适应
},
},
{
label: '知识库',
field: 'knowledgeId', // 注意:这里使用knowledgeId作为字段名
component: 'ApiSelect',
required: true,
componentProps: {
api: listKnowledgeName,
labelField: 'name', // 显示知识库名称
valueField: 'id', // 提交知识库ID
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
... ...
... ... @@ -2,6 +2,7 @@
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
<BasicForm @register="registerForm" name="AiragLogForm" />
<template #footer>
<a-button @click="closeModal">取消</a-button>
<!-- 根据 showSaveButton 决定显示哪个按钮 -->
<template v-if="showSaveButton">
<a-button @click="handleSubmit">存入</a-button>
... ... @@ -9,7 +10,6 @@
<template v-else>
<a-button @click="handleSubmit">确认</a-button>
</template>
<a-button @click="closeModal">取消</a-button>
</template>
</BasicModal>
</template>
... ...
... ... @@ -4,12 +4,27 @@ import { listKnowledge } from '@/views/super/airag/questionembedding/QuestionEmb
export const columns: BasicColumn[] = [
// {
// title: 'ID',
// title: '序号',
// align: 'center',
// dataIndex: 'id',
// width: 200,
// dataIndex: 'index',
// key: 'rowIndex',
// width: 60,
// customRender: function ({ index }) {
// // 获取分页参数
// const pagination = this.$parent.pagination;
// if (!pagination) return index + 1;
//
// // 计算连续序号: (当前页 - 1) * 每页条数 + 当前行索引 + 1
// return (pagination.current - 1) * pagination.pageSize + index + 1;
// },
// },
{
title: 'ID',
align: 'center',
dataIndex: 'id',
width: 200,
},
{
title: '知识库',
align: 'center',
dataIndex: 'knowledgeName',
... ...
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<BasicTable @register="registerTable" :rowSelection="rowSelection" @change="handleTableChange">
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>-->
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>-->
<a-button type="primary" preIcon="ant-design:import-outlined" @click="handleOpenImportModal">导入ZIP</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
... ... @@ -44,7 +44,7 @@
</template>
<script lang="ts" setup>
import { ref, reactive } from 'vue';
import { ref, reactive, watch } from 'vue';
import { UploadOutlined } from '@ant-design/icons-vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { BasicModal } from '/@/components/Modal';
... ... @@ -68,6 +68,24 @@
const progressColor = ref('#1890ff');
const uploadStatus = ref<'normal' | 'exception' | 'active' | 'success'>('normal');
// 分页信息
const pagination = ref({
current: 1,
pageSize: 10,
total: 0,
});
// 处理表格变化事件(包括分页变化)
function handleTableChange(pag) {
if (pag) {
pagination.value = {
current: pag.current,
pageSize: pag.pageSize,
total: pag.total
};
}
}
// 知识库选择表单
const [registerImportForm] = useForm({
labelWidth: 100,
... ... @@ -101,6 +119,7 @@
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
pagination: pagination.value, // 传递分页配置
actionColumn: {
width: 120,
fixed: 'right',
... ... @@ -113,7 +132,11 @@
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
const [registerTable, { reload }, { rowSelection, selectedRowKeys, pagination: tablePagination }] = tableContext;
watch(tablePagination, (newVal) => {
pagination.value = newVal;
});
function handleOpenImportModal() {
importModalVisible.value = true;
... ...
... ... @@ -146,6 +146,11 @@ function renderMetadataField(record: any, fieldName: string) {
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '文本名称',
field: 'docName',
component: 'Input',
},
{
label: '文本内容',
field: 'text',
component: 'Input',
... ...