Skip to content

Commit 483f255

Browse files
author
zhaoqiangqiang
committed
小功能修复
1 parent cccf7f9 commit 483f255

File tree

2 files changed

+56
-43
lines changed

2 files changed

+56
-43
lines changed

Gui/HiDb.Vue/build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "http://127.0.0.1"
88
}
99
],
10-
"productName": "hidb",
10+
"productName": "HiDb",
1111
"appId": "conchsoft.magicalconch.hidb",
1212
"directories": {
1313
"output": "build"

Gui/HiDb.Vue/src/renderer/components/MainPage.vue

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -96,46 +96,44 @@
9696
</div>
9797
</a-spin>
9898
</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">
104103
<a-button @click="searchData"
105104
:icon="h(CaretRightOutlined)" style="margin-right: 6px;">执行</a-button>
106105
</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>
109108
</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 }" />
110116
</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>
137135
</div>
138-
</a-spin>
136+
</div>
139137
</div>
140138
</div>
141139
<a-modal v-model:open="openDbListDialog" title="数据库列表" width="680px" height="550px">
@@ -316,6 +314,7 @@ import { life } from '../api/life';
316314
}
317315
}
318316
const menuWidth = ref(350); // 菜单宽度
317+
const bodyWidth = ref('calc(100% - 350px)'); // 内容宽度
319318
const refreshKey1 = ref<number>(0);
320319
const refreshKey2 = ref<number>(0);
321320
const mouseEventX = ref<number>(0);
@@ -326,7 +325,9 @@ import { life } from '../api/life';
326325
return false;
327326
};
328327
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)';
330331
refreshKey1.value = refreshKey1.value + 1;
331332
refreshKey2.value = refreshKey1.value + 1;
332333
};
@@ -729,6 +730,9 @@ import { life } from '../api/life';
729730
currdbData.value = data ? JSON.parse(data) : [];
730731
dbloading.value = false;
731732
}
733+
const clearData = ()=> {
734+
optValue.value = ''
735+
}
732736
733737
// 表格主查询
734738
const searchData = () => {
@@ -884,15 +888,22 @@ import { life } from '../api/life';
884888
.drap-line {
885889
height: 100%;
886890
width: 5px;
887-
background-color: #d0cece;
888-
border-radius: 6px;
891+
background-color: #f5f5f5;
889892
cursor: col-resize;
890893
z-index: 999;
891894
}
895+
.drap-line-left {
896+
border-left: #979797 2px solid;
897+
}
898+
.drap-line-right {
899+
border-right: #979797 2px solid;
900+
}
892901
.work {
893-
height: calc(100vh - 80px);
894-
padding: 0 0 8px 8px;
902+
height: calc(100vh - 50px);
903+
padding: 0;
895904
flex: 1;
905+
display: flex;
906+
flex-direction: column;
896907
897908
.tools {
898909
width: 100%;
@@ -905,7 +916,7 @@ import { life } from '../api/life';
905916
}
906917
.context {
907918
width: 100%;
908-
height: 100%;
919+
height: calc(100% - 40px);
909920
display: flex;
910921
flex-direction: column;
911922
padding: 0;
@@ -917,6 +928,7 @@ import { life } from '../api/life';
917928
.sql {
918929
width: 100%;
919930
min-height: 105px;
931+
920932
.input {
921933
height: calc(100% - 8px);
922934
margin: 4px;
@@ -925,11 +937,13 @@ import { life } from '../api/life';
925937
}
926938
.data {
927939
width: 100%;
928-
height: 100%;
940+
flex : 1;
929941
930942
.table {
931943
width: 100%;
932944
height: calc(100% - 30px);
945+
padding: 0;
946+
margin: 0;
933947
}
934948
.table-line {
935949
width: 100%;
@@ -942,7 +956,6 @@ import { life } from '../api/life';
942956
align-items: center;
943957
justify-content: flex-start;
944958
background-color: #f5f5f5;
945-
border-radius: 8px;
946959
}
947960
948961
.msg {

0 commit comments

Comments
 (0)