diff --git a/db/2pigxx.sql b/db/2pigxx.sql index bd51a285d..fcda295da 100644 --- a/db/2pigxx.sql +++ b/db/2pigxx.sql @@ -366,7 +366,6 @@ INSERT INTO `sys_menu` VALUES (1400, '部门管理', NULL, '/admin/dept/index', INSERT INTO `sys_menu` VALUES (1401, '部门新增', 'sys_dept_add', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:56:16', ' ', '2021-05-25 03:12:55', '0', 1); INSERT INTO `sys_menu` VALUES (1402, '部门修改', 'sys_dept_edit', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:56:59', ' ', '2021-05-25 03:12:55', '0', 1); INSERT INTO `sys_menu` VALUES (1403, '部门删除', 'sys_dept_del', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:57:28', ' ', '2021-05-25 03:12:55', '0', 1); -INSERT INTO `sys_menu` VALUES (1404, '互联同步', 'sys_connect_sync', NULL, 1400, NULL, 1, '0', '1', ' ', '2018-01-20 14:57:28', ' ', '2021-05-25 03:12:55', '0', 1); INSERT INTO `sys_menu` VALUES (1500, '租户管理', '', '/admin/tenant/index', 1000, 'icon-erji-zuhushouye', 5, '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2022-01-27 11:59:14', '0', 1); INSERT INTO `sys_menu` VALUES (1501, '租户新增', 'admin_systenant_add', NULL, 1500, '1', 0, '0', '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:56:52', '0', 1); INSERT INTO `sys_menu` VALUES (1502, '租户修改', 'admin_systenant_edit', NULL, 1500, '1', 1, '0', '1', ' ', '2018-05-15 21:35:18', ' ', '2020-03-24 08:56:53', '0', 1); @@ -631,7 +630,6 @@ INSERT INTO `sys_role_menu` VALUES (1, 1400); INSERT INTO `sys_role_menu` VALUES (1, 1401); INSERT INTO `sys_role_menu` VALUES (1, 1402); INSERT INTO `sys_role_menu` VALUES (1, 1403); -INSERT INTO `sys_role_menu` VALUES (1, 1404); INSERT INTO `sys_role_menu` VALUES (1, 1500); INSERT INTO `sys_role_menu` VALUES (1, 1501); INSERT INTO `sys_role_menu` VALUES (1, 1502); diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java index 7926ece5a..987337d68 100644 --- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java @@ -70,6 +70,11 @@ public interface CommonConstants { */ String FRONT_END_PROJECT = "pigx-ui"; + /** + * 移动端工程名 + */ + String UNI_END_PROJECT = "pigx-app"; + /** * 后端工程名 */ diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java index b92180589..90e9f516d 100644 --- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java @@ -21,7 +21,12 @@ public enum StyleTypeEnum { /** * 前端类型-element 风格 */ - ELEMENT("1", "element 风格"); + ELEMENT("1", "element 风格"), + + /** + * 前端风格-uview 风格 + */ + UVIEW("2", "uview 风格"); /** * 类型 diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java index dd6bf91a9..8091a825f 100644 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java @@ -62,7 +62,7 @@ public class GenConfig { private String comments; /** - * 代码风格 0 - avue 1 - element + * 代码风格 0 - avue 1 - element 2 - uview */ private String style; diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java index 804bcbddc..646430727 100644 --- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java +++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java @@ -89,6 +89,14 @@ public class GenUtils { private final String AVUE_CRUD_JS_VM = "avue/crud.js.vm"; + private final String UVIEW_API_JS_VM = "uview/api.js.vm"; + + private final String UVIEW_FORM_VUE_VM = "uview/form.vue.vm"; + + private final String UVIEW_INDEX_VUE_VM = "uview/index.vue.vm"; + + private final String UVIEW_PAGE_JSON_VM = "uview/page.json.vm"; + /** * 配置 * @param config @@ -103,15 +111,22 @@ public class GenUtils { templates.add("template/ServiceImpl.java.vm"); templates.add("template/Controller.java.vm"); templates.add("template/menu.sql.vm"); - templates.add("template/avue/api.js.vm"); if (StyleTypeEnum.AVUE.getStyle().equals(config.getStyle())) { templates.add("template/avue/index.vue.vm"); templates.add("template/avue/crud.js.vm"); + templates.add("template/avue/api.js.vm"); } - else { + else if (StyleTypeEnum.ELEMENT.getStyle().equals(config.getStyle())) { templates.add("template/element/index.vue.vm"); templates.add("template/element/form.vue.vm"); + templates.add("template/avue/api.js.vm"); + } + else { + templates.add("template/uview/api.js.vm"); + templates.add("template/uview/form.vue.vm"); + templates.add("template/uview/index.vue.vm"); + templates.add("template/uview/page.json.vm"); } return templates; @@ -406,6 +421,25 @@ public class GenUtils { + className.toLowerCase() + "-form.vue"; } + if (template.contains(UVIEW_INDEX_VUE_VM)) { + return CommonConstants.UNI_END_PROJECT + File.separator + "pages" + File.separator + moduleName + + File.separator + className.toLowerCase() + File.separator + className.toLowerCase() + + "-index.vue"; + } + + if (template.contains(UVIEW_FORM_VUE_VM)) { + return CommonConstants.UNI_END_PROJECT + File.separator + "pages" + File.separator + moduleName + + File.separator + className.toLowerCase() + File.separator + className.toLowerCase() + "-form.vue"; + } + + if (template.contains(UVIEW_API_JS_VM)) { + return CommonConstants.UNI_END_PROJECT + File.separator + "common" + File.separator + "http.api.js"; + } + + if (template.contains(UVIEW_PAGE_JSON_VM)) { + return "page.json"; + } + return null; } diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/api.js.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/api.js.vm new file mode 100644 index 000000000..16798df41 --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/api.js.vm @@ -0,0 +1,18 @@ +// 以下内容请复制到http.api.js中 +pigx${className}: { + // 分页 + #[[fetchList: (params={}) => vm.$u.get]]#('/${moduleName}/${pathName}/page',params), + + // 新增 + #[[addObj: (obj={}) => vm.$u.post]]#('/${moduleName}/${pathName}', obj), + + // 修改 + #[[putObj: (obj={}) => vm.$u.put]]#('/${moduleName}/${pathName}',obj), + + // 删除 + #[[delObj: (id) => vm.$u.delete]]#('/${moduleName}/${pathName}/'+id), + + // 查询 + #[[getObj: (id) => vm.$u.get]]#('/${moduleName}/${pathName}/' + id) +} + diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm new file mode 100644 index 000000000..116fc394a --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm @@ -0,0 +1,86 @@ + + + + diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm new file mode 100644 index 000000000..4ab6cd599 --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm @@ -0,0 +1,122 @@ + + + diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm new file mode 100644 index 000000000..6ba4471b5 --- /dev/null +++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm @@ -0,0 +1,17 @@ +// 以下内容请复制到pages.json +"pages": [ + + /**${comments}**/ + { + "path": "pages/${moduleName}/${pathName}/${pathName}+'-index.vue'", + "style": { + "navigationBarTitleText": "${comments}" + } + }, + { + "path": "pages/${moduleName}/${pathName}/${pathName}+'-form.vue'", + "style": { + "navigationBarTitleText": "${comments}详情" + } + } +} \ No newline at end of file