✨ Introducing new features. close #3857 【代码生成】 代码生成支持 uview 风格移动端代码生成

This commit is contained in:
lbw committed 2022-04-28 01:39:40 +08:00
1 parent ebcde77c01
commit 5abb4c6019
6 files changed
+94 -91

No files matched your search

+1
View File
@@ -257,6 +257,7 @@ INSERT INTO `sys_dict_item` VALUES (62, 15, 'MERGE_PAY', '聚合支付', 'channe
INSERT INTO `sys_dict_item` VALUES (63, 2, 'CAS', 'CAS登录', 'social_type', 'CAS 单点登录系统', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (64, 2, 'DINGTALK', '钉钉', 'social_type', '钉钉', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (65, 2, 'WEIXIN_CP', '企业微信', 'social_type', '企业微信', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
INSERT INTO `sys_dict_item` VALUES (66, 18, '2', 'APP', 'style_type', 'uview风格', 1, ' ', ' ', '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0', 1);
COMMIT;
-- ----------------------------
@@ -110,6 +110,9 @@
u.del_flag,
u.lock_flag,
u.tenant_id,
u.nickname,
u.name,
u.email,
u.create_time ucreate_time,
u.update_time uupdate_time,
r.role_id,
@@ -10,9 +10,9 @@ pigx${className}: {
#[[putObj: (obj={}) => vm.$u.put]]#('/${moduleName}/${pathName}',obj),
// 删除
#[[delObj: (id) => vm.$u.delete]]#('/${moduleName}/${pathName}/'+id),
#[[delObj: (params) => vm.$u.delete]]#('/${moduleName}/${pathName}/'+params.id),
// 查询
#[[getObj: (id) => vm.$u.get]]#('/${moduleName}/${pathName}/' + id)
#[[getObj: (params) => vm.$u.get]]#('/${moduleName}/${pathName}/' + params.id)
}
@@ -43,9 +43,9 @@
}
},
onLoad(params) {
if(params&&params.roleId){
if(params&&params.id){
this.type = 'edit'
#[[this.$u.api]]#.pigx${className}.getObj(params.${pk.lowerAttrName}).then(res => {
#[[this.$u.api]]#.pigx${className}.getObj(params}).then(res => {
Object.assign(this.model, res.data);
});
}else{
@@ -2,84 +2,95 @@
<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-card :title="item.${pk.lowerAttrName}" v-for="(item, index) in list" :key="item.${pk.lowerAttrName}"
:index="item.${pk.lowerAttrName}" @click="cardClick(item.${pk.lowerAttrName})">
<view class="" slot="body">
#foreach($column in $columns)
<view>
<span class="span-lable">${column.comments}: </span>{{item.${column.lowerAttrName}}}
</view>
#end
</view>
<view class="card-foot" slot="foot">
<u-button size="medium" @click="cardClick(item.${pk.lowerAttrName})">编辑</u-button>
<u-button size="medium" @click="del(item.${pk.lowerAttrName})">删除</u-button>
</view>
</u-card>
</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'')">
<view class="btn-plus" @click="navTo('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) {
export default {
data() {
return {
keywords: '',
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() {
methods: {
cardClick(id) {
uni.navigateTo({
url: '/pages/${moduleName}/${pathName}/${pathName}-form?id='+id
})
},
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) {
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";
});
},
del(id) {
let self = this;
uni.showModal({
title: '提示',
content: '确认要删除该数据吗?',
showCancel: true,
success: function (res2) {
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.$u.api]]#.pigx${className}.delObj({id:id}).then(res => {
#[[self.$u.toast('删除成功');]]#
self.query.current = 1
self.list = []
self.loadList()
@@ -88,35 +99,23 @@ export default {
}
});
}
},
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;
}
page {
background-color: #f8f8f8;
}
.btn-plus {
position: absolute;
bottom: 50rpx;
right: 50rpx;
z-index: 1;
opacity: 0.6;
}
.btn-plus {
position: absolute;
bottom: 50rpx;
right: 50rpx;
z-index: 1;
opacity: 0.6;
}
.btn-plus:hover {
opacity: 1;
}
.btn-plus:hover {
opacity: 1;
}
</style>
@@ -3,15 +3,15 @@
/**${comments}**/
{
"path": "pages/${moduleName}/${pathName}/${pathName}+'-index.vue'",
"path": "pages/${moduleName}/${pathName}/${pathName}-index.vue",
"style": {
"navigationBarTitleText": "${comments}"
}
},
{
"path": "pages/${moduleName}/${pathName}/${pathName}+'-form.vue'",
"path": "pages/${moduleName}/${pathName}/${pathName}-form.vue",
"style": {
"navigationBarTitleText": "${comments}详情"
}
}
}
}