UnisKB/ui/src/views/dataset/component/UploadComponent.vue

65 lines
1.6 KiB
Vue
Raw Normal View History

2023-10-27 09:49:06 +00:00
<template>
<h4 class="title-decoration-1 mb-10">上传文档</h4>
<el-form ref="FormRef" :model="form" :rules="rules" label-position="top">
2023-11-02 01:56:14 +00:00
<el-form-item prop="fileList">
2023-10-27 09:49:06 +00:00
<el-upload
class="w-full"
drag
multiple
2023-11-02 01:56:14 +00:00
v-model:file-list="form.fileList"
action="#"
:auto-upload="false"
2023-10-27 09:49:06 +00:00
>
<div class="el-upload__text">
<p>
拖拽文件到此上传或
<em>
选择文件
<el-icon style="font-size: 25px"><upload-filled /></el-icon>
</em>
</p>
<div class="upload__decoration">
<p>1. 当前支持TXTMarkdown文本文件</p>
<p>2. 每次最多上传50个文档每个文档最大不能超过10MB</p>
<p>3. 系统会对文档进行分段处理若使用高级分段建议上传文档前规范文档的分段标识</p>
</div>
</div>
</el-upload>
</el-form-item>
</el-form>
<p>文档列表</p>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
const form = reactive({
2023-11-02 01:56:14 +00:00
fileList: []
2023-10-27 09:49:06 +00:00
})
2023-11-02 01:56:14 +00:00
const rules = reactive({
fileList: [{ required: true, message: '请上传文件', trigger: 'change' }]
})
2023-10-27 09:49:06 +00:00
const FormRef = ref()
// 表单校验
function validate() {
if (!FormRef.value) return
2023-11-02 01:56:14 +00:00
return FormRef.value.validate((valid: any) => {
2023-10-27 09:49:06 +00:00
return valid
})
}
onMounted(() => {})
defineExpose({
2023-11-02 01:56:14 +00:00
validate,
form
2023-10-27 09:49:06 +00:00
})
</script>
<style scoped lang="scss">
.upload__decoration {
font-size: 12px;
line-height: 20px;
color: var(--el-text-color-secondary);
}
</style>