@@ -3,9 +3,9 @@ import icon_add_outlined from '@/assets/svg/icon_add_outlined.svg'
33import {treeDraggableChart } from ' @/views/dashboard/utils/treeDraggableChart'
44import newFolder from ' @/assets/svg/new-folder.svg'
55import icon_searchOutline_outlined from ' @/assets/svg/icon_search-outline_outlined.svg'
6- import Folder from ' @/assets/svg/folder .svg'
6+ import icon_folder from ' @/assets/svg/icon_folder .svg'
77import icon_fileAdd_outlined from ' @/assets/svg/icon_file-add_outlined.svg'
8- import icon_operationAnalysis_outlined from ' @/assets/svg/icon_operation-analysis_outlined .svg'
8+ import icon_dashboard from ' @/assets/svg/icon_dashboard .svg'
99import icon_edit_outlined from ' @/assets/svg/icon_edit_outlined.svg'
1010import {onMounted , reactive , ref , watch , nextTick , computed } from ' vue'
1111import {ElIcon , ElScrollbar } from ' element-plus-secondary'
@@ -14,7 +14,6 @@ import {type SQTreeNode} from '@/views/dashboard/utils/treeNode'
1414import _ from ' lodash'
1515import router from ' @/router'
1616import {dashboardStoreWithOut } from " @/stores/dashboard/dashboard.ts" ;
17- import HandleMore from " @/views/dashboard/common/HandleMore.vue" ;
1817import ResourceGroupOpt from " @/views/dashboard/common/ResourceGroupOpt.vue" ;
1918import {dashboardApi } from " @/api/dashboard.ts" ;
2019
@@ -58,10 +57,6 @@ const state = reactive({
5857})
5958
6059
61- const resourceTypeList = computed (() => {
62- return []
63- })
64-
6560// @ts-ignore
6661const {handleDrop, allowDrop, handleDragStart} = treeDraggableChart (
6762 state ,
@@ -118,7 +113,8 @@ const getTree = async () => {
118113 state .originResourceTree = []
119114 const params = {}
120115 dashboardApi .list (params ).then ((res : SQTreeNode []) => {
121- state .originResourceTree = res ?.data || []
116+ state .originResourceTree = res || []
117+ state .resourceTree = _ .cloneDeep (state .originResourceTree )
122118 afterTreeInit ()
123119 })
124120}
@@ -210,7 +206,7 @@ onMounted(() => {
210206// @ts-ignore
211207const addOperation = (params : any ) => {
212208 if (params .cmd === ' newLeaf' ) {
213- const newCanvasUrl = ' #/canvas?opt=create' + params . data ?.id ? ` &pid=${params . data ?.id } ` : ' '
209+ const newCanvasUrl = ' #/canvas?opt=create' + ( params ?.id ? ` &pid=${params ?.id } ` : ' ' )
214210 window .open (newCanvasUrl , ' _blank' )
215211 } else {
216212 // @ts-ignore
@@ -247,6 +243,7 @@ defineExpose({
247243 <el-icon
248244 class =" custom-icon btn"
249245 style =" margin-right : 10px "
246+ @click =" addOperation({cmd:'newLeaf',type:'dashboard'} )"
250247 >
251248 <Icon name =" dv-new-folder" >
252249 <icon _fileAdd_outlined class =" svg-icon" />
@@ -290,22 +287,26 @@ defineExpose({
290287 @node-drop =" handleDrop"
291288 draggable
292289 >
293- <template #default =" { data } " >
294- <span class =" custom-tree-node" :class = " { 'node-disabled-custom': data.extraFlag1 === 0 } " >
290+ <template #default =" { node , data } " >
291+ <span class =" custom-tree-node" >
295292 <el-icon style =" font-size : 18px " v-if =" !data.leaf" >
296- <Icon name =" dv-folder " ><Folder class =" svg-icon" /></Icon >
293+ <Icon name =" icon_folder " ><icon _folder class =" svg-icon" /></Icon >
297294 </el-icon >
298- <el-icon
299- class =" icon-screen-new color-dataV"
300- :class =" { 'color-dataV': data.extraFlag1, 'color-dataV-disabled': !data.extraFlag1 }"
301- style =" font-size : 18px "
302- v-else
303- >
304- <Icon name =" icon_operation-analysis_outlined"
305- ><icon _operationAnalysis_outlined class =" svg-icon"
306- /></Icon >
295+ <el-icon style =" font-size : 18px " v-else >
296+ <Icon name =" icon_dashboard" ><icon _dashboard class =" svg-icon" /></Icon >
307297 </el-icon >
298+ <span :title =" node.label" class =" label-tooltip" >
299+ {{ node.label }}
300+ </span >
308301 <div class =" icon-more" >
302+ <el-icon
303+ v-on:click.stop
304+ v-if =" !data.leaf"
305+ class =" hover-icon"
306+ @click =" addOperation({cmd:'newLeaf',type:'dashboard',id:data.id} )"
307+ >
308+ <Icon ><icon _add_outlined class =" svg-icon" /></Icon >
309+ </el-icon >
309310 <el-icon
310311 v-on:click.stop
311312 v-if =" data.leaf"
@@ -314,14 +315,14 @@ defineExpose({
314315 >
315316 <Icon ><icon _edit_outlined class =" svg-icon" /></Icon >
316317 </el-icon >
317- <HandleMore
318- @handle-command =" (cmd:string) => addOperation({cmd})
319- "
320- :menu-list =" resourceTypeList"
321- :icon-name =" icon_add_outlined"
322- placement =" bottom-start"
323- v-if =" !data.leaf"
324- ></HandleMore >
318+ <!-- <HandleMore-->
319+ <!-- @handle-command=" (cmd:string) => addOperation({cmd})-->
320+ <!-- "-->
321+ <!-- :menu-list="resourceTypeList"-->
322+ <!-- :icon-name="icon_add_outlined"-->
323+ <!-- placement="bottom-start"-->
324+ <!-- v-if="!data.leaf"-->
325+ <!-- ></HandleMore> -- >
325326 </div >
326327 </span >
327328 </template >
@@ -446,7 +447,7 @@ defineExpose({
446447 display : flex ;
447448 align-items : center ;
448449 box-sizing : content-box ;
449- padding-right : 4 px ;
450+ padding-right : 12 px ;
450451
451452 .label-tooltip {
452453 width : 100% ;
@@ -459,6 +460,7 @@ defineExpose({
459460 .icon-more {
460461 margin-left : auto ;
461462 display : none ;
463+ color : #bbbfc4 ;
462464 }
463465
464466 & :hover {
0 commit comments