Merge branch 'main' of github.com:maxkb-dev/maxkb

This commit is contained in:
shaohuzhang1 2023-12-12 15:44:42 +08:00
commit 7d5d0846d9
20 changed files with 196 additions and 245 deletions

View File

@ -85,8 +85,11 @@ const putApplication: (
* *
* @param applicaiton_id * @param applicaiton_id
*/ */
const delApplication: (applicaiton_id: String) => Promise<Result<boolean>> = (applicaiton_id) => { const delApplication: (
return del(`${prefix}/${applicaiton_id}`) applicaiton_id: String,
loading?: Ref<boolean>
) => Promise<Result<boolean>> = (applicaiton_id, loading) => {
return del(`${prefix}/${applicaiton_id}`, undefined, {}, loading)
} }
/** /**

View File

@ -37,8 +37,11 @@ const getAllDateset: (loading?: Ref<boolean>) => Promise<Result<any[]>> = (loadi
* *
* @param dataset_id * @param dataset_id
*/ */
const delDateset: (dataset_id: String) => Promise<Result<boolean>> = (dataset_id) => { const delDateset: (dataset_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
return del(`${prefix}/${dataset_id}`) dataset_id,
loading
) => {
return del(`${prefix}/${dataset_id}`, undefined, {}, loading)
} }
/** /**

View File

@ -1,5 +1,5 @@
<template v-loading="_loading"> <template v-loading="_loading">
<div style="width: 100%; display: flex; flex-wrap: wrap"> <div class="arrt-object-card flex w-full">
<el-card class="box-card" :style="style" v-for="(item, index) in _data" :key="index"> <el-card class="box-card" :style="style" v-for="(item, index) in _data" :key="index">
<DynamicsForm <DynamicsForm
:style="formStyle" :style="formStyle"
@ -113,13 +113,14 @@ defineExpose({
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.box-card { .arrt-object-card {
.box-card {
width: 30%; width: 30%;
position: relative; position: relative;
margin: 10px; margin: 10px;
padding-top: 20px; padding-top: 20px;
} }
.card-add { .card-add {
display: inline-flex; display: inline-flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -145,17 +146,12 @@ defineExpose({
border-color: var(--el-color-primary); border-color: var(--el-color-primary);
} }
} }
}
:deep(.el-form-item) {
&:last-child {
margin-bottom: 0px;
} }
margin-bottom: 18px; .delete-button {
}
.delete-button {
position: absolute; position: absolute;
right: 12px; right: 12px;
top: 10px; top: 10px;
height: auto; height: auto;
}
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<el-card class="box-card" :style="style"> <el-card :style="style">
<DynamicsForm <DynamicsForm
:read-only="view" :read-only="view"
:style="formStyle" :style="formStyle"
@ -72,11 +72,4 @@ defineExpose({
validate validate
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
:deep(.el-form-item) {
&:last-child {
margin-bottom: 0px;
}
margin-bottom: 18px;
}
</style>

View File

@ -8,7 +8,7 @@
:name="index" :name="index"
> >
<template v-if="formField.children"> <template v-if="formField.children">
<el-card class="box-card" :style="style"> <el-card :style="style">
<DynamicsForm <DynamicsForm
:style="formStyle" :style="formStyle"
:view="view" :view="view"
@ -119,11 +119,4 @@ defineExpose({
field: props.field field: props.field
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped></style>
:deep(.el-form-item) {
&:last-child {
margin-bottom: 0px;
}
margin-bottom: 18px;
}
</style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div class="progress-table-item">
<el-popover placement="top-start" :title="row[text_field]" :width="200" trigger="hover"> <el-popover placement="top-start" :title="row[text_field]" :width="200" trigger="hover">
<template #reference> <template #reference>
<el-progress v-bind="$attrs" :percentage="row[value_field]"></el-progress <el-progress v-bind="$attrs" :percentage="row[value_field]"></el-progress
@ -61,8 +61,10 @@ const view_card = computed(() => {
line-height: 22px; line-height: 22px;
height: 22px; height: 22px;
} }
.value { .progress-table-item {
.value {
float: right; float: right;
@include valueScss; @include valueScss;
}
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div class="table-checkbox">
<div class="header"> <div class="header">
<div class="title">{{ title }}</div> <div class="title">{{ title }}</div>
@ -186,7 +186,8 @@ const activeText = computed(() => {
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header { .table-checkbox {
.header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 16px; margin-bottom: 16px;
@ -199,13 +200,14 @@ const activeText = computed(() => {
.input-with-select { .input-with-select {
width: 45%; width: 45%;
} }
} }
.msg { .msg {
margin-top: 12px; margin-top: 12px;
color: rgba(100, 106, 115, 1); color: rgba(100, 106, 115, 1);
.active { .active {
margin-left: 3px; margin-left: 3px;
color: var(--el-color-primary); color: var(--el-color-primary);
} }
}
} }
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div class="table-radio">
<div class="header"> <div class="header">
<div class="title">{{ title }}</div> <div class="title">{{ title }}</div>
@ -174,7 +174,8 @@ const activeText = computed(() => {
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header { .table-radio {
.header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 16px; margin-bottom: 16px;
@ -187,13 +188,14 @@ const activeText = computed(() => {
.input-with-select { .input-with-select {
width: 45%; width: 45%;
} }
} }
.msg { .msg {
margin-top: 12px; margin-top: 12px;
color: rgba(100, 106, 115, 1); color: rgba(100, 106, 115, 1);
.active { .active {
margin-left: 3px; margin-left: 3px;
color: var(--el-color-primary); color: var(--el-color-primary);
} }
}
} }
</style> </style>

View File

@ -1,13 +1,17 @@
<template> <template>
<div class="login-form-container"> <div class="login-form-container">
<div class="login-title"> <div class="login-title">
<div class="title flex-center"> <div class="title flex-center mb-8">
<div class="logo"></div> <div class="logo mr-4"></div>
<div class="app-logo-font">{{ title || defaultTitle }}</div> <div class="app-logo-font">{{ title || defaultTitle }}</div>
</div> </div>
<div class="sub-title" v-if="subTitle">{{ subTitle }}</div> <div class="sub-title text-center" v-if="subTitle">
<el-text type="info">{{ subTitle }}</el-text>
</div> </div>
</div>
<el-card class="login-card">
<slot></slot> <slot></slot>
</el-card>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -20,27 +24,28 @@ defineProps({
</script> </script>
<style lang="scss" scope> <style lang="scss" scope>
.login-form-container { .login-form-container {
width: 420px; width: 480px;
.login-title { .login-title {
margin-bottom: 30px; margin-bottom: 32px;
.title { .title {
font-size: 28px; font-size: 32px;
height: 60px;
.logo { .logo {
background-image: url('@/assets/logo.png'); background-image: url('@/assets/logo.svg');
background-size: 100% 100%; background-size: 100% 100%;
width: 48px; width: 45px;
height: 48px; height: 45px;
background-position: center -2px;
} }
} }
.sub-title { .sub-title {
text-align: center; font-size: 16px;
color: #101010;
font-size: 18px;
} }
} }
.login-card {
border-radius: 8px;
padding: 18px;
}
} }
</style> </style>

View File

@ -3,17 +3,17 @@
<div class="login-container w-full h-full"> <div class="login-container w-full h-full">
<el-row class="container w-full h-full"> <el-row class="container w-full h-full">
<el-col <el-col
:xs="8" :xs="0"
:sm="6" :sm="0"
:md="14" :md="10"
:lg="14" :lg="10"
:xl="14" :xl="10"
class="left-container" class="left-container"
v-if="screenWidth && screenWidth >= 990" v-if="screenWidth && screenWidth >= 990"
> >
<div class="login-image"></div> <div class="login-image"></div>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :md="10" :lg="10" :xl="10" class="right-container flex-center"> <el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="14" class="right-container flex-center">
<slot></slot> <slot></slot>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -126,7 +126,9 @@ h4 {
.mb-16 { .mb-16 {
margin-bottom: calc(var(--app-base-px) * 2); margin-bottom: calc(var(--app-base-px) * 2);
} }
.mb-24 {
margin-bottom: calc(var(--app-base-px) * 3);
}
.ml-4 { .ml-4 {
margin-left: calc(var(--app-base-px) - 4px); margin-left: calc(var(--app-base-px) - 4px);
} }

View File

@ -28,6 +28,16 @@
--el-form-inline-content-width: 100%; --el-form-inline-content-width: 100%;
} }
.el-form-item {
margin-bottom: 18px;
.el-form-item {
margin-bottom: 18px;
&:last-child {
margin-bottom: 0px;
}
}
}
.el-dialog { .el-dialog {
--el-dialog-title-font-size: 16px; --el-dialog-title-font-size: 16px;
.dialog-sub-title { .dialog-sub-title {

View File

@ -102,14 +102,6 @@ const paginationConfig = reactive({
const searchValue = ref('') const searchValue = ref('')
const noMore = computed(
() =>
applicationList.value.length > 0 &&
applicationList.value.length === paginationConfig.total &&
paginationConfig.total > 20 &&
!loading.value
)
function searchHandle() { function searchHandle() {
paginationConfig.total = 0 paginationConfig.total = 0
paginationConfig.current_page = 1 paginationConfig.current_page = 1
@ -128,17 +120,11 @@ function deleteApplication(row: any) {
confirmButtonClass: 'danger' confirmButtonClass: 'danger'
}) })
.then(() => { .then(() => {
loading.value = true applicationApi.delApplication(row.id, loading).then(() => {
applicationApi
.delApplication(row.id)
.then(() => {
const index = applicationList.value.findIndex((v) => v.id === row.id) const index = applicationList.value.findIndex((v) => v.id === row.id)
applicationList.value.splice(index, 1) applicationList.value.splice(index, 1)
MsgSuccess('删除成功') MsgSuccess('删除成功')
}) })
.catch(() => {
loading.value = false
})
}) })
.catch(() => {}) .catch(() => {})
} }

View File

@ -75,24 +75,6 @@ const paginationConfig = reactive({
const searchValue = ref('') const searchValue = ref('')
const noMore = computed(
() =>
datasetList.value.length > 0 &&
datasetList.value.length === paginationConfig.total &&
paginationConfig.total > 20 &&
!loading.value
)
const disabledScroll = computed(
() => datasetList.value.length > 0 && (loading.value || noMore.value)
)
function loadDataset() {
if (paginationConfig.total > paginationConfig.page_size) {
paginationConfig.current_page += 1
getList()
}
}
function searchHandle() { function searchHandle() {
paginationConfig.current_page = 1 paginationConfig.current_page = 1
datasetList.value = [] datasetList.value = []
@ -109,17 +91,11 @@ function deleteDateset(row: any) {
} }
) )
.then(() => { .then(() => {
loading.value = true datasetApi.delDateset(row.id, loading).then(() => {
datasetApi
.delDateset(row.id)
.then(() => {
const index = datasetList.value.findIndex((v) => v.id === row.id) const index = datasetList.value.findIndex((v) => v.id === row.id)
datasetList.value.splice(index, 1) datasetList.value.splice(index, 1)
MsgSuccess('删除成功') MsgSuccess('删除成功')
}) })
.catch(() => {
loading.value = false
})
}) })
.catch(() => {}) .catch(() => {})
} }

View File

@ -3,13 +3,13 @@
<el-result icon="success" title="🎉 数据集创建成功 🎉"> <el-result icon="success" title="🎉 数据集创建成功 🎉">
<template #sub-title> <template #sub-title>
<div class="mt-8"> <div class="mt-8">
<span class="bold">{{ data?.document_count || 0 }}</span> <span class="bold">{{ data?.document_list.length || 0 }}</span>
<el-text type="info" class="ml-4">文档</el-text> <el-text type="info" class="ml-4">文档</el-text>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<span class="bold">{{ data?.document_list.length || 0 }}</span> <span class="bold">{{ paragraph_count || 0 }}</span>
<el-text type="info" class="ml-4">分段</el-text> <el-text type="info" class="ml-4">分段</el-text>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<span class="bold">{{ numberFormat(data?.char_length) || 0 }}</span> <span class="bold">{{ numberFormat(char_length) || 0 }}</span>
<el-text type="info" class="ml-4">字符</el-text> <el-text type="info" class="ml-4">字符</el-text>
</div> </div>
</template> </template>
@ -54,7 +54,8 @@
</el-scrollbar> </el-scrollbar>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter, useRoute } from 'vue-router' import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { numberFormat } from '@/utils/utils' import { numberFormat } from '@/utils/utils'
import { filesize, getImgUrl } from '@/utils/utils' import { filesize, getImgUrl } from '@/utils/utils'
const props = defineProps({ const props = defineProps({
@ -64,6 +65,14 @@ const props = defineProps({
} }
}) })
const router = useRouter() const router = useRouter()
const paragraph_count = computed(
() => props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.paragraph_count), 0)
)
const char_length = computed(
() =>
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.char_length), 0) || 0
)
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.result-success { .result-success {

View File

@ -1,7 +1,7 @@
<template> <template>
<login-layout> <login-layout>
<LoginContainer> <LoginContainer subTitle="欢迎使用 MaxKB 管理平台">
<h4 class="mb-16">忘记密码</h4> <h4 class="mb-24">忘记密码</h4>
<el-form <el-form
class="register-form" class="register-form"
ref="resetPasswordFormRef" ref="resetPasswordFormRef"
@ -15,9 +15,6 @@
v-model="CheckEmailForm.email" v-model="CheckEmailForm.email"
placeholder="请输入邮箱" placeholder="请输入邮箱"
> >
<template #prepend>
<el-button icon="UserFilled" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <el-form-item prop="code">
@ -28,9 +25,6 @@
v-model="CheckEmailForm.code" v-model="CheckEmailForm.code"
placeholder="请输入验证码" placeholder="请输入验证码"
> >
<template #prepend>
<el-button icon="Key" />
</template>
</el-input> </el-input>
<el-button <el-button
size="large" size="large"
@ -42,16 +36,16 @@
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" class="login-submit-button w-full" @click="checkCode" <el-button type="primary" class="login-submit-button w-full mt-4" @click="checkCode"
>立即验证</el-button >立即验证</el-button
> >
<div class="operate-container mt-8"> <div class="operate-container mt-12">
<el-button <el-button
class="register" class="register"
@click="router.push('/login')" @click="router.push('/login')"
link link
type="primary" type="primary"
icon="DArrowLeft" icon="ArrowLeft"
> >
返回登录 返回登录
</el-button> </el-button>

View File

@ -1,4 +1,3 @@
.login-submit-button { .login-submit-button {
margin-top: 12px;
height: 40px; height: 40px;
} }

View File

@ -1,20 +1,18 @@
<template> <template>
<login-layout v-loading="loading"> <login-layout v-loading="loading">
<LoginContainer subTitle="欢迎使用 MaxKB 管理平台"> <LoginContainer subTitle="欢迎使用 MaxKB 管理平台">
<h2 class="mb-24">普通登录</h2>
<el-form class="login-form" :rules="rules" :model="loginForm" ref="loginFormRef"> <el-form class="login-form" :rules="rules" :model="loginForm" ref="loginFormRef">
<el-form-item> <el-form-item prop="username">
<el-input <el-input
size="large" size="large"
class="input-item" class="input-item"
v-model="loginForm.username" v-model="loginForm.username"
placeholder="请输入用户名" placeholder="请输入用户名"
> >
<template #prepend>
<el-button icon="UserFilled" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item prop="password">
<el-input <el-input
type="password" type="password"
size="large" size="large"
@ -23,13 +21,13 @@
placeholder="请输入密码" placeholder="请输入密码"
show-password show-password
> >
<template #prepend>
<el-button icon="Lock" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="operate-container flex-between"> <el-button type="primary" class="login-submit-button mt-4 w-full" @click="login"
>登录</el-button
>
<div class="operate-container flex-between mt-12">
<el-button class="register" @click="router.push('/register')" link type="primary"> <el-button class="register" @click="router.push('/register')" link type="primary">
注册 注册
</el-button> </el-button>
@ -42,7 +40,6 @@
忘记密码 忘记密码
</el-button> </el-button>
</div> </div>
<el-button type="primary" class="login-submit-button w-full" @click="login">登录</el-button>
</LoginContainer> </LoginContainer>
</login-layout> </login-layout>
</template> </template>
@ -77,8 +74,8 @@ const rules = ref<FormRules<LoginRequest>>({
}, },
{ {
min: 6, min: 6,
max: 30, max: 20,
message: '长度在 6 到 30 个字符', message: '长度在 6 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
] ]

View File

@ -1,7 +1,7 @@
<template> <template>
<login-layout> <login-layout>
<LoginContainer> <LoginContainer subTitle="欢迎使用 MaxKB 管理平台">
<h4 class="mb-16">注册</h4> <h4 class="mb-24">用户注册</h4>
<el-form class="register-form" :model="registerForm" :rules="rules" ref="registerFormRef"> <el-form class="register-form" :model="registerForm" :rules="rules" ref="registerFormRef">
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input
@ -10,9 +10,6 @@
v-model="registerForm.username" v-model="registerForm.username"
placeholder="请输入用户名" placeholder="请输入用户名"
> >
<template #prepend>
<el-button :icon="UserFilled" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
@ -24,9 +21,6 @@
placeholder="请输入密码" placeholder="请输入密码"
show-password show-password
> >
<template #prepend>
<el-button :icon="Lock" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="repassword"> <el-form-item prop="repassword">
@ -38,9 +32,6 @@
placeholder="请输入确认密码" placeholder="请输入确认密码"
show-password show-password
> >
<template #prepend>
<el-button :icon="Lock" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="email"> <el-form-item prop="email">
@ -50,9 +41,6 @@
v-model="registerForm.email" v-model="registerForm.email"
placeholder="请输入邮箱" placeholder="请输入邮箱"
> >
<template #prepend>
<el-button :icon="Message" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <el-form-item prop="code">
@ -63,9 +51,6 @@
v-model="registerForm.code" v-model="registerForm.code"
placeholder="请输入验证码" placeholder="请输入验证码"
> >
<template #prepend>
<el-button :icon="Key" />
</template>
</el-input> </el-input>
<el-button <el-button
size="large" size="large"
@ -77,16 +62,16 @@
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" class="login-submit-button w-full" @click="register" <el-button type="primary" class="login-submit-button w-full mt-4" @click="register"
>注册</el-button >注册</el-button
> >
<div class="operate-container mt-8"> <div class="operate-container mt-12">
<el-button <el-button
class="register" class="register"
@click="router.push('/login')" @click="router.push('/login')"
link link
type="primary" type="primary"
icon="DArrowLeft" icon="ArrowLeft"
> >
返回登录 返回登录
</el-button> </el-button>
@ -128,8 +113,8 @@ const rules = ref<FormRules<RegisterRequest>>({
}, },
{ {
min: 6, min: 6,
max: 30, max: 20,
message: '长度在 6 到 30 个字符', message: '长度在 6 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
], ],
@ -141,8 +126,8 @@ const rules = ref<FormRules<RegisterRequest>>({
}, },
{ {
min: 6, min: 6,
max: 30, max: 20,
message: '长度在 6 到 30 个字符', message: '长度在 6 到 20 个字符',
trigger: 'blur' trigger: 'blur'
}, },
{ {

View File

@ -1,7 +1,7 @@
<template> <template>
<login-layout> <login-layout>
<LoginContainer> <LoginContainer subTitle="欢迎使用 MaxKB 管理平台">
<h4 class="mb-16">修改密码</h4> <h4 class="mb-24">修改密码</h4>
<el-form <el-form
class="reset-password-form" class="reset-password-form"
ref="resetPasswordFormRef" ref="resetPasswordFormRef"
@ -17,9 +17,6 @@
placeholder="请输入密码" placeholder="请输入密码"
show-password show-password
> >
<template #prepend>
<el-button icon="Lock" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="re_password"> <el-form-item prop="re_password">
@ -31,22 +28,19 @@
placeholder="请输入确认密码" placeholder="请输入确认密码"
show-password show-password
> >
<template #prepend>
<el-button icon="Lock" />
</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" class="login-submit-button w-full" @click="resetPassword" <el-button type="primary" class="login-submit-button w-full mt-4" @click="resetPassword"
>确认修改</el-button >确认修改</el-button
> >
<div class="operate-container mt-8"> <div class="operate-container mt-12">
<el-button <el-button
class="register" class="register"
@click="router.push('/login')" @click="router.push('/login')"
link link
type="primary" type="primary"
icon="DArrowLeft" icon="ArrowLeft"
> >
返回登录 返回登录
</el-button> </el-button>
@ -91,8 +85,8 @@ const rules = ref<FormRules<ResetPasswordRequest>>({
}, },
{ {
min: 6, min: 6,
max: 30, max: 20,
message: '长度在 6 到 30 个字符', message: '长度在 6 到 20 个字符',
trigger: 'blur' trigger: 'blur'
} }
], ],
@ -104,8 +98,8 @@ const rules = ref<FormRules<ResetPasswordRequest>>({
}, },
{ {
min: 6, min: 6,
max: 30, max: 20,
message: '长度在 6 到 30 个字符', message: '长度在 6 到 20 个字符',
trigger: 'blur' trigger: 'blur'
}, },
{ {