feat: 数据集
This commit is contained in:
parent
dc934c2f61
commit
64284b18db
30
ui/src/api/dataset.ts
Normal file
30
ui/src/api/dataset.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { Result } from '@/request/Result'
|
||||||
|
import { get, post, del, put } from '@/request/index'
|
||||||
|
import type { datasetListRequest } from '@/api/type/dataset'
|
||||||
|
|
||||||
|
const prefix = '/dataset'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分页数据集
|
||||||
|
* @param 参数 {
|
||||||
|
"current_page": "string",
|
||||||
|
"page_size": "string",
|
||||||
|
"search_text": "string",
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const getDateset: (param: datasetListRequest) => Promise<Result<any[]>> = (param) => {
|
||||||
|
return get(`${prefix}`, param)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部数据集
|
||||||
|
* @param 参数 search_text
|
||||||
|
*/
|
||||||
|
const getAllDateset: (param?: String) => Promise<Result<any[]>> = (param) => {
|
||||||
|
return get(`${prefix}`, param && { search_text: param })
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getDateset,
|
||||||
|
getAllDateset
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { Result } from '@/request/Result'
|
import { Result } from '@/request/Result'
|
||||||
import { get, post, del, put } from '@/request/index'
|
import { get, post, del, put } from '@/request/index'
|
||||||
import type { TeamMember, TeamMemberRequest } from '@/api/type/team'
|
import type { TeamMember } from '@/api/type/team'
|
||||||
// import type { Ref } from 'vue'
|
// import type { Ref } from 'vue'
|
||||||
|
|
||||||
const prefix = '/team/member'
|
const prefix = '/team/member'
|
||||||
@ -16,8 +16,8 @@ const getTeamMember: () => Promise<Result<TeamMember[]>> = () => {
|
|||||||
* 添加成员
|
* 添加成员
|
||||||
* @param 参数 { "username_or_email": "string" }
|
* @param 参数 { "username_or_email": "string" }
|
||||||
*/
|
*/
|
||||||
const postCreatTeamMember: (body: TeamMemberRequest) => Promise<Result<boolean>> = (body) => {
|
const postCreatTeamMember: (data: String) => Promise<Result<boolean>> = (data) => {
|
||||||
return post(`${prefix}`, body)
|
return post(`${prefix}`, { username_or_email: data })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
7
ui/src/api/type/dataset.ts
Normal file
7
ui/src/api/type/dataset.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
interface datasetListRequest {
|
||||||
|
current_page: number
|
||||||
|
page_size: number
|
||||||
|
search_text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { datasetListRequest }
|
||||||
@ -10,8 +10,4 @@ interface TeamMember {
|
|||||||
user_id: string
|
user_id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TeamMemberRequest {
|
export type { TeamMember }
|
||||||
username_or_email: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type { TeamMember, TeamMemberRequest }
|
|
||||||
|
|||||||
20
ui/src/components/app-avatar/index.vue
Normal file
20
ui/src/components/app-avatar/index.vue
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<el-avatar :size="30" v-bind="$attrs">
|
||||||
|
<slot> {{ firstUserName }} </slot>
|
||||||
|
</el-avatar>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
defineOptions({ name: 'AppAvatar' })
|
||||||
|
const props = defineProps({
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const firstUserName = computed(() => {
|
||||||
|
return props.name?.substring(0, 1)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
38
ui/src/components/card-add/index.vue
Normal file
38
ui/src/components/card-add/index.vue
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<template>
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<div class="card-add">
|
||||||
|
<AppIcon :iconName="icon" class="add-icon" />
|
||||||
|
<span class="ml-10">{{ title }}</span>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineOptions({ name: 'CardAdd' })
|
||||||
|
defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '标题'
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
default: 'CirclePlusFilled'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card-add {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 110px;
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
|
.add-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
74
ui/src/components/card-box/index.vue
Normal file
74
ui/src/components/card-box/index.vue
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<template>
|
||||||
|
<el-card shadow="hover" class="card-box" @mouseenter="cardEnter()" @mouseleave="cardLeave()">
|
||||||
|
<div class="card-header">
|
||||||
|
<slot name="header">
|
||||||
|
<div class="title flex">
|
||||||
|
<AppAvatar class="mr-10">
|
||||||
|
<el-icon><Document /></el-icon>
|
||||||
|
</AppAvatar>
|
||||||
|
<h3>{{ title }}</h3>
|
||||||
|
</div>
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
<div class="description mt-10">
|
||||||
|
<slot name="description">
|
||||||
|
{{ description }}
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
<slot />
|
||||||
|
<slot name="mouseEnter" v-if="$slots.mouseEnter && show" />
|
||||||
|
<div class="card-footer" v-if="$slots.footer">
|
||||||
|
<slot name="footer" />
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
defineOptions({ name: 'CardBox' })
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '标题'
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const show = ref(false)
|
||||||
|
function cardEnter() {
|
||||||
|
show.value = true
|
||||||
|
}
|
||||||
|
function cardLeave() {
|
||||||
|
show.value = false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.card-box {
|
||||||
|
font-size: 14px;
|
||||||
|
position: relative;
|
||||||
|
min-height: 150px;
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
.title {
|
||||||
|
align-items: center;
|
||||||
|
h3 {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.description {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.card-footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
min-height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar>
|
<el-scrollbar>
|
||||||
<div class="content-container__main">
|
<div class="content-container__main main-calc-height">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
@ -25,7 +25,7 @@ defineProps({
|
|||||||
<style lang="scss" scope>
|
<style lang="scss" scope>
|
||||||
.content-container {
|
.content-container {
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
|
padding: var(--app-view-padding);
|
||||||
.content-container__header {
|
.content-container__header {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
|||||||
@ -1,16 +1,24 @@
|
|||||||
import { type App } from 'vue'
|
import { type App } from 'vue'
|
||||||
import AppIcon from './icons/AppIcon.vue'
|
import AppIcon from './icons/AppIcon.vue'
|
||||||
|
import AppAvatar from './app-avatar/index.vue'
|
||||||
import LoginLayout from './login-layout/index.vue'
|
import LoginLayout from './login-layout/index.vue'
|
||||||
import LoginContainer from './login-container/index.vue'
|
import LoginContainer from './login-container/index.vue'
|
||||||
import LayoutContent from './content-container/LayoutContent.vue'
|
import LayoutContent from './content-container/LayoutContent.vue'
|
||||||
import TagsInput from './tags-input/index.vue'
|
import TagsInput from './tags-input/index.vue'
|
||||||
|
import CardBox from './card-box/index.vue'
|
||||||
|
import CardAdd from './card-add/index.vue'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install(app: App) {
|
install(app: App) {
|
||||||
app.component(AppIcon.name, AppIcon)
|
app.component(AppIcon.name, AppIcon)
|
||||||
|
app.component(AppAvatar.name, AppAvatar)
|
||||||
app.component(LoginLayout.name, LoginLayout)
|
app.component(LoginLayout.name, LoginLayout)
|
||||||
app.component(LoginContainer.name, LoginContainer)
|
app.component(LoginContainer.name, LoginContainer)
|
||||||
app.component(LayoutContent.name, LayoutContent)
|
app.component(LayoutContent.name, LayoutContent)
|
||||||
app.component(TagsInput.name, TagsInput)
|
app.component(TagsInput.name, TagsInput)
|
||||||
|
app.component(CardBox.name, CardBox)
|
||||||
|
app.component(CardAdd.name, CardAdd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dropdown trigger="click" type="primary">
|
<el-dropdown trigger="click" type="primary">
|
||||||
<el-avatar :size="30"> {{ firstUserName }} </el-avatar>
|
<AppAvatar :name="user.userInfo?.username" />
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item @click="openResetPassword">
|
<el-dropdown-item @click="openResetPassword">
|
||||||
@ -15,15 +15,13 @@
|
|||||||
<ResetPassword ref="resetPasswordRef"></ResetPassword>
|
<ResetPassword ref="resetPasswordRef"></ResetPassword>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import useStore from '@/stores';
|
import useStore from '@/stores'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import ResetPassword from './ResetPasssword.vue'
|
import ResetPassword from './ResetPasssword.vue'
|
||||||
const { user } = useStore();
|
const { user } = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const firstUserName = computed(() => {
|
|
||||||
return user.userInfo?.username?.substring(0, 1)
|
|
||||||
})
|
|
||||||
const resetPasswordRef = ref<InstanceType<typeof ResetPassword>>()
|
const resetPasswordRef = ref<InstanceType<typeof ResetPassword>>()
|
||||||
|
|
||||||
const openResetPassword = () => {
|
const openResetPassword = () => {
|
||||||
|
|||||||
@ -20,6 +20,5 @@ import { Sidebar, AppMain } from '../components'
|
|||||||
}
|
}
|
||||||
.view-container {
|
.view-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: var(--app-view-padding);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -11,12 +11,12 @@ export const routes: Array<RouteRecordRaw> = [
|
|||||||
component: () => import('@/layout/app-layout/index.vue'),
|
component: () => import('@/layout/app-layout/index.vue'),
|
||||||
redirect: '/setting',
|
redirect: '/setting',
|
||||||
children: [
|
children: [
|
||||||
{
|
// {
|
||||||
path: '/first',
|
// path: '/first',
|
||||||
name: 'first',
|
// name: 'first',
|
||||||
meta: { icon: 'House', title: '首页' },
|
// meta: { icon: 'House', title: '首页' },
|
||||||
component: () => import('@/views/first/index.vue')
|
// component: () => import('@/views/first/index.vue')
|
||||||
},
|
// },
|
||||||
...rolesRoutes
|
...rolesRoutes
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -136,6 +136,15 @@ ul {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ellipsis {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 100px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 内容部分 自适应高度
|
||||||
.main-calc-height {
|
.main-calc-height {
|
||||||
height: calc(100vh - 125px);
|
height: calc(100vh - 125px);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,95 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<LayoutContent header="数据集">
|
||||||
dataset
|
<div class="dataset-list-container p-15">
|
||||||
|
<div class="align-right">
|
||||||
|
<el-input
|
||||||
|
v-model="filterText"
|
||||||
|
placeholder="搜索内容"
|
||||||
|
suffix-icon="Search"
|
||||||
|
style="width: 300px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-row
|
||||||
|
:gutter="15"
|
||||||
|
v-infinite-scroll="loadDataset"
|
||||||
|
:infinite-scroll-disabled="disabledScroll"
|
||||||
|
>
|
||||||
|
<el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="4" class="mt-10">
|
||||||
|
<CardAdd title="创建数据集" />
|
||||||
|
</el-col>
|
||||||
|
<el-col
|
||||||
|
:xs="24"
|
||||||
|
:sm="12"
|
||||||
|
:md="6"
|
||||||
|
:lg="6"
|
||||||
|
: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>
|
||||||
|
<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>
|
||||||
|
</LayoutContent>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import datasetApi from '@/api/dataset'
|
||||||
|
import type { datasetListRequest } from '@/api/type/dataset'
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const filterText = ref('')
|
||||||
|
const datasetList = ref<any[]>([])
|
||||||
|
const disabledScroll = ref(false)
|
||||||
|
const pageConfig = ref<datasetListRequest>({
|
||||||
|
current_page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
search_text: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function loadDataset() {}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
datasetApi
|
||||||
|
.getDateset(pageConfig.value)
|
||||||
|
.then((res) => {
|
||||||
|
datasetList.value = res.data
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.dataset-list-container {
|
||||||
|
.delete-button {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -81,12 +81,10 @@ const submitMember = async (formEl: FormInstance | undefined) => {
|
|||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate((valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const obj: any = {
|
const submitValue: string = memberForm.value.users?.length
|
||||||
username_or_email: memberForm.value.users?.length
|
|
||||||
? memberForm.value.users.toString()
|
? memberForm.value.users.toString()
|
||||||
: memberForm.value.user
|
: memberForm.value.user
|
||||||
}
|
TeamApi.postCreatTeamMember(submitValue).then(() => {
|
||||||
TeamApi.postCreatTeamMember(obj).then(() => {
|
|
||||||
MsgSuccess('提交成功')
|
MsgSuccess('提交成功')
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
|||||||
@ -47,7 +47,7 @@ const allChecked: any = ref({
|
|||||||
[USE]: false
|
[USE]: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const tableHeight = ref(100)
|
const tableHeight = ref(0)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user