diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 26def832d..1f4242f60 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -102,6 +102,12 @@ const props = defineProps({ required: true, default: null }, + // 详情数据 + detailData: { + type: Object, + required: true, + default: null + } // // 主表参数 // masterParmas: { // type: Object, @@ -127,14 +133,14 @@ const formSchema = ref(props.formAllSchemas?.formSchema) // type 发起事件位置 type=tableForm 是明细中发起的 否则 为主表发起的 // searchCondition 查询条件 const searchTableRef = ref() -const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas, searchPage, type, row, searchCondition) => { +const opensearchTable = (formField, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition, type, row ) => { const _searchCondition = {} // 判断查询条件中,是否存在指向主表的数据 if (searchCondition && searchCondition.length > 0) { searchCondition.forEach(item => { - // 查询条件为主表某字段,需要赋值主表数据 + // 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 if (item.isMainValue) { - _searchCondition[item.key] = formRef.value.formModel[item.value] + _searchCondition[item.key] = formRef.value.formModel[item.value]?formRef.value.formModel[item.value]:props.detailData[item.value] } else { _searchCondition[item.key] = item.value } @@ -313,9 +319,9 @@ const inpuFocus = (headerItem, row, index) => { headerItem.tableForm.searchTitle, headerItem.tableForm.searchAllSchemas, headerItem.tableForm.searchPage, + headerItem.tableForm.searchCondition, 'tableForm', row, - headerItem.tableForm.searchCondition ) } diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index 2e9c3d8fc..3ec30b186 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -60,6 +60,7 @@ :apiUpdate="apiUpdate" :apiCreate="apiCreate" @searchTableSuccess="searchTableSuccess" + :detailData="detailData" />