diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei index 9f07be6df..b79102452 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei @@ -117,6 +117,15 @@ import {getPopDictByCode} from "@/utils/dict"; import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil"; + 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 bpm_flag==true> import { startProcess } from '/@/api/common/api'; const [registerBpmModal, { openModal: bpmPicModal }] = useModal(); @@ -133,7 +142,7 @@ title: '${tableVo.ftlDescription}', api: list, columns, - canResize:false, + canResize:true, formConfig: { //labelWidth: 120, schemas: searchFormSchema, @@ -171,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> diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei index 60c56a9a9..263176761 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/default/one/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei @@ -19,12 +19,13 @@ \ No newline at end of file diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/[1-n]List.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/[1-n]List.vuei index e34f17836..39ea595ca 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/[1-n]List.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/[1-n]List.vuei @@ -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, diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/${entityName}Form.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/${entityName}Form.vuei index 1011c586f..765872811 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/${entityName}Form.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/${entityName}Form.vuei @@ -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}', + + + }); 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); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/[1-n]Form.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/[1-n]Form.vuei index 4f71b6f7a..34b657974 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/[1-n]Form.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/erp/onetomany/java/${bussiPackage}/${entityPackage}/vue3Native/components/[1-n]Form.vuei @@ -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 @@ }; 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}', + + + }); 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); diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei index eed5b11ff..fc81d44f7 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/${entityName}List.vuei @@ -136,6 +136,15 @@ import {getPopDictByCode} from "@/utils/dict"; import {filterMultiDictText} from "@/utils/dict/JDictSelectUtil"; + import { getDateByPicker } from '/@/utils'; + //日期个性化选择 + const fieldPickers = reactive({ + <#list columns as po> + <#if po.extendParams?exists && po.extendParams.picker?exists> + ${po.fieldName}: '${po.extendParams.picker}', + + + }); import { useUserStore } from '/@/store/modules/user'; const queryParam = reactive({}); // 展开key @@ -150,7 +159,7 @@ title: '${tableVo.ftlDescription}', api: list, columns, - canResize:false, + canResize:true, formConfig: { //labelWidth: 120, schemas: searchFormSchema, @@ -188,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> diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei index 3abeca6cd..c7e89a75b 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/components/${entityName}Modal.vuei @@ -62,6 +62,26 @@ import {saveOrUpdate<#list subTables as sub>,query${sub.entityName}} 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}', + + + }); + <#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}', + + + }); + + const { createMessage } = useMessage(); // Emits声明 const emit = defineEmits(['register','success']); @@ -191,6 +211,8 @@ //表单提交事件 async function requestAddOrEdit(values) { try { + // 预处理日期数据 + changeDateValue(values); setModalProps({confirmLoading: true}); //提交表单 await saveOrUpdate(values, isUpdate.value); @@ -202,6 +224,33 @@ 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 buttonList?size gt 0> <#list buttonList?sort_by('orderNum') as btn> <#if btn.buttonStyle=='form'> diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/subTables/[1-n]SubTable.vuei b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/subTables/[1-n]SubTable.vuei index 2ab5fb7e1..dc2ed4aea 100644 --- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/subTables/[1-n]SubTable.vuei +++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/resources/jeecg/code-template-online/inner-table/onetomany/java/${bussiPackage}/${entityPackage}/vue3/subTables/[1-n]SubTable.vuei @@ -21,7 +21,7 @@ <#-- 结束循环 --> - +