From 8f8e796c777577dcef888b94603ed93bebcc1ee6 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 06 十二月 2021 14:36:38 +0800
Subject: [PATCH] update tlog 1.3.4 => 1.3.5 启用 tlog 自动配置
---
ruoyi-ui/src/views/tool/gen/index.vue | 62 +++++++++++++++++-------------
1 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue
index ad9dd2e..646decf 100644
--- a/ruoyi-ui/src/views/tool/gen/index.vue
+++ b/ruoyi-ui/src/views/tool/gen/index.vue
@@ -84,7 +84,7 @@
</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 type="selection" align="center" width="55"></el-table-column>
<el-table-column label="搴忓彿" type="index" width="50" align="center">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
@@ -161,7 +161,7 @@
@pagination="getList"
/>
<!-- 棰勮鐣岄潰 -->
- <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
+ <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body class="scrollbar">
<el-tabs v-model="preview.activeName">
<el-tab-pane
v-for="(value, key) in preview.data"
@@ -169,7 +169,7 @@
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:key="key"
>
- <highlightjs autodetect :code="value" />
+ <pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
</el-tab-pane>
</el-tabs>
</el-dialog>
@@ -180,7 +180,14 @@
<script>
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
import importTable from "./importTable";
-import { downLoadZip } from "@/utils/zipdownload";
+import hljs from "highlight.js/lib/highlight";
+import "highlight.js/styles/github-gist.css";
+hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
+hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
+hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
+hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml"));
+hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript"));
+hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
export default {
name: "Gen",
@@ -230,7 +237,8 @@
const time = this.$route.query.t;
if (time != null && time != this.uniqueId) {
this.uniqueId = time;
- this.resetQuery();
+ this.queryParams.pageNum = Number(this.$route.query.pageNum);
+ this.getList();
}
},
methods: {
@@ -253,29 +261,25 @@
handleGenTable(row) {
const tableNames = row.tableName || this.tableNames;
if (tableNames == "") {
- this.msgError("璇烽�夋嫨瑕佺敓鎴愮殑鏁版嵁");
+ this.$modal.msgError("璇烽�夋嫨瑕佺敓鎴愮殑鏁版嵁");
return;
}
if(row.genType === "1") {
genCode(row.tableName).then(response => {
- this.msgSuccess("鎴愬姛鐢熸垚鍒拌嚜瀹氫箟璺緞锛�" + row.genPath);
+ this.$modal.msgSuccess("鎴愬姛鐢熸垚鍒拌嚜瀹氫箟璺緞锛�" + row.genPath);
});
} else {
- downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
+ this.$download.zip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
}
},
/** 鍚屾鏁版嵁搴撴搷浣� */
handleSynchDb(row) {
const tableName = row.tableName;
- this.$confirm('纭瑕佸己鍒跺悓姝�"' + tableName + '"琛ㄧ粨鏋勫悧锛�', "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }).then(function() {
- return synchDb(tableName);
+ this.$modal.confirm('纭瑕佸己鍒跺悓姝�"' + tableName + '"琛ㄧ粨鏋勫悧锛�').then(function() {
+ return synchDb(tableName);
}).then(() => {
- this.msgSuccess("鍚屾鎴愬姛");
- })
+ this.$modal.msgSuccess("鍚屾鎴愬姛");
+ }).catch(() => {});
},
/** 鎵撳紑瀵煎叆琛ㄥ脊绐� */
openImportTable() {
@@ -292,7 +296,15 @@
previewTable(row.tableId).then(response => {
this.preview.data = response.data;
this.preview.open = true;
+ this.preview.activeName = "domain.java";
});
+ },
+ /** 楂樹寒鏄剧ず */
+ highlightedCode(code, key) {
+ const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"));
+ var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
+ const result = hljs.highlight(language, code || "", true);
+ return result.value || ' ';
},
// 澶氶�夋閫変腑鏁版嵁
handleSelectionChange(selection) {
@@ -304,22 +316,18 @@
/** 淇敼鎸夐挳鎿嶄綔 */
handleEditTable(row) {
const tableId = row.tableId || this.ids[0];
- this.$router.push("/gen/edit/" + tableId);
+ this.$router.push({ path: '/tool/gen-edit/index', query: { tableId: tableId, pageNum: this.queryParams.pageNum } });
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
handleDelete(row) {
const tableIds = row.tableId || this.ids;
- this.$confirm('鏄惁纭鍒犻櫎琛ㄧ紪鍙蜂负"' + tableIds + '"鐨勬暟鎹」?', "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }).then(function() {
- return delTable(tableIds);
+ this.$modal.confirm('鏄惁纭鍒犻櫎琛ㄧ紪鍙蜂负"' + tableIds + '"鐨勬暟鎹」锛�').then(function() {
+ return delTable(tableIds);
}).then(() => {
- this.getList();
- this.msgSuccess("鍒犻櫎鎴愬姛");
- })
+ this.getList();
+ this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ }).catch(() => {});
}
}
};
-</script>
\ No newline at end of file
+</script>
--
Gitblit v1.9.3