修复代码生成模块
parent
db42b4c2fb
commit
7e5b6a7925
|
@ -69,9 +69,17 @@ export function genCode(tableName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步数据库
|
// 同步数据库
|
||||||
export function synchDb(tableName) {
|
export function synchDb(tableName,dbName) {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen/synchDb/' + tableName,
|
url: '/code/gen/synchDb/' + tableName+'/'+dbName,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询所有数据库名称
|
||||||
|
export function selDbNameAll(tableName) {
|
||||||
|
return request({
|
||||||
|
url: '/code/gen/selDbNameAll',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
<!-- 导入表 -->
|
<!-- 导入表 -->
|
||||||
<el-dialog :visible.sync="visible" append-to-body title="导入表" top="5vh" width="800px">
|
<el-dialog :visible.sync="visible" append-to-body title="导入表" top="5vh" width="800px">
|
||||||
<el-form ref="queryForm" :inline="true" :model="queryParams" size="small">
|
<el-form ref="queryForm" :inline="true" :model="queryParams" size="small">
|
||||||
|
<el-form-item label="数据库名称" prop="dbName">
|
||||||
|
<el-select v-model="queryParams.dbName" placeholder="请选择数据库" clearable>
|
||||||
|
<el-option v-for="item in dbs" :key="item" :label="item" :value="item"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="表名称" prop="tableName">
|
<el-form-item label="表名称" prop="tableName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.tableName"
|
v-model="queryParams.tableName"
|
||||||
|
@ -49,6 +54,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {importTable, listDbTable} from "@/api/tool/gen";
|
import {importTable, listDbTable} from "@/api/tool/gen";
|
||||||
|
import {selDbNameAll} from "../../../api/tool/gen";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -74,6 +80,7 @@ export default {
|
||||||
// 显示弹框
|
// 显示弹框
|
||||||
show() {
|
show() {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.selDbNameList();
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
},
|
},
|
||||||
clickRow(row) {
|
clickRow(row) {
|
||||||
|
@ -107,11 +114,18 @@ export default {
|
||||||
this.$modal.msgError("请选择要导入的表");
|
this.$modal.msgError("请选择要导入的表");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const dbName = this.queryParams.dbName;
|
||||||
importTable({tables: tableNames}).then(res => {
|
importTable({tables: tableNames}).then(res => {
|
||||||
this.$modal.msgSuccess(res.data.msg);
|
this.$modal.msgSuccess(res.data.msg);
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit("ok");
|
this.$emit("ok");
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
// 查询所有数据库名称
|
||||||
|
selDbNameList() {
|
||||||
|
selDbNameAll().then(res => {
|
||||||
|
this.dbs = res.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -91,6 +91,13 @@
|
||||||
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="数据库名称"
|
||||||
|
align="center"
|
||||||
|
prop="dbName"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
width="120"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:show-overflow-tooltip="true"
|
:show-overflow-tooltip="true"
|
||||||
align="center"
|
align="center"
|
||||||
|
@ -286,8 +293,9 @@ export default {
|
||||||
/** 同步数据库操作 */
|
/** 同步数据库操作 */
|
||||||
handleSynchDb(row) {
|
handleSynchDb(row) {
|
||||||
const tableName = row.tableName;
|
const tableName = row.tableName;
|
||||||
|
const dbName = row.dbName;
|
||||||
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function () {
|
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function () {
|
||||||
return synchDb(tableName);
|
return synchDb(tableName, dbName);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$modal.msgSuccess("同步成功");
|
this.$modal.msgSuccess("同步成功");
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
Loading…
Reference in New Issue