mirror of
https://github.com/yangzongzhuan/RuoYi-Vue3.git
synced 2025-09-28 07:12:41 +00:00
代码生成新增创建表结构功能
This commit is contained in:
46
src/views/tool/gen/createTable.vue
Normal file
46
src/views/tool/gen/createTable.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<!-- 创建表 -->
|
||||
<el-dialog title="创建表" v-model="visible" width="800px" top="5vh" append-to-body>
|
||||
<span>创建表语句(支持多个建表语句):</span>
|
||||
<el-input type="textarea" :rows="10" placeholder="请输入文本" v-model="content"></el-input>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { createTable } from "@/api/tool/gen";
|
||||
|
||||
const visible = ref(false);
|
||||
const content = ref("");
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emit = defineEmits(["ok"]);
|
||||
|
||||
/** 显示弹框 */
|
||||
function show() {
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImportTable() {
|
||||
if (content.value === "") {
|
||||
proxy.$modal.msgError("请输入建表语句");
|
||||
return;
|
||||
}
|
||||
createTable({ sql: content.value }).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
if (res.code === 200) {
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user