@@ -10,10 +10,11 @@ import { IWorkspaceModelType } from '@/models/workspace';
1010import Tree from '../Tree' ;
1111import { treeConfig } from '../Tree/treeConfig' ;
1212import { ITreeNode } from '@/typings' ;
13- import { TreeNodeType } from '@/constants' ;
13+ import { TreeNodeType , CreateTabIntroType , WorkspaceTabType } from '@/constants' ;
1414import styles from './index.less' ;
1515import { approximateTreeNode } from '@/utils' ;
1616import { useUpdateEffect } from '@/hooks/useUpdateEffect' ;
17+ import { v4 as uuidV4 } from 'uuid' ;
1718
1819interface IOption {
1920 value : TreeNodeType ;
@@ -32,12 +33,18 @@ const optionsList: IOption[] = [
3233]
3334
3435const dvaModel = connect (
35- ( { connection, workspace, loading } : { connection : IConnectionModelType ; workspace : IWorkspaceModelType , loading : any } ) => ( {
36+ ( { connection, workspace } : { connection : IConnectionModelType ; workspace : IWorkspaceModelType } ) => ( {
3637 connectionModel : connection ,
3738 workspaceModel : workspace ,
3839 } ) ,
3940) ;
4041
42+ interface Option {
43+ value : string ;
44+ label : string ;
45+ children ?: Option [ ] ;
46+ }
47+
4148const TableList = dvaModel ( function ( props : any ) {
4249 const { workspaceModel, dispatch } = props ;
4350 const { curWorkspaceParams } = workspaceModel ;
@@ -113,6 +120,27 @@ const TableList = dvaModel(function (props: any) {
113120 setCurType ( selectedOptions [ 0 ] ) ;
114121 }
115122
123+ const cascaderOnChange : any = ( _ : string [ ] , selectedOptions : Option [ ] ) => {
124+ dispatch ( {
125+ type : 'workspace/setCreateConsoleIntro' ,
126+ payload : {
127+ id : uuidV4 ( ) ,
128+ type : WorkspaceTabType . EditTable ,
129+ title : 'create-table' ,
130+ uniqueData : {
131+
132+ }
133+ } ,
134+ } )
135+ } ;
136+
137+ const options = [
138+ {
139+ value : 'createTable' ,
140+ label : '新建表' ,
141+ }
142+ ]
143+
116144 return (
117145 < div className = { styles . tableModule } >
118146 < div className = { styles . leftModuleTitle } >
@@ -143,20 +171,28 @@ const TableList = dvaModel(function (props: any) {
143171 </ div >
144172 </ Cascader >
145173 < div className = { styles . iconBox } >
146- < div className = { styles . refreshIcon } onClick = { ( ) => refreshTableList ( ) } >
174+ < div className = { classnames ( styles . refreshIcon , styles . itemIcon ) } onClick = { ( ) => refreshTableList ( ) } >
147175 < Iconfont code = "" />
148176 </ div >
149- < div className = { styles . searchIcon } onClick = { ( ) => openSearch ( ) } >
177+ < div className = { classnames ( styles . searchIcon , styles . itemIcon ) } onClick = { ( ) => openSearch ( ) } >
150178 < Iconfont code = "" />
151179 </ div >
180+ {
181+ curType . value === TreeNodeType . TABLES &&
182+ < Cascader options = { options } onChange = { cascaderOnChange } >
183+ < div className = { classnames ( styles . moreIcon , styles . itemIcon ) } >
184+ < Iconfont code = "" />
185+ </ div >
186+ </ Cascader >
187+ }
152188 </ div >
153189 </ div >
154190 }
155191 </ div >
156192 < LoadingContent className = { styles . treeBox } isLoading = { tableLoading } >
157193 < Tree className = { styles . tree } initialData = { searchedTableList || curList } > </ Tree >
158194 </ LoadingContent >
159- </ div >
195+ </ div >
160196 ) ;
161197} ) ;
162198
0 commit comments