@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
22import classnames from 'classnames' ;
33import i18n from '@/i18n' ;
44import { connect } from 'umi' ;
5- import { Input , Cascader , Button , Space , Dropdown , MenuProps } from 'antd' ;
5+ import { Input , Cascader , Dropdown , MenuProps } from 'antd' ;
66import Iconfont from '@/components/Iconfont' ;
77import LoadingContent from '@/components/Loading/LoadingContent' ;
88import { IConnectionModelType } from '@/models/connection' ;
@@ -15,7 +15,6 @@ import { useUpdateEffect } from '@/hooks/useUpdateEffect';
1515import { v4 as uuidV4 } from 'uuid' ;
1616import { ITreeNode } from '@/typings' ;
1717import styles from './index.less' ;
18- import { DownOutlined } from '@ant-design/icons' ;
1918import { ExportTypeEnum } from '@/typings/resultTable' ;
2019
2120interface IOption {
@@ -64,44 +63,95 @@ const TableList = dvaModel((props: any) => {
6463 const items : MenuProps [ 'items' ] = useMemo (
6564 ( ) => [
6665 {
67- label : i18n ( 'common.button.exportWord' ) ,
68- key : '1' ,
69- // icon: <UserOutlined />,
70- onClick : ( ) => {
71- handleExport ( ExportTypeEnum . WORD ) ;
72- } ,
73- } ,
74- {
75- label : i18n ( 'common.button.exportExcel' ) ,
76- key : '2' ,
77- // icon: <UserOutlined />,
78- onClick : ( ) => {
79- handleExport ( ExportTypeEnum . EXCEL ) ;
80- } ,
81- } ,
82- {
83- label : i18n ( 'common.button.exportHtml' ) ,
84- key : '3' ,
85- // icon: <UserOutlined />,
86- onClick : ( ) => {
87- handleExport ( ExportTypeEnum . HTML ) ;
88- } ,
89- } ,
90- {
91- label : i18n ( 'common.button.exportMarkdown' ) ,
92- key : '4' ,
93- // icon: <UserOutlined />,
66+ label : (
67+ < div className = { styles . operationItem } >
68+ < Iconfont className = { styles . operationIcon } code = "" />
69+ < div className = { styles . operationTitle } > { i18n ( 'editTable.button.createTable' ) } </ div >
70+ </ div >
71+ ) ,
72+ key : 'createTable' ,
9473 onClick : ( ) => {
95- handleExport ( ExportTypeEnum . MARKDOWN ) ;
74+ dispatch ( {
75+ type : 'workspace/setCreateConsoleIntro' ,
76+ payload : {
77+ id : uuidV4 ( ) ,
78+ type : WorkspaceTabType . EditTable ,
79+ title : 'create-table' ,
80+ uniqueData : { } ,
81+ } ,
82+ } ) ;
9683 } ,
9784 } ,
9885 {
99- label : i18n ( 'common.button.exportPdf' ) ,
100- key : '5' ,
101- // icon: <UserOutlined />,
102- onClick : ( ) => {
103- handleExport ( ExportTypeEnum . PDF ) ;
104- } ,
86+ label : (
87+ < div className = { styles . operationItem } >
88+ < Iconfont className = { styles . operationIcon } code = "" />
89+ < div className = { styles . operationTitle } > { i18n ( 'editTable.button.importTable' ) } </ div >
90+ </ div >
91+ ) ,
92+ key : 'importTable' ,
93+ children : [
94+ {
95+ label : (
96+ < div className = { styles . operationItem } >
97+ < Iconfont className = { styles . operationIcon } code = "" />
98+ < div className = { styles . operationTitle } > { i18n ( 'common.button.exportWord' ) } </ div >
99+ </ div >
100+ ) ,
101+ key : '1' ,
102+ onClick : ( ) => {
103+ handleExport ( ExportTypeEnum . WORD ) ;
104+ } ,
105+ } ,
106+ {
107+ label : (
108+ < div className = { styles . operationItem } >
109+ < Iconfont className = { styles . operationIcon } code = "" />
110+ < div className = { styles . operationTitle } > { i18n ( 'common.button.exportExcel' ) } </ div >
111+ </ div >
112+ ) ,
113+ key : '2' ,
114+ onClick : ( ) => {
115+ handleExport ( ExportTypeEnum . EXCEL ) ;
116+ } ,
117+ } ,
118+ {
119+ label : (
120+ < div className = { styles . operationItem } >
121+ < Iconfont className = { styles . operationIcon } code = "" />
122+ < div className = { styles . operationTitle } > { i18n ( 'common.button.exportHtml' ) } </ div >
123+ </ div >
124+ ) ,
125+ key : '3' ,
126+ onClick : ( ) => {
127+ handleExport ( ExportTypeEnum . HTML ) ;
128+ } ,
129+ } ,
130+ {
131+ label : (
132+ < div className = { styles . operationItem } >
133+ < Iconfont className = { styles . operationIcon } code = "" />
134+ < div className = { styles . operationTitle } > { i18n ( 'common.button.exportMarkdown' ) } </ div >
135+ </ div >
136+ ) ,
137+ key : '4' ,
138+ onClick : ( ) => {
139+ handleExport ( ExportTypeEnum . MARKDOWN ) ;
140+ } ,
141+ } ,
142+ {
143+ label : (
144+ < div className = { styles . operationItem } >
145+ < Iconfont className = { styles . operationIcon } code = "" />
146+ < div className = { styles . operationTitle } > { i18n ( 'common.button.exportPdf' ) } </ div >
147+ </ div >
148+ ) ,
149+ key : '5' ,
150+ onClick : ( ) => {
151+ handleExport ( ExportTypeEnum . PDF ) ;
152+ } ,
153+ } ,
154+ ] ,
105155 } ,
106156 ] ,
107157 [ curWorkspaceParams ] ,
@@ -175,25 +225,6 @@ const TableList = dvaModel((props: any) => {
175225 setCurType ( selectedOptions [ 0 ] ) ;
176226 }
177227
178- const cascaderOnChange : any = ( ) => {
179- dispatch ( {
180- type : 'workspace/setCreateConsoleIntro' ,
181- payload : {
182- id : uuidV4 ( ) ,
183- type : WorkspaceTabType . EditTable ,
184- title : 'create-table' ,
185- uniqueData : { } ,
186- } ,
187- } ) ;
188- } ;
189-
190- const options = [
191- {
192- value : 'createTable' ,
193- label : i18n ( 'editTable.button.createTable' ) ,
194- } ,
195- ] ;
196-
197228 return (
198229 < div className = { styles . tableModule } >
199230 < div className = { styles . leftModuleTitle } >
@@ -223,26 +254,18 @@ const TableList = dvaModel((props: any) => {
223254 </ div >
224255 </ Cascader >
225256 < div className = { styles . iconBox } >
226- < Dropdown menu = { { items } } >
227- < Button >
228- < Space >
229- { i18n ( 'common.text.export' ) }
230- < DownOutlined />
231- </ Space >
232- </ Button >
233- </ Dropdown >
234257 < div className = { classnames ( styles . refreshIcon , styles . itemIcon ) } onClick = { ( ) => refreshTableList ( ) } >
235258 < Iconfont code = "" />
236259 </ div >
237260 < div className = { classnames ( styles . searchIcon , styles . itemIcon ) } onClick = { ( ) => openSearch ( ) } >
238261 < Iconfont code = "" />
239262 </ div >
240263 { curType . value === TreeNodeType . TABLES && (
241- < Cascader options = { options } onChange = { cascaderOnChange } >
264+ < Dropdown menu = { { items } } >
242265 < div className = { classnames ( styles . moreIcon , styles . itemIcon ) } >
243266 < Iconfont code = "" />
244267 </ div >
245- </ Cascader >
268+ </ Dropdown >
246269 ) }
247270 </ div >
248271 </ div >
0 commit comments