Skip to content

Commit 2691361

Browse files
committed
style
1 parent 2fd6fcf commit 2691361

8 files changed

Lines changed: 42 additions & 11 deletions

File tree

chat2db-client/src/components/SearchResult/TableBox/index.less

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@
1313
.hGEOgo {
1414
--header-bgcolor: #fafafa;
1515
--header-color: #000;
16+
table colgroup col {
17+
min-width: 120px;
18+
}
19+
table colgroup col:nth-of-type(1) {
20+
min-width: 60px;
21+
}
22+
.fnWppk {
23+
// word-break: break-all;
24+
// display: -webkit-box;
25+
// -webkit-box-orient: vertical;
26+
// box-orient: vertical;
27+
// -webkit-line-clamp: 1;
28+
// line-clamp: 1;
29+
// text-overflow: ellipsis;
30+
overflow: hidden;
31+
}
1632
th {
1733
font-weight: bold;
1834
}

chat2db-client/src/components/SearchResult/TableBox/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ export default function TableBox(props: ITableProps) {
384384
// onChangeSorts,
385385
}),
386386
);
387+
// .use(
388+
// features.columnResize({
389+
// fallbackSize: 120,
390+
// minSize: 60,
391+
// maxSize: 1080,
392+
// }),
393+
// );
387394

388395
const onPageNoChange = (pageNo: number) => {
389396
const config = { ...paginationConfig, pageNo };

chat2db-client/src/pages/main/workspace/components/TableList/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ const TableList = dvaModel((props: any) => {
255255
// 表的处理
256256
console.log(curType);
257257
if (curType.value === TreeNodeType.TABLES) {
258-
setCurList(res.data);
258+
setCurList(approximateTreeNode(res.data, inputRef.current?.input.value));
259259
setPagingData({
260260
...pagingData,
261261
total: res.total,
@@ -265,7 +265,7 @@ const TableList = dvaModel((props: any) => {
265265
payload: res.data,
266266
});
267267
} else {
268-
setCurList(res);
268+
setCurList(approximateTreeNode(res, inputRef.current?.input.value));
269269
}
270270
setTableLoading(false);
271271
})
@@ -380,7 +380,7 @@ const TableList = dvaModel((props: any) => {
380380
<LoadingContent className={styles.treeBox} isLoading={tableLoading}>
381381
<Tree className={styles.tree} initialData={searchedTableList || curList} />
382382
</LoadingContent>
383-
{pagingData?.total > 100 && (
383+
{pagingData?.total > 100 && !searchKey && (
384384
<div className={styles.paging}>
385385
<div className={styles.paginationBox}>
386386
<Pagination

chat2db-client/src/pages/main/workspace/components/Tree/TreeNodeRightClick/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,12 @@ function TreeNodeRightClick(props: IProps) {
176176
}
177177

178178
function refresh() {
179-
data.children = [];
179+
// data.children = [];
180180
setIsLoading(true);
181181
getChildren?.({
182182
...data,
183183
...data.extraParams,
184+
refresh: true,
184185
}).then((res) => {
185186
data.children = res;
186187
setIsLoading(false);

chat2db-client/src/pages/main/workspace/components/Tree/index.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
display: none;
6868
}
6969

70+
.loadingArrows {
71+
display: flex;
72+
}
73+
7074
.arrowsIcon {
7175
display: inline-block;
7276
transform: rotate(-90deg);

chat2db-client/src/pages/main/workspace/components/Tree/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,15 @@ const TreeNode = (props: TreeNodeIProps) => {
181181
<div className={classnames(styles.treeNode, { [styles.hiddenTreeNode]: !show })}>
182182
<div className={styles.left}>
183183
{indentArr.map((item, i) => {
184-
return <div key={i} className={styles.indent}></div>;
184+
return <div key={i} className={styles.indent} />;
185185
})}
186186
</div>
187187
<div className={styles.right}>
188188
{!data.isLeaf && (
189-
<div onClick={handleClick.bind(null, data)} className={styles.arrows}>
189+
<div
190+
onClick={handleClick.bind(null, data)}
191+
className={classnames(styles.arrows, { [styles.loadingArrows]: isLoading })}
192+
>
190193
{isLoading ? (
191194
<div className={styles.loadingIcon}>
192195
<Iconfont code="&#xe6cd;" />

chat2db-client/src/service/sql.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ const updateTableExample = createRequest<{ dbType: DatabaseTypeCode }, string>('
111111
const exportCreateTableSql = createRequest<ITableParams, string>('/api/rdb/ddl/export', { method: 'get' });
112112
const executeTable = createRequest<IExecuteTableParams, string>('/api/rdb/ddl/execute', { method: 'post' });
113113

114-
const getColumnList = createRequest<ITableParams, IColumn[]>('/api/rdb/ddl/column_list', { method: 'get' });
115-
const getIndexList = createRequest<ITableParams, IColumn[]>('/api/rdb/ddl/index_list', { method: 'get' });
116-
const getKeyList = createRequest<ITableParams, IColumn[]>('/api/rdb/ddl/key_list', { method: 'get' });
117-
const getSchemaList = createRequest<ISchemaParams, ISchemaResponse[]>('/api/rdb/ddl/schema_list', { method: 'get' });
114+
const getColumnList = createRequest<ITableParams, IColumn[]>('/api/rdb/ddl/column_list', { method: 'get', delayTime: 200 });
115+
const getIndexList = createRequest<ITableParams, IColumn[]>('/api/rdb/ddl/index_list', { method: 'get', delayTime: 200 });
116+
const getKeyList = createRequest<ITableParams, IColumn[]>('/api/rdb/ddl/key_list', { method: 'get', delayTime: 200 });
117+
const getSchemaList = createRequest<ISchemaParams, ISchemaResponse[]>('/api/rdb/ddl/schema_list', { method: 'get', delayTime: 200 });
118118

119119
const getDatabaseSchemaList = createRequest<{ dataSourceId: number }, MetaSchemaVO>(
120120
'/api/rdb/ddl/database_schema_list',

chat2db-client/src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function deepClone(target: any) {
7575
}
7676

7777
// 模糊匹配树并且高亮
78-
export function approximateTreeNode(treeData: ITreeNode[], target: string, isDelete = true) {
78+
export function approximateTreeNode(treeData: ITreeNode[], target: string = '', isDelete = true) {
7979
if (target) {
8080
const newTree: ITreeNode[] = lodash.cloneDeep(treeData || []);
8181
newTree.map((item, index) => {

0 commit comments

Comments
 (0)