From 89e1f2a53fbf99d8a48b7d12a41a862700a30015 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sun, 13 Dec 2020 15:01:03 +0800
Subject: [PATCH] 修改Set可能导致嵌套的问题
---
ruoyi-ui/src/views/tool/gen/index.vue | 54 ++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue
index 0c159a0..20170e3 100644
--- a/ruoyi-ui/src/views/tool/gen/index.vue
+++ b/ruoyi-ui/src/views/tool/gen/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="表名称" prop="tableName">
<el-input
v-model="queryParams.tableName"
@@ -32,7 +32,7 @@
></el-date-picker>
</el-form-item>
<el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+ <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
@@ -76,11 +76,16 @@
v-hasPermi="['tool:gen:remove']"
>删除</el-button>
</el-col>
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
- <el-table-column label="序号" align="center" prop="tableId" width="50px" />
+ <el-table-column label="序号" type="index" width="50" align="center">
+ <template slot-scope="scope">
+ <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
+ </template>
+ </el-table-column>
<el-table-column
label="表名称"
align="center"
@@ -130,6 +135,13 @@
<el-button
type="text"
size="small"
+ icon="el-icon-refresh"
+ @click="handleSynchDb(scope.row)"
+ v-hasPermi="['tool:gen:edit']"
+ >同步</el-button>
+ <el-button
+ type="text"
+ size="small"
icon="el-icon-download"
@click="handleGenTable(scope.row)"
v-hasPermi="['tool:gen:code']"
@@ -145,15 +157,15 @@
@pagination="getList"
/>
<!-- 预览界面 -->
- <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh">
+ <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
<el-tabs v-model="preview.activeName">
- <el-tab-pane
+ <el-tab-pane style="overflow-x: scroll;"
v-for="(value, key) in preview.data"
:label="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:key="key"
>
- <pre>{{ value }}</pre>
+ <highlightjs autodetect :code="value" />
</el-tab-pane>
</el-tabs>
</el-dialog>
@@ -162,9 +174,10 @@
</template>
<script>
-import { listTable, previewTable, delTable } from "@/api/tool/gen";
+import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
import importTable from "./importTable";
import { downLoadZip } from "@/utils/zipdownload";
+
export default {
name: "Gen",
components: { importTable },
@@ -182,6 +195,8 @@
single: true,
// 非多个禁用
multiple: true,
+ // 显示搜索条件
+ showSearch: true,
// 总条数
total: 0,
// 表数据
@@ -237,7 +252,26 @@
this.msgError("请选择要生成的数据");
return;
}
- downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
+ if(row.genType === "1") {
+ genCode(row.tableName).then(response => {
+ this.msgSuccess("成功生成到自定义路径:" + row.genPath);
+ });
+ } else {
+ downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
+ }
+ },
+ /** 同步数据库操作 */
+ handleSynchDb(row) {
+ const tableName = row.tableName;
+ this.$confirm('确认要强制同步"' + tableName + '"表结构吗?', "警告", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ }).then(function() {
+ return synchDb(tableName);
+ }).then(() => {
+ this.msgSuccess("同步成功");
+ })
},
/** 打开导入表弹窗 */
openImportTable() {
@@ -266,7 +300,7 @@
/** 修改按钮操作 */
handleEditTable(row) {
const tableId = row.tableId || this.ids[0];
- this.$router.push({ path: "/gen/edit", query: { tableId: tableId } });
+ this.$router.push("/gen/edit/" + tableId);
},
/** 删除按钮操作 */
handleDelete(row) {
@@ -280,7 +314,7 @@
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
- }).catch(function() {});
+ })
}
}
};
--
Gitblit v1.9.2