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" >
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 />
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') }}
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'
285279import { useRouter , useRoute } from ' vue-router'
286280import { isWorkFlow } from ' @/utils/application'
287281import { dateFormat } from ' @/utils/time'
288- import { SourceTypeEnum } from ' @/enums/common'
282+ import { SourceTypeEnum , ValidType , ValidCount } from ' @/enums/common'
289283import permissionMap from ' @/permission'
290284
291285const router = useRouter ()
292286const route = useRoute ()
293287
294288const apiType = computed <' workspace' >(() => {
295- return ' workspace'
289+ return ' workspace'
296290})
297291const permissionPrecise = computed (() => {
298292 return permissionMap [' application' ][apiType .value ]
299293})
300294
301- const { folder, application, user } = useStore ()
295+ const { folder, application, user, common } = useStore ()
302296
303297const loading = ref (false )
304298
@@ -321,48 +315,30 @@ const paginationConfig = reactive({
321315
322316const folderList = ref <any []>([])
323317const applicationList = ref <any []>([])
324- const currentFolder = ref <any >({})
325318const CopyApplicationDialogRef = ref ()
326319const CreateApplicationDialogRef = ref ()
327320
328321function 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
346338const 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-
366342function getAccessToken(id : string ) {
367343 applicationList .value
368344 .filter ((app ) => app .id === id )[0 ]
@@ -484,7 +460,7 @@ const importApplication = (file: any) => {
484460// 文件夹相关
485461const CreateFolderDialogRef = ref ()
486462function openCreateFolder() {
487- CreateFolderDialogRef .value .open (SourceTypeEnum .APPLICATION , currentFolder . value .id )
463+ CreateFolderDialogRef .value .open (SourceTypeEnum .APPLICATION , folder . currentFolder .id )
488464}
489465
490466function 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+ }
501483function 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+
517509onMounted (() => {
518510 getFolder (true )
519511})
0 commit comments