【版本合并】 branch 'origin/master' into springboot3

This commit is contained in:
JEECG
2024-10-08 19:30:14 +08:00
418 changed files with 13881 additions and 4476 deletions

View File

@ -26,6 +26,38 @@
}
return "";
}
<#elseif po.classType=='switch'>
<#assign switch_extend_arr=['Y','N']>
<#if po.dictField?default("")?contains("[")>
<#assign switch_extend_arr=po.dictField?eval>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
@Excel(name = "${po.filedComment}", width = 15,replace = {"是_${switch_extend_arr1}","否_${switch_extend_arr2}"} )
@ApiModelProperty(value = "${po.filedComment}")
private ${po.fieldType} ${po.fieldName};
<#elseif po.classType=='pca'>
@Excel(name = "${po.filedComment}", width = 15,exportConvert=true,importConvert = true )
@ApiModelProperty(value = "${po.filedComment}")
private ${po.fieldType} ${po.fieldName};
public String convertis${po.fieldName?cap_first}() {
return SpringContextUtils.getBean(ProvinceCityArea.class).getText(${po.fieldName});
}
public void convertset${po.fieldName?cap_first}(String text) {
this.${po.fieldName} = SpringContextUtils.getBean(ProvinceCityArea.class).getCode(text);
}
<#elseif po.classType=='cat_tree'>
<#assign list_field_dictCode=', dictTable = "sys_category", dicText = "name", dicCode = "id"'>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
@ApiModelProperty(value = "${po.filedComment}")
private ${po.fieldType} ${po.fieldName};
<#else>
@Schema(description = "${po.filedComment}")
<#if po.fieldDbName == 'del_flag'>

View File

@ -13,6 +13,9 @@
<#if need_popup>
JPopup,
</#if>
<#if need_popup_dict>
JPopupDict,
</#if>
<#if need_category>
JCategorySelect,
</#if>

View File

@ -9,7 +9,7 @@
<#assign form_field_dictCode="${po.dictField}">
</#if>
<a-col :span="${form_span}">
<a-form-item label="${po.filedComment}" v-bind="validateInfos.${autoStringSuffixForModel(po)}">
<a-form-item label="${po.filedComment}" v-bind="validateInfos.${autoStringSuffixForModel(po)}" id="${formEntityName}-${autoStringSuffixForModel(po)}" name="${autoStringSuffixForModel(po)}">
<#if po.classType =='date'>
<a-date-picker placeholder="请选择${po.filedComment}" <#if po.extendParams?exists && po.extendParams.picker?exists>picker="${po.extendParams.picker}"</#if> v-model:value="formData.${po.fieldName}" value-format="YYYY-MM-DD" style="width: 100%" <#if po.readonly=='Y'>disabled</#if> allow-clear />
<#elseif po.classType =='datetime'>
@ -33,9 +33,18 @@
:multi="${po.extendParams.popupMulti?c}"
:setFieldsValue="setFieldsValue"
<#if po.readonly=='Y'>disabled</#if><#rt> allow-clear />
<#elseif po.classType =='popup_dict'>
<#assign need_popup_dict = true>
<#assign sourceFields = po.dictField?default("")?trim?split(",")/>
<#assign targetFields = po.dictText?default("")?trim?split(",")/>
<j-popup-dict
placeholder="请选择${po.filedComment}"
v-model:value="formData.${po.fieldName}"
dictCode="${po.dictTable},${po.dictText},${po.dictField}"
:multi="${po.extendParams.popupMulti?c}" <#if po.readonly=='Y'>disabled</#if> />
<#elseif po.classType =='sel_depart'>
<#assign need_dept = true>
<j-select-dept v-model:value="formData.${po.fieldName}" :multiple="${po.extendParams.multi?default('true')}" checkStrictly <#if po.readonly=='Y'>disabled</#if> allow-clear />
<j-select-dept v-model:value="formData.${po.fieldName}" <#if po.extendParams?exists && po.extendParams.text?exists>labelKey="${po.extendParams.text}"</#if> <#if po.extendParams?exists && po.extendParams.store?exists>rowKey="${po.extendParams.store}"</#if> <#if po.readonly=='Y'>disabled</#if> :multiple="${po.extendParams.multi?default('true')}" checkStrictly <#if po.readonly=='Y'>disabled</#if> allow-clear />
<#elseif po.classType =='switch'>
<#assign need_switch = true>
<j-switch v-model:value="formData.${po.fieldName}" <#if po.dictField != 'is_open'>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
@ -50,7 +59,7 @@
<#elseif po.classType =='sel_user'>
<#assign need_dept_user = true>
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
<j-select-user v-model:value="formData.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if> allow-clear />
<j-select-user v-model:value="formData.${po.fieldName}" <#if po.extendParams?exists && po.extendParams.text?exists>labelKey="${po.extendParams.text}"</#if> <#if po.extendParams?exists && po.extendParams.store?exists>rowKey="${po.extendParams.store}"</#if> <#if po.readonly=='Y'>disabled</#if> allow-clear />
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
<#elseif po.classType =='textarea'>
<a-textarea v-model:value="formData.${autoStringSuffixForModel(po)}" :rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
@ -82,7 +91,7 @@
<j-image-upload <#if po.uploadnum??>:fileMax=${po.uploadnum}<#else>:fileMax="0"</#if> v-model:value="formData.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
<#elseif po.classType=='umeditor'>
<#assign need_editor = true>
<j-editor v-model:value="formData.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if>/>
<j-editor v-model:value="formData.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if> :autoFocus="false"/>
<#elseif po.fieldDbType=='Blob'>
<a-input v-model:value="formData.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if> allow-clear ></a-input>
<#elseif po.classType == 'sel_tree'>

View File

@ -13,6 +13,9 @@
<#if need_popup>
import JPopup from '/@/components/Form/src/jeecg/components/JPopup.vue';
</#if>
<#if need_popup_dict>
import JPopupDict from '/@/components/Form/src/jeecg/components/JPopupDict.vue';
</#if>
<#if need_category>
import JCategorySelect from '/@/components/Form/src/jeecg/components/JCategorySelect.vue';
</#if>
@ -47,4 +50,7 @@
</#if>
<#if need_checkbox>
import JCheckbox from "/@/components/Form/src/jeecg/components/JCheckbox.vue";
</#if>
<#if need_range_number>
import JRangeNumber from "/@/components/Form/src/jeecg/components/JRangeNumber.vue";
</#if>

View File

@ -9,9 +9,11 @@
<#assign query_field_dictCode="">
<#if po.dictTable?default("")?trim?length gt 1>
<#assign need_select_tag = true>
<#assign need_multi = true>
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign need_select_tag = true>
<#assign need_multi = true>
<#assign query_field_dictCode="${po.dictField}">
</#if>
<#if po.queryMode=='single'>
@ -56,66 +58,41 @@
<#if query_field_no gt 1> </#if>]"
<#if query_field_no gt 1> </#if>:multi="${po.extendParams.popupMulti?c}"
<#if query_field_no gt 1> </#if>:setFieldsValue="setFieldsValue" allow-clear />
<#elseif po.classType=='popup_dict'>
<#if query_field_no gt 1> </#if><j-popup-dict
<#if query_field_no gt 1> </#if>placeholder="请选择${po.filedComment}"
<#if query_field_no gt 1> </#if>v-model:value="queryParam.${po.fieldName}"
<#if query_field_no gt 1> </#if>dictCode="${po.dictTable},${po.dictText},${po.dictField}"
<#if query_field_no gt 1> </#if>:multi="${po.extendParams.popupMulti?c}"
<#if query_field_no gt 1> </#if><#if po.readonly=='Y'>disabled</#if> />
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
<#if po.dictTable?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}" allow-clear />
<#elseif po.dictField?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dictCode="${po.dictField}" allow-clear />
<#else>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
<#if po.dictTable?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-select-multiple placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}" allow-clear />
<#elseif po.dictField?default("")?trim?length gt 1>
<#if query_field_no gt 1> </#if><j-select-multiple placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dictCode="${po.dictField}" allow-clear />
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${po.fieldName}" allow-clear ></a-input>
</#if>
</#if>
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
<#if query_field_no gt 1> </#if><a-input-number placeholder="请输入${po.filedComment}" v-model:value="queryParam.${po.fieldName}"></a-input-number>
<#else>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${autoStringSuffixForModel(po)}" allow-clear ></a-input>
</#if>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
<#else>
<#if query_field_no gt 1> </#if><a-col :lg="6">
<#if query_field_no gt 1> </#if><a-form-item>
<#if query_field_no gt 1> </#if><template #label><span title="${po.filedComment}"><#if po.filedComment?default("")?trim?length gt 4>${po.filedComment?substring(0,4)}<#else>${po.filedComment}</#if></span></template>
<#if query_field_no gt 1> </#if><a-form-item name="${autoStringSuffixForModel(po)}">
<#if query_field_no gt 1> </#if><template #label><span title="${po.filedComment}"><#if po.filedComment?default("")?trim?length gt 4>${po.filedComment?substring(0,4)}<#else>${po.filedComment}</#if></span></template>
<#if po.classType=='date'>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择开始日期" <#if po.extendParams?exists && po.extendParams.picker?exists>picker="${po.extendParams.picker}"</#if> v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" allow-clear />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择结束日期" <#if po.extendParams?exists && po.extendParams.picker?exists>picker="${po.extendParams.picker}"</#if> v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" allow-clear />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#if query_field_no gt 1> </#if><a-range-picker value-format="YYYY-MM-DD" <#if po.extendParams?exists && po.extendParams.picker?exists>picker="${po.extendParams.picker}"</#if> v-model:value="queryParam.${po.fieldName}" class="query-group-cust"/>
<#elseif po.classType=='time'>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><time-picker value-format="HH:mm:ss" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" allow-clear />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><time-picker value-format="HH:mm:ss" placeholder="请选择结束日期" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" allow-clear />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#if query_field_no gt 1> </#if><a-time-range-picker value-format="HH:mm:ss" v-model:value="queryParam.${po.fieldName}" class="query-group-cust" />
<#elseif po.classType=='datetime'>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" allow-clear />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" allow-clear />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#if query_field_no gt 1> </#if><a-range-picker showTime value-format="YYYY-MM-DD HH:mm:ss" v-model:value="queryParam.${po.fieldName}" class="query-group-cust"/>
<#else>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" allow-clear ></a-input>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-left query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" allow-clear ></a-input>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#if query_field_no gt 1> </#if><JRangeNumber v-model:value="queryParam.${po.fieldName}" class="query-group-cust"></JRangeNumber>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>

View File

@ -1,10 +1,10 @@
-- 注意该页面对应的前台目录为views/${entityPackage}文件夹下
-- 注意该页面对应的前台目录为views/${entityPackagePath}文件夹下
-- 如果你想更改到其他目录请修改sql中component字段对应的值
<#assign id = '${.now?string["yyyyMMddhhmmSSsss"]}0'>
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
VALUES ('${id}', NULL, '${tableVo.ftlDescription}', '/${entityPackage}/${entityName?uncap_first}List', '${entityPackage}/${entityName}List', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0);
VALUES ('${id}', NULL, '${tableVo.ftlDescription}', '/${entityPackagePath}/${entityName?uncap_first}List', '${entityPackagePath}/${entityName}List', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0);
-- 权限控制sql
-- 新增

View File

@ -149,6 +149,8 @@
<#-- update-begin---author:chenrui ---date:20231228 for:fix 带条件字典存在单引号导致js编译错误---------- -->
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign dictCode="dictCode: '${po.dictField}'">
<#else>
<#assign dictCode="dictCode: ''">
</#if>
<#if po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='checkbox' || po.classType=='radio'>
@ -229,4 +231,19 @@
</#if>
</#if>
<#return flag>
</#function>
<#-- vue3 native 获取范围字段 -->
<#function getRangeField(columns) >
<#assign rangeField = "">
<#list columns as po>
<#if po.isQuery=='Y'>
<#if po.queryMode!='single'>
<#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal' || po.classType=='time' || po.classType=='date' || po.classType=='datetime'>
<#assign rangeField = rangeField + "${po.fieldName},">
</#if>
</#if>
</#if>
</#list>
<#return rangeField>
</#function>

View File

@ -1,6 +1,7 @@
package ${bussiPackage}.${entityPackage}.controller;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -11,6 +12,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
import ${bussiPackage}.${entityPackage}.entity.${entityName};
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
@ -37,10 +39,14 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign bpm_flag=false>
<#assign has_multi_query_field=false>
<#list originalColumns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
<#assign has_multi_query_field=true>
</#if>
</#list>
/**
@ -51,7 +57,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
*/
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
@Autowired
@ -73,7 +79,19 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
customeRuleMap.put("${po.fieldName}", QueryRuleEnum.LIKE_WITH_OR);
</#if>
</#list>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap(),customeRuleMap);
<#else>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -33,6 +35,7 @@ public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -68,7 +71,7 @@ public class ${entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -55,9 +55,9 @@
model: {},
backRouteName:'index',
url: {
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById",
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackagePath}/${entityName?uncap_first}/queryById",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
},
}
},

View File

@ -31,7 +31,7 @@
return {
CustomBar:this.CustomBar,
NavBarColor:this.NavBarColor,
url: "/${entityPackage}/${entityName?uncap_first}/list",
url: "/${entityPackagePath}/${entityName?uncap_first}/list",
};
},
methods: {

View File

@ -318,11 +318,11 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
list: "/${entityPackagePath}/${entityName?uncap_first}/list",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackagePath}/${entityName?uncap_first}/importExcel",
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
@ -380,7 +380,7 @@
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrl: '${entityPackagePath}/modules/${entityName}Form',
formUrlMobile: ''
}
postAction(this.url.startProcess, params).then(res=>{

View File

@ -165,9 +165,9 @@
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById"
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
queryById: "/${entityPackagePath}/${entityName?uncap_first}/queryById"
}
}
},

View File

@ -21,9 +21,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -33,7 +33,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -229,6 +229,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
]
}
@ -247,7 +248,8 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1'){
@ -272,7 +274,8 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -286,7 +289,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -318,6 +321,6 @@
</#if>
</script>
<style scoped>
<style lang="less" scoped>
<#include "/common/form/vue3SearchStyle.ftl">
</style>

View File

@ -4,13 +4,13 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
}
/**
* 导出api

View File

@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -104,6 +104,14 @@ export const searchFormSchema: FormSchema[] = [
<#elseif po.classType=='sel_user'>
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
<#elseif po.classType=='switch'>
component: 'JSwitch',
@ -115,6 +123,14 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='list_multi'>
component: 'JSelectMultiple',
componentProps:{
@ -156,9 +172,16 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JDictSelectTag',
component: 'JSelectMultiple',
componentProps:{
<#if po.dictTable?default("")?trim?length gt 1>
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
@ -276,8 +299,23 @@ export const formSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -299,8 +337,13 @@ export const formSchema: FormSchema[] = [
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
},
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
<#elseif po.classType=='list'>

View File

@ -41,7 +41,7 @@
});
let formData = {};
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});

View File

@ -1,7 +1,7 @@
<#include "/common/utils.ftl">
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${entityName}Form" />
</BasicModal>
</template>
@ -16,8 +16,10 @@
const isUpdate = ref(true);
const isDetail = ref(false);
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -51,6 +53,14 @@
closeModal();
//刷新列表
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({confirmLoading: false});
}

View File

@ -1,3 +1,4 @@
<#include "/common/utils.ftl">
<template>
<div class="p-2">
<#assign query_field_no=0>
@ -9,6 +10,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -18,6 +20,8 @@
<#assign need_image_upload = false>
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign need_range_number = false>
<#assign is_range = false>
<#assign query_flag = false>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
@ -52,11 +56,20 @@
<#if po.classType=='popup'>
<#assign need_popup = true>
</#if>
<#if po.classType=='popup_dict'>
<#assign need_popup_dict = true>
</#if>
<#if po.classType=='sel_tree'>
<#assign need_select_tree = true>
</#if>
<#if po.classType=='time'>
<#assign need_time = true>
</#if>
<#if po.queryMode!='single' && (po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal')>
<#assign need_range_number = true>
</#if>
<#if po.queryMode!='single'>
<#assign is_range = true>
</#if>
<#include "/common/form/native/vue3NativeSearch.ftl">
</#list>
@ -85,9 +98,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -97,7 +110,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -158,6 +171,9 @@
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
</#if>
<#if is_range>
import { cloneDeep } from "lodash-es";
</#if>
const formRef = ref();
const queryParam = reactive<any>({});
@ -176,8 +192,13 @@
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
beforeFetch: async (params) => {
<#if is_range>
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
return Object.assign(params, queryParam);
</#if>
},
},
exportConfig: {
@ -270,6 +291,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
},
];
}
@ -289,7 +311,8 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1'){
@ -314,7 +337,8 @@
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -369,7 +393,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -407,6 +431,32 @@
}
initDictConfig();
</#if>
<#if is_range>
let rangeField = '${getRangeField(columns)}'
/**
* 设置范围查询条件
*/
async function setRangeQuery(){
let queryParamClone = cloneDeep(queryParam);
if (rangeField) {
let fieldsValue = rangeField.split(',');
fieldsValue.forEach(item => {
if (queryParamClone[item]) {
let range = queryParamClone[item];
queryParamClone[item+'_begin'] = range[0];
queryParamClone[item+'_end'] = range[1];
delete queryParamClone[item];
} else {
queryParamClone[item+'_begin'] = '';
queryParamClone[item+'_end'] = '';
}
})
}
return queryParamClone;
}
</#if>
</script>
<style lang="less" scoped>

View File

@ -4,13 +4,13 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
}
/**

View File

@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}]);
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',

View File

@ -3,7 +3,7 @@
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="${entityName}Form">
<a-row>
<#assign need_category = false>
<#assign bpm_flag=false>
@ -14,6 +14,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -23,6 +24,7 @@
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign hasOnlyValidate = false>
<#assign need_range_number = false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
@ -38,6 +40,7 @@
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
<#assign hasOnlyValidate = true>
</#if>
<#assign formEntityName>${entityName}Form</#assign>
<#include "/common/form/native/vue3NativeForm.ftl">
</#list>
<#if bpm_flag>
@ -64,7 +67,10 @@
<#if hasOnlyValidate == true>
import { duplicateValidate } from '/@/utils/helper/validator'
</#if>
<#if bpm_flag>
import { usePermission } from '/@/hooks/web/usePermission';
const { isDisabledAuth, hasPermission, initBpmFormData } = usePermission();
</#if>
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
@ -101,10 +107,11 @@
<#if bpm_flag>
onMounted(()=>{
initBpmFormData(props.formData);
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
if(props.formBpm === true){
let params = {id: props.formData.dataId};
@ -152,8 +159,18 @@
* 提交数据
*/
async function submitForm() {
// 触发表单验证
await validate();
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//时间格式化

View File

@ -61,7 +61,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
*/
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller {
@Autowired

View File

@ -310,11 +310,11 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
list: "/${entityPackagePath}/${entityName?uncap_first}/list",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackagePath}/${entityName?uncap_first}/importExcel",
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
@ -363,7 +363,7 @@
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrl: '${entityPackagePath}/modules/${entityName}Form',
formUrlMobile: ''
}
postAction(this.url.startProcess, params).then(res=>{

View File

@ -389,12 +389,12 @@
},
</#list>
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
queryById: "/${entityPackagePath}/${entityName?uncap_first}/queryById",
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}: {
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
list: '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
},
</#list>
}

View File

@ -52,7 +52,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
</#list>
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service>{
@Autowired

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -29,6 +31,7 @@ public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -64,7 +67,7 @@ public class ${entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -299,13 +299,13 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/rootList",
childList: "/${entityPackage}/${entityName?uncap_first}/childList",
getChildListBatch: "/${entityPackage}/${entityName?uncap_first}/getChildListBatch",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
list: "/${entityPackagePath}/${entityName?uncap_first}/rootList",
childList: "/${entityPackagePath}/${entityName?uncap_first}/childList",
getChildListBatch: "/${entityPackagePath}/${entityName?uncap_first}/getChildListBatch",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackagePath}/${entityName?uncap_first}/importExcel",
},
expandedRowKeys:[],
hasChildrenField:"${hasChildrenField}",

View File

@ -142,8 +142,8 @@
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
},
expandedRowKeys:[],
pidField:"${pidFieldName}"

View File

@ -26,9 +26,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleCreate" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleCreate" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
@ -39,7 +39,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="ant-design:down-outlined"></Icon>
</a-button>
</a-dropdown>
@ -371,6 +371,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
},
{
label: '添加下级',
@ -392,9 +393,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -417,8 +418,9 @@
popConfirm: {
title: '确定删除吗?',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -432,7 +434,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -442,6 +444,6 @@
</script>
<style scoped>
<style lang="less" scoped>
<#include "/common/form/vue3SearchStyle.ftl">
</style>

View File

@ -4,15 +4,15 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/rootList',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
delete${entityName} = '/${entityPackage}/${entityName?uncap_first}/delete',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
loadTreeData = '/${entityPackage}/${entityName?uncap_first}/loadTreeRoot',
getChildList = '/${entityPackage}/${entityName?uncap_first}/childList',
getChildListBatch = '/${entityPackage}/${entityName?uncap_first}/getChildListBatch',
list = '/${entityPackagePath}/${entityName?uncap_first}/rootList',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
delete${entityName} = '/${entityPackagePath}/${entityName?uncap_first}/delete',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
loadTreeData = '/${entityPackagePath}/${entityName?uncap_first}/loadTreeRoot',
getChildList = '/${entityPackagePath}/${entityName?uncap_first}/childList',
getChildListBatch = '/${entityPackagePath}/${entityName?uncap_first}/getChildListBatch',
}
/**

View File

@ -61,7 +61,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -109,6 +109,14 @@ export const searchFormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='switch'>
component: 'JSwitch',
componentProps:{
@ -118,6 +126,14 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='list_multi'>
component: 'JSelectMultiple',
componentProps:{
@ -159,6 +175,13 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType == 'sel_tree'>
component: 'JTreeSelect',
componentProps:{
@ -177,7 +200,7 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JDictSelectTag',
component: 'JSelectMultiple',
componentProps:{
<#if po.dictTable?default("")?trim?length gt 1>
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
@ -294,8 +317,23 @@ export const formSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -317,8 +355,13 @@ export const formSchema: FormSchema[] = [
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
},
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
<#elseif po.classType=='list'>

View File

@ -41,7 +41,7 @@
});
let formData = {};
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});

View File

@ -11,7 +11,7 @@
</#list>
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :title="getTitle" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${entityName}Form" />
</BasicModal>
</template>
<script lang="ts" setup>
@ -29,7 +29,7 @@
// 当前编辑的数据
let model:Nullable<Recordable> = null;
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate, updateSchema}] = useForm({
const [registerForm, { setProps,resetFields, setFieldsValue, validate, updateSchema, scrollToField }] = useForm({
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
@ -103,6 +103,14 @@
// 是否更改了父级节点
changeParent: model != null && (model['${pidFieldName}'] != values['${pidFieldName}']),
});
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({confirmLoading: false});
}

View File

@ -20,6 +20,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -29,6 +30,8 @@
<#assign need_image_upload = false>
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign need_range_number = false>
<#assign is_range = false>
<#assign query_flag = false>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
@ -63,11 +66,20 @@
<#if po.classType=='popup'>
<#assign need_popup = true>
</#if>
<#if po.classType=='popup_dict'>
<#assign need_popup_dict = true>
</#if>
<#if po.classType=='sel_tree'>
<#assign need_select_tree = true>
</#if>
<#if po.classType=='time'>
<#assign need_time = true>
</#if>
<#if po.queryMode!='single' && (po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal')>
<#assign need_range_number = true>
</#if>
<#if po.queryMode!='single'>
<#assign is_range = true>
</#if>
<#include "/common/form/native/vue3NativeSearch.ftl">
</#list>
@ -96,7 +108,7 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -106,7 +118,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'"
>批量操作
<Icon icon="ant-design:down-outlined"></Icon>
</a-button>
@ -164,6 +176,9 @@
</#if>
<#if need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
</#if>
<#if is_range>
import { cloneDeep } from "lodash-es";
</#if>
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
@ -186,8 +201,13 @@
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
beforeFetch: async (params) => {
<#if is_range>
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
return Object.assign(params, queryParam.value);
</#if>
},
},
exportConfig: {
@ -419,6 +439,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
];
}
@ -443,8 +464,9 @@
popConfirm: {
title: '确定删除吗?',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
},
];
if(record.bpmStatus == '1' || !record.bpmStatus){
@ -475,6 +497,7 @@
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: '${entityPackage}:${tableName}:delete'
},
];
</#if>
@ -488,7 +511,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -569,6 +592,32 @@
}
initDictConfig();
</#if>
<#if is_range>
let rangeField = '${getRangeField(columns)}'
/**
* 设置范围查询条件
*/
async function setRangeQuery(){
let queryParamClone = cloneDeep(queryParam.value);
if (rangeField) {
let fieldsValue = rangeField.split(',');
fieldsValue.forEach(item => {
if (queryParamClone[item]) {
let range = queryParamClone[item];
queryParamClone[item+'_begin'] = range[0];
queryParamClone[item+'_end'] = range[1];
delete queryParamClone[item];
} else {
queryParamClone[item+'_begin'] = '';
queryParamClone[item+'_end'] = '';
}
})
}
return queryParamClone;
}
</#if>
</script>
<style lang="less" scoped>

View File

@ -4,15 +4,15 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/rootList',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
delete${entityName} = '/${entityPackage}/${entityName?uncap_first}/delete',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
loadTreeData = '/${entityPackage}/${entityName?uncap_first}/loadTreeRoot',
getChildList = '/${entityPackage}/${entityName?uncap_first}/childList',
getChildListBatch = '/${entityPackage}/${entityName?uncap_first}/getChildListBatch',
list = '/${entityPackagePath}/${entityName?uncap_first}/rootList',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
delete${entityName} = '/${entityPackagePath}/${entityName?uncap_first}/delete',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
loadTreeData = '/${entityPackagePath}/${entityName?uncap_first}/loadTreeRoot',
getChildList = '/${entityPackagePath}/${entityName?uncap_first}/childList',
getChildListBatch = '/${entityPackagePath}/${entityName?uncap_first}/getChildListBatch',
}
/**

View File

@ -61,7 +61,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}]);
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',

View File

@ -3,7 +3,7 @@
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="${entityName}Form">
<a-row>
<#assign need_category = false>
<#assign bpm_flag=false>
@ -14,6 +14,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -22,6 +23,7 @@
<#assign need_image_upload = false>
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign need_range_number = false>
<#assign pidFieldName = "">
<#assign hasOnlyValidate = false>
<#assign form_span = 24>
@ -56,6 +58,7 @@
</a-form-item>
</a-col>
</#if>
<#assign formEntityName>${entityName}Form</#assign>
<#include "/common/form/native/vue3NativeForm.ftl">
</#list>
<#if bpm_flag>
@ -82,7 +85,10 @@
<#if hasOnlyValidate == true>
import { duplicateValidate } from '/@/utils/helper/validator'
</#if>
<#if bpm_flag>
import { usePermission } from '/@/hooks/web/usePermission';
const { isDisabledAuth, hasPermission, initBpmFormData } = usePermission();
</#if>
const useForm = Form.useForm;
const formRef = ref();
const isUpdate = ref(true);
@ -124,10 +130,11 @@
<#if bpm_flag>
onMounted(()=>{
initBpmFormData(props.formData);
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
if(props.formBpm === true){
let params = {id: props.formData.dataId};
@ -196,8 +203,18 @@
* 提交数据
*/
async function submitForm() {
// 触发表单验证
await validate();
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//时间格式化

View File

@ -2,6 +2,7 @@ package ${bussiPackage}.${entityPackage}.controller;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.common.system.query.QueryRuleEnum;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
@ -13,6 +14,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays;
import java.util.HashMap;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
@ -39,7 +41,12 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=false>
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
<#assign has_multi_query_field=true>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -48,7 +55,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
*/
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
@ -78,7 +85,19 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
customeRuleMap.put("${po.fieldName}", QueryRuleEnum.LIKE_WITH_OR);
</#if>
</#list>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap(),customeRuleMap);
<#else>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -28,6 +30,7 @@ public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -63,7 +66,7 @@ public class ${entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -30,6 +32,7 @@ public class ${subTab.entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list subTab.originalColumns as po>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@ -50,7 +53,7 @@ public class ${subTab.entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15)
</#if>
</#if>
@ -63,7 +66,7 @@ public class ${subTab.entityName} implements Serializable {
</#if>
</#if>
<#if po.classType =='cat_tree'>
@Dict(dicCode = "id",dicText = "name",dictTable = "sys_category")
//@Dict(dicCode = "id",dicText = "name",dictTable = "sys_category")
</#if>
<#if po.classType =='sel_depart'>
<#assign list_field_dictCode='dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dictTable = "sys_depart"'>

View File

@ -310,11 +310,11 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
list: "/${entityPackagePath}/${entityName?uncap_first}/list",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackagePath}/${entityName?uncap_first}/importExcel",
},
dictOptions:{
<#list columns as po>

View File

@ -287,11 +287,11 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId",
delete: "/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/export${sub.entityName}",
importUrl: "/${entityPackage}/${entityName?uncap_first}/import${sub.entityName}",
list: "/${entityPackagePath}/${entityName?uncap_first}/list${sub.entityName}ByMainId",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete${sub.entityName}",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch${sub.entityName}",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/export${sub.entityName}",
importUrl: "/${entityPackagePath}/${entityName?uncap_first}/import${sub.entityName}",
},
dictOptions:{
<#list columns as po>

View File

@ -138,8 +138,8 @@
confirmLoading: false,
<#include "/common/validatorRulesTemplate/main.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
}
}

View File

@ -130,8 +130,8 @@
confirmLoading: false,
<#include "/common/validatorRulesTemplate/sub.ftl">
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}",
edit: "/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}",
add: "/${entityPackagePath}/${entityName?uncap_first}/add${sub.entityName}",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit${sub.entityName}",
}
}

View File

@ -22,9 +22,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -34,7 +34,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -251,6 +251,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
]
}
@ -263,7 +264,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrl: '${entityPackagePath}/modules/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -285,8 +286,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1'){
@ -309,8 +311,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>

View File

@ -4,19 +4,19 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId',
${sub.entityName?uncap_first}Save='/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}',
${sub.entityName?uncap_first}Edit='/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}',
${sub.entityName?uncap_first}Delete = '/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}',
${sub.entityName?uncap_first}DeleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}',
${sub.entityName?uncap_first}List = '/${entityPackagePath}/${entityName?uncap_first}/list${sub.entityName}ByMainId',
${sub.entityName?uncap_first}Save='/${entityPackagePath}/${entityName?uncap_first}/add${sub.entityName}',
${sub.entityName?uncap_first}Edit='/${entityPackagePath}/${entityName?uncap_first}/edit${sub.entityName}',
${sub.entityName?uncap_first}Delete = '/${entityPackagePath}/${entityName?uncap_first}/delete${sub.entityName}',
${sub.entityName?uncap_first}DeleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch${sub.entityName}',
</#list>
}
/**
@ -124,10 +124,10 @@ export const ${sub.entityName?uncap_first}SaveOrUpdate = (params, isUpdate) =>
/**
* 导入
*/
export const ${sub.entityName?uncap_first}ImportUrl = '/${entityPackage}/${entityName?uncap_first}/import${sub.entityName}'
export const ${sub.entityName?uncap_first}ImportUrl = '/${entityPackagePath}/${entityName?uncap_first}/import${sub.entityName}'
/**
* 导出
*/
export const ${sub.entityName?uncap_first}ExportXlsUrl = '/${entityPackage}/${entityName?uncap_first}/export${sub.entityName}'
export const ${sub.entityName?uncap_first}ExportXlsUrl = '/${entityPackagePath}/${entityName?uncap_first}/export${sub.entityName}'
</#list>

View File

@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -102,6 +102,14 @@ export const searchFormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='switch'>
component: 'JSwitch',
componentProps:{
@ -112,6 +120,14 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='list_multi'>
component: 'JSelectMultiple',
componentProps:{
@ -148,9 +164,16 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JDictSelectTag',
component: 'JSelectMultiple',
componentProps:{
<#if po.dictTable?default("")?trim?length gt 1>
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
@ -269,8 +292,23 @@ export const formSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -292,7 +330,14 @@ export const formSchema: FormSchema[] = [
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
<#else>
labelKey:'realname',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',//TODO 注意string转换问题
@ -575,8 +620,23 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -597,9 +657,16 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
},
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
<#else>
labelKey:'realname',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
<#elseif po.classType=='list' || po.classType=='radio'>

View File

@ -79,6 +79,7 @@
useSearchForm: false,
actionColumn: {
width: 180,
fixed:'right'
},
pagination:{
current: 1,

View File

@ -1,7 +1,7 @@
<#include "/common/utils.ftl">
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${entityName}Form" />
</BasicModal>
</template>
@ -16,8 +16,10 @@
const isUpdate = ref(true);
const isDetail = ref(false);
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -51,6 +53,14 @@
closeModal();
//刷新列表
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
} finally {
setModalProps({confirmLoading: false});
}

View File

@ -3,7 +3,7 @@
#segment#${sub.entityName}Modal.vue
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${sub.entityName}Form" />
</BasicModal>
</template>
@ -21,8 +21,10 @@
const isUpdate = ref(true);
const isDetail = ref(false);
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
const [registerForm, { setProps,resetFields, setFieldsValue, validate, scrollToField }] = useForm({
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: ${sub.entityName?uncap_first}FormSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -61,6 +63,13 @@
closeModal();
//刷新列表
emit('success');
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
} finally {
setModalProps({confirmLoading: false});
}

View File

@ -10,6 +10,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -20,6 +21,8 @@
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign query_flag = false>
<#assign need_range_number = false>
<#assign is_range = false>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
@ -56,12 +59,21 @@
<#if po.classType=='popup'>
<#assign need_popup = true>
</#if>
<#if po.classType=='popup_dict'>
<#assign need_popup_dict = true>
</#if>
<#if po.classType=='sel_tree'>
<#assign need_select_tree = true>
</#if>
<#if po.classType=='time'>
<#assign need_time = true>
</#if>
<#if po.queryMode!='single' && (po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal')>
<#assign need_range_number = true>
</#if>
<#if po.queryMode!='single'>
<#assign is_range = true>
</#if>
<#include "/common/form/native/vue3NativeSearch.ftl">
</#list>
<#if query_field_no gt 2>
@ -90,9 +102,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -102,7 +114,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'"
>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
@ -160,7 +172,7 @@
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import ${entityName}Modal from './components/${entityName}Modal.vue'
import { columns, searchFormSchema, superQuerySchema } from './${entityName}.data';
import { columns, superQuerySchema } from './${entityName}.data';
import { list, deleteOne, batchDelete, getImportUrl,getExportUrl } from './${entityName}.api';
import { downloadFile } from '/@/utils/common/renderUtils';
<#include "/common/form/native/vue3NativeImport.ftl">
@ -179,7 +191,9 @@
import ${sub.entityName}List from './${sub.entityName}List.vue'
</#list>
import { useUserStore } from '/@/store/modules/user';
<#if is_range>
import { cloneDeep } from "lodash-es";
</#if>
const formRef = ref();
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
@ -199,8 +213,13 @@
width: 120,
fixed:'right'
},
beforeFetch: (params) => {
beforeFetch: async (params) => {
<#if is_range>
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
return Object.assign(params, queryParam);
</#if>
},
pagination: {
current: 1,
@ -292,6 +311,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
},
];
}
@ -310,8 +330,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1' || !record.bpmStatus){
@ -336,8 +357,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
},
];
</#if>
@ -351,7 +373,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -436,6 +458,32 @@
}
}
</#if>
<#if is_range>
let rangeField = '${getRangeField(columns)}'
/**
* 设置范围查询条件
*/
async function setRangeQuery(){
let queryParamClone = cloneDeep(queryParam);
if (rangeField) {
let fieldsValue = rangeField.split(',');
fieldsValue.forEach(item => {
if (queryParamClone[item]) {
let range = queryParamClone[item];
queryParamClone[item+'_begin'] = range[0];
queryParamClone[item+'_end'] = range[1];
delete queryParamClone[item];
} else {
queryParamClone[item+'_begin'] = '';
queryParamClone[item+'_end'] = '';
}
})
}
return queryParamClone;
}
</#if>
</script>
<style lang="less" scoped>
<#include "/common/form/native/vueNativeSearchStyle.ftl">

View File

@ -4,19 +4,19 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save= '/${entityPackage}/${entityName?uncap_first}/add',
edit= '/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save= '/${entityPackagePath}/${entityName?uncap_first}/add',
edit= '/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId',
${sub.entityName?uncap_first}Save= '/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}',
${sub.entityName?uncap_first}Edit= '/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}',
${sub.entityName?uncap_first}Delete = '/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}',
${sub.entityName?uncap_first}DeleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}',
${sub.entityName?uncap_first}List = '/${entityPackagePath}/${entityName?uncap_first}/list${sub.entityName}ByMainId',
${sub.entityName?uncap_first}Save= '/${entityPackagePath}/${entityName?uncap_first}/add${sub.entityName}',
${sub.entityName?uncap_first}Edit= '/${entityPackagePath}/${entityName?uncap_first}/edit${sub.entityName}',
${sub.entityName?uncap_first}Delete = '/${entityPackagePath}/${entityName?uncap_first}/delete${sub.entityName}',
${sub.entityName?uncap_first}DeleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch${sub.entityName}',
</#list>
}
/**
@ -130,10 +130,10 @@ export const ${sub.entityName?uncap_first}SaveOrUpdate = (params, isUpdate) =>
/**
* 导入
*/
export const ${sub.entityName?uncap_first}ImportUrl = '/${entityPackage}/${entityName?uncap_first}/import${sub.entityName}'
export const ${sub.entityName?uncap_first}ImportUrl = '/${entityPackagePath}/${entityName?uncap_first}/import${sub.entityName}'
/**
* 导出
*/
export const ${sub.entityName?uncap_first}ExportXlsUrl = '/${entityPackage}/${entityName?uncap_first}/export${sub.entityName}'
export const ${sub.entityName?uncap_first}ExportXlsUrl = '/${entityPackagePath}/${entityName?uncap_first}/export${sub.entityName}'
</#list>

View File

@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -121,7 +121,7 @@ export const ${sub.entityName?uncap_first}Columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',

View File

@ -87,6 +87,7 @@
useSearchForm: false,
actionColumn: {
width: 180,
fixed:'right'
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);

View File

@ -3,7 +3,7 @@
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="${entityName}Form">
<a-row>
<#assign need_category = false>
<#assign bpm_flag=false>
@ -14,6 +14,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -23,6 +24,7 @@
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign hasOnlyValidate = false>
<#assign need_range_number = false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
@ -38,6 +40,7 @@
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
<#assign hasOnlyValidate = true>
</#if>
<#assign formEntityName>${entityName}Form</#assign>
<#include "/common/form/native/vue3NativeForm.ftl">
</#list>
<#if bpm_flag>
@ -103,7 +106,7 @@
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
if(props.formBpm === true){
let params = {id: props.formData.dataId};
@ -151,8 +154,18 @@
* 提交数据
*/
async function submitForm() {
// 触发表单验证
await validate();
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//时间格式化

View File

@ -10,6 +10,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -18,6 +19,7 @@
<#assign need_image_upload = false>
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign need_range_number = false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
@ -31,7 +33,7 @@
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form class="antd-modal-form" v-bind="formItemLayout" ref="formRef">
<a-form class="antd-modal-form" v-bind="formItemLayout" ref="formRef" name="${sub.entityName}Form">
<a-row>
<#list sub.colums as po>
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
@ -40,6 +42,7 @@
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#assign formEntityName>${sub.entityName}</#assign>
<#include "/common/form/native/vue3NativeForm.ftl">
</#list>
</a-row>
@ -121,7 +124,18 @@
*/
async function submitForm() {
// 触发表单验证
await validate();
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//时间格式化

View File

@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.stream.Collectors;
import jakarta.servlet.http.HttpServletRequest;
@ -21,6 +22,7 @@ import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
@ -46,7 +48,12 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=false>
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
<#assign has_multi_query_field=true>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -55,7 +62,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
*/
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller {
@Autowired
@ -81,7 +88,19 @@ public class ${entityName}Controller {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
customeRuleMap.put("${po.fieldName}", QueryRuleEnum.LIKE_WITH_OR);
</#if>
</#list>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap(),customeRuleMap);
<#else>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -28,6 +30,7 @@ public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -63,7 +66,7 @@ public class ${entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -30,6 +32,7 @@ public class ${subTab.entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list subTab.originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -65,7 +68,7 @@ public class ${subTab.entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -14,6 +14,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
/**
* @Description: ${tableVo.ftlDescription}
@ -26,6 +28,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
public class ${entityName}Page {
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -38,6 +41,8 @@ public class ${entityName}Page {
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
<#elseif po.classType=='cat_tree'>
<#assign list_field_dictCode=', dictTable = "sys_category", dicText = "name", dicCode = "id"'>
</#if>
</#if>
/**${po.filedComment}*/
@ -58,10 +63,10 @@ public class ${entityName}Page {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
<#if list_field_dictCode?length gt 1>
<#if list_field_dictCode?length gt 1 && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Dict(${list_field_dictCode?substring(2)})
</#if>
</#if>
@ -69,6 +74,34 @@ public class ${entityName}Page {
@Schema(description = "${po.filedComment}")
<#if po.fieldDbType=='Blob'>
private java.lang.String ${po.fieldName}String;
<#elseif po.classType=='pca'>
@Excel(name = "${po.filedComment}", width = 15,exportConvert=true,importConvert = true )
private ${po.fieldType} ${po.fieldName};
public String convertis${po.fieldName?cap_first}() {
return SpringContextUtils.getBean(ProvinceCityArea.class).getText(${po.fieldName});
}
public void convertset${po.fieldName?cap_first}(String text) {
this.${po.fieldName} = SpringContextUtils.getBean(ProvinceCityArea.class).getCode(text);
}
<#elseif po.classType=='cat_tree'>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
private ${po.fieldType} ${po.fieldName};
<#elseif po.classType=='switch'>
<#assign switch_extend_arr=['Y','N']>
<#if po.dictField?default("")?contains("[")>
<#assign switch_extend_arr=po.dictField?eval>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
@Excel(name = "${po.filedComment}", width = 15,replace = {"是_${switch_extend_arr1}","否_${switch_extend_arr2}"} )
private ${po.fieldType} ${po.fieldName};
<#else>
private ${po.fieldType} ${po.fieldName};
</#if>
@ -76,7 +109,7 @@ public class ${entityName}Page {
<#list subTables as sub>
@ExcelCollection(name="${sub.ftlDescription}")
@Schema(description = "${sub.ftlDescription}")
@ApiModelProperty(value = "${sub.ftlDescription}")
private List<${sub.entityName}> ${sub.entityName?uncap_first}List;
</#list>

View File

@ -443,7 +443,7 @@
dictOptions: {},
// 展开的行test
expandedRowKeys: [],
<#assign urlPrefix="/${entityPackage}/${entityName?uncap_first}">
<#assign urlPrefix="/${entityPackagePath}/${entityName?uncap_first}">
url: {
list: '${urlPrefix}/list',
delete: '${urlPrefix}/delete',

View File

@ -373,11 +373,11 @@
},
</#list>
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}: {
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
list: '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
},
</#list>
}

View File

@ -104,7 +104,7 @@
</#list>
<#-- end 遍历表头 -->
],
<#assign urlPrefix="/${entityPackage}/${entityName?uncap_first}">
<#assign urlPrefix="/${entityPackagePath}/${entityName?uncap_first}">
url: {
listByMainId: '${urlPrefix}/query${sub.entityName}ByMainId',
},

View File

@ -35,9 +35,9 @@
<!-- 内嵌table区域 end -->
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -47,7 +47,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -257,6 +257,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
]
}
@ -269,7 +270,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -291,8 +292,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1' || !record.bpmStatus){
@ -316,8 +318,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -347,6 +350,6 @@
</#if>
</script>
<style scoped>
<style lang="less" scoped>
<#include "/common/form/vue3SearchStyle.ftl">
</style>

View File

@ -4,15 +4,15 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
${sub.entityName?uncap_first}List = '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
</#list>
}
/**

View File

@ -58,7 +58,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -106,6 +106,14 @@ export const searchFormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='switch'>
component: 'JSwitch',
componentProps:{
@ -116,6 +124,14 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='list_multi'>
component: 'JSelectMultiple',
componentProps:{
@ -152,9 +168,16 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JDictSelectTag',
component: 'JSelectMultiple',
componentProps:{
<#if po.dictTable?default("")?trim?length gt 1>
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
@ -272,8 +295,23 @@ export const formSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -294,8 +332,13 @@ export const formSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
@ -494,7 +537,7 @@ export const ${sub.entityName?uncap_first}Columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -565,8 +608,23 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -587,8 +645,13 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
@ -780,14 +843,6 @@ export const ${sub.entityName?uncap_first}JVxeColumns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='list' || col.classType =='radio'>
type: JVxeTypes.select,
options:[],
@ -822,11 +877,27 @@ export const ${sub.entityName?uncap_first}JVxeColumns: JVxeColumn[] = [
</#if>
<#elseif col.classType =='sel_depart'>
type: JVxeTypes.departSelect,
props:{
<#if col.extendParams?exists && col.extendParams.text?exists>
labelKey: '${col.extendParams.text}',
</#if>
<#if col.extendParams?exists && col.extendParams.store?exists>
rowKey: '${col.extendParams.store}',
</#if>
},
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='sel_user'>
type: JVxeTypes.userSelect,
props:{
<#if col.extendParams?exists && col.extendParams.text?exists>
labelKey: '${col.extendParams.text}',
</#if>
<#if col.extendParams?exists && col.extendParams.store?exists>
rowKey: '${col.extendParams.store}',
</#if>
},
<#if col.readonly=='Y'>
disabled:true,
</#if>
@ -867,6 +938,14 @@ export const ${sub.entityName?uncap_first}JVxeColumns: JVxeColumn[] = [
<#assign popupBackFields = "${col.dictText}">
</#if>
<#include "/common/form/vue3Jvxepopup.ftl">
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#else>
type: JVxeTypes.input,
<#if col.readonly=='Y'>

View File

@ -113,7 +113,7 @@
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
if(props.formBpm === true){
await reset();

View File

@ -1,7 +1,7 @@
<#include "/common/utils.ftl">
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" ref="formRef"/>
<BasicForm @register="registerForm" ref="formRef" name="${entityName}Form" />
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
<#list subTables as sub><#rt/>
@ -77,7 +77,9 @@
</#list>
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -157,6 +159,12 @@
if (e.error === VALIDATE_FAILED) {
// 如果有未通过表单验证的子表就自动跳转到它所在的tab
activeKey.value = e.index == null ? unref(activeKey) : refKeys.value[e.index]
if (e.errorFields) {
const firstField = e.errorFields[0];
if (firstField) {
e.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
} else {
console.error(e)
}

View File

@ -3,7 +3,7 @@
<#if sub.foreignRelationType=='1'>
#segment#${sub.entityName}Form.vue
<template>
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${sub.entityName}Form" class="basic-modal-form" />
</template>
<script lang="ts">
import {defineComponent} from 'vue';
@ -23,8 +23,10 @@
}
},
setup(props,{emit}) {
const [registerForm, {setProps, resetFields, setFieldsValue,getFieldsValue,validate}] = useForm({
//labelWidth: 150,
const [registerForm, { setProps, resetFields, setFieldsValue, getFieldsValue, validate, scrollToField }] = useForm({
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: ${sub.entityName?uncap_first}FormSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -62,8 +64,8 @@
// 验证子表表单
validate().then(()=>{
return resolve()
}).catch(()=> {
return reject({ error: VALIDATE_FAILED ,index})
}).catch(({ errorFields })=> {
return reject({ error: VALIDATE_FAILED ,index, errorFields: errorFields, scrollToField: scrollToField })
})
})
}
@ -77,5 +79,11 @@
}
})
</script>
<style lang="less" scoped>
.basic-modal-form {
overflow: auto;
height: 340px;
}
</style>
</#if>
</#list>

View File

@ -8,6 +8,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.HashMap;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@ -21,6 +22,7 @@ import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
@ -48,12 +50,19 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign bpm_flag=false>
<#assign has_multi_query_field=false>
<#list originalColumns as po>
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
</#list>
<#assign has_multi_query_field=false>
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
<#assign has_multi_query_field=true>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -62,7 +71,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
*/
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller {
@Autowired
@ -88,7 +97,19 @@ public class ${entityName}Controller {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
customeRuleMap.put("${po.fieldName}", QueryRuleEnum.LIKE_WITH_OR);
</#if>
</#list>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap(),customeRuleMap);
<#else>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -28,6 +30,7 @@ public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -63,7 +66,7 @@ public class ${entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -29,6 +31,7 @@ public class ${subTab.entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list subTab.originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -64,7 +67,7 @@ public class ${subTab.entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -14,6 +14,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
/**
* @Description: ${tableVo.ftlDescription}
@ -26,6 +28,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
public class ${entityName}Page {
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -39,6 +42,8 @@ public class ${entityName}Page {
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
<#elseif po.classType=='cat_tree'>
<#assign list_field_dictCode=', dictTable = "sys_category", dicText = "name", dicCode = "id"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>
@ -58,17 +63,45 @@ public class ${entityName}Page {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
<#if list_field_dictCode?length gt 1>
<#if list_field_dictCode?length gt 1 && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Dict(${list_field_dictCode?substring(2)})
</#if>
</#if>
@Schema(description = "${po.filedComment}")
<#if po.fieldDbType=='Blob'>
private java.lang.String ${po.fieldName}String;
<#elseif po.classType=='pca'>
@Excel(name = "${po.filedComment}", width = 15,exportConvert=true,importConvert = true )
private ${po.fieldType} ${po.fieldName};
public String convertis${po.fieldName?cap_first}() {
return SpringContextUtils.getBean(ProvinceCityArea.class).getText(${po.fieldName});
}
public void convertset${po.fieldName?cap_first}(String text) {
this.${po.fieldName} = SpringContextUtils.getBean(ProvinceCityArea.class).getCode(text);
}
<#elseif po.classType=='cat_tree'>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
private ${po.fieldType} ${po.fieldName};
<#elseif po.classType=='switch'>
<#assign switch_extend_arr=['Y','N']>
<#if po.dictField?default("")?contains("[")>
<#assign switch_extend_arr=po.dictField?eval>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
@Excel(name = "${po.filedComment}", width = 15,replace = {"是_${switch_extend_arr1}","否_${switch_extend_arr2}"} )
private ${po.fieldType} ${po.fieldName};
<#else>
private ${po.fieldType} ${po.fieldName};
</#if>

View File

@ -310,11 +310,11 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
list: "/${entityPackagePath}/${entityName?uncap_first}/list",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackagePath}/${entityName?uncap_first}/importExcel",
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
},
<#if bpm_flag>
@ -363,7 +363,7 @@
let params = {
flowCode: this.flowCode,
id: record.id,
formUrl: '${entityPackage}/modules/${entityName}Form',
formUrl: '${entityPackagePath}/modules/${entityName}Form',
formUrlMobile: ''
}
postAction(this.url.startProcess, params).then(res=>{

View File

@ -395,12 +395,12 @@
},
</#list>
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
queryById: "/${entityPackagePath}/${entityName?uncap_first}/queryById",
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}: {
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
list: '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
},
</#list>
}

View File

@ -21,9 +21,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -33,7 +33,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -230,6 +230,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
]
}
@ -242,7 +243,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -264,8 +265,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1' || !record.bpmStatus){
@ -289,8 +291,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -320,6 +323,6 @@
</#if>
</script>
<style scoped>
<style lang="less" scoped>
<#include "/common/form/vue3SearchStyle.ftl">
</style>

View File

@ -4,15 +4,15 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
${sub.entityName?uncap_first}List = '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
</#list>
}
/**

View File

@ -58,7 +58,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -106,6 +106,14 @@ export const searchFormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='switch'>
component: 'JSwitch',
componentProps:{
@ -116,6 +124,14 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='list_multi'>
component: 'JSelectMultiple',
componentProps:{
@ -152,9 +168,16 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JDictSelectTag',
component: 'JSelectMultiple',
componentProps:{
<#if po.dictTable?default("")?trim?length gt 1>
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
@ -272,8 +295,23 @@ export const formSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -294,8 +332,13 @@ export const formSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件------------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件------------- -->
componentProps:{
labelKey:'realname',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
@ -505,6 +548,13 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
<#elseif po.classType =='switch'>
@ -720,14 +770,6 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='list' || col.classType =='radio'>
type: JVxeTypes.select,
options:[],
@ -762,11 +804,27 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
</#if>
<#elseif col.classType =='sel_depart'>
type: JVxeTypes.departSelect,
props:{
<#if col.extendParams?exists && col.extendParams.text?exists>
labelKey: '${col.extendParams.text}',
</#if>
<#if col.extendParams?exists && col.extendParams.store?exists>
rowKey: '${col.extendParams.store}',
</#if>
},
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='sel_user'>
type: JVxeTypes.userSelect,
props:{
<#if col.extendParams?exists && col.extendParams.text?exists>
labelKey: '${col.extendParams.text}',
</#if>
<#if col.extendParams?exists && col.extendParams.store?exists>
rowKey: '${col.extendParams.store}',
</#if>
},
<#if col.readonly=='Y'>
disabled:true,
</#if>
@ -807,6 +865,14 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#assign popupBackFields = "${col.dictText}">
</#if>
<#include "/common/form/vue3Jvxepopup.ftl">
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#else>
type: JVxeTypes.input,
<#if col.readonly=='Y'>

View File

@ -154,7 +154,7 @@
await saveOrUpdate(values, true);
}
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});

View File

@ -1,7 +1,7 @@
<#include "/common/utils.ftl">
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" ref="formRef"/>
<BasicForm @register="registerForm" ref="formRef" name="${entityName}Form"/>
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
<#list subTables as sub><#rt/>
@ -77,7 +77,9 @@
</#list>
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -157,6 +159,12 @@
if (e.error === VALIDATE_FAILED) {
// 如果有未通过表单验证的子表就自动跳转到它所在的tab
activeKey.value = e.index == null ? unref(activeKey) : refKeys.value[e.index]
if (e.errorFields) {
const firstField = e.errorFields[0];
if (firstField) {
e.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
} else {
console.error(e)
}

View File

@ -3,7 +3,7 @@
<#if sub.foreignRelationType=='1'>
#segment#${sub.entityName}Form.vue
<template>
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${sub.entityName}Form" class="basic-modal-form"/>
</template>
<script lang="ts">
import {defineComponent} from 'vue';
@ -23,8 +23,10 @@
}
},
setup(props,{emit}) {
const [registerForm, {setProps, resetFields, setFieldsValue,getFieldsValue,validate}] = useForm({
//labelWidth: 150,
const [registerForm, { setProps, resetFields, setFieldsValue, getFieldsValue, validate, scrollToField }] = useForm({
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: ${sub.entityName?uncap_first}FormSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -60,9 +62,9 @@
// 验证子表表单
validate().then(()=>{
return resolve()
}).catch(()=> {
return reject({ error: VALIDATE_FAILED ,index})
})
}).catch(({ errorFields }) => {
return reject({ error: VALIDATE_FAILED, index, errorFields: errorFields, scrollToField: scrollToField });
});
})
}
return {
@ -75,5 +77,11 @@
}
})
</script>
<style lang="less" scoped>
.basic-modal-form {
overflow: auto;
height: 340px;
}
</style>
</#if>
</#list>

View File

@ -10,6 +10,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -20,6 +21,8 @@
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign query_flag = false>
<#assign need_range_number = false>
<#assign is_range = false>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
@ -56,12 +59,21 @@
<#if po.classType=='popup'>
<#assign need_popup = true>
</#if>
<#if po.classType=='popup_dict'>
<#assign need_popup_dict = true>
</#if>
<#if po.classType=='sel_tree'>
<#assign need_select_tree = true>
</#if>
<#if po.classType=='time'>
<#assign need_time = true>
</#if>
<#if po.queryMode!='single' && (po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal')>
<#assign need_range_number = true>
</#if>
<#if po.queryMode!='single'>
<#assign is_range = true>
</#if>
<#include "/common/form/native/vue3NativeSearch.ftl">
</#list>
<#if query_field_no gt 2>
@ -89,9 +101,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -101,7 +113,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -163,6 +175,9 @@
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
</#if>
<#if is_range>
import { cloneDeep } from "lodash-es";
</#if>
import { useUserStore } from '/@/store/modules/user';
const formRef = ref();
const queryParam = reactive<any>({});
@ -182,8 +197,13 @@
width: 120,
fixed:'right'
},
beforeFetch: (params) => {
beforeFetch: async (params) => {
<#if is_range>
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
return Object.assign(params, queryParam);
</#if>
},
},
exportConfig: {
@ -269,6 +289,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
]
}
@ -285,8 +306,9 @@
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
confirm: handleDelete.bind(null, record)
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1' || !record.bpmStatus){
@ -310,8 +332,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -325,7 +348,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -407,6 +430,32 @@
}
}
</#if>
<#if is_range>
let rangeField = '${getRangeField(columns)}'
/**
* 设置范围查询条件
*/
async function setRangeQuery(){
let queryParamClone = cloneDeep(queryParam);
if (rangeField) {
let fieldsValue = rangeField.split(',');
fieldsValue.forEach(item => {
if (queryParamClone[item]) {
let range = queryParamClone[item];
queryParamClone[item+'_begin'] = range[0];
queryParamClone[item+'_end'] = range[1];
delete queryParamClone[item];
} else {
queryParamClone[item+'_begin'] = '';
queryParamClone[item+'_end'] = '';
}
})
}
return queryParamClone;
}
</#if>
</script>
<style lang="less" scoped>
<#include "/common/form/native/vueNativeSearchStyle.ftl">

View File

@ -4,16 +4,16 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
queryDataById = '/${entityPackage}/${entityName?uncap_first}/queryById',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
queryDataById = '/${entityPackagePath}/${entityName?uncap_first}/queryById',
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
${sub.entityName?uncap_first}List = '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
</#list>
}
/**

View File

@ -58,7 +58,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -115,14 +115,6 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='list' || col.classType =='radio'>
type: JVxeTypes.select,
options:[],
@ -202,6 +194,14 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#assign popupBackFields = "${col.dictText}">
</#if>
<#include "/common/form/vue3Jvxepopup.ftl">
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#else>
type: JVxeTypes.input,
<#if col.readonly=='Y'>

View File

@ -8,6 +8,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -16,6 +17,7 @@
<#assign need_image_upload = false>
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign need_range_number = false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
@ -33,7 +35,7 @@
<a-spin :spinning="loading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form v-bind="formItemLayout">
<a-form v-bind="formItemLayout" name="${entityName}Form" ref="formRef">
<a-row>
<#list columns as po>
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
@ -42,6 +44,7 @@
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#assign formEntityName>${entityName}Form</#assign>
<#include "/common/form/native/vue3NativeForm.ftl">
</#list>
</a-row>
@ -135,6 +138,7 @@
emits:['success'],
setup(props, {emit}) {
const loading = ref(false);
const formRef = ref();
<#list subTables as sub>
<#if sub_index == 0>
<#assign subTabActiveKey = '${sub.entityName?uncap_first}'>
@ -188,7 +192,7 @@
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
if(props.formBpm === true){
let params = {id: props.formData.dataId};
@ -247,6 +251,7 @@
async function queryMainData(id) {
const row = await queryDataById(id);
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(row.hasOwnProperty(key)){
@ -268,7 +273,18 @@
});
async function getFormData() {
await validate();
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
return transformData(toRaw(formData))
}
@ -332,7 +348,8 @@
getFormData,
submitForm,
add,
edit
edit,
formRef,
}
}
});

View File

@ -12,6 +12,7 @@
<#assign need_dept = false>
<#assign need_multi = false>
<#assign need_popup = false>
<#assign need_popup_dict = false>
<#assign need_select_tag = false>
<#assign need_select_tree = false>
<#assign need_time = false>
@ -20,6 +21,7 @@
<#assign need_image_upload = false>
<#assign need_editor = false>
<#assign need_checkbox = false>
<#assign need_range_number = false>
<#assign form_span = 24>
<#if tableVo.fieldRowNum==2>
<#assign form_span = 12>
@ -33,7 +35,7 @@
<a-spin :spinning="loading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form v-bind="formItemLayout">
<a-form v-bind="formItemLayout" name="${sub.entityName}Form" ref="formRef" class="antd-modal-form">
<a-row>
<#list sub.colums as po>
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
@ -42,6 +44,7 @@
<#if po.fieldDbName=='bpm_status'>
<#assign bpm_flag=true>
</#if>
<#assign formEntityName>${sub.entityName}Form</#assign>
<#include "/common/form/native/vue3NativeForm.ftl">
</#list>
</a-row>
@ -79,6 +82,7 @@
const { createMessage } = useMessage();
const isForm = true;
const loading = ref(false);
const formRef = ref();
const formData = reactive<Record<string, any>>({
id: '',
<#include "/common/init/native/vue3NativeSubInitValue.ftl">
@ -116,7 +120,18 @@
}
async function getFormData() {
await validate();
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
let subFormData = toRaw(formData);
if(Object.keys(subFormData).length>0){
return subFormData
@ -158,10 +173,17 @@
setFieldsValue,
handleFormChange,
isForm,
validateInfos
validateInfos,
formRef,
}
}
});
</script>
<style lang="less" scoped>
.antd-modal-form {
max-height: 340px;
overflow: auto;
}
</style>
</#if>
</#list>

View File

@ -8,6 +8,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.HashMap;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@ -21,6 +22,7 @@ import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
<#list subTables as sub>
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
@ -46,7 +48,12 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=false>
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
<#assign has_multi_query_field=true>
</#if>
</#list>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -55,7 +62,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
*/
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@Slf4j
public class ${entityName}Controller {
@Autowired
@ -81,7 +88,19 @@ public class ${entityName}Controller {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
<#list originalColumns as po>
<#if po.isQuery=='Y' && (po.classType=='list' || po.classType=='list_multi' || po.classType=='radio' || po.classType=='checkbox')>
customeRuleMap.put("${po.fieldName}", QueryRuleEnum.LIKE_WITH_OR);
</#if>
</#list>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap(),customeRuleMap);
<#else>
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -28,6 +30,7 @@ public class ${entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -63,7 +66,7 @@ public class ${entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -29,6 +31,7 @@ public class ${subTab.entityName} implements Serializable {
private static final long serialVersionUID = 1L;
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list subTab.originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -64,7 +67,7 @@ public class ${subTab.entityName} implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>

View File

@ -13,6 +13,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import io.swagger.v3.oas.annotations.media.Schema;
/**
@ -26,6 +28,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
public class ${entityName}Page {
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
<#assign excel_ignore_classType_arr=['pca','switch','cat_tree']>
<#list originalColumns as po>
<#-- 生成字典Code -->
<#assign list_field_dictCode="">
@ -38,6 +41,8 @@ public class ${entityName}Page {
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
<#elseif po.dictField?default("")?trim?length gt 1>
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
<#elseif po.classType=='cat_tree'>
<#assign list_field_dictCode=', dictTable = "sys_category", dicText = "name", dicCode = "id"'>
</#if>
</#if>
/**${po.filedComment}*/
@ -58,17 +63,45 @@ public class ${entityName}Page {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
</#if>
<#else>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
<#if !excel_ignore_arr?seq_contains("${po.fieldName}") && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
</#if>
</#if>
<#if list_field_dictCode?length gt 1>
<#if list_field_dictCode?length gt 1 && !excel_ignore_classType_arr?seq_contains("${po.classType}")>
@Dict(${list_field_dictCode?substring(2)})
</#if>
</#if>
@Schema(description = "${po.filedComment}")
<#if po.fieldDbType=='Blob'>
private java.lang.String ${po.fieldName}String;
<#elseif po.classType=='pca'>
@Excel(name = "${po.filedComment}", width = 15,exportConvert=true,importConvert = true )
private ${po.fieldType} ${po.fieldName};
public String convertis${po.fieldName?cap_first}() {
return SpringContextUtils.getBean(ProvinceCityArea.class).getText(${po.fieldName});
}
public void convertset${po.fieldName?cap_first}(String text) {
this.${po.fieldName} = SpringContextUtils.getBean(ProvinceCityArea.class).getCode(text);
}
<#elseif po.classType=='cat_tree'>
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
private ${po.fieldType} ${po.fieldName};
<#elseif po.classType=='switch'>
<#assign switch_extend_arr=['Y','N']>
<#if po.dictField?default("")?contains("[")>
<#assign switch_extend_arr=po.dictField?eval>
</#if>
<#list switch_extend_arr as a>
<#if a_index == 0>
<#assign switch_extend_arr1=a>
<#else>
<#assign switch_extend_arr2=a>
</#if>
</#list>
@Excel(name = "${po.filedComment}", width = 15,replace = {"是_${switch_extend_arr1}","否_${switch_extend_arr2}"} )
private ${po.fieldType} ${po.fieldName};
<#else>
private ${po.fieldType} ${po.fieldName};
</#if>

View File

@ -294,11 +294,11 @@
}
],
url: {
list: "/${entityPackage}/${entityName?uncap_first}/list",
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
list: "/${entityPackagePath}/${entityName?uncap_first}/list",
delete: "/${entityPackagePath}/${entityName?uncap_first}/delete",
deleteBatch: "/${entityPackagePath}/${entityName?uncap_first}/deleteBatch",
exportXlsUrl: "/${entityPackagePath}/${entityName?uncap_first}/exportXls",
importExcelUrl: "${entityPackagePath}/${entityName?uncap_first}/importExcel",
},
dictOptions:{},
superFieldList:[],

View File

@ -377,14 +377,14 @@ export default {
},
</#list>
url: {
add: "/${entityPackage}/${entityName?uncap_first}/add",
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
add: "/${entityPackagePath}/${entityName?uncap_first}/add",
edit: "/${entityPackagePath}/${entityName?uncap_first}/edit",
${tableVo.entityName?uncap_first}: {
list: '/${entityPackage}/${entityName?uncap_first}/queryById'
list: '/${entityPackagePath}/${entityName?uncap_first}/queryById'
},
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}: {
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
list: '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
},
</#list>
}

View File

@ -21,9 +21,9 @@
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'${entityPackage}:${tableName}:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -33,7 +33,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<a-button v-auth="'${entityPackage}:${tableName}:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
@ -229,6 +229,7 @@
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: '${entityPackage}:${tableName}:edit'
}
]
}
@ -241,7 +242,7 @@
let params = {
flowCode: 'dev_${tableName}_001',
id: record.id,
formUrl: '${entityPackage}/components/${entityName}Form',
formUrl: '${entityPackagePath}/components/${entityName}Form',
formUrlMobile: ''
}
await startProcess(params);
@ -263,8 +264,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
];
if(record.bpmStatus == '1' || !record.bpmStatus){
@ -288,8 +290,9 @@
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
]
</#if>
@ -319,6 +322,6 @@
</#if>
</script>
<style scoped>
<style lang="less" scoped>
<#include "/common/form/vue3SearchStyle.ftl">
</style>

View File

@ -4,15 +4,15 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/${entityPackage}/${entityName?uncap_first}/list',
save='/${entityPackage}/${entityName?uncap_first}/add',
edit='/${entityPackage}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
list = '/${entityPackagePath}/${entityName?uncap_first}/list',
save='/${entityPackagePath}/${entityName?uncap_first}/add',
edit='/${entityPackagePath}/${entityName?uncap_first}/edit',
deleteOne = '/${entityPackagePath}/${entityName?uncap_first}/delete',
deleteBatch = '/${entityPackagePath}/${entityName?uncap_first}/deleteBatch',
importExcel = '/${entityPackagePath}/${entityName?uncap_first}/importExcel',
exportXls = '/${entityPackagePath}/${entityName?uncap_first}/exportXls',
<#list subTables as sub><#rt/>
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
${sub.entityName?uncap_first}List = '/${entityPackagePath}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
</#list>
}
/**

View File

@ -58,7 +58,7 @@ export const columns: BasicColumn[] = [
customRender:({text}) => {
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
},
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user' || po.classType=='popup_dict'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -106,6 +106,14 @@ export const searchFormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='switch'>
component: 'JSwitch',
componentProps:{
@ -116,6 +124,14 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType=='list_multi'>
component: 'JSelectMultiple',
componentProps:{
@ -152,9 +168,16 @@ export const searchFormSchema: FormSchema[] = [
},
<#elseif po.classType=='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JDictSelectTag',
component: 'JSelectMultiple',
componentProps:{
<#if po.dictTable?default("")?trim?length gt 1>
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
@ -272,8 +295,23 @@ export const formSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -294,8 +332,13 @@ export const formSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
@ -505,8 +548,23 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
},
<#elseif po.classType =='popup'>
<#include "/common/form/vue3popup.ftl">
<#elseif po.classType=='popup_dict'>
component: 'JPopupDict',
componentProps: {
placeholder: '请选择${po.filedComment}',
dictCode: '${po.dictTable},${po.dictText},${po.dictField}',
multi: ${po.extendParams.popupMulti?c}
},
<#elseif po.classType =='sel_depart'>
component: 'JSelectDept',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='switch'>
component: 'JSwitch',
componentProps:{
@ -527,8 +585,13 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
<#-- update-begin---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
component: 'JSelectUser',
<#-- update-end---author:chenrui ---date:20240102 for[issue/#5711]修复用户选择组件在生成代码后变成部门用户选择组件---------- -->
componentProps:{
labelKey:'realname',
componentProps:{
<#if po.extendParams?exists && po.extendParams.text?exists>
labelKey: '${po.extendParams.text}',
</#if>
<#if po.extendParams?exists && po.extendParams.store?exists>
rowKey: '${po.extendParams.store}',
</#if>
},
<#elseif po.classType =='textarea'>
component: 'InputTextArea',
@ -720,14 +783,6 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='list' || col.classType =='radio'>
type: JVxeTypes.select,
options:[],
@ -762,11 +817,27 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
</#if>
<#elseif col.classType =='sel_depart'>
type: JVxeTypes.departSelect,
props:{
<#if col.extendParams?exists && col.extendParams.text?exists>
labelKey: '${col.extendParams.text}',
</#if>
<#if col.extendParams?exists && col.extendParams.store?exists>
rowKey: '${col.extendParams.store}',
</#if>
},
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#elseif col.classType =='sel_user'>
type: JVxeTypes.userSelect,
props:{
<#if col.extendParams?exists && col.extendParams.text?exists>
labelKey: '${col.extendParams.text}',
</#if>
<#if col.extendParams?exists && col.extendParams.store?exists>
rowKey: '${col.extendParams.store}',
</#if>
},
<#if col.readonly=='Y'>
disabled:true,
</#if>
@ -807,6 +878,14 @@ export const ${sub.entityName?uncap_first}Columns: JVxeColumn[] = [
<#assign popupBackFields = "${col.dictText}">
</#if>
<#include "/common/form/vue3Jvxepopup.ftl">
<#-- update-begin-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
<#-- elseif "int,decimal,double,"?contains(col.classType) -->
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
<#-- update-end-author:taoyan date:20220523 for: VUEN-1084 【vue3】online表单测试发现的新问题 20、一对多列字段类型生成的不对数字或者金额类型 -->
type: JVxeTypes.inputNumber,
<#if col.readonly=='Y'>
disabled:true,
</#if>
<#else>
type: JVxeTypes.input,
<#if col.readonly=='Y'>

View File

@ -116,7 +116,7 @@
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/${entityPackage}/${entityName?uncap_first}/queryById';
const queryByIdUrl = '/${entityPackagePath}/${entityName?uncap_first}/queryById';
async function initFormData(){
if(props.formBpm === true){
await reset();

View File

@ -17,7 +17,7 @@
<!--表单区域 -->
<div class="contentArea">
<!--主表区域 -->
<BasicForm @register="registerForm" ref="formRef" v-show="activeKey == refKeys[0]"/>
<BasicForm @register="registerForm" ref="formRef" v-show="activeKey == refKeys[0]" name="${entityName}Form"/>
<!--子表区域 -->
<#list subTables as sub><#rt/>
<#assign refKey = sub.entityName?uncap_first/>
@ -95,7 +95,9 @@
</#list>
//表单配置
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
//labelWidth: 150,
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -192,6 +194,12 @@
if (e.error === VALIDATE_FAILED) {
// 如果有未通过表单验证的子表就自动跳转到它所在的tab
activeKey.value = e.index == null ? unref(activeKey) : refKeys.value[e.index]
if (e.errorFields) {
const firstField = e.errorFields[0];
if (firstField) {
e.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
} else {
console.error(e)
}

View File

@ -3,7 +3,7 @@
<#if sub.foreignRelationType=='1'>
#segment#${sub.entityName}Form.vue
<template>
<BasicForm @register="registerForm"/>
<BasicForm @register="registerForm" name="${sub.entityName}Form" class="basic-modal-form" />
</template>
<script lang="ts">
import {defineComponent} from 'vue';
@ -23,8 +23,10 @@
}
},
setup(props,{emit}) {
const [registerForm, {setProps, resetFields, setFieldsValue,getFieldsValue,validate}] = useForm({
//labelWidth: 150,
const [registerForm, { setProps, resetFields, setFieldsValue, getFieldsValue, validate, scrollToField }] = useForm({
<#if tableVo.fieldRowNum == 1>
labelWidth: 150,
</#if>
schemas: ${sub.entityName?uncap_first}FormSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
@ -60,9 +62,9 @@
// 验证子表表单
validate().then(()=>{
return resolve()
}).catch(()=> {
return reject({ error: VALIDATE_FAILED ,index})
})
}).catch(({ errorFields }) => {
return reject({ error: VALIDATE_FAILED , index, errorFields: errorFields, scrollToField: scrollToField });
});
})
}
return {
@ -75,5 +77,11 @@
}
})
</script>
<style lang="less" scoped>
.basic-modal-form {
overflow: auto;
height: 340px;
}
</style>
</#if>
</#list>