mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-30 01:32:49 +00:00
feat: 数据集
This commit is contained in:
parent
9f9d65a74b
commit
a1a312d109
|
|
@ -1,6 +1,6 @@
|
|||
import { Result } from '@/request/Result'
|
||||
import { get, post, del, put } from '@/request/index'
|
||||
import type { datasetListRequest } from '@/api/type/dataset'
|
||||
import type { datasetListRequest, datasetData } from '@/api/type/dataset'
|
||||
|
||||
const prefix = '/dataset'
|
||||
|
||||
|
|
@ -9,19 +9,22 @@ const prefix = '/dataset'
|
|||
* @param 参数 {
|
||||
"current_page": "string",
|
||||
"page_size": "string",
|
||||
"search_text": "string",
|
||||
"name": "string",
|
||||
}
|
||||
*/
|
||||
const getDateset: (param: datasetListRequest) => Promise<Result<any[]>> = (param) => {
|
||||
return get(`${prefix}`, param)
|
||||
const getDateset: (param: datasetListRequest) => Promise<Result<any>> = (param) => {
|
||||
return get(
|
||||
`${prefix}/${param.current_page}/${param.page_size}`,
|
||||
param.name && { name: param.name }
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部数据集
|
||||
* @param 参数 search_text
|
||||
* @param 参数 name
|
||||
*/
|
||||
const getAllDateset: (param?: String) => Promise<Result<any[]>> = (param) => {
|
||||
return get(`${prefix}`, param && { search_text: param })
|
||||
const getAllDateset: (param?: string) => Promise<Result<any[]>> = (param) => {
|
||||
return get(`${prefix}`, param && { name: param })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +48,6 @@ const delDateset: (dataset_id: String) => Promise<Result<boolean>> = (dataset_id
|
|||
{
|
||||
"content": "string",
|
||||
"title": "string",
|
||||
"is_active": true,
|
||||
"problem_list": [
|
||||
{
|
||||
"id": "string",
|
||||
|
|
@ -58,10 +60,34 @@ const delDateset: (dataset_id: String) => Promise<Result<boolean>> = (dataset_id
|
|||
]
|
||||
}
|
||||
*/
|
||||
const postDateset: (data: any) => Promise<Result<any>> = (data) => {
|
||||
const postDateset: (data: datasetData) => Promise<Result<any>> = (data) => {
|
||||
return post(`${prefix}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据集详情
|
||||
* @param 参数 dataset_id
|
||||
*/
|
||||
const getDatesetDetail: (dataset_id: string) => Promise<Result<any>> = (dataset_id) => {
|
||||
return get(`${prefix}/${dataset_id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据集信息
|
||||
* @param 参数
|
||||
* dataset_id, document_id,
|
||||
* {
|
||||
"name": "string",
|
||||
"desc": true
|
||||
}
|
||||
*/
|
||||
const putDateset: (dataset_id: string, data: any) => Promise<Result<any>> = (
|
||||
dataset_id,
|
||||
data: any
|
||||
) => {
|
||||
return put(`${prefix}/${dataset_id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分段预览(上传文档)
|
||||
* @param 参数 file:file,limit:number,patterns:array,with_filter:boolean
|
||||
|
|
@ -82,6 +108,32 @@ const getDocument: (dataset_id: string, name?: string) => Promise<Result<any>> =
|
|||
return get(`${prefix}/${dataset_id}/document`, name && { name })
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文档
|
||||
* @param 参数
|
||||
* {
|
||||
"name": "string",
|
||||
"paragraphs": [
|
||||
{
|
||||
"content": "string",
|
||||
"title": "string",
|
||||
"problem_list": [
|
||||
{
|
||||
"id": "string",
|
||||
"content": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
const postDocument: (dataset_id: string, data: any) => Promise<Result<any>> = (
|
||||
dataset_id,
|
||||
data
|
||||
) => {
|
||||
return post(`${prefix}/${dataset_id}/document`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文档
|
||||
* @param 参数
|
||||
|
|
@ -115,8 +167,11 @@ export default {
|
|||
getAllDateset,
|
||||
delDateset,
|
||||
postDateset,
|
||||
getDatesetDetail,
|
||||
putDateset,
|
||||
postSplitDocument,
|
||||
getDocument,
|
||||
postDocument,
|
||||
putDocument,
|
||||
delDocument
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
interface datasetListRequest {
|
||||
current_page: number
|
||||
page_size: number
|
||||
search_text: string
|
||||
name: string
|
||||
}
|
||||
|
||||
interface datasetData {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
class="w-240 mr-12"
|
||||
/>
|
||||
|
||||
<el-button type="primary" @click="submitHandle">创建</el-button>
|
||||
<el-button @click="showInput = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitHandle" :disabled="loading">创建</el-button>
|
||||
<el-button @click="showInput = false" :disabled="loading">取消</el-button>
|
||||
</div>
|
||||
<div v-else @click="quickCreateHandel" class="w-full">
|
||||
<el-button type="primary" link>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, watch } from 'vue'
|
||||
import { ref, nextTick, watch, computed } from 'vue'
|
||||
defineOptions({ name: 'AppTable' })
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -53,9 +53,13 @@ const props = defineProps({
|
|||
})
|
||||
const emit = defineEmits(['changePage', 'sizeChange', 'creatQuick'])
|
||||
|
||||
const paginationConfig = computed(() => props.paginationConfig)
|
||||
|
||||
const pageSizes = [10, 20, 50, 100]
|
||||
|
||||
const quickInputRef = ref()
|
||||
|
||||
const loading = ref(false)
|
||||
const showInput = ref(false)
|
||||
const inputValue = ref('')
|
||||
|
||||
|
|
@ -66,8 +70,12 @@ watch(showInput, (bool) => {
|
|||
})
|
||||
|
||||
function submitHandle() {
|
||||
loading.value = true
|
||||
emit('creatQuick', inputValue.value)
|
||||
showInput.value = false
|
||||
setTimeout(() => {
|
||||
showInput.value = false
|
||||
loading.value = false
|
||||
}, 200)
|
||||
}
|
||||
|
||||
function quickCreateHandel() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export const routes: Array<RouteRecordRaw> = [
|
|||
path: '/',
|
||||
name: 'home',
|
||||
component: () => import('@/layout/app-layout/index.vue'),
|
||||
redirect: '/setting',
|
||||
redirect: '/dataset',
|
||||
children: [
|
||||
// {
|
||||
// path: '/first',
|
||||
|
|
|
|||
|
|
@ -14,26 +14,41 @@
|
|||
</el-step>
|
||||
</el-steps>
|
||||
</template>
|
||||
<div class="create-dataset__main flex">
|
||||
<div class="create-dataset__main flex" v-loading="loading">
|
||||
<div class="create-dataset__component">
|
||||
<component :is="steps[active].component" :ref="steps[active]?.ref" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="create-dataset__footer text-right border-t">
|
||||
<el-button @click="router.go(-1)">取 消</el-button>
|
||||
<el-button @click="prev" v-if="active === 1">上一步</el-button>
|
||||
<el-button @click="next" type="primary" v-if="active === 0">下一步</el-button>
|
||||
<el-button @click="next" type="primary" v-if="active === 1">开始导入</el-button>
|
||||
<el-button @click="router.go(-1)" :disabled="loading">取 消</el-button>
|
||||
<el-button @click="prev" v-if="active === 1" :disabled="loading">上一步</el-button>
|
||||
<el-button @click="next" type="primary" v-if="active === 0" :disabled="loading"
|
||||
>下一步</el-button
|
||||
>
|
||||
<el-button @click="submit" type="primary" v-if="active === 1" :disabled="loading">
|
||||
开始导入
|
||||
</el-button>
|
||||
</div>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ref, computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import StepFirst from './step/StepFirst.vue'
|
||||
import StepSecond from './step/StepSecond.vue'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import type { datasetData } from '@/api/type/dataset'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
import useStore from '@/stores'
|
||||
const { dataset } = useStore()
|
||||
const baseInfo = computed(() => dataset.baseInfo)
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { type },
|
||||
query: { id }
|
||||
} = route as any
|
||||
|
||||
const steps = [
|
||||
{
|
||||
|
|
@ -42,14 +57,16 @@ const steps = [
|
|||
component: StepFirst
|
||||
},
|
||||
{
|
||||
ref: 'SetRulesRef',
|
||||
ref: 'StepSecondRef',
|
||||
name: '设置分段规则',
|
||||
component: StepSecond
|
||||
}
|
||||
]
|
||||
|
||||
const StepFirstRef = ref()
|
||||
const StepSecondRef = ref()
|
||||
|
||||
const loading = ref(false)
|
||||
const active = ref(0)
|
||||
|
||||
async function next() {
|
||||
|
|
@ -60,6 +77,39 @@ async function next() {
|
|||
const prev = () => {
|
||||
active.value = 0
|
||||
}
|
||||
|
||||
function submit() {
|
||||
loading.value = true
|
||||
const documents = [] as any[]
|
||||
StepSecondRef.value.segmentList.map((item: any) => {
|
||||
documents.push({
|
||||
name: item.name,
|
||||
paragraphs: item.content
|
||||
})
|
||||
})
|
||||
const obj = { ...baseInfo.value, documents } as datasetData
|
||||
if (id) {
|
||||
datasetApi
|
||||
.postDocument(id, documents)
|
||||
.then((res) => {
|
||||
MsgSuccess('提交成功')
|
||||
router.push({ path: `/dataset/${id}/document` })
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
} else {
|
||||
datasetApi
|
||||
.postDateset(obj)
|
||||
.then((res) => {
|
||||
MsgSuccess('提交成功')
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.create-dataset {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
<div class="main-calc-height">
|
||||
<div class="p-24">
|
||||
<div class="flex-between">
|
||||
<el-button type="primary" @click="router.push({ path: '/dataset/upload' })"
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="router.push({ path: '/dataset/upload', query: { id: datasetId } })"
|
||||
>上传文档</el-button
|
||||
>
|
||||
<el-input
|
||||
|
|
@ -11,6 +13,7 @@
|
|||
placeholder="按 文档名称 搜索"
|
||||
prefix-icon="Search"
|
||||
class="w-240"
|
||||
@change="getList"
|
||||
/>
|
||||
</div>
|
||||
<app-table
|
||||
|
|
@ -22,6 +25,7 @@
|
|||
@changePage="handleCurrentChange"
|
||||
@cell-mouse-enter="cellMouseEnter"
|
||||
@cell-mouse-leave="cellMouseLeave"
|
||||
@creatQuick="creatQuickHandle"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column prop="name" label="文件名称" min-width="280">
|
||||
|
|
@ -69,7 +73,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column prop="name" label="操作" align="center">
|
||||
<template #default="{ row }">
|
||||
<span>
|
||||
<span v-if="row.status === 2">
|
||||
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||
<el-button type="primary" text>
|
||||
<el-icon><RefreshRight /></el-icon>
|
||||
|
|
@ -99,8 +103,9 @@ import { datetimeFormat } from '@/utils/time'
|
|||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { params } = route
|
||||
const { datasetId } = params as any
|
||||
const {
|
||||
params: { datasetId }
|
||||
} = route as any
|
||||
|
||||
const loading = ref(false)
|
||||
const filterText = ref('')
|
||||
|
|
@ -113,6 +118,21 @@ const paginationConfig = reactive({
|
|||
total: 0
|
||||
})
|
||||
|
||||
// 快速创建空白文档
|
||||
function creatQuickHandle(val: string) {
|
||||
loading.value = true
|
||||
const obj = { name: val }
|
||||
datasetApi
|
||||
.postDocument(datasetId, obj)
|
||||
.then((res) => {
|
||||
getList()
|
||||
MsgSuccess('创建成功')
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function deleteDocument(row: any) {
|
||||
MsgConfirm(
|
||||
`是否删除文档:${row.name} ?`,
|
||||
|
|
@ -137,6 +157,7 @@ function deleteDocument(row: any) {
|
|||
.catch(() => {})
|
||||
}
|
||||
|
||||
// 更新名称或状态
|
||||
function updateData(documentId: string, data: any) {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
|
|
|
|||
|
|
@ -1,14 +1,65 @@
|
|||
<template>
|
||||
<LayoutContainer header="设置">
|
||||
<div class="main-calc-height">
|
||||
<div class="p-24">
|
||||
<BaseForm />
|
||||
<div class="main-calc-height dataset-setting">
|
||||
<div class="p-24" v-loading="loading">
|
||||
<BaseForm ref="BaseFormRef" :data="detail" />
|
||||
<div class="text-right">
|
||||
<el-button @click="submit" type="primary"> 保存 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import BaseForm from '@/views/dataset/component/BaseForm.vue'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { datasetId }
|
||||
} = route as any
|
||||
|
||||
const BaseFormRef = ref()
|
||||
const loading = ref(false)
|
||||
const detail = ref({})
|
||||
|
||||
async function submit() {
|
||||
if (await BaseFormRef.value?.validate()) {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
.postDocument(datasetId, BaseFormRef.value.form)
|
||||
.then((res) => {
|
||||
MsgSuccess('保存成功')
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function getDetail() {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
.getDatesetDetail(datasetId)
|
||||
.then((res) => {
|
||||
detail.value = res.data
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
.dataset-setting {
|
||||
width: 70%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,20 @@
|
|||
</el-form>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
const form = reactive({
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||
import useStore from '@/stores'
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
|
||||
const { dataset } = useStore()
|
||||
const baseInfo = computed(() => dataset.baseInfo)
|
||||
|
||||
const form = ref<any>({
|
||||
name: '',
|
||||
desc: ''
|
||||
})
|
||||
|
|
@ -33,6 +45,21 @@ const rules = reactive({
|
|||
desc: [{ required: true, message: '请输入数据集描述', trigger: 'blur' }]
|
||||
})
|
||||
const FormRef = ref()
|
||||
|
||||
watch(
|
||||
() => props.data,
|
||||
(value) => {
|
||||
if (JSON.stringify(value) !== '{}') {
|
||||
form.value.name = value.name
|
||||
form.value.desc = value.desc
|
||||
}
|
||||
},
|
||||
{
|
||||
// 初始化立即执行
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
// 表单校验
|
||||
function validate() {
|
||||
if (!FormRef.value) return
|
||||
|
|
@ -41,7 +68,11 @@ function validate() {
|
|||
})
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
onMounted(() => {
|
||||
if (baseInfo.value) {
|
||||
form.value = baseInfo.value
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
validate,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<EditSegmentDialog ref="EditSegmentDialogRef" @updateContent="updateContent" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, onMounted, watch } from 'vue'
|
||||
import type { TabsPaneContext } from 'element-plus'
|
||||
import EditSegmentDialog from './EditSegmentDialog.vue'
|
||||
import { filesize, getImgUrl } from '@/utils/utils'
|
||||
|
|
@ -65,7 +65,18 @@ const activeName = ref(0)
|
|||
const currentPIndex = ref(null) as any
|
||||
const currentCIndex = ref(null) as any
|
||||
|
||||
const newData = ref(props.data)
|
||||
const newData = ref<any[]>([])
|
||||
|
||||
watch(
|
||||
() => props.data,
|
||||
(value) => {
|
||||
newData.value = value
|
||||
},
|
||||
{
|
||||
// 初始化立即执行
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
function editHandle(item: any, index: number, cIndex: number) {
|
||||
currentPIndex.value = index
|
||||
|
|
@ -90,11 +101,11 @@ function updateContent(data: any) {
|
|||
emit('update:data', newData.value)
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||
// console.log(tab, event)
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.segment-tabs {
|
||||
|
|
|
|||
|
|
@ -48,11 +48,14 @@
|
|||
</el-row>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import type { UploadProps } from 'element-plus'
|
||||
import { filesize, getImgUrl } from '@/utils/utils'
|
||||
import { MsgError } from '@/utils/message'
|
||||
const form = reactive({
|
||||
import useStore from '@/stores'
|
||||
const { dataset } = useStore()
|
||||
const documentsFiles = computed(() => dataset.documentsFiles)
|
||||
const form = ref({
|
||||
fileList: [] as any
|
||||
})
|
||||
|
||||
|
|
@ -61,7 +64,6 @@ const rules = reactive({
|
|||
})
|
||||
const FormRef = ref()
|
||||
|
||||
|
||||
// const beforeUploadHandle: UploadProps['beforeUpload'] = (rawFile) => {
|
||||
// const type = fileType(rawFile?.name)
|
||||
// console.log(type)
|
||||
|
|
@ -75,7 +77,7 @@ const FormRef = ref()
|
|||
// return true
|
||||
// }
|
||||
function deleteFlie(index: number) {
|
||||
form.fileList.splice(index, 1)
|
||||
form.value.fileList.splice(index, 1)
|
||||
}
|
||||
|
||||
// 表单校验
|
||||
|
|
@ -85,7 +87,11 @@ function validate() {
|
|||
return valid
|
||||
})
|
||||
}
|
||||
onMounted(() => {})
|
||||
onMounted(() => {
|
||||
if (documentsFiles.value) {
|
||||
form.value.fileList = documentsFiles.value
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
validate,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,13 @@
|
|||
<div class="dataset-list-container p-24">
|
||||
<div class="flex-between">
|
||||
<h3>数据集</h3>
|
||||
<el-input v-model="filterText" placeholder="搜索内容" prefix-icon="Search" class="w-240" />
|
||||
<el-input
|
||||
v-model="pageConfig.name"
|
||||
@change="search"
|
||||
placeholder="按 名称 搜索"
|
||||
prefix-icon="Search"
|
||||
class="w-240"
|
||||
/>
|
||||
</div>
|
||||
<div v-loading.fullscreen.lock="loading">
|
||||
<el-row
|
||||
|
|
@ -54,7 +60,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import datasetApi from '@/api/dataset'
|
||||
import type { datasetListRequest } from '@/api/type/dataset'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
|
|
@ -63,17 +69,21 @@ import { numberFormat } from '@/utils/utils'
|
|||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
const filterText = ref('')
|
||||
const datasetList = ref<any[]>([])
|
||||
const disabledScroll = ref(false)
|
||||
const pageConfig = ref<datasetListRequest>({
|
||||
const pageConfig = reactive<datasetListRequest>({
|
||||
current_page: 1,
|
||||
page_size: 20,
|
||||
search_text: ''
|
||||
name: ''
|
||||
})
|
||||
|
||||
function loadDataset() {}
|
||||
|
||||
function search() {
|
||||
pageConfig.current_page = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function deleteDateset(row: any) {
|
||||
MsgConfirm(
|
||||
`是否删除数据集:${row.name} ?`,
|
||||
|
|
@ -101,9 +111,9 @@ function deleteDateset(row: any) {
|
|||
function getList() {
|
||||
loading.value = true
|
||||
datasetApi
|
||||
.getDateset(pageConfig.value)
|
||||
.getDateset(pageConfig)
|
||||
.then((res) => {
|
||||
datasetList.value = res.data
|
||||
datasetList.value = res.data?.records
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
|
|||
|
|
@ -2,31 +2,48 @@
|
|||
<el-scrollbar>
|
||||
<div class="upload-document p-24">
|
||||
<!-- 基本信息 -->
|
||||
<BaseForm ref="BaseFormRef" />
|
||||
<BaseForm ref="BaseFormRef" v-if="isCreate" />
|
||||
<!-- 上传文档 -->
|
||||
<UploadComponent ref="UploadComponentRef" />
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import BaseForm from '@/views/dataset/component/BaseForm.vue'
|
||||
import UploadComponent from '@/views/dataset/component/UploadComponent.vue'
|
||||
|
||||
import useStore from '@/stores'
|
||||
const { dataset } = useStore()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { type }
|
||||
} = route
|
||||
const isCreate = type === 'create'
|
||||
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
|
||||
if (isCreate) {
|
||||
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
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
if (await UploadComponentRef.value.validate()) {
|
||||
// stores保存数据
|
||||
dataset.saveDocumentsFile(UploadComponentRef.value.form.fileList)
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
</el-col>
|
||||
|
||||
<el-col :span="12" class="p-24 border-l">
|
||||
<div>
|
||||
<div v-loading="loading">
|
||||
<h4 class="title-decoration-1 mb-8">分段预览</h4>
|
||||
<SegmentPreview v-model:data="segmentList" />
|
||||
</div>
|
||||
|
|
@ -116,14 +116,14 @@ function splitDocument() {
|
|||
fd.append('file', item?.raw)
|
||||
}
|
||||
})
|
||||
|
||||
Object.keys(form).forEach((key) => {
|
||||
fd.append(key, form[key])
|
||||
})
|
||||
|
||||
if (radio.value === '2') {
|
||||
Object.keys(form).forEach((key) => {
|
||||
fd.append(key, form[key])
|
||||
})
|
||||
}
|
||||
DatasetApi.postSplitDocument(fd)
|
||||
.then((res: any) => {
|
||||
segmentList.value = res
|
||||
segmentList.value = res.data
|
||||
loading.value = false
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
@ -131,7 +131,13 @@ function splitDocument() {
|
|||
})
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
onMounted(() => {
|
||||
splitDocument()
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
segmentList
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.set-rules {
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@ import type { FormInstance, FormRules } from 'element-plus'
|
|||
import UserApi from '@/api/user'
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { params } = route
|
||||
const { code, email } = params
|
||||
const {
|
||||
params: { code, email }
|
||||
} = route
|
||||
const resetPasswordForm = ref<ResetPasswordRequest>({
|
||||
password: '',
|
||||
re_password: '',
|
||||
|
|
|
|||
Loading…
Reference in New Issue