【v3.8.3】升级代码生成器模板

pull/8786/merge
JEECG 2025-09-14 10:43:00 +08:00
parent 7abc2e4c9c
commit d728d6b090
27 changed files with 76 additions and 36 deletions

View File

@ -1,4 +1,4 @@
<#include "../utils.ftl">
<#include "/common/utils.ftl">
<#if po.isShow == 'Y' && poHasCheck(po)>
<#if po.fieldName != 'id'>
${po.fieldName}: [

View File

@ -1,4 +1,4 @@
<#include "../../utils.ftl">
<#include "/common/utils.ftl">
<#list columns as po>
<#if po.isShow == 'Y' && poHasCheck(po)>
${po.fieldName}: [<#include "vue3CoreNative.ftl">],

View File

@ -1,4 +1,4 @@
<#include "../utils.ftl">
<#include "/common/utils.ftl">
<#if col.isShow == 'Y' && poHasCheck(col)>
validateRules: [
<#if col.fieldName != 'id'>

View File

@ -1,4 +1,3 @@
<#--<#include "../../../../../../../common/utils.ftl">-->
<#include "/common/utils.ftl">
<template>
<a-spin :spinning="confirmLoading">

View File

@ -1,4 +1,3 @@
<#--<#include "../../../../../../../common/utils.ftl">-->
<#include "/common/utils.ftl">
<#assign modal_width = 800>
<#if tableVo.fieldRowNum==2>

View File

@ -4,7 +4,7 @@
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" name="${entityName}Form" />
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
@ -38,7 +38,8 @@
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
baseRowStyle: { padding: "0 20px" }
});
//表单赋值
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {

View File

@ -251,6 +251,6 @@
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
padding: 14px 20px;
}
</style>

View File

@ -1,9 +1,10 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<j-modal :title="title" maxHeight="500px" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<${entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${entityName}Form>
<template #footer>
<#if buttonList?? && buttonList?size gt 0>

View File

@ -177,7 +177,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
*/
private ${entityName} getTreeRoot(String pidVal){
${entityName} data = baseMapper.selectById(pidVal);
if(data != null && !I${entityName}Service.ROOT_PID_VALUE.equals(data.get${pidFieldName?cap_first}())){
if(data != null && !I${entityName}Service.ROOT_PID_VALUE.equals(data.get${pidFieldName?cap_first}()) && !data.get${pidFieldName?cap_first}().equals(data.getId())){
return this.getTreeRoot(data.get${pidFieldName?cap_first}());
}else{
return data;

View File

@ -14,7 +14,7 @@
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :title="getTitle" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :title="getTitle" @ok="handleSubmit">
<BasicForm @register="registerForm" name="${entityName}Form" />
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
@ -65,6 +65,7 @@
xs: { span: 24 },
sm: { span: 18 },
},
baseRowStyle: { padding: "0 20px" }
});
//表单赋值
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
@ -80,8 +81,20 @@
await setFieldsValue({
...data.record,
});
updateSchema([
{
field: '${pidFieldName}',
componentProps: { hiddenNodeKey: data.record.id },
},
]);
} else {
model = null;
updateSchema([
{
field: '${pidFieldName}',
componentProps: { hiddenNodeKey: '' },
},
]);
}
//父级节点树信息
treeData.value = await loadTreeData({'async': false,'pcode':''});

View File

@ -54,6 +54,7 @@
pidField="${tableVo.extendParams.pidField}"
pidValue="0"
hasChildField="${tableVo.extendParams.hasChildren}"
:hiddenNodeKey="hiddenNodeKey"
<#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>>
</j-tree-select>
</a-form-item>
@ -106,6 +107,8 @@
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//需要隐藏的key
const hiddenNodeKey = ref<string>('');
//表单验证
const validatorRules = reactive({
<#include "/common/validatorRulesTemplate/native/vue3MainNative.ftl">
@ -186,6 +189,11 @@
})
//赋值
Object.assign(formData,tmpData);
if(tmpData.id) {
hiddenNodeKey.value = tmpData.id;
} else {
hiddenNodeKey.value = "";
}
model = tmpData
});
}
@ -303,6 +311,6 @@
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
padding: 14px 20px;
}
</style>

View File

@ -1,9 +1,10 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<j-modal :title="title" maxHeight="500px" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<${entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${entityName}Form>
<template #footer>
<#if buttonList?? && buttonList?size gt 0>

View File

@ -154,6 +154,7 @@
api: list,
columns,
canResize: true,
maxHeight: 300,
clickToRowSelect: true,
rowSelection: {type: 'radio'},
formConfig: {

View File

@ -4,7 +4,7 @@
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" name="${entityName}Form" />
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
@ -46,7 +46,8 @@
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
baseRowStyle: { padding: "0 20px" }
});
//表单赋值
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {

View File

@ -2,7 +2,7 @@
<#list subTables as sub>
#segment#${sub.entityName}Modal.vue
<template>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" name="${sub.entityName}Form" />
</BasicModal>
</template>
@ -36,7 +36,8 @@
</#if>
schemas: ${sub.entityName?uncap_first}FormSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
baseRowStyle: { padding: "0 20px" }
});
//表单赋值
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {

View File

@ -243,6 +243,7 @@
api: list,
columns,
canResize:true,
maxHeight: 300,
useSearchForm: false,
clickToRowSelect: true,
rowSelection: {type: 'radio'},

View File

@ -1,9 +1,10 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<j-modal :title="title" maxHeight="500px" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<${entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${entityName}Form>
<template #footer>
<#if buttonList?? && buttonList?size gt 0>

View File

@ -222,7 +222,7 @@
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
padding: 14px 20px;
}
</style>
</#list>

View File

@ -2,7 +2,7 @@
<#list subTables as sub>
#segment#${sub.entityName}Modal.vue
<template>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<j-modal :title="title" maxHeight="500px" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<${sub.entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${sub.entityName}Form>
</j-modal>
</template>

View File

@ -1,7 +1,6 @@
<#-- noinspection JSDuplicatedDeclaration,RequiredAttributes,NpmUsedModulesInstalled -->
<#-- ** 引入全局工具方法 ** -->
<#--<#include "/common/utils.ftl">-->
<#include "../../../../../../common/utils.ftl">
<#include "/common/utils.ftl">
<#-- ** 定义全局使用的变量 ** -->
<#-- 是否有查询条件 -->
<#assign query_flag=false>

View File

@ -1,6 +1,5 @@
<#-- ** 引入全局工具方法 ** -->
<#--<#include "/common/utils.ftl">-->
<#include "../../../../../../common/utils.ftl">
<#include "/common/utils.ftl">
<template>
<div>
<#assign list_need_category=false>

View File

@ -4,10 +4,10 @@
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" ref="formRef" name="${entityName}Form" />
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs" class="jeecg-tab">
<#list subTables as sub><#rt/>
<#assign refKey = sub.entityName?uncap_first/>
<#if sub.foreignRelationType =='1'>
@ -118,7 +118,8 @@
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
baseRowStyle: { padding: "0 20px"}
});
//表单赋值
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
@ -271,4 +272,8 @@
:deep(.ant-calendar-picker) {
width: 100%;
}
.jeecg-tab {
padding: 0 20px;
}
</style>

View File

@ -4,10 +4,10 @@
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicForm @register="registerForm" ref="formRef" name="${entityName}Form"/>
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
<a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs" class="jeecg-tab">
<#list subTables as sub><#rt/>
<#assign refKey = sub.entityName?uncap_first/>
<#if sub.foreignRelationType =='1'>
@ -106,7 +106,8 @@
const ${sub.entityName?uncap_first}Table = reactive({
loading: false,
dataSource: [],
columns:${sub.entityName?uncap_first}Columns
columns:${sub.entityName?uncap_first}Columns,
baseRowStyle: { padding: "0 20px"}
})
</#if>
</#list>
@ -117,7 +118,8 @@
</#if>
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
baseRowStyle: { padding: "0 20px" }
});
//表单赋值
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
@ -270,4 +272,8 @@
:deep(.ant-calendar-picker) {
width: 100%;
}
.jeecg-tab {
padding: 0 20px;
}
</style>

View File

@ -36,7 +36,7 @@
<a-spin :spinning="loading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form v-bind="formItemLayout" name="${entityName}Form" ref="formRef">
<a-form v-bind="formItemLayout" name="${entityName}Form" ref="formRef" class="jeecg-native-form">
<a-row>
<#list columns as po>
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
@ -54,7 +54,7 @@
</JFormContainer>
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated style="overflow:hidden;">
<a-tabs v-model:activeKey="activeKey" animated style="overflow:hidden;" class="jeecg-native-tab">
<#list subTables as sub><#rt/>
<#if sub.foreignRelationType =='1'>
<a-tab-pane class="sub-one-form" tab="${sub.ftlDescription}" key="${sub.entityName?uncap_first}" :forceRender="true">
@ -408,4 +408,8 @@
max-height: 340px;
overflow: auto;
}
.jeecg-native-form,
.jeecg-native-tab {
padding: 0 20px;
}
</style>

View File

@ -4,7 +4,7 @@
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" maxHeight="500px" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<${Format.humpToShortbar(entityName)}-form ref="formComponent" :formDisabled="formDisabled" :formBpm="false" @success="submitSuccess"></${Format.humpToShortbar(entityName)}-form>
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>

View File

@ -4,7 +4,7 @@
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<BasicModal ref="modalRef" destroyOnClose wrapClassName="j-cgform-tab-modal" v-bind="$attrs" @register="registerModal" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<BasicModal ref="modalRef" destroyOnClose wrapClassName="j-cgform-tab-modal" v-bind="$attrs" @register="registerModal" :maxHeight="500" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @ok="handleSubmit">
<!-- 标题区域 -->
<template #title>
<div class="titleArea">