@@ -383,7 +383,39 @@ function closeDialog() {
383383 multipleSelection .value = []
384384 multipleTableRef .value ?.clearSelection ()
385385}
386+ function getResourcesByFolderId(treeData : any [], folderId : string ): any [] {
387+ const result: any [] = []
388+ let target: any = null
386389
390+ function dfs(nodes : any []) {
391+ for (const node of nodes ) {
392+ if (node .id === folderId ) {
393+ target = node
394+ return
395+ }
396+ if (node .children ?.length ) {
397+ dfs (node .children )
398+ if (target ) return
399+ }
400+ }
401+ }
402+
403+ function collect(node : any ) {
404+ if (! node ?.children ) return
405+ for (const child of node .children ) {
406+ result .push (child )
407+ collect (child )
408+ }
409+ }
410+
411+ dfs (treeData )
412+
413+ if (target ) {
414+ collect (target )
415+ }
416+
417+ return result
418+ }
387419function submitPermissions(value : string , row : any ) {
388420 const obj = [
389421 {
@@ -409,9 +441,15 @@ function submitPermissions(value: string, row: any) {
409441 }
410442 return result
411443 }
444+
412445 if ([' VIEW' , ' MANAGE' , ' ROLE' ].includes (value )) {
413446 emitSubmitPermissions (props .data , [row .folder_id ], obj )
414447 }
448+ if ([' NOT_AUTH' ].includes (value ) && ' folder' == row .resource_type ) {
449+ getResourcesByFolderId (props .data , row .id ).forEach ((n ) => {
450+ obj .push ({ target_id: n .id , permission: ' NOT_AUTH' })
451+ })
452+ }
415453 emit (' submitPermissions' , obj )
416454}
417455const provider_list = ref <Array <Provider >>([])
0 commit comments