feat: 创建数据集
This commit is contained in:
parent
219c521437
commit
34aad04edd
@ -32,9 +32,49 @@ const delDateset: (dataset_id: String) => Promise<Result<boolean>> = (dataset_id
|
|||||||
return del(`${prefix}/${dataset_id}`)
|
return del(`${prefix}/${dataset_id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建数据集
|
||||||
|
* @param 参数
|
||||||
|
* {
|
||||||
|
"name": "string",
|
||||||
|
"desc": "string",
|
||||||
|
"documents": [
|
||||||
|
{
|
||||||
|
"name": "string",
|
||||||
|
"paragraphs": [
|
||||||
|
{
|
||||||
|
"content": "string",
|
||||||
|
"title": "string",
|
||||||
|
"is_active": true,
|
||||||
|
"problem_list": [
|
||||||
|
{
|
||||||
|
"id": "string",
|
||||||
|
"content": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const postDateset: (data: any) => Promise<Result<any>> = (data) => {
|
||||||
|
return post(`${prefix}`, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分段预览(上传文档)
|
||||||
|
* @param 参数 file:file,limit:number,patterns:array,with_filter:boolean
|
||||||
|
*/
|
||||||
|
const postSplitDocument: (data: any) => Promise<Result<any>> = (data) => {
|
||||||
|
console.log(data)
|
||||||
|
return post(`${prefix}/document/split`, data)
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getDateset,
|
getDateset,
|
||||||
getAllDateset,
|
getAllDateset,
|
||||||
delDateset
|
delDateset,
|
||||||
|
postDateset,
|
||||||
|
postSplitDocument
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,4 +4,10 @@ interface datasetListRequest {
|
|||||||
search_text: string
|
search_text: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { datasetListRequest }
|
interface datasetData {
|
||||||
|
name: String
|
||||||
|
desc: String
|
||||||
|
documents?: Array<any>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { datasetListRequest, datasetData }
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card shadow="hover">
|
<el-card shadow="always">
|
||||||
<div class="card-add">
|
<div class="card-add">
|
||||||
<AppIcon :iconName="icon" class="add-icon" />
|
<AppIcon :iconName="icon" class="add-icon" />
|
||||||
<span class="ml-10">{{ title }}</span>
|
<span class="ml-10">{{ title }}</span>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card shadow="hover" class="card-box" @mouseenter="cardEnter()" @mouseleave="cardLeave()">
|
<el-card shadow="always" class="card-box" @mouseenter="cardEnter()" @mouseleave="cardLeave()">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<slot name="header">
|
<slot name="header">
|
||||||
<div class="title flex align-center">
|
<div class="title flex align-center">
|
||||||
|
|||||||
@ -2,9 +2,11 @@ import { createPinia } from 'pinia'
|
|||||||
const store = createPinia()
|
const store = createPinia()
|
||||||
export { store }
|
export { store }
|
||||||
import useUserStore from './modules/user'
|
import useUserStore from './modules/user'
|
||||||
|
import useDatasetStore from './modules/dataset'
|
||||||
|
|
||||||
const useStore = () => ({
|
const useStore = () => ({
|
||||||
user: useUserStore()
|
user: useUserStore(),
|
||||||
|
dataset: useDatasetStore()
|
||||||
})
|
})
|
||||||
|
|
||||||
export default useStore
|
export default useStore
|
||||||
|
|||||||
26
ui/src/stores/modules/dataset.ts
Normal file
26
ui/src/stores/modules/dataset.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import type { datasetData } from '@/api/type/dataset'
|
||||||
|
import type { UploadUserFile } from 'element-plus'
|
||||||
|
|
||||||
|
export interface datasetStateTypes {
|
||||||
|
baseInfo: datasetData | null
|
||||||
|
documentsFiles: UploadUserFile[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const useDatasetStore = defineStore({
|
||||||
|
id: 'dataset',
|
||||||
|
state: (): datasetStateTypes => ({
|
||||||
|
baseInfo: null,
|
||||||
|
documentsFiles: []
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
saveBaseInfo(info: datasetData) {
|
||||||
|
this.baseInfo = info
|
||||||
|
},
|
||||||
|
saveDocumentsFile(file: UploadUserFile[]) {
|
||||||
|
this.documentsFiles = file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default useDatasetStore
|
||||||
@ -2,14 +2,14 @@ import { defineStore } from 'pinia'
|
|||||||
import type { User } from '@/api/type/user'
|
import type { User } from '@/api/type/user'
|
||||||
import UserApi from '@/api/user'
|
import UserApi from '@/api/user'
|
||||||
|
|
||||||
export interface appStateTypes {
|
export interface userStateTypes {
|
||||||
userInfo: User | null
|
userInfo: User | null
|
||||||
token: any
|
token: any
|
||||||
}
|
}
|
||||||
|
|
||||||
const useUserStore = defineStore({
|
const useUserStore = defineStore({
|
||||||
id: 'user',
|
id: 'user',
|
||||||
state: (): appStateTypes => ({
|
state: (): userStateTypes => ({
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
token: ''
|
token: ''
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
:root {
|
:root {
|
||||||
--el-menu-item-height: 45px;
|
--el-menu-item-height: 45px;
|
||||||
--el-text-color-primary: '#1F2329';
|
--el-text-color-primary: '#1F2329';
|
||||||
|
--el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
@ -85,6 +86,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-card {
|
||||||
|
--el-card-border-radius: 8px;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
// 抽屉样式整体修改
|
// 抽屉样式整体修改
|
||||||
.el-drawer {
|
.el-drawer {
|
||||||
.el-drawer__header {
|
.el-drawer__header {
|
||||||
|
|||||||
@ -8,12 +8,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="create-dataset__component p-15">
|
<div class="create-dataset__component p-15">
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<component :is="steps[active].component" />
|
<component :is="steps[active].component" :ref="steps[active]?.ref" />
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
<div class="create-dataset__footer text-right p-15 border-t">
|
<div class="create-dataset__footer text-right p-15 border-t">
|
||||||
<el-button @click="next">取 消</el-button>
|
<el-button @click="next">取 消</el-button>
|
||||||
<el-button @click="next">上一步</el-button>
|
<el-button @click="prev">上一步</el-button>
|
||||||
<el-button @click="next" type="primary">下一步</el-button>
|
<el-button @click="next" type="primary">下一步</el-button>
|
||||||
<el-button @click="next" type="primary">开始导入</el-button>
|
<el-button @click="next" type="primary">开始导入</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -22,24 +22,32 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import BaseForm from './component/BaseForm.vue'
|
import UploadDocument from './step/UploadDocument.vue'
|
||||||
|
import SetRules from './step/SetRules.vue'
|
||||||
const active = ref(0)
|
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
|
ref: 'UploadDocumentRef',
|
||||||
name: '上传文档',
|
name: '上传文档',
|
||||||
component: BaseForm
|
component: UploadDocument
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
ref: 'SetRulesRef',
|
||||||
name: '设置分段规则',
|
name: '设置分段规则',
|
||||||
component: ''
|
component: SetRules
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const next = () => {
|
const UploadDocumentRef = ref()
|
||||||
if (active.value++ > 2) active.value = 0
|
|
||||||
|
const active = ref(0)
|
||||||
|
|
||||||
|
async function next() {
|
||||||
|
if (await UploadDocumentRef.value.onSubmit()) {
|
||||||
|
if (active.value++ > 2) active.value = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
const prev = () => {}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.create-dataset {
|
.create-dataset {
|
||||||
|
|||||||
@ -9,9 +9,9 @@
|
|||||||
show-word-limit
|
show-word-limit
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据集描述" prop="describe">
|
<el-form-item label="数据集描述" prop="desc">
|
||||||
<el-input
|
<el-input
|
||||||
v-model.trim="form.describe"
|
v-model.trim="form.desc"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
placeholder="描述数据集的内容,详尽的描述将帮助AI能深入理解该数据集的内容,能更准确的检索到内容,提高该数据集的命中率。"
|
placeholder="描述数据集的内容,详尽的描述将帮助AI能深入理解该数据集的内容,能更准确的检索到内容,提高该数据集的命中率。"
|
||||||
maxlength="500"
|
maxlength="500"
|
||||||
@ -20,25 +20,23 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<UploadDocument />
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import UploadDocument from '@/views/dataset/component/UploadDocument.vue'
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
describe: ''
|
desc: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
name: [{ required: true, message: '请输入数据集名称', trigger: 'blur' }],
|
name: [{ required: true, message: '请输入数据集名称', trigger: 'blur' }],
|
||||||
describe: [{ required: true, message: '请输入数据集描述', trigger: 'blur' }]
|
desc: [{ required: true, message: '请输入数据集描述', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
const FormRef = ref()
|
const FormRef = ref()
|
||||||
// 表单校验
|
// 表单校验
|
||||||
function validate() {
|
function validate() {
|
||||||
if (!FormRef.value) return
|
if (!FormRef.value) return
|
||||||
return FormRef.value.validate((valid) => {
|
return FormRef.value.validate((valid: any) => {
|
||||||
return valid
|
return valid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -46,7 +44,8 @@ function validate() {
|
|||||||
onMounted(() => {})
|
onMounted(() => {})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
validate
|
validate,
|
||||||
|
form
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss"></style>
|
||||||
|
|||||||
30
ui/src/views/dataset/component/SegmentPreview.vue
Normal file
30
ui/src/views/dataset/component/SegmentPreview.vue
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
||||||
|
<el-tab-pane label="User" name="first">
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="Config" name="second">Config</el-tab-pane>
|
||||||
|
<el-tab-pane label="Role" name="third">Role</el-tab-pane>
|
||||||
|
<el-tab-pane label="Task" name="fourth">Task</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import type { TabsPaneContext } from 'element-plus'
|
||||||
|
const activeName = ref('first')
|
||||||
|
onMounted(() => {})
|
||||||
|
|
||||||
|
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||||
|
console.log(tab, event)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.set-rules {
|
||||||
|
&__radio {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<h4 class="title-decoration-1 mb-10">上传文档</h4>
|
<h4 class="title-decoration-1 mb-10">上传文档</h4>
|
||||||
<el-form ref="FormRef" :model="form" :rules="rules" label-position="top">
|
<el-form ref="FormRef" :model="form" :rules="rules" label-position="top">
|
||||||
<el-form-item prop="name">
|
<el-form-item prop="fileList">
|
||||||
<el-upload
|
<el-upload
|
||||||
class="w-full"
|
class="w-full"
|
||||||
drag
|
drag
|
||||||
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
|
|
||||||
multiple
|
multiple
|
||||||
|
v-model:file-list="form.fileList"
|
||||||
|
action="#"
|
||||||
|
:auto-upload="false"
|
||||||
>
|
>
|
||||||
<div class="el-upload__text">
|
<div class="el-upload__text">
|
||||||
<p>
|
<p>
|
||||||
@ -30,17 +32,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '',
|
fileList: []
|
||||||
describe: ''
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = reactive({})
|
const rules = reactive({
|
||||||
|
fileList: [{ required: true, message: '请上传文件', trigger: 'change' }]
|
||||||
|
})
|
||||||
const FormRef = ref()
|
const FormRef = ref()
|
||||||
|
|
||||||
// 表单校验
|
// 表单校验
|
||||||
function validate() {
|
function validate() {
|
||||||
if (!FormRef.value) return
|
if (!FormRef.value) return
|
||||||
return FormRef.value.validate((valid) => {
|
return FormRef.value.validate((valid: any) => {
|
||||||
return valid
|
return valid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -48,7 +51,8 @@ function validate() {
|
|||||||
onMounted(() => {})
|
onMounted(() => {})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
validate
|
validate,
|
||||||
|
form
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@ -1,54 +1,53 @@
|
|||||||
<template>
|
<template>
|
||||||
<LayoutContent header="数据集">
|
<div class="dataset-list-container p-15">
|
||||||
<div class="dataset-list-container p-15">
|
<div class="flex-between">
|
||||||
<div class="text-right">
|
<h3>数据集</h3>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="filterText"
|
v-model="filterText"
|
||||||
placeholder="搜索内容"
|
placeholder="搜索内容"
|
||||||
suffix-icon="Search"
|
suffix-icon="Search"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<el-row
|
|
||||||
:gutter="15"
|
|
||||||
v-infinite-scroll="loadDataset"
|
|
||||||
:infinite-scroll-disabled="disabledScroll"
|
|
||||||
>
|
|
||||||
<el-col :xs="24" :sm="12" :md="6" :lg="5" :xl="4" class="mt-10">
|
|
||||||
<CardAdd title="创建数据集" @click="router.push({ path: '/dataset/create' })" />
|
|
||||||
</el-col>
|
|
||||||
<el-col
|
|
||||||
:xs="24"
|
|
||||||
:sm="12"
|
|
||||||
:md="6"
|
|
||||||
:lg="5"
|
|
||||||
:xl="4"
|
|
||||||
v-for="(item, index) in datasetList"
|
|
||||||
:key="index"
|
|
||||||
class="mt-10"
|
|
||||||
>
|
|
||||||
<CardBox :title="item.name" :description="item.desc" class="cursor">
|
|
||||||
<template #mouseEnter>
|
|
||||||
<div class="delete-button">
|
|
||||||
<el-button type="primary" link @click.stop="deleteDateset(item)">
|
|
||||||
<el-icon><Delete /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class="footer-content">
|
|
||||||
{{ item?.document_count || 0 }}文档数 {{ item?.char_length || 0 }}字符数
|
|
||||||
{{ item?.char_length || 0 }}关联应用
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</CardBox>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</LayoutContent>
|
<div>
|
||||||
|
<el-row
|
||||||
|
:gutter="15"
|
||||||
|
v-infinite-scroll="loadDataset"
|
||||||
|
:infinite-scroll-disabled="disabledScroll"
|
||||||
|
>
|
||||||
|
<el-col :xs="24" :sm="12" :md="6" :lg="5" :xl="4" class="mt-10">
|
||||||
|
<CardAdd title="创建数据集" @click="router.push({ path: '/dataset/create' })" />
|
||||||
|
</el-col>
|
||||||
|
<el-col
|
||||||
|
:xs="24"
|
||||||
|
:sm="12"
|
||||||
|
:md="6"
|
||||||
|
:lg="5"
|
||||||
|
:xl="4"
|
||||||
|
v-for="(item, index) in datasetList"
|
||||||
|
:key="index"
|
||||||
|
class="mt-10"
|
||||||
|
>
|
||||||
|
<CardBox :title="item.name" :description="item.desc" class="cursor">
|
||||||
|
<template #mouseEnter>
|
||||||
|
<div class="delete-button">
|
||||||
|
<el-button type="primary" link @click.stop="deleteDateset(item)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="footer-content">
|
||||||
|
{{ item?.document_count || 0 }}文档数 {{ item?.char_length || 0 }}字符数
|
||||||
|
{{ item?.char_length || 0 }}关联应用
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</CardBox>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
|||||||
64
ui/src/views/dataset/step/SetRules.vue
Normal file
64
ui/src/views/dataset/step/SetRules.vue
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<template>
|
||||||
|
<div class="set-rules">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<h4 class="title-decoration-1 mb-10">分段规则</h4>
|
||||||
|
<el-radio-group v-model="radio1" class="set-rules__radio">
|
||||||
|
<div>
|
||||||
|
<el-radio label="1" size="large">智能分段(推荐)</el-radio>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-radio label="2" size="large">高级分段</el-radio>
|
||||||
|
</div>
|
||||||
|
</el-radio-group>
|
||||||
|
<div>
|
||||||
|
<el-button @click="splitDocument">生成预览</el-button>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<h4 class="title-decoration-1 mb-10">分段预览</h4>
|
||||||
|
<SegmentPreview />
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, onMounted } from 'vue'
|
||||||
|
import SegmentPreview from '@/views/dataset/component/SegmentPreview.vue'
|
||||||
|
import DatasetApi from '@/api/dataset'
|
||||||
|
import useStore from '@/stores'
|
||||||
|
const { dataset } = useStore()
|
||||||
|
const documentsFiles = computed(() => dataset.documentsFiles)
|
||||||
|
|
||||||
|
const radio1 = ref('1')
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
function splitDocument() {
|
||||||
|
loading.value = true
|
||||||
|
let fd = new FormData()
|
||||||
|
console.log(documentsFiles.value)
|
||||||
|
documentsFiles.value.forEach((item) => {
|
||||||
|
if (item?.raw) {
|
||||||
|
fd.append('file', item?.raw)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
DatasetApi.postSplitDocument(fd)
|
||||||
|
.then((res) => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {})
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.set-rules {
|
||||||
|
&__radio {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
35
ui/src/views/dataset/step/UploadDocument.vue
Normal file
35
ui/src/views/dataset/step/UploadDocument.vue
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基本信息 -->
|
||||||
|
<BaseForm ref="BaseFormRef" />
|
||||||
|
<!-- 上传文档 -->
|
||||||
|
<UploadComponent ref="UploadComponentRef" />
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import BaseForm from '@/views/dataset/component/BaseForm.vue'
|
||||||
|
import UploadComponent from '@/views/dataset/component/UploadComponent.vue'
|
||||||
|
import useStore from '@/stores'
|
||||||
|
const { dataset } = useStore()
|
||||||
|
|
||||||
|
const BaseFormRef = ref()
|
||||||
|
const UploadComponentRef = ref()
|
||||||
|
|
||||||
|
// submit
|
||||||
|
const onSubmit = async () => {
|
||||||
|
if ((await BaseFormRef.value.validate()) && (await UploadComponentRef.value.validate())) {
|
||||||
|
// stores保存数据
|
||||||
|
dataset.saveBaseInfo(BaseFormRef.value.form)
|
||||||
|
dataset.saveDocumentsFile(UploadComponentRef.value.form.fileList)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
onSubmit
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
Loading…
Reference in New Issue
Block a user