1
0
forked from ruoyi/RuoYi-Vue
Files
RuoYi-Vue/ruoyi-ui/src/views/tool/gen/createTable.vue

46 lines
1.1 KiB
Vue
Raw Normal View History

<template>
<!-- 创建表 -->
<el-dialog title="创建表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<span>创建表语句(支持多个建表语句)</span>
<el-input type="textarea" :rows="10" placeholder="请输入文本" v-model="content"></el-input>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleCreateTable"> </el-button>
<el-button @click="visible = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
2025-04-27 10:05:55 +08:00
import { createTable } from "@/api/tool/gen"
export default {
data() {
return {
// 遮罩层
visible: false,
// 文本内容
content: ""
2025-04-27 10:05:55 +08:00
}
},
methods: {
// 显示弹框
show() {
2025-04-27 10:05:55 +08:00
this.visible = true
},
/** 创建按钮操作 */
handleCreateTable() {
if (this.content === "") {
2025-04-27 10:05:55 +08:00
this.$modal.msgError("请输入建表语句")
return
}
createTable({ sql: this.content }).then(res => {
2025-04-27 10:05:55 +08:00
this.$modal.msgSuccess(res.msg)
if (res.code === 200) {
2025-04-27 10:05:55 +08:00
this.visible = false
this.$emit("ok")
}
2025-04-27 10:05:55 +08:00
})
}
}
2025-04-27 10:05:55 +08:00
}
</script>