Co-authored-by: bingguo <bingguo@gaoding.com>
This commit is contained in:
parent
1a43142252
commit
2423aeab64
|
|
@ -70,3 +70,5 @@ export function handleInputNumberValue(component?: ComponentType, val?: any) {
|
|||
* 时间字段
|
||||
*/
|
||||
export const dateItemType = genType();
|
||||
|
||||
export const defaultValueComponents = ['Input', 'InputPassword', 'InputSearch', 'InputTextArea'];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
|
|||
import { unref, toRaw, nextTick } from 'vue';
|
||||
import { isArray, isFunction, isObject, isString } from '/@/utils/is';
|
||||
import { deepMerge } from '/@/utils';
|
||||
import { dateItemType, handleInputNumberValue } from '../helper';
|
||||
import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
|
||||
import { dateUtil } from '/@/utils/dateUtil';
|
||||
import { cloneDeep, uniqBy } from 'lodash-es';
|
||||
import { error } from '/@/utils/log';
|
||||
|
|
@ -37,7 +37,9 @@ export function useFormEvents({
|
|||
if (!formEl) return;
|
||||
|
||||
Object.keys(formModel).forEach((key) => {
|
||||
formModel[key] = defaultValueRef.value[key];
|
||||
const schema = unref(getSchema).find((item) => item.field === key);
|
||||
const isInput = schema?.component && defaultValueComponents.includes(schema.component);
|
||||
formModel[key] = isInput ? defaultValueRef.value[key] || '' : defaultValueRef.value[key];
|
||||
});
|
||||
nextTick(() => clearValidate());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue