fix: use form
parent
57a1be1c15
commit
f97f541f30
|
@ -1,8 +1,7 @@
|
|||
import type { ColEx } from '../types'
|
||||
import type { AdvanceState } from '../types/hooks'
|
||||
import { ComputedRef, getCurrentInstance, Ref, shallowReactive } from 'vue'
|
||||
import { ComputedRef, getCurrentInstance, Ref, shallowReactive, computed, unref, watch } from 'vue'
|
||||
import type { FormProps, FormSchema } from '../types/form'
|
||||
import { computed, unref, watch } from 'vue'
|
||||
import { isBoolean, isFunction, isNumber, isObject } from '@/utils/is'
|
||||
import { useBreakpoint } from '@/hooks/event/useBreakpoint'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
|
|
|
@ -6,7 +6,7 @@ import { isArray, isFunction, isObject, isString, isDef, isNullOrUnDef, isEmpty
|
|||
import { deepMerge } from '@/utils'
|
||||
import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper'
|
||||
import { dateUtil } from '@/utils/dateUtil'
|
||||
import { cloneDeep, set, uniqBy } from 'lodash-es'
|
||||
import { cloneDeep, set, uniqBy, get } from 'lodash-es'
|
||||
import { error } from '@/utils/log'
|
||||
|
||||
interface UseFormActionContext {
|
||||
|
@ -35,7 +35,7 @@ function tryConstructArray(field: string, values: Recordable = {}): any[] | unde
|
|||
set(result, index, values[k.trim()])
|
||||
})
|
||||
|
||||
return result.length ? result : undefined
|
||||
return result.filter(Boolean).length ? result : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,9 +104,8 @@ export function useFormEvents({
|
|||
const validKeys: string[] = []
|
||||
fields.forEach((key) => {
|
||||
const schema = unref(getSchema).find((item) => item.field === key)
|
||||
let value = values[key]
|
||||
|
||||
const hasKey = Reflect.has(values, key)
|
||||
let value = get(values, key)
|
||||
const hasKey = !!get(values, key)
|
||||
|
||||
value = handleInputNumberValue(schema?.component, value)
|
||||
const { componentProps } = schema || {}
|
||||
|
@ -157,6 +156,7 @@ export function useFormEvents({
|
|||
})
|
||||
validateFields(validKeys).catch((_) => {})
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Delete based on field name
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue