Files
RuoYi-Vue3/src/views/tool/gen/createTable.vue
2025-04-27 09:58:29 +08:00

47 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>