diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 6f07a9544..7df639f52 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -44,7 +44,7 @@ "element-ui": "2.14.1", "file-saver": "2.0.4", "fuse.js": "6.4.3", - "highlight.js": "10.4.1", + "highlight.js": "9.18.5", "js-beautify": "1.13.0", "js-cookie": "2.2.1", "jsencrypt": "3.0.0-rc.1", diff --git a/ruoyi-ui/src/api/tool/codegen.js b/ruoyi-ui/src/api/tool/codegen.js new file mode 100644 index 000000000..d95ed38d5 --- /dev/null +++ b/ruoyi-ui/src/api/tool/codegen.js @@ -0,0 +1,2 @@ +import request from '@/utils/request' + diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index 969a93e50..3bd0e5b38 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -21,8 +21,8 @@ import Pagination from "@/components/Pagination"; // 自定义表格工具扩展 import RightToolbar from "@/components/RightToolbar" // 代码高亮插件 -import hljs from 'highlight.js' -import 'highlight.js/styles/github-gist.css' +// import hljs from 'highlight.js' +// import 'highlight.js/styles/github-gist.css' import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict"; // 全局方法挂载 @@ -57,7 +57,7 @@ Vue.component('Pagination', Pagination) Vue.component('RightToolbar', RightToolbar) Vue.use(permission) -Vue.use(hljs.vuePlugin); +// Vue.use(hljs.vuePlugin); /** * If you don't want to use mock-server diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index 800368326..39071894e 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -90,7 +90,8 @@ - + + @@ -112,7 +113,7 @@ - + @@ -143,6 +144,8 @@ export default { activeName: "cloum", // 表格的高度 tableHeight: document.documentElement.scrollHeight - 245 + "px", + // 表信息 + tables: [], // 表列信息 cloumns: [], // 字典信息 @@ -160,6 +163,7 @@ export default { getGenTable(tableId).then(res => { this.cloumns = res.data.rows; this.info = res.data.info; + this.tables = res.data.tables; }); /** 查询字典下拉列表 */ getDictOptionselect().then(response => { @@ -167,7 +171,7 @@ export default { }); /** 查询菜单下拉列表 */ getMenuTreeselect().then(response => { - this.menus = this.handleTree(response.data, "id"); + this.menus = this.handleTree(response.data, "menuId"); }); } }, diff --git a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue index a77098c9e..926376c96 100644 --- a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue +++ b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue @@ -4,9 +4,10 @@ 生成模板 - + + @@ -126,8 +127,8 @@ @@ -144,8 +145,8 @@ @@ -162,8 +163,47 @@ + + + + + +

关联信息

+ + + + 关联子表的表名 + + + + + + + + + + + + + 子表关联的外键名 + + + + + + @@ -185,6 +225,10 @@ export default { type: Object, default: null }, + tables: { + type: Array, + default: null + }, menus: { type: Array, default: [] @@ -192,6 +236,7 @@ export default { }, data() { return { + subColumns: [], rules: { tplCategory: [ { required: true, message: "请选择生成模板", trigger: "blur" } @@ -212,6 +257,11 @@ export default { }; }, created() {}, + watch: { + 'info.subTableName': function(val) { + this.setSubTableColumns(val); + } + }, methods: { /** 转换菜单数据结构 */ normalizer(node) { @@ -219,10 +269,31 @@ export default { delete node.children; } return { - id: node.id, - label: node.name, + id: node.menuId, + label: node.menuName, children: node.children }; + }, + /** 选择子表名触发 */ + subSelectChange(value) { + this.info.subTableFkName = ''; + }, + /** 选择生成模板触发 */ + tplSelectChange(value) { + if(value !== 'sub') { + this.info.subTableName = ''; + this.info.subTableFkName = ''; + } + }, + /** 设置关联外键 */ + setSubTableColumns(value) { + for (var item in this.tables) { + const name = this.tables[item].tableName; + if (value === name) { + this.subColumns = this.tables[item].columns; + break; + } + } } } }; diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index a9145f8f5..2d62d475d 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -32,7 +32,7 @@ > - 搜索 + 搜索 重置
@@ -41,6 +41,7 @@ - +