Merge remote-tracking branch 'origin/fxz_dev' into leng_dev
# Conflicts: # db/2pigxx.sql
This commit is contained in:
commit
ebcde77c01
9 files changed
+291
-6
No files matched your search
@@ -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);
|
||||
|
||||
+5
@@ -70,6 +70,11 @@ public interface CommonConstants {
|
||||
*/
|
||||
String FRONT_END_PROJECT = "pigx-ui";
|
||||
|
||||
/**
|
||||
* 移动端工程名
|
||||
*/
|
||||
String UNI_END_PROJECT = "pigx-app";
|
||||
|
||||
/**
|
||||
* 后端工程名
|
||||
*/
|
||||
|
||||
+6
-1
@@ -21,7 +21,12 @@ public enum StyleTypeEnum {
|
||||
/**
|
||||
* 前端类型-element 风格
|
||||
*/
|
||||
ELEMENT("1", "element 风格");
|
||||
ELEMENT("1", "element 风格"),
|
||||
|
||||
/**
|
||||
* 前端风格-uview 风格
|
||||
*/
|
||||
UVIEW("2", "uview 风格");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class GenConfig {
|
||||
private String comments;
|
||||
|
||||
/**
|
||||
* 代码风格 0 - avue 1 - element
|
||||
* 代码风格 0 - avue 1 - element 2 - uview
|
||||
*/
|
||||
private String style;
|
||||
|
||||
|
||||
+36
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<u-form class="form" :model="model" :rules="rules" ref="uForm" label-position="left">
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pk.columnName)
|
||||
<u-form-item label="${column.comments}" prop="${column.lowerAttrName}" label-width="180">
|
||||
<u-input v-model="model.${column.lowerAttrName}" placeholder="${column.comments}"></u-input>
|
||||
</u-form-item>
|
||||
#end
|
||||
#end
|
||||
</u-form>
|
||||
<view class="form-footer">
|
||||
<u-button class="btn" type="primary" @click="submit">提交</u-button>
|
||||
<u-button class="btn" type="default" @click="cancel">关闭</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type:'',
|
||||
model: {
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName == $pk.columnName)
|
||||
${column.lowerAttrName}: 0,
|
||||
#else
|
||||
${column.lowerAttrName}: ''#if($velocityCount != $columns.size()),#end
|
||||
#end
|
||||
#end
|
||||
},
|
||||
rules: {
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pk.columnName)
|
||||
${column.lowerAttrName}: [
|
||||
{ required: true, message: '${column.comments}不能为空', trigger: 'blur' }
|
||||
]#if($velocityCount != $columns.size()),#end
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(params) {
|
||||
if(params&¶ms.roleId){
|
||||
this.type = 'edit'
|
||||
#[[this.$u.api]]#.pigx${className}.getObj(params.${pk.lowerAttrName}).then(res => {
|
||||
Object.assign(this.model, res.data);
|
||||
});
|
||||
}else{
|
||||
this.type = 'add'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
#[[this.$refs.uForm.validate(valid => {]]#
|
||||
if (valid) {
|
||||
if(this.type==='edit'){
|
||||
await #[[this.$u.api]]#.pigx${className}.putObj(this.model)
|
||||
}else{
|
||||
await #[[this.$u.api]]#.pigx${className}.addObj(this.model)
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '修改成功',
|
||||
showCancel: false,
|
||||
success: function() {
|
||||
uni.setStorageSync('refreshList', true);
|
||||
uni.navigateBack();
|
||||
}
|
||||
})
|
||||
}, 200)
|
||||
} else {
|
||||
#[[this.$u.toast('您填写的信息有误,请根据提示修正。')]]#
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<scroll-view class="scroll-list" scroll-y="true" @scrolltolower="loadMore">
|
||||
<u-cell-group class="list" :border="false">
|
||||
<u-swipe-action :options="options" v-for="(item, index) in list" :key="item.${pk.lowerAttrName}" :index="index"
|
||||
@click="optionsClick">
|
||||
<u-cell-item :arrow="true" @click="navTo('${pathName}+'-form'?${pk.lowerAttrName}='+item.${pk.lowerAttrName})">
|
||||
<text slot="title">{{item.${pk.lowerAttrName}}}</text>
|
||||
<text slot="label">
|
||||
创建时间: {{item.createTime}}
|
||||
</text>
|
||||
</u-cell-item>
|
||||
</u-swipe-action>
|
||||
</u-cell-group>
|
||||
<view class="loadmore" @click="loadMore">
|
||||
<u-loadmore :status="loadStatus"></u-loadmore>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="btn-plus" @click="navTo('${pathName}+'-form'')">
|
||||
<u-icon name="plus-circle-fill" size="90" color="#3d87ff"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
query: {
|
||||
current: 1,
|
||||
size: 20
|
||||
},
|
||||
list: [],
|
||||
count: 0,
|
||||
loadStatus: 'loadmore',
|
||||
options: [
|
||||
{text: '删除', style: {background: '#dd524d'}}
|
||||
]
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.loadList();
|
||||
},
|
||||
onShow() {
|
||||
if (uni.getStorageSync('refreshList') === true) {
|
||||
uni.removeStorageSync('refreshList');
|
||||
this.search('');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadMore() {
|
||||
this.loadStatus = "loading";
|
||||
setTimeout(() => {
|
||||
this.query.current += 1;
|
||||
this.loadList();
|
||||
}, 100);
|
||||
},
|
||||
loadList() {
|
||||
#[[this.$u.api]]#.pigx${className}.fetchList(this.query).then(res => {
|
||||
if (!res.data.records || res.data.records.length == 0) {
|
||||
this.loadStatus = "nomore";
|
||||
return;
|
||||
}
|
||||
this.list = this.list.concat(res.data.records);
|
||||
this.total = res.data.total;
|
||||
this.query.current = res.data.current;
|
||||
this.query.size = res.data.size;
|
||||
this.loadStatus = "loadmore";
|
||||
});
|
||||
},
|
||||
optionsClick(rowIndex, btnIndex) {
|
||||
if (btnIndex == 0) {
|
||||
let self = this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认要删除该数据吗?',
|
||||
showCancel: true,
|
||||
success: function (res2) {
|
||||
if (res2.confirm) {
|
||||
let row = self.list[rowIndex];
|
||||
#[[self.$u.api]]#.pigx${className}.delObj(row.${pk.lowerAttrName}).then(res => {
|
||||
#[[self.$u.toast('删除成功');]]#
|
||||
self.query.current = 1
|
||||
self.list = []
|
||||
self.loadList()
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
search(value) {
|
||||
this.list = [];
|
||||
this.query.current = 1;
|
||||
this.query.username = value;
|
||||
this.loadList();
|
||||
},
|
||||
navTo(url) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/${moduleName}/${pathName}/'+url
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.btn-plus {
|
||||
position: absolute;
|
||||
bottom: 50rpx;
|
||||
right: 50rpx;
|
||||
z-index: 1;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.btn-plus:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -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}详情"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user