Commit 7203551e authored by nick zheng's avatar nick zheng

fix: 限制拖拽上传文件类型及知识库排序

parent fe8f9b36
......@@ -16,6 +16,7 @@ common_module:
name: '名称'
desc: '描述'
publish_time_in: '发布于'
created_time: '创建时间'
modified_time: '编辑时间'
is_open: '启用'
status: '状态'
......
......@@ -16,6 +16,7 @@ common_module:
name: '名稱'
desc: '描述'
publish_time_in: '發佈於'
created_time: '創建時間'
modified_time: '編輯時間'
is_open: '啓用'
status: '狀態'
......
......@@ -35,15 +35,15 @@ export function createKnowledgeColumn(
},
},
{
title: () => <span>{t('common_module.modified_time')}</span>,
key: 'modifiedTime',
title: () => <span>{t('common_module.created_time')}</span>,
key: 'createdTime',
align: 'left',
ellipsis: {
tooltip: true,
},
width: 170,
render(row: KnowledgeItem) {
return formatDateTime(row.modifiedTime) || '--'
return row.createdTime ? formatDateTime(row.createdTime) : '--'
},
},
{
......
......@@ -12,7 +12,7 @@ export interface KnowledgeItem {
desc: string
trainStatus: TrainStatus
isOpen: 'Y' | 'N'
modifiedTime: Date
createdTime: Date
}
export interface SegmentationConfigInterface {
......
......@@ -137,6 +137,21 @@ async function handleUpload(file: any) {
}
}
// 拖拽文件
function handleDropFile(e: DragEvent) {
const files = e.dataTransfer?.files as FileList
const file = files[0]
const allowTypeList = ['md', 'doc', 'docx', 'pdf', 'txt']
if (file && !allowTypeList.includes(file.name.split('.')[1].toLowerCase())) {
window.$message.error(
t('personal_space_module.knowledge_module.upload_document_module.upload_format_error_message'),
)
return false
}
}
function handleRemoveFile(id: string) {
uploadFileList.value = uploadFileList.value.filter((item) => item.id !== id)
}
......@@ -158,6 +173,7 @@ function handleNextStep() {
accept=".doc, .pdf, .docx, .txt, .md"
@before-upload="handleLimitUpload"
@change="handleUpload"
@drop="handleDropFile"
>
<NUploadDragger>
<div class="mb-3 flex justify-center">
......
......@@ -21,6 +21,7 @@ declare namespace I18n {
name: string
desc: string
publish_time_in: string
created_time: string
modified_time: string
is_open: string
status: string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment