【优化】代码生成器适配uv版本移动端

pull/165/head
877617829 2023-09-17 20:26:27 +08:00
parent ecd9131930
commit 543373d58a
14 changed files with 241 additions and 246 deletions

View File

@ -86,6 +86,7 @@
:options="mobileModuleList"
style="width: 100%"
placeholder="请选择移动端所属模块"
allow-clear
>
</a-select>
</a-form-item>
@ -312,7 +313,6 @@
generateType: [required('请选择生成方式')],
module: [required('请选择所属模块')],
menuPid: [required('请选择上级目录')],
mobileModule: [required('请选择移动端所属模块')],
functionName: [required('请输入功能名')],
busName: [required('请输入业务名')],
className: [required('请输入类名')],

View File

@ -54,11 +54,6 @@
codeTypeTitle: '前端代码',
codeTypeList: data.genBasicCodeFrontendResultList
},
{
codeTypeKey: 'mobile',
codeTypeTitle: '移动端代码',
codeTypeList: data.genBasicCodeMobileResultList
},
{
codeTypeKey: 'backend',
codeTypeTitle: '后端代码',
@ -70,6 +65,13 @@
codeTypeList: data.genBasicCodeSqlResultList
}
]
if (data.genBasicCodeMobileResultList){
codeTypeArray.value.push({
codeTypeKey: 'mobile',
codeTypeTitle: '移动端代码',
codeTypeList: data.genBasicCodeMobileResultList
})
}
} else {
message.warning('预览失败:请检查问题或反馈小诺官方')
}

View File

@ -12,6 +12,8 @@
*/
package vip.xiaonuo.gen.modular.basic.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -67,6 +69,7 @@ public class GenBasic extends CommonEntity {
/** 移动端所属模块 */
@ApiModelProperty(value = "移动端所属模块", position = 10)
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
private String mobileModule;
/** 功能名 */

View File

@ -70,7 +70,6 @@ public class GenBasicAddParam {
/** 移动端所属模块 */
@ApiModelProperty(value = "移动端所属模块", required = true, position = 9)
@NotNull(message = "mobileModule不能为空")
private String mobileModule;
/** 功能名 */

View File

@ -75,7 +75,6 @@ public class GenBasicEditParam {
/** 移动端所属模块 */
@ApiModelProperty(value = "移动端所属模块", required = true, position = 10)
@NotNull(message = "mobileModule不能为空")
private String mobileModule;
/** 功能名 */

View File

@ -459,6 +459,9 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
FileUtil.writeUtf8String(genBasicCodeResult.getCodeFileContent(), FileUtil.file(tempFolder + File.separator
+ "backend" + File.separator + genBasicCodeResult.getCodeFileWithPathName())));
// 生成移动端代码到临时目录
if (ObjectUtil.isEmpty(genBasic.getMobileModule())){
return tempFolder;
}
genBasicPreviewResult.getGenBasicCodeMobileResultList().forEach(genBasicCodeResult ->
FileUtil.writeUtf8String(genBasicCodeResult.getCodeFileContent(), FileUtil.file(tempFolder + File.separator
+ "mobile" + File.separator + genBasicCodeResult.getCodeFileWithPathName())));
@ -541,6 +544,9 @@ public class GenBasicServiceImpl extends ServiceImpl<GenBasicMapper, GenBasic> i
genBasicPreviewResult.setGenBasicCodeBackendResultList(genBasicCodeBackendResultList);
// 移动端基础路径
if (ObjectUtil.isEmpty(genBasic.getMobileModule())){
return genBasicPreviewResult;
}
String genMobileBasicPath = "";
// 移动端
GroupTemplate groupTemplateMobile = new GroupTemplate(new ClasspathResourceLoader("mobile"), Configuration.defaultConfiguration());

View File

@ -2,7 +2,7 @@ import request from '@/utils/request'
// 获取${functionName}分页
export function ${classNameFirstLower}Page(data) {
return request({
return request({
url: '/${moduleName}/${busName}/page',
method: 'get',
data: data
@ -10,7 +10,7 @@ export function ${classNameFirstLower}Page(data) {
}
// 提交${functionName}表单 add为false时为编辑默认为新增
export function ${classNameFirstLower}SubmitForm(data, add = true) {
return request({
return request({
url: '/${moduleName}/${busName}/'+ (add ? 'add' : 'edit'),
method: 'post',
data: data
@ -18,7 +18,7 @@ export function ${classNameFirstLower}SubmitForm(data, add = true) {
}
// 删除${functionName}
export function ${classNameFirstLower}Delete(data) {
return request({
return request({
url: '/${moduleName}/${busName}/delete',
method: 'post',
data: data
@ -26,7 +26,7 @@ export function ${classNameFirstLower}Delete(data) {
}
// 获取${functionName}详情
export function ${classNameFirstLower}Detail(data) {
return request({
return request({
url: '/${moduleName}/${busName}/detail',
method: 'get',
data: data

View File

@ -1,44 +1,53 @@
<template>
<view class="container">
<uni-forms ref="formRef" :model="formData" label-position="top" :rules="rules" validate-trigger="blur" labelWidth="100px">
<view class="container snowy-shadow">
<uv-form ref="formRef" :model="formData" :rules="rules" label-position="top" labelWidth="auto" :labelStyle="{marginBottom: '25rpx', fontSize: '27rpx', color: '#606266'}">
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].whetherAddUpdate && configList[i].fieldNameCamelCase != 'tenantId') { %>
<% if(configList[i].effectType == 'input') { %>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请输入${configList[i].fieldRemark}' }]">
<uni-easyinput v-model="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uni-easyinput>
</uni-forms-item>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<uv-input v-model="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uv-input>
</uv-form-item>
<% } else if (configList[i].effectType == 'textarea') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请输入${configList[i].fieldRemark}' }]">
<uni-easyinput type="textarea" v-model="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uni-easyinput>
</uni-forms-item>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<uv-textarea v-model="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uv-textarea>
</uv-form-item>
<% } else if (configList[i].effectType == 'select') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请输入${configList[i].fieldRemark}' }]">
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<snowy-sel-picker :map="{key: 'value', label: 'text'}" v-model="formData.${configList[i].fieldNameCamelCase}" :rangeData="${configList[i].fieldNameCamelCase}Options" placeholder="请选择${configList[i].fieldRemark}"></snowy-sel-picker>
</uni-forms-item>
<% } else if (configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请选择${configList[i].fieldRemark}' }]">
<uni-data-checkbox :multiple="${configList[i].effectType == 'checkbox'?true:false}" :map="{key: 'value', label: 'text'}" v-model="searchFormState.${configList[i].fieldNameCamelCase}" :rangeData="${configList[i].fieldNameCamelCase}Options" placeholder="请选择${configList[i].fieldRemark}"> </uni-data-checkbox>
</uni-forms-item>
<% } else if (configList[i].effectType == 'datepicker' || configList[i].effectType == 'timepicker') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请选择${configList[i].fieldRemark}' }]">
<uni-datetime-picker type=${configList[i].effectType == 'timepicker'?'datetime':'date'} v-model="formData.${configList[i].fieldNameCamelCase}" > </uni-datetime-picker>
</uni-forms-item>
</uv-form-item>
<% } else if (configList[i].effectType == 'radio') {%>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<uv-radio-group v-model="formData.${configList[i].fieldNameCamelCase}">
<uv-radio :customStyle="{marginRight: '50rpx'}" v-for="(item, index) in ${configList[i].fieldNameCamelCase}Options" :key="index" :name="item.value" :label="item.text"></uv-radio>
</uv-radio-group>
</uv-form-item>
<% } else if (configList[i].effectType == 'checkbox') {%>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<uv-checkbox-group v-model="formData.${configList[i].fieldNameCamelCase}">
<uv-checkbox :customStyle="{marginRight: '50rpx'}" v-for="(item, index) in ${configList[i].fieldNameCamelCase}Options" :key="index" :name="item.value" :label="item.text"></uv-checkbox>
</uv-checkbox-group>
</uv-form-item>
<% } else if (configList[i].effectType == 'datepicker') {%>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<snowy-calendar v-model="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></snowy-calendar>
</uv-form-item>
<% } else if (configList[i].effectType == 'timepicker') {%>
<% } else if (configList[i].effectType == 'inputNumber') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请输入${configList[i].fieldRemark}' }]">
<uni-number-box v-model="formData.${configList[i].fieldNameCamelCase}" :min="1" :max="100"></uni-number-box>
</uni-forms-item>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<uv-number-box v-model="formData.${configList[i].fieldNameCamelCase}" :min="1" :max="100"></uv-number-box>
</uv-form-item>
<% } else if (configList[i].effectType == 'slider') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}" :rules="[{ required: ${configList[i].required}, errorMessage: '请输入${configList[i].fieldRemark}' }]">
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}" :required="${configList[i].required}">
<slider :value="formData.${configList[i].fieldNameCamelCase}" :min="1" :max="100" :step="1" @change="(e)=>{formData.${configList[i].fieldNameCamelCase} = e.detail.value}"></slider>
</uni-forms-item>
</uv-form-item>
<% } %>
<% } %>
<% } %>
</uni-forms>
<button class="btn-sub" type="primary" @click="submit">提交</button>
</uv-form>
<tui-button margin="50rpx 0" :preventClick="true" :shadow="true" @click="submit">提交</tui-button>
</view>
</template>
<script setup name="${classNameFirstLower}Form">
<%
var iptTool = 0;
@ -52,7 +61,6 @@
%>
<% if(iptTool > 0) { %>
import tool from '@/plugins/tool'
import SnowySelPicker from '@/components/snowy-sel-picker.vue'
<% } %>
import XEUtils from "xe-utils"
import { onLoad } from "@dcloudio/uni-app"
@ -61,14 +69,27 @@
const { proxy } = getCurrentInstance()
const formRef = ref()
const formData = ref({})
// 常用正则规则大全https://any86.github.io/any-rule/
const formData = ref({
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].whetherAddUpdate && configList[i].fieldNameCamelCase != 'tenantId') { %>
${configList[i].fieldNameCamelCase}: '',
<% } %>
<% } %>
})
// https://www.uvui.cn/components/form.html
// 去pages/biz/user/form.vue中寻找示例
const rules = reactive({
})
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].whetherAddUpdate && configList[i].fieldNameCamelCase != 'tenantId' && configList[i].required) { %>
${configList[i].fieldNameCamelCase}: [{
type: 'string',
required: true,
message: '请输入${configList[i].fieldRemark}',
trigger: ['blur', 'change']
}],
<% } %>
<% } %>
})
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId) { %>
<% if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %>
@ -96,24 +117,19 @@
const submit = () => {
formRef.value.validate().then(res => {
${classNameFirstLower}SubmitForm(formData.value, !formData.value.id).then(respond => {
uni.$emit('formBack', {
data: respond.data
})
uni.navigateBack({
delta: 1
})
})
uni.$emit('formBack', {
data: respond.data
})
uni.navigateBack({
delta: 1
})
})
})
}
</script>
<style lang="scss" scoped>
.container {
margin: 15upx;
border-radius: 5upx;
padding: 25upx;
background-color: $uni-white;
.btn-sub {
background-color: $uni-primary;
}
}
.container {
margin: 80rpx 0 0;
padding: 30rpx;
}
</style>

View File

@ -6,87 +6,59 @@
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }%>
<% } %>
<view>
<% if (searchCount > 0) { %>
<view class="sticky">
<% if (searchCount > 0) { %>
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { row ++; %>
<% if(row <= 1) { %>
<snowy-search placeholder="请输入${configList[i].fieldRemark}" v-model="searchFormState.${configList[i].fieldNameCamelCase}" @confirm="loadData(true)" @clear="loadData(true)" :enableSenior="true" @seniorSearch="$refs.searchRef.open()"></snowy-search>
<% } %>
<% } %>
<% } %>
<search ref="searchRef" :searchFormState="searchFormState" @confirm="loadData(true)"></search>
<% } %>
<view class="${busName}-list">
<view class="item" v-for="(item, index) in ${classNameFirstLower}Data" :key="index" :index="index" @tap="moreTapItem(item, index)">
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { row ++; %>
<% if(row <= 1) { %>
<uni-row>
<view style="display: flex; align-items: center; justify-content: center;">
<uni-col :span="22">
<uni-search-bar v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" @confirm="loadData(true)" cancelButton="none"></uni-search-bar>
</uni-col>
<uni-col :span="2">
<view style="color: #2979ff;" @click="$refs.searchRef.open()">
<text>高级\n搜索</text>
</view>
</uni-col>
</view>
</uni-row>
<% } %>
<% if(!configList[i].needTableId && configList[i].whetherTable && configList[i].fieldNameCamelCase != 'tenantId') { %>
<uv-row customStyle="margin-bottom: 15rpx">
<uv-col :span="1">
<uv-icon size="18" name="tags-fill" color="#5677fc"></uv-icon>
</uv-col>
<uv-col :span="5">
<view class="item-left">${configList[i].fieldRemark}</view>
</uv-col>
<uv-col :span="6" textAlign="right">
<view class="item-right snowy-bold snowy-ellipsis"> {{ item.${configList[i].fieldNameCamelCase} }} </view>
</uv-col>
</uv-row>
<% } %>
<% } %>
</view>
<search ref="searchRef" :searchFormState="searchFormState" @confirm="loadData(true)"></search>
<% } %>
<view class="${busName}-list">
<uni-list>
<uni-list-item v-for="(item, index) in ${classNameFirstLower}Data" :key="index" :showArrow="false" :clickable="true" @tap="moreTapItem(item, index)">
<template v-slot:body>
<view class="item">
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].whetherTable && configList[i].fieldNameCamelCase != 'tenantId') { %>
<view class="item-row">
<uni-row>
<uni-col :span="4">
<view class="item-row-title">${configList[i].fieldRemark}</view>
</uni-col>
<uni-col :span="20">
<view class="item-row-content">{{ item.${configList[i].fieldNameCamelCase} }}</view>
</uni-col>
</uni-row>
</view>
<% } %>
<% } %>
</view>
</template>
</uni-list-item>
</uni-list>
<snowy-empty v-if="$utils.isEmpty(${classNameFirstLower}Data)" />
</view>
<!-- 新增悬浮按钮 -->
<uni-fab
v-if="hasPerm('mobile${className}Add')"
horizontal="right"
vertical="bottom"
direction="horizontal"
@fabClick="add"
:pattern="{
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF',
iconColor: '#fff'
}">
</uni-fab>
<more ref="moreRef" @handleOk="loadData(true)"></more>
</view>
<snowy-empty :fixed="true" v-if="$utils.isEmpty(${classNameFirstLower}Data)" />
<snowy-float-btn v-if="hasPerm('mobile${className}Add')" @click="add"></snowy-float-btn>
<more ref="moreRef" @handleOk="loadData(true)"></more>
</template>
<script setup name="${busName}">
<% if (searchCount > 0) { %>
import search from './search.vue'
<% } %>
import SnowyEmpty from "@/components/snowy-empty.vue"
import { ${classNameFirstLower}Page } from '@/api/${moduleName}/${classNameFirstLower}Api'
import more from './more.vue'
import XEUtils from 'xe-utils'
import { onLoad, onShow, onReady, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app"
import { reactive, ref, getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const searchFormState = reactive({})
const searchFormState = reactive({
<% if (searchCount > 0) { %>
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { %>
${configList[i].fieldNameCamelCase}: '',
<% } %>
<% } %>
<% } %>
})
const parameter = reactive({
current: 1,
size: 10
@ -136,22 +108,22 @@
</script>
<style lang="scss" scoped>
.${busName}-list {
margin: 15upx;
border-radius: 5upx;
.item {
width: 100vw;
.item-row {
margin: 20upx 10upx;
.item-row-title {
font-size: 25upx;
color: #999;
}
.item-row-content {
font-size: 25upx;
text-align: right;
}
}
}
}
.${busName}-list {}
.item {
background: #ffffff;
margin: 20rpx 0;
padding: 25rpx;
box-shadow: 0 1px 2px #ccc;
border-radius: 15rpx;
.item-left {
color: #999;
font-size: 26rpx;
}
.item-right {
font-size: 26rpx;
}
}
.item:hover {
box-shadow: 1upx 5upx 5upx #5677fc;
}
</style>

View File

@ -1,30 +1,35 @@
<template>
<uni-popup ref="popupRef" type="bottom" safeArea>
<uv-popup ref="popRef" mode="bottom" bg-color="null" z-index="99">
<view class="container">
<uni-list :border="false">
<uni-list-item v-if="hasPerm('mobile${className}Edit')" title="编辑" class="item" :clickable="true" @click="edit"/>
<uni-list-item v-if="hasPerm('mobile${className}Delete')" title="刪除" class="item" :clickable="true" @click="del"/>
<uni-list-item title="取消" class="item" :clickable="true" @click="cancel"/>
</uni-list>
<tui-list-view unlined="all" background-color="transparent">
<tui-list-cell v-if="hasPerm('mobile${className}Edit')" :hover="true" :arrow="false" @click="edit" :radius="10" >
<view class="item"> 编辑 </view>
</tui-list-cell>
<tui-list-cell v-if="hasPerm('mobile${className}Delete')" :hover="true" :arrow="false" @click="del" :radius="10" :margin-top="2">
<view class="item"> 刪除 </view>
</tui-list-cell>
<tui-list-cell :hover="true" :arrow="false" @click="cancel" :margin-top="10" :radius="10">
<view class="item"> 取消 </view>
</tui-list-cell>
</tui-list-view>
</view>
</uni-popup>
</uv-popup>
</template>
<script setup name="${classNameFirstLower}More">
import { ${classNameFirstLower}Delete } from '@/api/${moduleName}/${classNameFirstLower}Api'
import modal from '@/plugins/modal'
import { reactive, ref, getCurrentInstance } from "vue"
const emits = defineEmits(['handleOk'])
const popupRef = ref()
const popRef = ref()
const record = ref({})
const open = (data) => {
record.value = data
popupRef.value.open("bottom")
popRef.value.open()
}
// 编辑
const edit = () => {
uni.navigateTo({
url: '/pages/${moduleName}/${busName}/form?id=' + record.value.id
url: '/pages/${moduleName}/${busName}/form?id=' + record.value.id
})
popupRef.value.close()
}
@ -49,12 +54,10 @@
</script>
<style lang="scss" scoped>
.container {
margin: 15upx;
border-radius: 5upx;
padding: 5upx;
background-color: $uni-white;
.item {
text-align:center;
}
}
padding: 5upx;
background-color: transparent;
.item {
text-align: center;
}
}
</style>

View File

@ -2,46 +2,46 @@
// 不使用分包
{
"path": "pages/${moduleName}/${busName}/index",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": true,
//#ifdef H5
"navigationStyle": "custom"
//#endif
"path": "pages/${moduleName}/${busName}/index",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": true,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
}, {
"path": "pages/${moduleName}/${busName}/form",
"path": "pages/${moduleName}/${busName}/form",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": false,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": false,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
},
// 使用分包微信小程序开发主包不能超过2m所以建议使用分包
{
"root": "pages/${moduleName}/${busName}",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": true,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
},{
"path": "form",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": false,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
}]
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": true,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
},{
"path": "form",
"style": {
"navigationBarTitleText": "${functionName}管理",
"enablePullDownRefresh": false,
//#ifdef H5
"navigationStyle": "custom"
//#endif
}
}]
}

View File

@ -6,47 +6,42 @@
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }%>
<% } %>
<uni-popup ref="popupRef" type="bottom" safeArea background-color="#ffffff">
<uv-popup ref="popRef" mode="bottom" bg-color="null" z-index="99">
<view class="container">
<view class="close">
<icon type="clear" :size="20" color="#5677fc" @click="close"></icon>
</view>
<% if (searchCount > 0) { %>
<uni-forms ref="formRef" :model="searchFormState" label-position="top" labelWidth="100px">
<uv-form ref="formRef" :model="searchFormState" label-position="top" labelWidth="auto" :labelStyle="{marginBottom: '25rpx', fontSize: '27rpx', color: '#606266'}">
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { %>
<% if(configList[i].effectType == 'input' || configList[i].effectType == 'textarea') { %>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
<uni-easyinput v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uni-easyinput>
</uni-forms-item>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}">
<uv-input v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uv-input>
</uv-form-item>
<% } else if (configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
<snowy-sel-picker :map="{key: 'value', label: 'text'}" v-model="searchFormState.${configList[i].fieldNameCamelCase}" :rangeData="${configList[i].fieldNameCamelCase}Options" placeholder="请选择${configList[i].fieldRemark}"></snowy-sel-picker>
</uni-forms-item>
<% } else if (configList[i].effectType == 'inputNumber' || configList[i].effectType == 'slider') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
<uni-number-box v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"/>
</uni-forms-item>
<% } else if (configList[i].effectType == 'datepicker') {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
<uni-datetime-picker v-model="searchFormState.${configList[i].fieldNameCamelCase}" type="datetimerange"/>
</uni-forms-item>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}">
<snowy-sel-picker :map="{key: 'value', label: 'text'}" v-model="searchFormState.${configList[i].fieldNameCamelCase}" :rangeData="${configList[i].fieldNameCamelCase}Options" placeholder="请选择${configList[i].fieldRemark}"></snowy-sel-picker>
</uv-form-item>
<% } else {%>
<uni-forms-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
<uni-easyinput v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uni-easyinput>
</uni-forms-item>
<uv-form-item label="${configList[i].fieldRemark}" prop="${configList[i].fieldNameCamelCase}">
<uv-input v-model="searchFormState.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}"></uv-input>
</uv-form-item>
<% } %>
<% } %>
<% } %>
</uni-forms>
</uv-form>
<% } %>
<uni-row :gutter="10">
<uni-col :span="12">
<button class="btn-reset" type="default" @click="reset">重置</button>
</uni-col>
<uni-col :span="12">
<button class="btn-sub" type="primary" @click="confirm">确认</button>
</uni-col>
</uni-row>
<uv-row :gutter="10">
<uv-col :span="6">
<tui-button height="90rpx" type="gray" @click="reset">重置</tui-button>
</uv-col>
<uv-col :span="6">
<tui-button height="90rpx" type="primary" @click="confirm">确认</tui-button>
</uv-col>
</uv-row>
</view>
</uni-popup>
</uv-popup>
</template>
<script setup name="${classNameFirstLower}Search">
<%
@ -63,17 +58,15 @@
%>
<% if(iptTool > 0) { %>
import tool from '@/plugins/tool'
import SnowySelPicker from '@/components/snowy-sel-picker.vue'
<% } %>
import { ref } from "vue"
const emits = defineEmits(['reset', 'confirm'])
const props = defineProps({
searchFormState: {
type: Object,
required: true
type: Object,
required: true
},
})
<% if (searchCount > 0) { %>
<% for(var i = 0; i < configList.~size; i++) { %>
<% if(!configList[i].needTableId && configList[i].needPage) { %>
@ -83,12 +76,9 @@
<% } %>
<% } %>
<% } %>
// 弹出ref
const popupRef = ref()
// 打开
const popRef = ref()
const open = () => {
popupRef.value.open()
popRef.value.open()
}
const reset = () =>{
// 重置数据
@ -100,24 +90,25 @@
emits('reset', props.searchFormState)
}
const confirm = () => {
popupRef.value.close()
popRef.value.close()
emits('confirm', props.searchFormState)
}
const close = () => {
popRef.value.close()
}
defineExpose({
open
})
</script>
<style lang="scss" scoped>
.container {
margin: 15upx;
border-radius: 5upx;
padding: 5upx;
background-color: $uni-white;
.btn-reset {
}
.btn-sub {
background-color: $uni-primary;
}
}
.container {
margin: 5rpx;
border-radius: 10rpx;
padding: 20rpx;
background-color: white;
.close {
display: flex;
justify-content: flex-end;
}
}
</style>

View File

@ -14,6 +14,7 @@ INSERT INTO `SYS_RESOURCE` VALUES ('${editButtonId}', '${menuId}', '编辑${func
INSERT INTO `SYS_RESOURCE` VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', NULL, '${classNameFirstLower}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, 4, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
<% if (mobileModuleId != null && mobileModuleId != '') { %>
INSERT INTO `MOBILE_RESOURCE` VALUES ('${menuId}', '0', '${functionName}管理', NULL, 'MENU', '${mobileModuleId}', 'MENU', '/pages/${moduleName}/${busName}/index', 'apartment-outlined', '#1890ff', 'YES', 'ENABLE', 99, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
INSERT INTO `MOBILE_RESOURCE` VALUES ('${addButtonId}', '${menuId}', '新增${functionName}', 'mobile${className}Add', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
@ -21,3 +22,4 @@ INSERT INTO `MOBILE_RESOURCE` VALUES ('${addButtonId}', '${menuId}', '新增${fu
INSERT INTO `MOBILE_RESOURCE` VALUES ('${editButtonId}', '${menuId}', '编辑${functionName}', 'mobile${className}Edit', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
INSERT INTO `MOBILE_RESOURCE` VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', 'mobile${className}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
<% } %>

View File

@ -14,6 +14,7 @@ INSERT INTO "SNOWY"."SYS_RESOURCE" VALUES ('${editButtonId}', '${menuId}', '编
INSERT INTO "SNOWY"."SYS_RESOURCE" VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', NULL, '${classNameFirstLower}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, '4', NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
<% if (mobileModuleId != null && mobileModuleId != '') { %>
INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${menuId}', '0', '${functionName}管理', NULL, 'MENU', '${mobileModuleId}', 'MENU', '/pages/${moduleName}/${busName}/index', 'apartment-outlined', '#1890ff', 'YES', 'ENABLE', 99, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${addButtonId}', '${menuId}', '新增${functionName}', 'mobile${className}Add', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
@ -21,3 +22,4 @@ INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${addButtonId}', '${menuId}', '
INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${editButtonId}', '${menuId}', '编辑${functionName}', 'mobile${className}Edit', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', 'mobile${className}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
<% } %>