Commit 729eb0e2 authored by 田翔's avatar 田翔

fix: 隐藏组件数据丢失问题

parent 10c93e50
{
"name": "panda-xform",
"version": "4.0.0",
"description": "4.0.0: 提交被隐藏的数据",
"version": "4.0.1",
"description": "4.0.1: 隐藏组件数据丢失问题",
"keywords": [
"panda-xform"
],
......
......@@ -172,7 +172,7 @@ const formFieldHide = async (params) => {
data.forEach(v => {
let path = getPath(params.schema, v.fieldName)
if (path) {
params?.form?.setSchemaByPath(path, { ...params?.form?.getSchemaByPath(path), hidden: v.fieldValue })
params?.form?.setSchemaByPath(path, { ...params?.form?.getSchemaByPath(path), hidden: v.isHide, presetValue: v.fieldValue })
let hidden = getGroupHidden(params?.form, params.schema, params.gorupName)
params?.form?.setSchemaByPath(params.gorupName, { ...params?.form?.getSchemaByPath(params.gorupName), hidden: hidden })
}
......@@ -185,11 +185,26 @@ const Automatic = debounce(formAutomatic)
const fieldHide = debounce(formFieldHide)
const getFieldValue = (formValue, fieldName) => {
let value = ''
Object.keys(formValue).map(k => {
if (isObject(formValue[k])) {
Object.keys(formValue[k]).map(j => {
if (j === fieldName) {
value = formValue[k][j]
}
})
}
})
return value
}
//自动计算监听/隐藏条件监听
const getAutoWatch = (schema, form, startTime) => {
let watch = {}
let paths = []
let { relationForm } = form?.getValues()
let formValue = form?.getValues()
let { relationForm } = formValue
const configs = relationForm?.configs || []
const AutoCalculate = getWidgetInfo(schema, 'NumberInput')
const HiddenWidget = getHiddenWidget(schema)
......@@ -231,6 +246,7 @@ const getAutoWatch = (schema, form, startTime) => {
type: ['HiddenWidget'],
path,
fieldName,
fieldValue: getFieldValue(formValue, fieldName),
formula: hiddenCondition
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment