diff --git a/pigx-common/pigx-common-bom/pom.xml b/pigx-common/pigx-common-bom/pom.xml index de8f331c1..1479ff668 100644 --- a/pigx-common/pigx-common-bom/pom.xml +++ b/pigx-common/pigx-common-bom/pom.xml @@ -22,7 +22,7 @@ 3.4.1 1.2.9 5.7.22 - 8.0.27 + 8.0.29 21.3.0.0 8.4.1.jre8 8.1.2.79 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 646430727..c0f191b79 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 @@ -104,13 +104,6 @@ public class GenUtils { */ private List getTemplates(GenConfig config) { List templates = new ArrayList<>(); - templates.add("template/Entity.java.vm"); - templates.add("template/Mapper.java.vm"); - templates.add("template/Mapper.xml.vm"); - templates.add("template/Service.java.vm"); - templates.add("template/ServiceImpl.java.vm"); - templates.add("template/Controller.java.vm"); - templates.add("template/menu.sql.vm"); if (StyleTypeEnum.AVUE.getStyle().equals(config.getStyle())) { templates.add("template/avue/index.vue.vm"); @@ -123,12 +116,20 @@ public class GenUtils { 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/form.vue.vm"); + templates.add("template/uview/api.js.vm"); templates.add("template/uview/page.json.vm"); } + templates.add("template/Entity.java.vm"); + templates.add("template/Mapper.java.vm"); + templates.add("template/Mapper.xml.vm"); + templates.add("template/Service.java.vm"); + templates.add("template/ServiceImpl.java.vm"); + templates.add("template/Controller.java.vm"); + templates.add("template/menu.sql.vm"); + return templates; } @@ -289,7 +290,7 @@ public class GenUtils { // 获取模板列表 List templates = getTemplates(genConfig); - Map resultMap = new HashMap<>(8); + Map resultMap = new LinkedHashMap<>(8); for (String template : templates) { // 如果是crud @@ -433,11 +434,12 @@ public class GenUtils { } if (template.contains(UVIEW_API_JS_VM)) { - return CommonConstants.UNI_END_PROJECT + File.separator + "common" + File.separator + "http.api.js"; + return CommonConstants.UNI_END_PROJECT + File.separator + "common" + File.separator + + className.toLowerCase() + ".api.js"; } if (template.contains(UVIEW_PAGE_JSON_VM)) { - return "page.json"; + return className.toLowerCase() + ".page.json"; } return null; 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 index 29eaada5e..b7ccaa5db 100644 --- 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 @@ -43,18 +43,19 @@ } }, onLoad(params) { - if(params&¶ms.id){ + if(params&¶ms.id!= "undefined"){ this.type = 'edit' - #[[this.$u.api]]#.pigx${className}.getObj(params}).then(res => { - Object.assign(this.model, res.data); + #[[this.$u.api]]#.pigx${className}.getObj(params).then(res => { + this.model = res.data; }); }else{ this.type = 'add' + this.model = {} } }, methods: { submit() { - #[[this.$refs.uForm.validate(valid => {]]# + #[[this.$refs.uForm.validate(async valid => {]]# if (valid) { if(this.type==='edit'){ await #[[this.$u.api]]#.pigx${className}.putObj(this.model) @@ -64,11 +65,13 @@ setTimeout(() => { uni.showModal({ title: '提示', - content: '修改成功', + ccontent: this.type === 'edit' ? '修改成功' : '添加成功', showCancel: false, success: function() { uni.setStorageSync('refreshList', true); - uni.navigateBack(); + uni.navigateTo({ + url: '/pages/${moduleName}/${pathName}/${pathName}-index' + }) } }) }, 200) 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 index c05d20156..7b1b32cb2 100644 --- 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 @@ -21,7 +21,7 @@ - + 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 index 47a65c7f9..f496b639a 100644 --- 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 @@ -3,13 +3,13 @@ /**${comments}**/ { - "path": "pages/${moduleName}/${pathName}/${pathName}-index.vue", + "path": "pages/${moduleName}/${pathName}/${pathName}-index", "style": { "navigationBarTitleText": "${comments}" } }, { - "path": "pages/${moduleName}/${pathName}/${pathName}-form.vue", + "path": "pages/${moduleName}/${pathName}/${pathName}-form", "style": { "navigationBarTitleText": "${comments}详情" } diff --git a/pom.xml b/pom.xml index 0c0e1ffa9..12cce6547 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 2.6.7 - 2021.0.1 + 2021.0.2 2021.0.1.0 UTF-8 1.8