【合并升级v3.8.1】

Merge remote-tracking branch 'origin/master' into springboot3

# Conflicts:
#	jeecg-boot/README.md
#	jeecg-boot/db/tables_nacos.sql
#	jeecg-boot/jeecg-boot-base-core/pom.xml
#	jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java
#	jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/encryption/AesEncryptUtil.java
#	jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebMvcConfiguration.java
#	jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/pom.xml
#	jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/controller/AiragAppController.java
#	jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/monitor/actuator/httptrace/CustomInMemoryHttpTraceRepository.java
#	jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/service/impl/OpenApiPermissionServiceImpl.java
#	jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleIndexController.java
#	jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
#	jeecg-boot/jeecg-module-system/jeecg-system-start/pom.xml
#	jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml
#	jeecg-boot/jeecg-server-cloud/jeecg-system-cloud-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java
#	jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-sentinel/pom.xml
#	jeecg-boot/pom.xml
#	jeecgboot-vue3/pnpm-lock.yaml
This commit is contained in:
JEECG
2025-07-08 16:33:51 +08:00
370 changed files with 12841 additions and 5591 deletions

View File

@ -48,7 +48,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=true>
</#if>
</#list>
<#assign enhanceJavaList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.enhanceJavaList??>
<#assign enhanceJavaList = tableVo.extendParams.enhanceJavaList?filter(enhance -> enhance??)>
</#if>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -79,6 +82,16 @@ 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) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 查询前触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeQuery()
</#if>
</#list>
</#if>
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
@ -94,6 +107,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 查询后触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterQuery()
</#if>
</#list>
</#if>
return Result.OK(pageList);
}
@ -108,10 +129,27 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 新增前的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeAdd()
</#if>
</#list>
</#if>
<#if bpm_flag>
${entityName?uncap_first}.setBpmStatus("1");
</#if>
${entityName?uncap_first}Service.save(${entityName?uncap_first});
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 新增后的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterAdd()
</#if>
</#list>
</#if>
return Result.OK("添加成功!");
}
@ -126,7 +164,23 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 编辑前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeEdit()
</#if>
</#list>
</#if>
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 编辑后,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterEdit()
</#if>
</#list>
</#if>
return Result.OK("编辑成功!");
}
@ -186,6 +240,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='export' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导出前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeExport()
</#if>
</#list>
</#if>
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
@ -199,6 +261,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='import' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导入前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeImport()
</#if>
</#list>
</#if>
return super.importExcel(request, response, ${entityName}.class);
}

View File

@ -51,6 +51,8 @@ public class ${entityName} implements Serializable {
</#if>
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -8,8 +8,8 @@ navigationBarTitleText: '${tableVo.ftlDescription}',
},
}
</route>
<template>
<#assign onlyFields = []>
<PageLayout :navTitle="navTitle" :backRouteName="backRouteName">
<scroll-view class="scrollArea" scroll-y>
<view class="form-container">
@ -49,19 +49,11 @@ navigationBarTitleText: '${tableVo.ftlDescription}',
:required="true"
</#if>
>
<!-- #ifndef APP-PLUS -->
<online-file
v-model:value="myFormData[${autoStringSuffix(po)}]"
name=${autoStringSuffix(po)}
></online-file>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<online-file-custom
v-model:value="myFormData[${autoStringSuffix(po)}]"
name=${autoStringSuffix(po)}
></online-file-custom>
<!-- #endif -->
</wd-cell>
<#elseif po.classType =='datetime' || po.classType =='time'>
<DateTime
@ -166,6 +158,15 @@ navigationBarTitleText: '${tableVo.ftlDescription}',
clearable
v-model="myFormData[${autoStringSuffix(po)}]"
></wd-input>
<#elseif po.classType =='pca'>
<online-pca
:label="get4Label('${po.filedComment}')"
labelWidth="100px"
name=${autoStringSuffix(po)}
prop=${autoStringSuffix(po)}
clearable
v-model:value="myFormData[${autoStringSuffix(po)}]"
></online-pca>
<#elseif po.classType =='popup_dict'>
<PopupDict
labelWidth="100px"
@ -291,9 +292,12 @@ navigationBarTitleText: '${tableVo.ftlDescription}',
<#-- 金额 -->
<#elseif fieldValidType == 'money'>
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
<#-- 唯一校验 -->
<#elseif fieldValidType != '' && fieldValidType == 'only'>
<#assign onlyFields = onlyFields + [autoStringSuffix(po)]>
<#-- 正则校验 -->
<#elseif fieldValidType != '' && fieldValidType != '*'>
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
{ pattern: /${fieldValidType}/, message: '不符合校验规则!'},
<#-- 无校验 -->
<#else>
<#t>
@ -352,9 +356,12 @@ navigationBarTitleText: '${tableVo.ftlDescription}',
<#-- 金额 -->
<#elseif fieldValidType == 'money'>
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
<#-- 唯一校验 -->
<#elseif fieldValidType != '' && fieldValidType == 'only'>
<#assign onlyFields = onlyFields + [autoStringSuffix(po)]>
<#-- 正则校验 -->
<#elseif fieldValidType != '' && fieldValidType != '*'>
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
{ pattern: /${fieldValidType}/, message: '不符合校验规则!'},
<#-- 无校验 -->
<#else>
<#t>
@ -393,8 +400,10 @@ import OnlineRadio from '@/components/online/view/online-radio.vue'
import OnlineCheckbox from '@/components/online/view/online-checkbox.vue'
import OnlineMulti from '@/components/online/view/online-multi.vue'
import OnlinePopupLinkRecord from '@/components/online/view/online-popup-link-record.vue'
import OnlinePca from '@/components/online/view/online-pca.vue'
import SelectDept from '@/components/SelectDept/SelectDept.vue'
import SelectUser from '@/components/SelectUser/SelectUser.vue'
import {duplicateCheck} from "@/service/api";
defineOptions({
name: '${entityName}Form',
options: {
@ -434,8 +443,40 @@ const handleSuccess = () => {
uni.$emit('refreshList');
router.back()
}
/**
* 校验唯一
* @param values
* @returns {boolean}
*/
async function fieldCheck(values: any) {
const onlyField = [
<#list onlyFields as field>
${field}<#sep>, </#sep>
</#list>
];
for (const field of onlyField) {
if (values[field]) {
// 仅校验有值的字段
const res: any = await duplicateCheck({
tableName: '${tableName}',
fieldName: field, // 使用处理后的字段名
fieldVal: values[field],
dataId: values.id,
});
if (!res.success) {
toast.warning(res.message);
return true; // 校验失败
}
}
}
return false; // 校验通过
}
// 提交表单
const handleSubmit = () => {
const handleSubmit = async () => {
// 判断字段必填和正则
if (await fieldCheck(myFormData)) {
return
}
let url = dataId.value?'/${entityPackagePath}/${entityName?uncap_first}/edit':'/${entityPackagePath}/${entityName?uncap_first}/add';
form.value
.validate()
@ -509,4 +550,11 @@ onLoad((option) => {
padding-bottom: calc(constant(safe-area-inset-bottom) + 10px);
padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
}
:deep(.wd-cell__label) {
font-size: 14px;
color: #444;
}
:deep(.wd-cell__value) {
text-align: left;
}
</style>

View File

@ -20,6 +20,10 @@
<#assign list_need_pca=true>
</#if>
</#list>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#-- 结束循环 -->
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
@ -28,6 +32,14 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -75,6 +87,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -88,6 +104,7 @@
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
<#if list_need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
</#if>
@ -100,12 +117,23 @@
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
const { createMessage } = useMessage();
//注册model
const [registerModal, {openModal}] = useModal();
//注册table数据
@ -114,7 +142,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
@ -152,6 +180,13 @@
fixed:'right'
},
beforeFetch: (params) => {
if (params && fieldPickers) {
for (let key in fieldPickers) {
if (params[key]) {
params[key] = getDateByPicker(params[key], fieldPickers[key]);
}
}
}
return Object.assign(params, queryParam);
},
<#if list_has_popup_dict>
@ -261,7 +296,22 @@
placement: 'topLeft',
},
auth: '${entityPackage}:${tableName}:delete'
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1'){
dropDownAction.push({
@ -288,6 +338,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -306,8 +366,32 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
<#if list_need_category>
/**
* 初始化字典配置

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' || po.classType=='popup_dict'>
<#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' || po.classType=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -423,6 +423,14 @@ export const formSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>

View File

@ -1,16 +1,32 @@
<#include "/common/utils.ftl">
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#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">
<BasicForm @register="registerForm" name="${entityName}Form" />
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {ref, computed, unref, reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../${entityName}.data';
import {saveOrUpdate} from '../${entityName}.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
const { createMessage } = useMessage();
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -40,12 +56,22 @@
// 隐藏底部时禁用整个表单
setProps({ disabled: !data?.showFooter })
});
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
//设置标题
const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(isDetail) ? '详情' : '编辑'));
//表单提交事件
async function handleSubmit(v) {
try {
let values = await validate();
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
//提交表单
await saveOrUpdate(values, isUpdate.value);
@ -65,6 +91,30 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
};
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

View File

@ -23,6 +23,10 @@
<#assign need_range_number = false>
<#assign is_range = false>
<#assign query_flag = false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#assign is_like = false>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
@ -105,6 +109,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -151,6 +162,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal ref="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -163,6 +178,8 @@
import { downloadFile } from '/@/utils/common/renderUtils';
import ${entityName}Modal from './components/${entityName}Modal.vue'
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
import {useModal} from '/@/components/Modal';
<#include "/common/form/native/vue3NativeImport.ftl">
<#if need_category>
import { loadCategoryData } from '/@/api/common/api';
@ -172,29 +189,40 @@
<#if need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
</#if>
import { getDateByPicker } from '/@/utils';
<#if need_popup_dict>
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
<#if is_range>
import { cloneDeep } from "lodash-es";
</#if>
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
const { createMessage } = useMessage();
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
useSearchForm: false,
actionColumn: {
width: 120,
@ -205,6 +233,11 @@
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
for (let key in fieldPickers) {
if (queryParam[key] && fieldPickers[key]) {
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
}
}
return Object.assign(params, queryParam);
</#if>
},
@ -328,7 +361,22 @@
placement: 'topLeft',
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1'){
dropDownAction.push({
@ -355,6 +403,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -413,9 +471,33 @@
}
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
<#if need_category>
/**
* form点击事件

View File

@ -61,7 +61,7 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
import { getValueType } from '/@/utils';
import { getDateByPicker, getValueType } from '/@/utils';
import { saveOrUpdate } from '../${entityName}.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
@ -93,6 +93,14 @@
<#include "/common/validatorRulesTemplate/native/vue3MainNative.ftl">
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
// 表单禁用
const disabled = computed(()=>{
@ -181,6 +189,8 @@
}
//循环数据
for (let data in model) {
// 更新个性化日期选择器的值
model[data] = getDateByPicker(model[data], fieldPickers[data]);
//如果该数据是数组并且是字符串类型
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);

View File

@ -1,6 +1,21 @@
<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="关闭">
<${entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${entityName}Form>
<template #footer>
<#if buttonList?? && buttonList?size gt 0>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-button @click="handleCancel">取消</a-button>
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认</a-button>
</template>
</j-modal>
</template>
@ -8,7 +23,8 @@
import { ref, nextTick, defineExpose } from 'vue';
import ${entityName}Form from './${entityName}Form.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
@ -60,7 +76,15 @@
function handleCancel() {
visible.value = false;
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
defineExpose({
add,
edit,

View File

@ -50,6 +50,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign pidFieldName = po.fieldName>
</#if>
</#list>
<#assign enhanceJavaList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.enhanceJavaList??>
<#assign enhanceJavaList = tableVo.extendParams.enhanceJavaList?filter(enhance -> enhance??)>
</#if>
@Tag(name="${tableVo.ftlDescription}")
@RestController
@RequestMapping("/${entityPackagePath}/${entityName?uncap_first}")
@ -74,6 +78,14 @@ 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) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 查询前触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeQuery()
</#if>
</#list>
</#if>
String hasQuery = req.getParameter("hasQuery");
if(hasQuery != null && "true".equals(hasQuery)){
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
@ -92,6 +104,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
queryWrapper.eq("${Format.humpToUnderline(pidFieldName)}", parentId);
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 查询后触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterQuery()
</#if>
</#list>
</#if>
return Result.OK(pageList);
}
}
@ -210,7 +230,23 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 新增前的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeAdd()
</#if>
</#list>
</#if>
${entityName?uncap_first}Service.add${entityName}(${entityName?uncap_first});
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 新增后的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterAdd()
</#if>
</#list>
</#if>
return Result.OK("添加成功!");
}
@ -225,7 +261,23 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 编辑前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeEdit()
</#if>
</#list>
</#if>
${entityName?uncap_first}Service.update${entityName}(${entityName?uncap_first});
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 编辑后,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterEdit()
</#if>
</#list>
</#if>
return Result.OK("编辑成功!");
}
@ -285,6 +337,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='export' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导出前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeExport()
</#if>
</#list>
</#if>
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
@ -298,6 +358,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='import' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导入前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeImport()
</#if>
</#list>
</#if>
return super.importExcel(request, response, ${entityName}.class);
}

View File

@ -48,6 +48,8 @@ public class ${entityName} implements Serializable {
</#if>
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -12,6 +12,10 @@
</#if>
</#list>
<#assign list_need_pca=false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
@ -33,7 +37,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -81,6 +91,10 @@
</BasicTable>
<!--字典弹窗-->
<${entityName}Modal @register="registerModal" @success="handleSuccess"/>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -93,6 +107,7 @@
import ${entityName}Modal from './components/${entityName}Modal.vue';
import {columns, searchFormSchema, superQuerySchema} from './${entityName}.data';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useMessage } from '/@/hooks/web/useMessage';
import {list, delete${entityName}, batchDelete${entityName}, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './${entityName}.api';
<#if list_need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
@ -101,9 +116,20 @@
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
const { createMessage } = useMessage();
const queryParam = reactive<any>({});
const expandedRowKeys = ref([]);
//字典model
@ -114,7 +140,7 @@
api: list,
title: '${tableVo.ftlDescription}',
columns,
canResize:false,
canResize:true,
<#-- update-begin---author:chenrui ---date:20231228 for[issue/#5658] 树表复选框与展开按钮重叠问题---------- -->
isTreeTable: true,
<#-- update-end---author:chenrui ---date:20231228 for[issue/#5658] 树表复选框与展开按钮重叠问题---------- -->
@ -155,7 +181,14 @@
fixed:'right'
},
beforeFetch: (params) => {
params.hasQuery = "true";
if (params && fieldPickers) {
for (let key in fieldPickers) {
if (params[key]) {
params[key] = getDateByPicker(params[key], fieldPickers[key]);
}
}
}
params.hasQuery = "true";
return Object.assign(params, queryParam);
},
<#if list_has_popup_dict>
@ -408,6 +441,21 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
},{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -434,6 +482,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -452,6 +510,16 @@
await startProcess(params);
await reload();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
<#if list_has_popup_dict>
/**
@ -474,6 +542,21 @@
return records;
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

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' || po.classType=='popup_dict'>
<#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' || po.classType=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -198,6 +198,14 @@ export const searchFormSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
component: 'JSelectMultiple',

View File

@ -9,17 +9,41 @@
<#assign hasChildrenField = po.fieldName>
</#if>
</#list>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#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">
<BasicForm @register="registerForm" name="${entityName}Form" />
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {ref, computed, unref, reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form';
import {formSchema} from '../${entityName}.data';
import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const { createMessage } = useMessage();
// 获取emit
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
@ -88,6 +112,8 @@
async function handleSubmit() {
try {
let values = await validate();
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
//提交表单
await saveOrUpdateDict(values, isUpdate.value);
@ -115,6 +141,30 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
};
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */

View File

@ -33,6 +33,10 @@
<#assign need_range_number = false>
<#assign is_range = false>
<#assign is_like = false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#assign query_flag = false>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
@ -113,6 +117,13 @@
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'${entityPackage}:${tableName}:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -161,6 +172,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal ref="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -172,6 +187,7 @@
import {list, delete${entityName}, batchDelete${entityName}, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './${entityName}.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import ${entityName}Modal from './components/${entityName}Modal.vue'
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
<#if need_category>
import { loadCategoryData } from '/@/api/common/api';
@ -181,6 +197,7 @@
<#if need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
</#if>
import { getDateByPicker } from '/@/utils';
<#if need_popup_dict>
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
@ -190,8 +207,16 @@
</#if>
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const { createMessage } = useMessage();
const expandedRowKeys = ref([]);
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
@ -202,7 +227,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
useSearchForm: false,
isTreeTable: true,
actionColumn: {
@ -215,6 +240,11 @@
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
for (let key in fieldPickers) {
if (queryParam[key] && fieldPickers[key]) {
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
}
}
return Object.assign(params, queryParam.value);
</#if>
},
@ -480,6 +510,21 @@
},
auth: '${entityPackage}:${tableName}:delete'
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -510,7 +555,17 @@
placement: 'topLeft',
},
auth: '${entityPackage}:${tableName}:delete'
},
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
</#if>
}
@ -528,9 +583,31 @@
}
await startProcess(params);
await reload();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
/**
* 查询

View File

@ -79,7 +79,7 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
import { getValueType } from '/@/utils';
import { getDateByPicker, getValueType } from '/@/utils';
import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
@ -111,6 +111,14 @@
<#include "/common/validatorRulesTemplate/native/vue3MainNative.ftl">
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
@ -224,6 +232,8 @@
}
//循环数据
for (let data in formData) {
// 更新个性化日期选择器的值
model[data] = getDateByPicker(model[data], fieldPickers[data]);
//如果该数据是数组并且是字符串类型
if (formData[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);

View File

@ -1,6 +1,21 @@
<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="关闭">
<${entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${entityName}Form>
<template #footer>
<#if buttonList?? && buttonList?size gt 0>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-button @click="handleCancel">取消</a-button>
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认</a-button>
</template>
</j-modal>
</template>
@ -8,7 +23,9 @@
import { ref, nextTick, defineExpose } from 'vue';
import ${entityName}Form from './${entityName}Form.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);

View File

@ -47,6 +47,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=true>
</#if>
</#list>
<#assign enhanceJavaList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.enhanceJavaList??>
<#assign enhanceJavaList = tableVo.extendParams.enhanceJavaList?filter(enhance -> enhance??)>
</#if>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -85,6 +89,14 @@ 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) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 查询前触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeQuery()
</#if>
</#list>
</#if>
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
@ -100,6 +112,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 查询后触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterQuery()
</#if>
</#list>
</#if>
return Result.OK(pageList);
}
@ -113,7 +133,23 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 新增前的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeAdd()
</#if>
</#list>
</#if>
${entityName?uncap_first}Service.save(${entityName?uncap_first});
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 新增后的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterAdd()
</#if>
</#list>
</#if>
return Result.OK("添加成功!");
}
@ -127,7 +163,23 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 编辑前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeEdit()
</#if>
</#list>
</#if>
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 编辑后,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterEdit()
</#if>
</#list>
</#if>
return Result.OK("编辑成功!");
}
@ -166,6 +218,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='export' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导出前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeExport()
</#if>
</#list>
</#if>
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
}
@ -176,6 +236,14 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
@RequiresPermissions("${entityPackage}:${tableName}:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='import' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导入前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeImport()
</#if>
</#list>
</#if>
return super.importExcel(request, response, ${entityName}.class);
}
/*---------------------------------主表处理-end-------------------------------------*/

View File

@ -47,6 +47,8 @@ public class ${entityName} implements Serializable {
</#if>
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -72,6 +72,10 @@ public class ${subTab.entityName} implements Serializable {
<#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"'>
@Dict(${list_field_dictCode})
</#if>
<#if po.classType =='link_table'>
<#assign list_field_dictCode='dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dictTable = "sys_depart"'>
@Dict(${list_field_dictCode})
</#if>
<#-- 大字段转换 -->
<#include "/common/blob.ftl">

View File

@ -20,6 +20,10 @@
</#if>
</#list>
<#-- 结束循环 -->
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<div class="content">
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
@ -28,6 +32,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -86,6 +97,10 @@
</div>
<!-- 表单区域 -->
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -96,6 +111,7 @@
import {useModal} from '/@/components/Modal';
import ${entityName}Modal from './components/${entityName}Modal.vue'
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
<#list subTables as sub>
import ${sub.entityName}List from './${sub.entityName}List.vue'
</#list>
@ -114,10 +130,21 @@
import { getAuthCache, setAuthCache } from '/@/utils/auth';
import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum';
</#if>
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
const queryParam = reactive<any>({});
const { createMessage } = useMessage();
//注册model
const [registerModal, {openModal}] = useModal();
//注册table数据
@ -126,7 +153,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize: false,
canResize: true,
clickToRowSelect: true,
rowSelection: {type: 'radio'},
formConfig: {
@ -163,6 +190,13 @@
fixed:'right'
},
beforeFetch: (params) => {
if (params && fieldPickers) {
for (let key in fieldPickers) {
if (params[key]) {
params[key] = getDateByPicker(params[key], fieldPickers[key]);
}
}
}
return Object.assign(params, queryParam);
},
<#if list_has_popup_dict>
@ -280,6 +314,15 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
/**
@ -299,7 +342,22 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1'){
dropDownAction.push({
@ -325,6 +383,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -373,6 +441,21 @@
return records;
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>
@ -381,7 +464,6 @@
height: 100%;
.content {
background-color: #fff;
height: 100%;
}
}
}

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' || po.classType=='popup_dict'>
<#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' || po.classType=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -418,6 +418,14 @@ export const formSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>
@ -551,7 +559,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=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -740,6 +748,14 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>

View File

@ -75,7 +75,7 @@
tableProps: {
api: ${sub.entityName?uncap_first}List,
columns: ${sub.entityName?uncap_first}Columns,
canResize: false,
canResize: true,
useSearchForm: false,
actionColumn: {
width: 180,

View File

@ -1,16 +1,40 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#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">
<BasicForm @register="registerForm" name="${entityName}Form" />
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {ref, computed, unref, reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../${entityName}.data';
import {saveOrUpdate} from '../${entityName}.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const { createMessage } = useMessage();
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -46,6 +70,8 @@
async function handleSubmit(v) {
try {
let values = await validate();
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
//提交表单
await saveOrUpdate(values, isUpdate.value);
@ -65,6 +91,29 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
};
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

View File

@ -8,11 +8,20 @@
</template>
<script lang="ts" setup>
import {ref, computed, unref,inject} from 'vue';
import {ref, computed, unref,inject, reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {${sub.entityName?uncap_first}FormSchema} from '../${entityName}.data';
import {${sub.entityName?uncap_first}SaveOrUpdate} from '../${entityName}.api';
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list sub.colums as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
//接收主表id
const mainId = inject('mainId');
@ -51,6 +60,8 @@
async function handleSubmit(v) {
try {
let values = await validate();
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
if (unref(mainId)) {
<#list sub.foreignKeys as key>
@ -74,6 +85,20 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
};
</script>
<style lang="less" scoped>
/** 时间和数字输入框样式 */

View File

@ -24,6 +24,10 @@
<#assign need_range_number = false>
<#assign is_range = false>
<#assign is_like = false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
@ -109,6 +113,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -168,6 +179,10 @@
</div>
<!-- 表单区域 -->
<${entityName}Modal ref="registerModal" @success="handleSuccess" />
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -175,10 +190,12 @@
import { ref, reactive, computed, unref, provide } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
import ${entityName}Modal from './components/${entityName}Modal.vue'
import { columns, superQuerySchema } from './${entityName}.data';
import { list, deleteOne, batchDelete, getImportUrl,getExportUrl } from './${entityName}.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
<#if need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
@ -188,8 +205,11 @@
import { getAuthCache, setAuthCache } from '/@/utils/auth';
import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum';
</#if>
import { getDateByPicker } from '/@/utils';
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
<#list subTables as sub>
import ${sub.entityName}List from './${sub.entityName}List.vue'
@ -202,18 +222,27 @@
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const formRef = ref();
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const registerModal = ref();
const userStore = useUserStore();
const { createMessage } = useMessage();
//注册table数据
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
useSearchForm: false,
clickToRowSelect: true,
rowSelection: {type: 'radio'},
@ -226,6 +255,11 @@
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
for (let key in fieldPickers) {
if (queryParam[key] && fieldPickers[key]) {
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
}
}
return Object.assign(params, queryParam);
</#if>
},
@ -348,7 +382,22 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
},
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -375,7 +424,17 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
},
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
</#if>
}
@ -394,8 +453,30 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
<#if need_category>
/**
* form点击事件
@ -526,7 +607,6 @@
height: 100%;
.content {
background-color: #fff;
height: 100%;
}
}
</style>

View File

@ -84,7 +84,7 @@
tableProps: {
api: ${sub.entityName?uncap_first}List,
columns: ${sub.entityName?uncap_first}Columns,
canResize: false,
canResize: true,
useSearchForm: false,
actionColumn: {
width: 180,

View File

@ -61,7 +61,7 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
import { getValueType } from '/@/utils';
import { getDateByPicker, getValueType } from '/@/utils';
import { saveOrUpdate } from '../${entityName}.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
@ -89,6 +89,14 @@
<#include "/common/validatorRulesTemplate/native/vue3MainNative.ftl">
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const formRef = ref();
// 表单禁用
const disabled = computed(()=>{
@ -176,6 +184,8 @@
}
//循环数据
for (let data in model) {
// 更新个性化日期选择器的值
model[data] = getDateByPicker(model[data], fieldPickers[data]);
//如果该数据是数组并且是字符串类型
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);

View File

@ -1,14 +1,31 @@
<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="关闭">
<${entityName}Form ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></${entityName}Form>
</j-modal>
<template #footer>
<#if buttonList?? && buttonList?size gt 0>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="ant-design:${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-button @click="handleCancel">取消</a-button>
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认</a-button>
</template>
</j-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import ${entityName}Form from './${entityName}Form.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
@ -61,6 +78,16 @@
visible.value = false;
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
defineExpose({
add,
edit,

View File

@ -58,7 +58,7 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
import { getValueType } from '/@/utils';
import { getDateByPicker, getValueType } from '/@/utils';
import { ${sub.entityName?uncap_first}SaveOrUpdate } from '../${entityName}.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
@ -88,6 +88,14 @@
</#list>
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//日期个性化选择
const fieldPickers = reactive({
<#list sub.colums as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const props = defineProps({
disabled: { type: Boolean, default: false },
});
@ -147,6 +155,8 @@
//循环数据
for (let data in model) {
// 更新个性化日期选择器的值
model[data] = getDateByPicker(model[data], fieldPickers[data]);
//如果该数据是数组并且是字符串类型
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);

View File

@ -54,6 +54,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=true>
</#if>
</#list>
<#assign enhanceJavaList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.enhanceJavaList??>
<#assign enhanceJavaList = tableVo.extendParams.enhanceJavaList?filter(enhance -> enhance??)>
</#if>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -88,6 +92,14 @@ public class ${entityName}Controller {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 查询前触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeQuery()
</#if>
</#list>
</#if>
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
@ -103,6 +115,14 @@ public class ${entityName}Controller {
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 查询后触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterQuery()
</#if>
</#list>
</#if>
return Result.OK(pageList);
}
@ -117,9 +137,25 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 新增前的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeAdd()
</#if>
</#list>
</#if>
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 新增后的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterAdd()
</#if>
</#list>
</#if>
return Result.OK("添加成功!");
}
@ -134,6 +170,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 编辑前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeEdit()
</#if>
</#list>
</#if>
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
@ -141,6 +185,14 @@ public class ${entityName}Controller {
return Result.error("未找到对应数据");
}
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 编辑后,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterEdit()
</#if>
</#list>
</#if>
return Result.OK("编辑成功!");
}
@ -221,6 +273,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='export' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导出前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeExport()
</#if>
</#list>
</#if>
// Step.1 组装查询条件查询数据
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@ -265,6 +325,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='import' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导入前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeImport()
</#if>
</#list>
</#if>
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

View File

@ -47,6 +47,8 @@ public class ${entityName} implements Serializable {
</#if>
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -49,6 +49,8 @@ public class ${subTab.entityName} implements Serializable {
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
</#if>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -7,7 +7,10 @@
<#assign list_need_pca=false>
<#assign bpm_flag=false>
<#assign list_has_popup_dict=false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
@ -42,6 +45,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -89,6 +99,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -97,6 +111,7 @@
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import ${entityName}Modal from './components/${entityName}Modal.vue'
<#list subTables as sub>
import ${sub.entityName}SubTable from './subTables/${sub.entityName}SubTable.vue'
@ -114,17 +129,29 @@
</#if>
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
<#if list_has_popup_dict>
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
// 展开key
const expandedRowKeys = ref<any[]>([]);
//注册model
const [registerModal, {openModal}] = useModal();
const { createMessage } = useMessage();
const userStore = useUserStore();
//注册table数据
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
@ -132,7 +159,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
@ -170,6 +197,13 @@
fixed:'right'
},
beforeFetch: (params) => {
if (params && fieldPickers) {
for (let key in fieldPickers) {
if (params[key]) {
params[key] = getDateByPicker(params[key], fieldPickers[key]);
}
}
}
return Object.assign(params, queryParam);
},
<#if list_has_popup_dict>
@ -287,6 +321,15 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
/**
@ -306,7 +349,22 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -333,6 +391,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -381,6 +449,21 @@
return records;
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

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' || po.classType=='popup_dict'>
<#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' || po.classType=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -419,6 +419,14 @@ export const formSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>
@ -543,7 +551,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' || po.classType=='popup_dict'>
<#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' || po.classType=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -732,6 +740,14 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>

View File

@ -1,5 +1,9 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#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">
<BasicForm @register="registerForm" ref="formRef" name="${entityName}Form" />
<!-- 子表单区域 -->
@ -30,6 +34,16 @@
</#if>
</#list>
</a-tabs>
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
@ -47,6 +61,28 @@
import {formSchema<#list subTables as sub><#if sub.foreignRelationType =='0'>,${sub.entityName?uncap_first}JVxeColumns</#if></#list>} from '../${entityName}.data';
import {saveOrUpdate<#list subTables as sub>,query${sub.entityName}</#list>} from '../${entityName}.api';
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
const ${sub.entityName?uncap_first}FieldPickers = reactive({
<#list sub.colums as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
</#if>
</#list>
const { createMessage } = useMessage();
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -175,6 +211,8 @@
//表单提交事件
async function requestAddOrEdit(values) {
try {
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
//提交表单
await saveOrUpdate(values, isUpdate.value);
@ -186,6 +224,42 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
if(formData && formData.${sub.entityName?uncap_first}List && formData.${sub.entityName?uncap_first}List.length > 0){
formData.${sub.entityName?uncap_first}List.forEach(subFormData=>{
for (let key in ${sub.entityName?uncap_first}FieldPickers) {
if (subFormData[key]) {
subFormData[key] = getDateByPicker(subFormData[key], ${sub.entityName?uncap_first}FieldPickers[key]);
}
}
})
}
</#if>
</#list>
};
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

View File

@ -21,7 +21,7 @@
</#list>
<#-- 结束循环 -->
<!--引用表格-->
<BasicTable bordered size="middle" :loading="loading" rowKey="id" :canResize="false" :columns="${sub.entityName?uncap_first}Columns" :dataSource="dataSource" :pagination="false">
<BasicTable bordered size="middle" :loading="loading" rowKey="id" :canResize="true" :columns="${sub.entityName?uncap_first}Columns" :dataSource="dataSource" :pagination="false">
<!--字段回显插槽-->
<template v-slot:bodyCell="{ column, record, index, text }">
<#list sub.originalColumns as po>

View File

@ -63,6 +63,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=true>
</#if>
</#list>
<#assign enhanceJavaList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.enhanceJavaList??>
<#assign enhanceJavaList = tableVo.extendParams.enhanceJavaList?filter(enhance -> enhance??)>
</#if>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -97,6 +101,14 @@ public class ${entityName}Controller {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 查询前触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeQuery()
</#if>
</#list>
</#if>
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
@ -112,6 +124,14 @@ public class ${entityName}Controller {
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 查询后触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterQuery()
</#if>
</#list>
</#if>
return Result.OK(pageList);
}
@ -126,12 +146,28 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 新增前的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeAdd()
</#if>
</#list>
</#if>
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
<#if bpm_flag>
${entityName?uncap_first}.setBpmStatus("1");
</#if>
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 新增后的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterAdd()
</#if>
</#list>
</#if>
return Result.OK("添加成功!");
}
@ -146,6 +182,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 编辑前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeEdit()
</#if>
</#list>
</#if>
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
@ -153,6 +197,14 @@ public class ${entityName}Controller {
return Result.error("未找到对应数据");
}
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 编辑后,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterEdit()
</#if>
</#list>
</#if>
return Result.OK("编辑成功!");
}
@ -229,6 +281,15 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='export' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导出前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeExport()
</#if>
</#list>
</#if>
// Step.1 组装查询条件查询数据
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@ -273,6 +334,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='import' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导入前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeImport()
</#if>
</#list>
</#if>
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

View File

@ -47,6 +47,8 @@ public class ${entityName} implements Serializable {
</#if>
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -47,6 +47,8 @@ public class ${subTab.entityName} implements Serializable {
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
</#if>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -4,6 +4,10 @@
<#assign list_need_pca=false>
<#assign bpm_flag=false>
<#assign list_has_popup_dict=false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
@ -27,6 +31,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -74,6 +85,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -87,6 +102,7 @@
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
import {downloadFile} from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
<#if list_need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
</#if>
@ -99,12 +115,24 @@
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
const { createMessage } = useMessage();
//注册model
const [registerModal, {openModal}] = useModal();
//注册table数据
@ -113,7 +141,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
@ -151,6 +179,13 @@
fixed:'right'
},
beforeFetch: (params) => {
if (params && fieldPickers) {
for (let key in fieldPickers) {
if (params[key]) {
params[key] = getDateByPicker(params[key], fieldPickers[key]);
}
}
}
return Object.assign(params, queryParam);
},
<#if list_has_popup_dict>
@ -259,6 +294,16 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
/**
@ -278,7 +323,22 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -305,6 +365,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -353,6 +423,21 @@
return records;
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

View File

@ -419,6 +419,14 @@ export const formSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>
@ -659,6 +667,14 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>

View File

@ -1,5 +1,9 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#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">
<BasicForm @register="registerForm" ref="formRef" name="${entityName}Form"/>
<!-- 子表单区域 -->
@ -30,6 +34,15 @@
</#if>
</#list>
</a-tabs>
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
@ -47,6 +60,28 @@
import {formSchema<#list subTables as sub><#if sub.foreignRelationType =='0'>,${sub.entityName?uncap_first}Columns</#if></#list>} from '../${entityName}.data';
import {saveOrUpdate<#list subTables as sub>,${sub.entityName?uncap_first}List</#list>} from '../${entityName}.api';
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
const ${sub.entityName?uncap_first}FieldPickers = reactive({
<#list sub.colums as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
</#if>
</#list>
const { createMessage } = useMessage();
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -175,6 +210,8 @@
//表单提交事件
async function requestAddOrEdit(values) {
try {
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
//提交表单
await saveOrUpdate(values, isUpdate.value);
@ -186,6 +223,42 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
if(formData && formData.${sub.entityName?uncap_first}List && formData.${sub.entityName?uncap_first}List.length > 0){
formData.${sub.entityName?uncap_first}List.forEach(subFormData=>{
for (let key in ${sub.entityName?uncap_first}FieldPickers) {
if (subFormData[key]) {
subFormData[key] = getDateByPicker(subFormData[key], ${sub.entityName?uncap_first}FieldPickers[key]);
}
}
})
}
</#if>
</#list>
};
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

View File

@ -24,6 +24,10 @@
<#assign need_range_number = false>
<#assign is_range = false>
<#assign is_like = false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
@ -108,6 +112,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -155,6 +166,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -167,6 +182,7 @@
import {columns, superQuerySchema} from './${entityName}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
import {downloadFile} from '/@/utils/common/renderUtils';
import { useMessage } from '/@/hooks/web/useMessage';
<#include "/common/form/native/vue3NativeImport.ftl">
<#if need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
@ -178,6 +194,8 @@
</#if>
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
<#if is_range>
import { cloneDeep } from "lodash-es";
@ -186,20 +204,30 @@
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
import { getDateByPicker } from '/@/utils';
import { useUserStore } from '/@/store/modules/user';
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const formRef = ref();
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
//注册model
const [registerModal, {openModal}] = useModal();
const userStore = useUserStore();
const { createMessage } = useMessage();
//注册table数据
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
useSearchForm: false,
actionColumn: {
width: 120,
@ -210,6 +238,11 @@
let rangerQuery = await setRangeQuery();
return Object.assign(params, rangerQuery);
<#else>
for (let key in fieldPickers) {
if (queryParam[key] && fieldPickers[key]) {
queryParam[key] = getDateByPicker(queryParam[key], fieldPickers[key]);
}
}
return Object.assign(params, queryParam);
</#if>
},
@ -324,7 +357,22 @@
confirm: handleDelete.bind(null, record)
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -351,6 +399,17 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -369,8 +428,33 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
<#if need_category>
/**
* form点击事件

View File

@ -116,6 +116,8 @@
</#if>
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import { Form } from 'ant-design-vue';
import { getDateByPicker } from '/@/utils';
import dayjs from 'dayjs';
const useForm = Form.useForm;
export default defineComponent({
@ -174,6 +176,14 @@
</#list>
});
const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
const dbData = {};
const formItemLayout = {
labelCol: {xs: {span: 24}, sm: {span: 5}},
@ -296,6 +306,8 @@
async function submitForm() {
const mainData = await getFormData();
const subData = await getSubFormAndTableData();
// 预处理日期数据
changeDateValue(mainData, subData);
const values = Object.assign({}, dbData, mainData, subData);
console.log('表单提交数据', values)
const isUpdate = values.id ? true : false
@ -312,6 +324,38 @@
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (mainData, subData) => {
for (let key in mainData) {
// 更新个性化日期选择器的值
mainData[key] = getDateByPicker(mainData[key], fieldPickers[key]);
}
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
if(subData.${sub.entityName?uncap_first}List && subData.${sub.entityName?uncap_first}List.length > 0){
${sub.entityName?uncap_first}Columns.forEach(subFormField => {
if(subFormField && subFormField.picker && subFormField.key){
let subPicker = subFormField.picker;
const subFieldName = subFormField.key
subData.${sub.entityName?uncap_first}List.forEach(subFormData=>{
if (subPicker === 'year') {
subFormData[subFieldName] = dayjs(subFormData[subFieldName]).set('month', 0).set('date', 1).format('YYYY-MM-DD');
} else if (subPicker === 'month') {
subFormData[subFieldName] = dayjs(subFormData[subFieldName]).set('date', 1).format('YYYY-MM-DD');
} else if (subPicker === 'week') {
subFormData[subFieldName] = dayjs(subFormData[subFieldName]).startOf('week').format('YYYY-MM-DD');
}
})
}
})
}
</#if>
</#list>
};
/**
* 值改变事件触发-树控件回调
* @param key

View File

@ -1,7 +1,20 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#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">
<${Format.humpToShortbar(entityName)}-form ref="formComponent" :formDisabled="formDisabled" :formBpm="false" @success="submitSuccess"></${Format.humpToShortbar(entityName)}-form>
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
@ -9,7 +22,8 @@
import { ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import ${entityName}Form from './${entityName}Form.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
export default {
name: "TestCgMainVxeModal",
components:{
@ -44,14 +58,29 @@
emit('success');
closeModal();
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
return {
registerModal,
title,
formComponent,
formDisabled,
handleSubmit,
submitSuccess
submitSuccess,
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
handle${btn.buttonCode?cap_first},
</#if>
</#list>
</#if>
}
}
}

View File

@ -54,6 +54,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
<#assign has_multi_query_field=true>
</#if>
</#list>
<#assign enhanceJavaList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.enhanceJavaList??>
<#assign enhanceJavaList = tableVo.extendParams.enhanceJavaList?filter(enhance -> enhance??)>
</#if>
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot
@ -88,6 +92,14 @@ public class ${entityName}Controller {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 查询前触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeQuery()
</#if>
</#list>
</#if>
<#if has_multi_query_field>
// 自定义查询规则
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
@ -103,6 +115,14 @@ public class ${entityName}Controller {
</#if>
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='query' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 查询后触发的方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterQuery()
</#if>
</#list>
</#if>
return Result.OK(pageList);
}
@ -117,9 +137,25 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 新增前的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeAdd()
</#if>
</#list>
</#if>
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='add' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 新增后的处理方法,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterAdd()
</#if>
</#list>
</#if>
return Result.OK("添加成功!");
}
@ -134,6 +170,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 编辑前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeEdit()
</#if>
</#list>
</#if>
${entityName} ${entityName?uncap_first} = new ${entityName}();
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
@ -141,6 +185,14 @@ public class ${entityName}Controller {
return Result.error("未找到对应数据");
}
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='edit' && enhanceJava.event=='end' && enhanceJava.activeStatus=='1'>
//TODO 编辑后,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.afterEdit()
</#if>
</#list>
</#if>
return Result.OK("编辑成功!");
}
@ -217,6 +269,15 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='export' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导出前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeExport()
</#if>
</#list>
</#if>
// Step.1 组装查询条件查询数据
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@ -261,6 +322,14 @@ public class ${entityName}Controller {
@RequiresPermissions("${entityPackage}:${tableName}:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
<#if enhanceJavaList?size gt 0>
<#list enhanceJavaList as enhanceJava>
<#if enhanceJava.buttonCode=='import' && enhanceJava.event=='start' && enhanceJava.activeStatus=='1'>
//TODO 导入前,代码生成后,请手工实现增强类逻辑;
//${entityName?uncap_first}Service.beforeImport()
</#if>
</#list>
</#if>
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {

View File

@ -46,7 +46,9 @@ public class ${entityName} implements Serializable {
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
</#if>
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -48,6 +48,8 @@ public class ${subTab.entityName} implements Serializable {
<#elseif po.classType=='sel_tree'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
</#if>
<#elseif po.classType=='link_table'>
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicCode = "${po.dictField}", dicText = "${po.dictText?split(",")[0]}"'>
</#if>
/**${po.filedComment}*/
<#if po.fieldName == primaryKeyField>

View File

@ -4,6 +4,10 @@
<#assign list_need_pca=false>
<#assign bpm_flag=false>
<#assign list_has_popup_dict=false>
<#assign buttonList=[]>
<#if tableVo.extendParams?? && tableVo.extendParams.cgButtonList??>
<#assign buttonList = tableVo.extendParams.cgButtonList?filter(btn -> btn??)>
</#if>
<#-- 开始循环 -->
<#list columns as po>
<#if po.fieldDbName=='bpm_status'>
@ -27,6 +31,13 @@
<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>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'button'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</#if>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
@ -74,6 +85,10 @@
</BasicTable>
<!-- 表单区域 -->
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
<#if bpm_flag==true>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</#if>
</div>
</template>
@ -87,6 +102,7 @@
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
import {downloadFile} from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
<#if list_need_pca>
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
</#if>
@ -99,11 +115,23 @@
import {getPopDictByCode} from "@/utils/dict";
import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil";
</#if>
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#if bpm_flag==true>
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
</#if>
const queryParam = reactive<any>({});
const userStore = useUserStore();
const { createMessage } = useMessage();
const checkedKeys = ref<Array<string | number>>([]);
//注册model
const [registerModal, {openModal}] = useModal();
@ -113,7 +141,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
@ -151,6 +179,13 @@
fixed:'right'
},
beforeFetch: (params) => {
if (params && fieldPickers) {
for (let key in fieldPickers) {
if (params[key]) {
params[key] = getDateByPicker(params[key], fieldPickers[key]);
}
}
}
return Object.assign(params, queryParam);
},
<#if list_has_popup_dict>
@ -258,6 +293,16 @@
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_${tableName}_001',
dataId: record.id,
});
}
</#if>
/**
@ -277,7 +322,22 @@
placement: 'topLeft'
},
auth: '${entityPackage}:${tableName}:delete'
}
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
];
if(record.bpmStatus == '1' || !record.bpmStatus){
dropDownAction.push({
@ -304,6 +364,16 @@
},
auth: '${entityPackage}:${tableName}:delete'
}
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle == 'link'>
,{
label: '${btn.buttonName}',
onClick: handle${btn.buttonCode?cap_first}.bind(null, record),
}
</#if>
</#list>
</#if>
]
</#if>
}
@ -352,6 +422,21 @@
return records;
}
</#if>
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='button'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
<#if btn.buttonStyle=='link'>
function handle${btn.buttonCode?cap_first}(record){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

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' || po.classType=='popup_dict'>
<#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' || po.classType=='link_table'>
dataIndex: '${po.fieldName}_dictText'
<#elseif po.classType=='cat_tree'>
dataIndex: '${po.fieldName}',
@ -419,6 +419,14 @@ export const formSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>
@ -672,6 +680,14 @@ export const ${sub.entityName?uncap_first}FormSchema: FormSchema[] = [
</#if>
pidValue:"${po.dictField}",
},
<#elseif po.classType=='link_table'>
component: 'JLinkTableCard',
componentProps: {
valueField: '${po.dictField}',
textField: '${po.dictText}',
tableName: '${po.dictTable}',
multi: <#if (po.queryMode!"") == "multi">true<#else>false</#if>
},
<#else>
component: 'Input',
</#if>

View File

@ -1,5 +1,9 @@
<#include "/common/utils.ftl">
<template>
<#assign buttonList=[]>
<#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">
<!-- 标题区域 -->
<template #title>
@ -41,6 +45,15 @@
</#if>
</#list>
</div>
<#if buttonList?? && buttonList?size gt 0>
<template #insertFooter>
<#list buttonList as btn>
<#if btn.buttonStyle=='form'>
<a-button type="primary" @click="handle${btn.buttonCode?cap_first}" <#if btn.buttonIcon??> preIcon="${btn.buttonIcon}" </#if>>${btn.buttonName}</a-button>
</#if>
</#list>
</template>
</#if>
</BasicModal>
</template>
@ -58,6 +71,28 @@
import {formSchema<#list subTables as sub><#if sub.foreignRelationType =='0'>,${sub.entityName?uncap_first}Columns</#if></#list>} from '../${entityName}.data';
import {saveOrUpdate<#list subTables as sub>,${sub.entityName?uncap_first}List</#list>} from '../${entityName}.api';
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
import { useMessage } from '/@/hooks/web/useMessage';
import { getDateByPicker } from '/@/utils';
//日期个性化选择
const fieldPickers = reactive({
<#list columns as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
const ${sub.entityName?uncap_first}FieldPickers = reactive({
<#list sub.colums as po>
<#if po.extendParams?exists && po.extendParams.picker?exists>
${po.fieldName}: '${po.extendParams.picker}',
</#if>
</#list>
});
</#if>
</#list>
const { createMessage } = useMessage();
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -210,6 +245,8 @@
//表单提交事件
async function requestAddOrEdit(values) {
try {
// 预处理日期数据
changeDateValue(values);
setModalProps({confirmLoading: true});
//提交表单
await saveOrUpdate(values, isUpdate.value);
@ -221,6 +258,42 @@
setModalProps({confirmLoading: false});
}
}
/**
* 处理日期值
* @param formData 表单数据
*/
const changeDateValue = (formData) => {
if (formData && fieldPickers) {
for (let key in fieldPickers) {
if (formData[key]) {
formData[key] = getDateByPicker(formData[key], fieldPickers[key]);
}
}
}
<#list subTables as sub>
<#if sub.foreignRelationType =='0'>
if(formData && formData.${sub.entityName?uncap_first}List && formData.${sub.entityName?uncap_first}List.length > 0){
formData.${sub.entityName?uncap_first}List.forEach(subFormData=>{
for (let key in ${sub.entityName?uncap_first}FieldPickers) {
if (subFormData[key]) {
subFormData[key] = getDateByPicker(subFormData[key], ${sub.entityName?uncap_first}FieldPickers[key]);
}
}
})
}
</#if>
</#list>
};
<#if buttonList?size gt 0>
<#list buttonList?sort_by('orderNum') as btn>
<#if btn.buttonStyle=='form'>
function handle${btn.buttonCode?cap_first}(){
createMessage.info('点击了${btn.buttonName}按钮,对应的业务逻辑需自行实现!');
}
</#if>
</#list>
</#if>
</script>
<style lang="less" scoped>

View File

@ -32,8 +32,8 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
/**
* @Description: ${tableVo.ftlDescription}
@ -59,7 +59,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@ -78,7 +78,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@Operation(summary = "${tableVo.ftlDescription}-添加")
@Operation(summary="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.save(${entityName?uncap_first});
@ -92,7 +92,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@Operation(summary = "${tableVo.ftlDescription}-编辑")
@Operation(summary="${tableVo.ftlDescription}-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
@ -106,7 +106,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.removeById(id);
@ -120,7 +120,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@Operation(summary = "${tableVo.ftlDescription}-批量删除")
@Operation(summary="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
@ -134,7 +134,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);

View File

@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

View File

@ -49,7 +49,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,

View File

@ -35,8 +35,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
@ -63,7 +63,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@ -82,7 +82,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@Operation(summary = "${tableVo.ftlDescription}-添加")
@Operation(summary="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.save(${entityName?uncap_first});
@ -96,7 +96,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@Operation(summary = "${tableVo.ftlDescription}-编辑")
@Operation(summary="${tableVo.ftlDescription}-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
@ -109,7 +109,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.removeById(id);
@ -123,7 +123,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@Operation(summary = "${tableVo.ftlDescription}-批量删除")
@Operation(summary="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
@ -137,7 +137,7 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);

View File

@ -49,7 +49,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,

View File

@ -41,8 +41,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
@ -73,7 +73,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@ -92,7 +92,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@Operation(summary = "${tableVo.ftlDescription}-添加")
@Operation(summary="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
${entityName} ${entityName?uncap_first} = new ${entityName}();
@ -108,7 +108,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@Operation(summary = "${tableVo.ftlDescription}-编辑")
@Operation(summary="${tableVo.ftlDescription}-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
${entityName} ${entityName?uncap_first} = new ${entityName}();
@ -124,7 +124,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.delMain(id);
@ -138,7 +138,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@Operation(summary = "${tableVo.ftlDescription}-批量删除")
@Operation(summary="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
@ -152,7 +152,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
@ -167,7 +167,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-通过主表ID查询")
@Operation(summary = "${tableVo.ftlDescription}-通过主表ID查询")
@Operation(summary="${sub.ftlDescription}-通过主表ID查询")
@GetMapping(value = "/query${sub.entityName}ByMainId")
public Result<?> query${sub.entityName}ListByMainId(@RequestParam(name="id",required=true) String id) {
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(id);

View File

@ -10,7 +10,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot

View File

@ -13,7 +13,6 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot

View File

@ -47,7 +47,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize:false,
canResize:true,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,

View File

@ -40,8 +40,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
@ -72,7 +72,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary = "${tableVo.ftlDescription}-分页列表查询")
@Operation(summary="${tableVo.ftlDescription}-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@ -91,7 +91,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-添加")
@Operation(summary = "${tableVo.ftlDescription}-添加")
@Operation(summary="${tableVo.ftlDescription}-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
${entityName} ${entityName?uncap_first} = new ${entityName}();
@ -107,7 +107,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
@Operation(summary = "${tableVo.ftlDescription}-编辑")
@Operation(summary="${tableVo.ftlDescription}-")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
${entityName} ${entityName?uncap_first} = new ${entityName}();
@ -123,7 +123,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary = "${tableVo.ftlDescription}-通过id删除")
@Operation(summary="${tableVo.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
${entityName?uncap_first}Service.delMain(id);
@ -137,7 +137,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
@Operation(summary = "${tableVo.ftlDescription}-批量删除")
@Operation(summary="${tableVo.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
@ -151,7 +151,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary = "${tableVo.ftlDescription}-通过id查询")
@Operation(summary="${tableVo.ftlDescription}-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
@ -168,7 +168,7 @@ public class ${entityName}Controller {
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-通过主表id查询")
@Operation(summary = "${sub.ftlDescription}-通过主表id查询")
@Operation(summary="${sub.ftlDescription}-通过主表id查询")
<#-- update-begin--Author:kangxiaolin Date:20190905 for[442]主子表分开维护,生成的代码子表的分页改为真实的分页-------------------- -->
@GetMapping(value = "/list${sub.entityName}ByMainId")
public Result<?> list${sub.entityName}ByMainId(${sub.entityName} ${sub.entityName?uncap_first},
@ -208,7 +208,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-添加")
@Operation(summary = "${sub.ftlDescription}-添加")
@Operation(summary="${sub.ftlDescription}-添加")
@PostMapping(value = "/add${sub.entityName}")
public Result<?> add${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
${sub.entityName?uncap_first}Service.save(${sub.entityName?uncap_first});
@ -222,7 +222,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-编辑")
@Operation(summary = "${sub.ftlDescription}-编辑")
@Operation(summary="${sub.ftlDescription}-编辑")
@RequestMapping(value = "/edit${sub.entityName}", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<?> edit${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
${sub.entityName?uncap_first}Service.updateById(${sub.entityName?uncap_first});
@ -236,7 +236,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-通过id删除")
@Operation(summary = "${sub.ftlDescription}-通过id删除")
@Operation(summary="${sub.ftlDescription}-通过id删除")
@DeleteMapping(value = "/delete${sub.entityName}")
public Result<?> delete${sub.entityName}(@RequestParam(name = "id", required = true) String id) {
${sub.entityName?uncap_first}Service.removeById(id);
@ -250,7 +250,7 @@ ${sub.entityName?uncap_first}.get${key}()!=null<#rt/>
* @return
*/
@AutoLog(value = "${sub.ftlDescription}-批量删除")
@Operation(summary = "${sub.ftlDescription}-批量删除")
@Operation(summary="${sub.ftlDescription}-批量删除")
@DeleteMapping(value = "/deleteBatch${sub.entityName}")
public Result<?> deleteBatch${sub.entityName}(@RequestParam(name = "ids", required = true) String ids) {
if (ids == null || "".equals(ids.trim())) {

View File

@ -10,7 +10,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot

View File

@ -12,7 +12,6 @@ import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @Description: ${subTab.ftlDescription}
* @Author: jeecg-boot

View File

@ -12,7 +12,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* @Description: ${tableVo.ftlDescription}
* @Author: jeecg-boot

View File

@ -60,7 +60,7 @@
title: '${tableVo.ftlDescription}',
api: list,
columns,
canResize: false,
canResize: true,
rowSelection: {type: 'radio'},
formConfig: {
labelWidth: 120,

View File

@ -56,7 +56,7 @@
tableProps: {
api: ${subTab.entityName?uncap_first}List,
columns: ${subTab.entityName?uncap_first}Columns,
canResize: false,
canResize: true,
useSearchForm: false,
searchInfo,
actionColumn: {