feat(ui): 添加文件上传成功事件并刷新任务列表
在文件上传组件中添加success事件,当上传成功时触发并刷新任务列表。同时在基准评测组件中添加刷新按钮并优化任务提交后的处理逻辑。
This commit is contained in:
parent
ade5445cae
commit
9032848450
@ -6,6 +6,10 @@
|
|||||||
<span class="total-count">{{ benchmarks.length }} 个基准</span>
|
<span class="total-count">{{ benchmarks.length }} 个基准</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
|
<a-button @click="loadBenchmarks">
|
||||||
|
<template #icon><ReloadOutlined /></template>
|
||||||
|
刷新
|
||||||
|
</a-button>
|
||||||
<a-button type="primary" @click="showUploadModal">
|
<a-button type="primary" @click="showUploadModal">
|
||||||
<template #icon><UploadOutlined /></template>
|
<template #icon><UploadOutlined /></template>
|
||||||
上传基准
|
上传基准
|
||||||
@ -92,7 +96,6 @@
|
|||||||
<!-- 底部信息 -->
|
<!-- 底部信息 -->
|
||||||
<div class="benchmark-footer">
|
<div class="benchmark-footer">
|
||||||
<span class="benchmark-time">{{ formatDate(benchmark.created_at) }}</span>
|
<span class="benchmark-time">{{ formatDate(benchmark.created_at) }}</span>
|
||||||
<span class="benchmark-id">{{ benchmark.benchmark_id.slice(0, 8) }}</span>
|
|
||||||
<span class="benchmark-count">{{ benchmark.question_count }} 个问题</span>
|
<span class="benchmark-count">{{ benchmark.question_count }} 个问题</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -182,9 +185,11 @@ import {
|
|||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
CheckCircleOutlined,
|
CheckCircleOutlined,
|
||||||
CloseCircleOutlined
|
CloseCircleOutlined,
|
||||||
|
ReloadOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import { evaluationApi } from '@/apis/knowledge_api';
|
import { evaluationApi } from '@/apis/knowledge_api';
|
||||||
|
import { useTaskerStore } from '@/stores/tasker';
|
||||||
import BenchmarkUploadModal from './modals/BenchmarkUploadModal.vue';
|
import BenchmarkUploadModal from './modals/BenchmarkUploadModal.vue';
|
||||||
import BenchmarkGenerateModal from './modals/BenchmarkGenerateModal.vue';
|
import BenchmarkGenerateModal from './modals/BenchmarkGenerateModal.vue';
|
||||||
|
|
||||||
@ -197,6 +202,8 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['refresh']);
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
|
const taskerStore = useTaskerStore();
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const benchmarks = ref([]);
|
const benchmarks = ref([]);
|
||||||
@ -243,6 +250,7 @@ const showGenerateModal = () => {
|
|||||||
const onUploadSuccess = () => {
|
const onUploadSuccess = () => {
|
||||||
loadBenchmarks();
|
loadBenchmarks();
|
||||||
message.success('基准上传成功');
|
message.success('基准上传成功');
|
||||||
|
taskerStore.loadTasks(); // 刷新任务列表
|
||||||
// 通知父组件刷新基准列表
|
// 通知父组件刷新基准列表
|
||||||
emit('refresh');
|
emit('refresh');
|
||||||
};
|
};
|
||||||
@ -250,7 +258,8 @@ const onUploadSuccess = () => {
|
|||||||
// 生成成功回调
|
// 生成成功回调
|
||||||
const onGenerateSuccess = () => {
|
const onGenerateSuccess = () => {
|
||||||
loadBenchmarks();
|
loadBenchmarks();
|
||||||
message.success('基准生成成功');
|
// message.success('基准生成成功'); // 移除,由模态框提示任务提交
|
||||||
|
taskerStore.loadTasks(); // 刷新任务列表
|
||||||
// 通知父组件刷新基准列表
|
// 通知父组件刷新基准列表
|
||||||
emit('refresh');
|
emit('refresh');
|
||||||
};
|
};
|
||||||
|
|||||||
@ -172,7 +172,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:visible']);
|
const emit = defineEmits(['update:visible', 'success']);
|
||||||
|
|
||||||
const store = useDatabaseStore();
|
const store = useDatabaseStore();
|
||||||
|
|
||||||
@ -740,6 +740,7 @@ const chunkData = async () => {
|
|||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
emit('update:visible', false);
|
emit('update:visible', false);
|
||||||
|
emit('success');
|
||||||
fileList.value = [];
|
fileList.value = [];
|
||||||
sameNameFiles.value = []; // 清空同名文件列表
|
sameNameFiles.value = []; // 清空同名文件列表
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<FileUploadModal
|
<FileUploadModal
|
||||||
v-model:visible="addFilesModalVisible"
|
v-model:visible="addFilesModalVisible"
|
||||||
|
@success="onFileUploadSuccess"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="unified-layout">
|
<div class="unified-layout">
|
||||||
@ -75,6 +76,7 @@
|
|||||||
import { onMounted, reactive, ref, watch, onUnmounted, computed } from 'vue';
|
import { onMounted, reactive, ref, watch, onUnmounted, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useDatabaseStore } from '@/stores/database';
|
import { useDatabaseStore } from '@/stores/database';
|
||||||
|
import { useTaskerStore } from '@/stores/tasker';
|
||||||
import KnowledgeBaseCard from '@/components/KnowledgeBaseCard.vue';
|
import KnowledgeBaseCard from '@/components/KnowledgeBaseCard.vue';
|
||||||
import FileTable from '@/components/FileTable.vue';
|
import FileTable from '@/components/FileTable.vue';
|
||||||
import FileDetailModal from '@/components/FileDetailModal.vue';
|
import FileDetailModal from '@/components/FileDetailModal.vue';
|
||||||
@ -87,6 +89,7 @@ import EvaluationBenchmarks from '@/components/EvaluationBenchmarks.vue';
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = useDatabaseStore();
|
const store = useDatabaseStore();
|
||||||
|
const taskerStore = useTaskerStore();
|
||||||
|
|
||||||
const databaseId = computed(() => store.databaseId);
|
const databaseId = computed(() => store.databaseId);
|
||||||
const database = computed(() => store.database);
|
const database = computed(() => store.database);
|
||||||
@ -167,6 +170,11 @@ const showAddFilesModal = () => {
|
|||||||
addFilesModalVisible.value = true;
|
addFilesModalVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 文件上传成功回调
|
||||||
|
const onFileUploadSuccess = () => {
|
||||||
|
taskerStore.loadTasks();
|
||||||
|
};
|
||||||
|
|
||||||
// 重置文件选中状态
|
// 重置文件选中状态
|
||||||
const resetFileSelectionState = () => {
|
const resetFileSelectionState = () => {
|
||||||
store.selectedRowKeys = [];
|
store.selectedRowKeys = [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user