From a9c6ba12e6f96fe316927324f2a038b61bc3a2bc Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期五, 25 十二月 2020 09:35:20 +0800 Subject: [PATCH] 代码生成日期控件区分范围 --- ruoyi-ui/src/views/tool/gen/index.vue | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 39 insertions(+), 9 deletions(-) diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index a819f51..a9145f8 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,6 +76,7 @@ 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"> @@ -90,21 +91,21 @@ align="center" prop="tableName" :show-overflow-tooltip="true" - width="130" + width="120" /> <el-table-column label="表描述" align="center" prop="tableComment" :show-overflow-tooltip="true" - width="130" + width="120" /> <el-table-column label="实体" align="center" prop="className" :show-overflow-tooltip="true" - width="130" + width="120" /> <el-table-column label="创建时间" align="center" prop="createTime" width="160" /> <el-table-column label="更新时间" align="center" prop="updateTime" width="160" /> @@ -134,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']" @@ -157,7 +165,7 @@ :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> @@ -166,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 }, @@ -186,6 +195,8 @@ single: true, // 非多个禁用 multiple: true, + // 显示搜索条件 + showSearch: true, // 总条数 total: 0, // 表数据 @@ -241,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() { @@ -284,7 +314,7 @@ }).then(() => { this.getList(); this.msgSuccess("删除成功"); - }).catch(function() {}); + }) } } }; -- Gitblit v1.9.2