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
*/
const delApplication: (applicaiton_id: String) => Promise<Result<boolean>> = (applicaiton_id) => {
return del(`${prefix}/${applicaiton_id}`)
const delApplication: (
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
*/
const delDateset: (dataset_id: String) => Promise<Result<boolean>> = (dataset_id) => {
return del(`${prefix}/${dataset_id}`)
const delDateset: (dataset_id: String, loading?: Ref<boolean>) => Promise<Result<boolean>> = (
dataset_id,
loading
) => {
return del(`${prefix}/${dataset_id}`, undefined, {}, loading)
}
/**

View File

@ -1,5 +1,5 @@
<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">
<DynamicsForm
:style="formStyle"
@ -113,49 +113,45 @@ defineExpose({
})
</script>
<style lang="scss" scoped>
.box-card {
width: 30%;
position: relative;
margin: 10px;
padding-top: 20px;
}
.card-add {
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 16px;
cursor: pointer;
min-height: var(--card-min-height);
border: 1px dashed var(--el-color-primary);
background: #eff0f1;
padding-bottom: 20px;
.add-icon {
font-size: 14px;
border-radius: 4px;
border: 1px solid var(--app-border-color-dark);
background: var(--app-layout-bg-color);
margin-right: 12px;
.arrt-object-card {
.box-card {
width: 30%;
position: relative;
margin: 10px;
padding-top: 20px;
}
&:hover {
color: var(--el-color-primary);
background: #ffffff;
.card-add {
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 16px;
cursor: pointer;
min-height: var(--card-min-height);
border: 1px dashed var(--el-color-primary);
background: #eff0f1;
padding-bottom: 20px;
.add-icon {
font-size: 14px;
border-radius: 4px;
border: 1px solid var(--app-border-color-dark);
background: var(--app-layout-bg-color);
margin-right: 12px;
}
&:hover {
color: var(--el-color-primary);
background: #ffffff;
border-color: var(--el-color-primary);
.add-icon {
background: #ffffff;
border-color: var(--el-color-primary);
}
}
}
}
:deep(.el-form-item) {
&:last-child {
margin-bottom: 0px;
.delete-button {
position: absolute;
right: 12px;
top: 10px;
height: auto;
}
margin-bottom: 18px;
}
.delete-button {
position: absolute;
right: 12px;
top: 10px;
height: auto;
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,17 +3,17 @@
<div class="login-container w-full h-full">
<el-row class="container w-full h-full">
<el-col
:xs="8"
:sm="6"
:md="14"
:lg="14"
:xl="14"
:xs="0"
:sm="0"
:md="10"
:lg="10"
:xl="10"
class="left-container"
v-if="screenWidth && screenWidth >= 990"
>
<div class="login-image"></div>
</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>
</el-col>
</el-row>

View File

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

View File

@ -28,6 +28,16 @@
--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-title-font-size: 16px;
.dialog-sub-title {

View File

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

View File

@ -75,24 +75,6 @@ const paginationConfig = reactive({
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() {
paginationConfig.current_page = 1
datasetList.value = []
@ -109,17 +91,11 @@ function deleteDateset(row: any) {
}
)
.then(() => {
loading.value = true
datasetApi
.delDateset(row.id)
.then(() => {
const index = datasetList.value.findIndex((v) => v.id === row.id)
datasetList.value.splice(index, 1)
MsgSuccess('删除成功')
})
.catch(() => {
loading.value = false
})
datasetApi.delDateset(row.id, loading).then(() => {
const index = datasetList.value.findIndex((v) => v.id === row.id)
datasetList.value.splice(index, 1)
MsgSuccess('删除成功')
})
})
.catch(() => {})
}

View File

@ -3,13 +3,13 @@
<el-result icon="success" title="🎉 数据集创建成功 🎉">
<template #sub-title>
<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-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-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>
</div>
</template>
@ -54,7 +54,8 @@
</el-scrollbar>
</template>
<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 { filesize, getImgUrl } from '@/utils/utils'
const props = defineProps({
@ -64,6 +65,14 @@ const props = defineProps({
}
})
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>
<style scoped lang="scss">
.result-success {

View File

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

View File

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

View File

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

View File

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

View File

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