From cc08afc16a5290a9242afd3da279e2066c98180a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Mon, 13 Nov 2023 15:53:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=20=E5=9F=BA=E7=A1=80form?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=20=E7=BB=84=E4=BB=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BasicForm/src/BasicForm.vue | 14 ++++++++++---- src/components/Detail/src/Detail.vue | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) 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" />