Commit 84427aaa authored by 田翔's avatar 田翔

fix: 关联属性增加关联表单的表格数据

parent 56f8751f
{
"name": "panda-xform",
"version": "5.7.2",
"description": "5.7.2 电话号码正常修改",
"version": "5.7.3",
"description": "5.7.3 关联属性增加关联表单的表格数据",
"keywords": [
"panda-xform"
],
......
......@@ -309,6 +309,7 @@ const FormDesigner = (props, ref) => {
const testSubmit = async () => {
const { formValue, relationForm, errors } = await formRenderRef?.current?.getValues()
console.log(formValue, relationForm)
if (errors.length) {
setTextShow(false)
return message.error('表单校验未通过!')
......
......@@ -126,9 +126,10 @@ const RelationForm = (props) => {
const getConfig = async () => {
let { code, data, msg } = await GetAccountConfigInfo(accountName)
if (code === 0) {
setConfig({ ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} })
let config = { ...data, formJson: isJson(data.formJson) ? JSON.parse(data.formJson) : {} }
setConfig(config)
const queryWheres = getQueryWheres()
getTableData(queryWheres)
getTableData(queryWheres, config)
} else {
message.error(msg)
}
......@@ -142,7 +143,7 @@ const RelationForm = (props) => {
queryWheres.push({ field: v.toField, type: '等于', value: codes[v.fromField] || formDataObj[v.fromField] })
})
}
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
let relationForm = addons.getValue('relationForm') || { configs: [], data: [], table: [] }
addons.setValueByPath('relationForm',
{
...relationForm,
......@@ -151,7 +152,7 @@ const RelationForm = (props) => {
return queryWheres
}
const getTableData = async (queryWheres) => {
const getTableData = async (queryWheres, config) => {
if (!addons) return
let params = {
user: userID,
......@@ -169,6 +170,8 @@ const RelationForm = (props) => {
if (Array.isArray(tableData)) {
setDataSource(tableData)
onChange(`${tableData.length}`)
let relationForm = addons.getValue('relationForm') || { configs: [], data: [], table: [] }
addons.setValue('relationForm', { ...relationForm, table: [...relationForm.table, { config, dataSource }] })
} else {
setDataSource([])
onChange(`${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