From 136e30360c262858913dc7424ac5986e5ed3b682 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Sat, 26 Nov 2022 10:16:39 +0800 Subject: [PATCH] =?UTF-8?q?[issues/215]=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=A1=86=EF=BC=88=E6=97=A5=E6=9C=9F=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=A1=86=EF=BC=89=E8=AE=BE=E7=BD=AE=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E6=97=B6=E9=97=B4=EF=BC=8C=E4=B8=80=E8=BF=9B=E5=85=A5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=97=B6=EF=BC=8C=E5=90=8E=E5=8F=B0=E6=8A=A5=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=BD=AC=E6=8D=A2=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/BasicForm.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index 2ff4a4a..80a0eb0 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -113,15 +113,28 @@ const getSchema = computed((): FormSchema[] => { const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any); for (const schema of schemas) { - const { defaultValue, component } = schema; + const { defaultValue, component, componentProps } = schema; // handle date type if (defaultValue && dateItemType.includes(component)) { + const { valueFormat } = componentProps if (!Array.isArray(defaultValue)) { - schema.defaultValue = dateUtil(defaultValue); + //update-begin---author:wangshuai ---date:20221124 for:[issues/215]列表页查询框(日期选择框)设置初始时间,一进入页面时,后台报日期转换类型错误的------------ + if(valueFormat){ + schema.defaultValue = dateUtil(defaultValue).format(valueFormat); + }else{ + schema.defaultValue = dateUtil(defaultValue); + } + //update-end---author:wangshuai ---date:20221124 for:[issues/215]列表页查询框(日期选择框)设置初始时间,一进入页面时,后台报日期转换类型错误的------------ } else { const def: dayjs.Dayjs[] = []; defaultValue.forEach((item) => { - def.push(dateUtil(item)); + //update-begin---author:wangshuai ---date:20221124 for:[issues/215]列表页查询框(日期选择框)设置初始时间,一进入页面时,后台报日期转换类型错误的------------ + if(valueFormat){ + def.push(dateUtil(item).format(valueFormat)); + }else{ + def.push(dateUtil(item)); + } + //update-end---author:wangshuai ---date:20221124 for:[issues/215]列表页查询框(日期选择框)设置初始时间,一进入页面时,后台报日期转换类型错误的------------ }); schema.defaultValue = def; }