| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |