中国算力平台算力登记系统2.0
yanzhaofeige
2024-09-30 3c4fee1db116c11d4f04727cfe076d7c94daeaf2
commit | author | age
43dc29 1 <template>
Y 2   <!-- 创建表 -->
3   <el-dialog title="创建表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
4     <span>创建表语句(支持多个建表语句):</span>
5     <el-input type="textarea" :rows="10" placeholder="请输入文本" v-model="content"></el-input>
6     <div slot="footer" class="dialog-footer">
7       <el-button type="primary" @click="handleCreateTable">确 定</el-button>
8       <el-button @click="visible = false">取 消</el-button>
9     </div>
10   </el-dialog>
11 </template>
12
13 <script>
14 import { createTable } from "@/api/tool/gen";
15 export default {
16   data() {
17     return {
18       // 遮罩层
19       visible: false,
20       // 文本内容
21       content: ""
22     };
23   },
24   methods: {
25     // 显示弹框
26     show() {
27       this.visible = true;
28     },
29     /** 创建按钮操作 */
30     handleCreateTable() {
31       if (this.content === "") {
32         this.$modal.msgError("请输入建表语句");
33         return;
34       }
35       createTable({ sql: this.content }).then(res => {
36         this.$modal.msgSuccess(res.msg);
37         if (res.code === 200) {
38           this.visible = false;
39           this.$emit("ok");
40         }
41       });
42     }
43   }
44 };
45 </script>