96
96
</div >
97
97
</a-spin >
98
98
</div >
99
- <div class =" drap-line" @mousedown =" leftResize" ></div >
100
- <div class =" work" :key =" refreshKey2" :style =" { 'width': 'calc(100% - '+ (menuWidth + 20) + ')px' }" >
101
- <a-spin :spinning =" currloading" >
102
- <div class =" tools" >
103
- <a-tooltip title =" 执行" >
99
+ <div :class =" menuWidth <= 350 ? 'drap-line drap-line-left' : menuWidth >= 850 ? 'drap-line drap-line-right': 'drap-line'" @mousedown =" leftResize" ></div >
100
+ <div class =" work" :key =" refreshKey2" :style =" { 'width': bodyWidth }" >
101
+ <div class =" tools" >
102
+ <a-tooltip title =" 执行SQL区域内的SQL" >
104
103
<a-button @click =" searchData"
105
104
:icon =" h(CaretRightOutlined)" style =" margin-right : 6px ;" >执行</a-button >
106
105
</a-tooltip >
107
- <a-tooltip title =" 撤销 " >
108
- <a-button :icon =" h(RedoOutlined)" >撤销 </a-button >
106
+ <a-tooltip title =" 清空SQL区域内容 " >
107
+ <a-button @click = " clearData " :icon =" h(RedoOutlined)" >清空 </a-button >
109
108
</a-tooltip >
109
+ </div >
110
+ <div class =" context" >
111
+ <div class =" sql" >
112
+ <a-textarea class =" input" ref =" textarea"
113
+ v-model:value =" optValue" @click =" handleClick"
114
+ placeholder =" 输入SQL语句后执行"
115
+ :auto-size =" { minRows: 4, maxRows: 15 }" />
110
116
</div >
111
- <div class =" context" >
112
- <div class =" sql" >
113
- <a-textarea class =" input" ref =" textarea"
114
- v-model:value =" optValue" @click =" handleClick"
115
- placeholder =" 输入SQL语句后执行"
116
- :auto-size =" { minRows: 4, maxRows: 15 }" />
117
- </div >
118
- <div class =" data" >
119
- <a-table class =" table"
120
- v-if =" isQuery"
121
- :columns =" columns"
122
- size =" small"
123
- :data-source =" currData"
124
- :scroll =" { y: pageHeight }"
125
- :loading =" loading"
126
- :pagination =" false"
127
- >
128
- <template #headerCell =" { column } " />
129
- </a-table >
130
- <div class =" msg" v-if =" !isQuery" >
131
- 影响行数: {{executeNum}}
132
- </div >
133
- <div v-if =" isQuery && pagination.total" class =" table-line" >
134
- 总记录行数:{{ pagination.total }} | 当前查询页大小:{{ pagination.pageSize }}
135
- </div >
136
- </div >
117
+ <div class =" data" >
118
+ <a-table class =" table"
119
+ v-if =" isQuery"
120
+ :columns =" columns"
121
+ size =" small"
122
+ :data-source =" currData"
123
+ :scroll =" { y: pageHeight, x: '(100% - ' + (menuWidth + 30) + ')'}"
124
+ :loading =" loading"
125
+ :pagination =" false"
126
+ >
127
+ <template #headerCell =" { column } " />
128
+ </a-table >
129
+ <div class =" msg" v-if =" !isQuery" >
130
+ 影响行数: {{executeNum}}
131
+ </div >
132
+ <div v-if =" isQuery && pagination.total" class =" table-line" >
133
+ 总记录行数:{{ pagination.total }} | 当前查询页大小:{{ pagination.pageSize }}
134
+ </div >
137
135
</div >
138
- </a-spin >
136
+ </div >
139
137
</div >
140
138
</div >
141
139
<a-modal v-model:open =" openDbListDialog" title =" 数据库列表" width =" 680px" height =" 550px" >
@@ -316,6 +314,7 @@ import { life } from '../api/life';
316
314
}
317
315
}
318
316
const menuWidth = ref (350 ); // 菜单宽度
317
+ const bodyWidth = ref (' calc(100% - 350px)' ); // 内容宽度
319
318
const refreshKey1 = ref <number >(0 );
320
319
const refreshKey2 = ref <number >(0 );
321
320
const mouseEventX = ref <number >(0 );
@@ -326,7 +325,9 @@ import { life } from '../api/life';
326
325
return false ;
327
326
};
328
327
const changeWidth = (documentE : MouseEvent ) => {
329
- menuWidth .value = documentE .clientX ;
328
+ let width = documentE .clientX < 350 ? 350 : documentE .clientX > 850 ? 850 : documentE .clientX ;
329
+ menuWidth .value = width ;
330
+ bodyWidth .value = ' calc(100% - ' + menuWidth .value + ' px)' ;
330
331
refreshKey1 .value = refreshKey1 .value + 1 ;
331
332
refreshKey2 .value = refreshKey1 .value + 1 ;
332
333
};
@@ -729,6 +730,9 @@ import { life } from '../api/life';
729
730
currdbData .value = data ? JSON .parse (data ) : [];
730
731
dbloading .value = false ;
731
732
}
733
+ const clearData = ()=> {
734
+ optValue .value = ' '
735
+ }
732
736
733
737
// 表格主查询
734
738
const searchData = () => {
@@ -884,15 +888,22 @@ import { life } from '../api/life';
884
888
.drap-line {
885
889
height : 100% ;
886
890
width : 5px ;
887
- background-color : #d0cece ;
888
- border-radius : 6px ;
891
+ background-color : #f5f5f5 ;
889
892
cursor : col-resize ;
890
893
z-index : 999 ;
891
894
}
895
+ .drap-line-left {
896
+ border-left : #979797 2px solid ;
897
+ }
898
+ .drap-line-right {
899
+ border-right : #979797 2px solid ;
900
+ }
892
901
.work {
893
- height : calc (100vh - 80 px );
894
- padding : 0 0 8 px 8 px ;
902
+ height : calc (100vh - 50 px );
903
+ padding : 0 ;
895
904
flex : 1 ;
905
+ display : flex ;
906
+ flex-direction : column ;
896
907
897
908
.tools {
898
909
width : 100% ;
@@ -905,7 +916,7 @@ import { life } from '../api/life';
905
916
}
906
917
.context {
907
918
width : 100% ;
908
- height : 100% ;
919
+ height : calc ( 100% - 40 px ) ;
909
920
display : flex ;
910
921
flex-direction : column ;
911
922
padding : 0 ;
@@ -917,6 +928,7 @@ import { life } from '../api/life';
917
928
.sql {
918
929
width : 100% ;
919
930
min-height : 105px ;
931
+
920
932
.input {
921
933
height : calc (100% - 8px );
922
934
margin : 4px ;
@@ -925,11 +937,13 @@ import { life } from '../api/life';
925
937
}
926
938
.data {
927
939
width : 100% ;
928
- height : 100 % ;
940
+ flex : 1 ;
929
941
930
942
.table {
931
943
width : 100% ;
932
944
height : calc (100% - 30px );
945
+ padding : 0 ;
946
+ margin : 0 ;
933
947
}
934
948
.table-line {
935
949
width : 100% ;
@@ -942,7 +956,6 @@ import { life } from '../api/life';
942
956
align-items : center ;
943
957
justify-content : flex-start ;
944
958
background-color : #f5f5f5 ;
945
- border-radius : 8px ;
946
959
}
947
960
948
961
.msg {
0 commit comments