Commit d330e0a4 authored by 田翔's avatar 田翔

fix: 关联表单数据修复

parent 4bad32ab
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.8.11", "version": "6.8.13",
"description": "6.8.11 完善区域任务控件以及配置", "description": "6.8.13 关联表单数量问题",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -101,6 +101,7 @@ const XRender = (props, ref) => { ...@@ -101,6 +101,7 @@ const XRender = (props, ref) => {
displayType: schemaForm.displayType === 'column' ? 'column' : 'row',//未知原因出现存储'左右'/'上下' displayType: schemaForm.displayType === 'column' ? 'column' : 'row',//未知原因出现存储'左右'/'上下'
properties: parentObj properties: parentObj
} }
console.log('json', json)
setInitField(array) setInitField(array)
return json return json
}, [formJson, values, disabledFields, disabled]) }, [formJson, values, disabledFields, disabled])
......
...@@ -190,8 +190,11 @@ const formFieldHide = async (params) => { ...@@ -190,8 +190,11 @@ const formFieldHide = async (params) => {
//关联表单隐藏之后将数据清空 //关联表单隐藏之后将数据清空
if (schema.widget === 'RelationForm' && v.isHide) { if (schema.widget === 'RelationForm' && v.isHide) {
const { configs, data } = params?.form?.formData?.relationForm || { configs: [], data: [] } const { configs, data } = params?.form?.formData?.relationForm || { configs: [], data: [] }
let newData = data.filter(v => v.path === !path) let newData = data.filter(v => v.path !== path)
params?.form?.setValueByPath('relationForm', { configs: configs, data: newData }) params?.form?.setValueByPath('relationForm', { configs: configs, data: newData })
setTimeout(() => {
params?.form?.setValueByPath(path, '')
}, 0)
} }
params?.form?.setSchemaByPath(path, { ...schema, hidden: v.isHide, presetValue: v.fieldValue || schema.presetValue || '' }) params?.form?.setSchemaByPath(path, { ...schema, hidden: v.isHide, presetValue: v.fieldValue || schema.presetValue || '' })
let gorupPath = path.split('.')[0] let gorupPath = path.split('.')[0]
......
...@@ -290,7 +290,7 @@ const RelationForm = (props) => { ...@@ -290,7 +290,7 @@ const RelationForm = (props) => {
let listArray = relationForm.data.filter(v => v.ID !== itemData.ID) let listArray = relationForm.data.filter(v => v.ID !== itemData.ID)
listArray.push(itemData) listArray.push(itemData)
addons?.setValue('relationForm', { ...relationForm, data: listArray }) addons?.setValue('relationForm', { ...relationForm, data: listArray })
onChange(`${new Date().getTime()}`) onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `)
addons?.setValue(addons?.dataPath, `${array.length}`) addons?.setValue(addons?.dataPath, `${array.length}`)
} else { } else {
rowClick(type, row) rowClick(type, row)
...@@ -331,7 +331,7 @@ const RelationForm = (props) => { ...@@ -331,7 +331,7 @@ const RelationForm = (props) => {
relationForm.data.push(item) relationForm.data.push(item)
addons.setValue('relationForm', { ...relationForm }) addons.setValue('relationForm', { ...relationForm })
setTimeout(() => { setTimeout(() => {
onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `) onChange(value ? `${Number(value) + 1}` : `1`)
}, 0) }, 0)
} }
} }
......
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