bugfix
This commit is contained in:
@ -39,7 +39,7 @@ export function importTable(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: "/tool/gen/importTable",
|
url: "/tool/gen/importTable",
|
||||||
method: "post",
|
method: "post",
|
||||||
params: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,16 +26,18 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||||
>搜索</el-button
|
>搜索
|
||||||
>
|
</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-table
|
<el-table
|
||||||
|
class="db-table-list"
|
||||||
@row-click="clickRow"
|
@row-click="clickRow"
|
||||||
ref="table"
|
ref="table"
|
||||||
:data="dbTableList"
|
:data="dbTableList"
|
||||||
|
@select="handleSelect"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
height="260px"
|
height="260px"
|
||||||
>
|
>
|
||||||
@ -71,7 +73,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { listDbTable, importTable } from "@/api/tool/gen";
|
import { importTable, listDbTable } from "@/api/tool/gen";
|
||||||
|
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
@ -93,14 +95,40 @@ function show() {
|
|||||||
getList();
|
getList();
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 单击选择行 */
|
/** 单击选择行 */
|
||||||
function clickRow(row) {
|
function clickRow(row, _, event) {
|
||||||
proxy.$refs.table.toggleRowSelection(row);
|
const rowIndex = dbTableList.value.findIndex(
|
||||||
|
(el) => el.tableName === row.tableName
|
||||||
|
);
|
||||||
|
document
|
||||||
|
.querySelector(
|
||||||
|
`.db-table-list .el-table__body tbody > .el-table__row:nth-child(${
|
||||||
|
rowIndex + 1
|
||||||
|
}) .el-table-column--selection .el-checkbox`
|
||||||
|
)
|
||||||
|
.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {}
|
||||||
tables.value = selection.map((item) => item.tableName);
|
|
||||||
}
|
const handleSelect = (selection, row) => {
|
||||||
|
const isCheck =
|
||||||
|
selection.findIndex((el) => el.tableName === row.tableName) >
|
||||||
|
-1; /* 是否将行切换为选中状态 */
|
||||||
|
if (isCheck) {
|
||||||
|
selection.forEach((el) => {
|
||||||
|
if (el.tableName !== row.tableName) {
|
||||||
|
proxy.$refs.table.toggleRowSelection(el, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tables.value = [row];
|
||||||
|
} else {
|
||||||
|
tables.value = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/** 查询表数据 */
|
/** 查询表数据 */
|
||||||
function getList() {
|
function getList() {
|
||||||
listDbTable(queryParams).then((res) => {
|
listDbTable(queryParams).then((res) => {
|
||||||
@ -108,24 +136,30 @@ function getList() {
|
|||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.pageNum = 1;
|
queryParams.pageNum = 1;
|
||||||
getList();
|
getList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
proxy.resetForm("queryRef");
|
proxy.resetForm("queryRef");
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
function handleImportTable() {
|
function handleImportTable() {
|
||||||
const tableNames = tables.value.join(",");
|
if (tables.value.length === 0) {
|
||||||
if (tableNames == "") {
|
|
||||||
proxy.$modal.msgError("请选择要导入的表");
|
proxy.$modal.msgError("请选择要导入的表");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
importTable({ tables: tableNames }).then((res) => {
|
const tableObj = tables.value[0];
|
||||||
|
importTable({
|
||||||
|
tableName: tableObj.tableName,
|
||||||
|
tableComment: tableObj.tableComment,
|
||||||
|
}).then((res) => {
|
||||||
proxy.$modal.msgSuccess(res.msg);
|
proxy.$modal.msgSuccess(res.msg);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
@ -138,3 +172,23 @@ defineExpose({
|
|||||||
show,
|
show,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.db-table-list) {
|
||||||
|
.el-table__header {
|
||||||
|
.el-checkbox {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table__body {
|
||||||
|
.el-table__row {
|
||||||
|
.el-table__cell:first-child {
|
||||||
|
.el-checkbox__inner {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Reference in New Issue
Block a user