Skip to content

Commit a163757

Browse files
feat: tip
1 parent 87415e9 commit a163757

File tree

17 files changed

+178
-153
lines changed

17 files changed

+178
-153
lines changed

ui/src/api/folder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const getFolder: (
3232
{
3333
"name": "string",
3434
"desc": "string",
35-
"parent_id": "root"
35+
"parent_id": "default"
3636
}
3737
*/
3838
const postFolder: (
@@ -64,7 +64,7 @@ const getFolderDetail: (
6464
{
6565
"name": "string",
6666
"desc": "string",
67-
"parent_id": "root"
67+
"parent_id": "default"
6868
}
6969
*/
7070
const putFolder: (

ui/src/components/folder-breadcrumb/index.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<template>
22
<el-breadcrumb separator-icon="ArrowRight" style="line-height: 22px">
3-
<h2 v-if="breadcrumbData?.length === 1">{{ breadcrumbData[0]?.name }}</h2>
3+
<h2 v-if="breadcrumbData?.length === 1" class="ellipsis" :title="breadcrumbData[0]?.name">
4+
{{ breadcrumbData[0]?.name }}
5+
</h2>
46
<el-breadcrumb-item v-for="(item, index) in breadcrumbData" :key="index" v-else>
5-
<h5 class="ml-4" v-if="index === breadcrumbData.length - 1">{{ item.name }}</h5>
6-
<el-button v-else link @click="handleClick(item)">{{ item.name }}</el-button>
7+
<h5 class="ml-4 ellipsis" v-if="index === breadcrumbData.length - 1" :title="item.name">
8+
{{ item.name }}
9+
</h5>
10+
<el-button v-else link @click="handleClick(item)" :title="item.name">
11+
<span class="ellipsis"> {{ item.name }}</span>
12+
</el-button>
713
</el-breadcrumb-item>
814
</el-breadcrumb>
915
</template>

ui/src/locales/lang/en-US/views/knowledge.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ export default {
6464
label: 'Selector',
6565
placeholder: 'Default is body, can input .classname/#idname/tagname',
6666
},
67+
file_count_limit: {
68+
label: 'Maximum number of files uploaded at once',
69+
},
70+
file_size_limit: {
71+
label: 'Maximum size of each document(MB)',
72+
placeholder: 'Suggest based on server configuration, otherwise may cause service shutdown',
73+
},
6774
},
6875

6976
ResultSuccess: {

ui/src/locales/lang/zh-CN/views/document.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ export default {
2323
nameMessage: '文件名称不能为空!',
2424
importMessage: '导入成功',
2525
migrationSuccess: '迁移成功',
26+
fileLimitCountTip1: '每次最多上传',
27+
fileLimitCountTip2: '个文件',
28+
fileLimitSizeTip1: '每个文件不超过',
2629
},
2730
upload: {
2831
selectFile: '选择文件',
2932
selectFiles: '选择文件夹',
3033
uploadMessage: '拖拽文件至此上传或',
3134
formats: '支持格式:',
3235
requiredMessage: '请上传文件',
33-
errorMessage1: '文件大小超过 100MB',
3436
errorMessage2: '文件格式不支持',
3537
errorMessage3: '文件不能为空',
36-
errorMessage4: '每次最多上传50个文件',
38+
// errorMessage4: '每次最多上传50个文件',
3739
template: '模版',
3840
download: '下载',
3941
},
@@ -42,20 +44,17 @@ export default {
4244
txt: {
4345
label: '文本文件',
4446
tip1: '1、文件上传前,建议规范文件的分段标识',
45-
tip2: '2、每次最多上传 50 个文件,每个文件不超过 100MB',
4647
},
4748
table: {
4849
label: '表格',
4950
tip1: '1、点击下载对应模版并完善信息:',
5051
tip2: '2、第一行必须是列标题,且列标题必须是有意义的术语,表中每条记录将作为一个分段',
5152
tip3: '3、上传的表格文件中每个 sheet 会作为一个文档,sheet名称为文档名称',
52-
tip4: '4、每次最多上传 50 个文件,每个文件不超过 100MB',
5353
},
5454
QA: {
5555
label: 'QA 问答对',
5656
tip1: '1、点击下载对应模版并完善信息',
5757
tip2: '2、上传的表格文件中每个 sheet 会作为一个文档,sheet名称为文档名称',
58-
tip3: '3、每次最多上传 50 个文件,每个文件不超过 100MB',
5958
},
6059
lark: {},
6160
},

ui/src/locales/lang/zh-CN/views/knowledge.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ export default {
6464
label: '选择器',
6565
placeholder: '默认为 body,可输入 .classname/#idname/tagname',
6666
},
67-
68-
67+
file_count_limit: {
68+
label: '每次上传最多文件数',
69+
},
70+
file_size_limit: {
71+
label: '上传的每个文档最大(MB)',
72+
placeholder: '建议根据服务器配置调整,否则可能会造成服务宕机',
73+
},
6974
},
7075

7176
ResultSuccess: {

ui/src/locales/lang/zh-Hant/views/knowledge.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ export default {
5858
label: '選擇器',
5959
placeholder: '預設為 body,可輸入 .classname/#idname/tagname',
6060
},
61+
file_count_limit: {
62+
label: '每次上傳最多文件數',
63+
},
64+
file_size_limit: {
65+
label: '上傳的每個文件最大(MB)',
66+
placeholder: '建议根据服务器配置调整,否則會造成服務宕机',
67+
},
6168
},
6269

6370
ResultSuccess: {

ui/src/styles/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ h5 {
368368
-webkit-box-orient: vertical;
369369
-webkit-line-clamp: 1;
370370
overflow: hidden;
371+
word-break: break-all;
371372
}
372373

373374
.break-all {

ui/src/styles/component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,8 @@
210210
display: block;
211211
}
212212
}
213+
214+
// tooltip
215+
.auto-tooltip-popper {
216+
max-width: 500px;
217+
}

ui/src/views/application/component/CopyApplicationDialog.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ const submitValid = (formEl: FormInstance | undefined) => {
145145
if (user.isEnterprise()) {
146146
submitHandle(formEl)
147147
} else {
148-
// common
149-
// .asyncGetValid(ValidType.Application, ValidCount.Application, loading)
150-
// .then(async (res: any) => {
151-
// if (res?.data) {
152-
// submitHandle(formEl)
153-
// } else {
154-
// MsgAlert(t('common.tip'), t('views.application.tip.professionalMessage'))
155-
// }
156-
// })
148+
common
149+
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
150+
.then(async (res: any) => {
151+
if (res?.data) {
152+
submitHandle(formEl)
153+
} else {
154+
MsgAlert(t('common.tip'), t('views.application.tip.professionalMessage'))
155+
}
156+
})
157157
}
158158
}
159159
const submitHandle = async (formEl: FormInstance | undefined) => {

ui/src/views/application/index.vue

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
<folder-tree
66
:source="SourceTypeEnum.APPLICATION"
77
:data="folderList"
8-
:currentNodeKey="currentFolder?.id"
8+
:currentNodeKey="folder.currentFolder?.id"
99
@handleNodeClick="folderClickHandel"
1010
@refreshTree="refreshFolder"
1111
class="p-8"
1212
/>
1313
</template>
14-
<ContentContainer :header="currentFolder?.name">
14+
<ContentContainer>
15+
<template #header>
16+
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandel" />
17+
</template>
1518
<template #search>
1619
<div class="flex">
1720
<div class="flex-between complex-search">
@@ -43,13 +46,8 @@
4346
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.username" />
4447
</el-select>
4548
</div>
46-
<el-dropdown trigger="click"
47-
v-if="permissionPrecise.create()"
48-
>
49-
<el-button
50-
type="primary"
51-
class="ml-8"
52-
>
49+
<el-dropdown trigger="click" v-if="permissionPrecise.create()">
50+
<el-button type="primary" class="ml-8">
5351
{{ $t('common.create') }}
5452
<el-icon class="el-icon--right">
5553
<arrow-down />
@@ -238,9 +236,7 @@
238236
<el-dropdown-item
239237
divided
240238
@click.stop="exportApplication(item)"
241-
v-if="
242-
permissionPrecise.export(item.id)
243-
"
239+
v-if="permissionPrecise.export(item.id)"
244240
>
245241
<AppIcon iconName="app-export"></AppIcon>
246242
{{ $t('common.export') }}
@@ -249,9 +245,7 @@
249245
divided
250246
icon="Delete"
251247
@click.stop="deleteApplication(item)"
252-
v-if="
253-
permissionPrecise.delete(item.id)
254-
"
248+
v-if="permissionPrecise.delete(item.id)"
255249
>{{ $t('common.delete') }}</el-dropdown-item
256250
>
257251
</el-dropdown-menu>
@@ -285,20 +279,20 @@ import { t } from '@/locales'
285279
import { useRouter, useRoute } from 'vue-router'
286280
import { isWorkFlow } from '@/utils/application'
287281
import { dateFormat } from '@/utils/time'
288-
import { SourceTypeEnum } from '@/enums/common'
282+
import { SourceTypeEnum, ValidType, ValidCount } from '@/enums/common'
289283
import permissionMap from '@/permission'
290284
291285
const router = useRouter()
292286
const route = useRoute()
293287
294288
const apiType = computed<'workspace'>(() => {
295-
return 'workspace'
289+
return 'workspace'
296290
})
297291
const permissionPrecise = computed(() => {
298292
return permissionMap['application'][apiType.value]
299293
})
300294
301-
const { folder, application, user } = useStore()
295+
const { folder, application, user, common } = useStore()
302296
303297
const loading = ref(false)
304298
@@ -321,48 +315,30 @@ const paginationConfig = reactive({
321315
322316
const folderList = ref<any[]>([])
323317
const applicationList = ref<any[]>([])
324-
const currentFolder = ref<any>({})
325318
const CopyApplicationDialogRef = ref()
326319
const CreateApplicationDialogRef = ref()
327320
328321
function openCreateDialog(type?: string) {
329-
CreateApplicationDialogRef.value.open(currentFolder.value?.id || 'root', type)
330-
// common
331-
// .asyncGetValid(ValidType.Application, ValidCount.Application, loading)
332-
// .then(async (res: any) => {
333-
// if (res?.data) {
334-
// CreateApplicationDialogRef.value.open()
335-
// } else if (res?.code === 400) {
336-
// MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
337-
// cancelButtonText: t('common.confirm'),
338-
// confirmButtonText: t('common.professional'),
339-
// }).then(() => {
340-
// window.open('https://maxkb.cn/pricing.html', '_blank')
341-
// })
342-
// }
343-
// })
322+
common
323+
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
324+
.then(async (res: any) => {
325+
if (res?.data) {
326+
CreateApplicationDialogRef.value.open(folder.currentFolder?.id || 'default', type)
327+
} else if (res?.code === 400) {
328+
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
329+
cancelButtonText: t('common.confirm'),
330+
confirmButtonText: t('common.professional'),
331+
}).then(() => {
332+
window.open('https://maxkb.cn/pricing.html', '_blank')
333+
})
334+
}
335+
})
344336
}
345337
346338
const search_type_change = () => {
347339
search_form.value = { name: '', create_user: '' }
348340
}
349341
350-
function getList() {
351-
const params = {
352-
folder_id: currentFolder.value?.id || 'root',
353-
}
354-
ApplicaitonApi.getApplication(paginationConfig, params, loading).then((res) => {
355-
paginationConfig.total = res.data.total
356-
applicationList.value = [...applicationList.value, ...res.data.records]
357-
})
358-
}
359-
360-
function clickFolder(item: any) {
361-
currentFolder.value.id = item.id
362-
applicationList.value = []
363-
getList()
364-
}
365-
366342
function getAccessToken(id: string) {
367343
applicationList.value
368344
.filter((app) => app.id === id)[0]
@@ -484,7 +460,7 @@ const importApplication = (file: any) => {
484460
// 文件夹相关
485461
const CreateFolderDialogRef = ref()
486462
function openCreateFolder() {
487-
CreateFolderDialogRef.value.open(SourceTypeEnum.APPLICATION, currentFolder.value.id)
463+
CreateFolderDialogRef.value.open(SourceTypeEnum.APPLICATION, folder.currentFolder.id)
488464
}
489465
490466
function getFolder(bool?: boolean) {
@@ -493,13 +469,19 @@ function getFolder(bool?: boolean) {
493469
folderList.value = res.data
494470
if (bool) {
495471
// 初始化刷新
496-
currentFolder.value = res.data?.[0] || {}
472+
folder.setCurrentFolder(res.data?.[0] || {})
497473
}
498474
getList()
499475
})
500476
}
477+
478+
function clickFolder(item: any) {
479+
folder.setCurrentFolder(item)
480+
applicationList.value = []
481+
getList()
482+
}
501483
function folderClickHandel(row: any) {
502-
currentFolder.value = row
484+
folder.setCurrentFolder(row)
503485
applicationList.value = []
504486
getList()
505487
}
@@ -514,6 +496,16 @@ function searchHandel() {
514496
getList()
515497
}
516498
499+
function getList() {
500+
const params = {
501+
folder_id: folder.currentFolder?.id || 'default',
502+
}
503+
ApplicaitonApi.getApplication(paginationConfig, params, loading).then((res) => {
504+
paginationConfig.total = res.data.total
505+
applicationList.value = [...applicationList.value, ...res.data.records]
506+
})
507+
}
508+
517509
onMounted(() => {
518510
getFolder(true)
519511
})

0 commit comments

Comments
 (0)