From bf4b9b7ca1f3844ef5f69dc5b57a64b742db8a54 Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Mon, 15 Apr 2024 15:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=90=E8=A1=A8=E5=B1=95=E7=A4=BA=E4=B8=BB?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=B0=81=E8=A3=85=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableHead/src/TableHead.vue | 8 ++++++-- src/components/XButton/src/ButtonBase.vue | 7 ++++++- src/components/rowDrop/index.vue | 8 ++++++-- src/hooks/web/useCrudSchemas.ts | 8 ++++++-- src/types/form.d.ts | 2 ++ 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/components/TableHead/src/TableHead.vue b/src/components/TableHead/src/TableHead.vue index e99426886..6b4fff698 100644 --- a/src/components/TableHead/src/TableHead.vue +++ b/src/components/TableHead/src/TableHead.vue @@ -10,7 +10,7 @@
+ :allSchemas="allSchemas" :detailAllSchemas="detailAllSchemas" ref="rowDropRef"/>
@@ -60,7 +60,11 @@ import rowDrop from "@/components/rowDrop/index.vue" allSchemas: { type: Object, default: null - } + }, + detailAllSchemas: { + type: Object, + default: null + }, }) const buttonsLeft = ref([]) const buttonsRight = ref([]) diff --git a/src/components/XButton/src/ButtonBase.vue b/src/components/XButton/src/ButtonBase.vue index 15f997966..32a6f05c7 100644 --- a/src/components/XButton/src/ButtonBase.vue +++ b/src/components/XButton/src/ButtonBase.vue @@ -25,6 +25,7 @@ ref="rowDropRef" @updata-table-columns="updataTableColumns" :allSchemas="allSchemas" + :detailAllSchemas="detailAllSchemas" @closeRowDrop="closeRowDrop" @updataTableColumns="updataTableColumns" /> @@ -60,7 +61,11 @@ const props = defineProps({ allSchemas: { type: Object, default: null - } + }, + detailAllSchemas: { + type: Object, + default: null + }, }) // 传递给父类 diff --git a/src/components/rowDrop/index.vue b/src/components/rowDrop/index.vue index 72c2fb400..45c97c0aa 100644 --- a/src/components/rowDrop/index.vue +++ b/src/components/rowDrop/index.vue @@ -30,7 +30,11 @@ const props = defineProps({ allSchemas: { type: Object, default: null - } + }, + detailAllSchemas: { + type: Object, + default: null + }, }) const popoverVisible = ref(false) const route = useRoute() // 路由信息 @@ -121,7 +125,7 @@ const dragover = (e) => { // 初始化当前全选状态 const initSelectSta = () => { RedisApi.getRedis(routeName.value).then(res => { - const _myTableColumns = props.allSchemas?.tableColumns + let _myTableColumns = [...props.allSchemas?.tableColumns,...props.detailAllSchemas?.tableMainColumns] // 有缓存 if (res) { checkedDataList.value = [] diff --git a/src/hooks/web/useCrudSchemas.ts b/src/hooks/web/useCrudSchemas.ts index b39d0453f..1028821e3 100644 --- a/src/hooks/web/useCrudSchemas.ts +++ b/src/hooks/web/useCrudSchemas.ts @@ -67,6 +67,7 @@ interface AllSchemas { formSchema: FormSchema[] detailSchema: DescriptionsSchema[] tableFormColumns: TableFormColumn[] + tableMainColumns:TableColumn[] } const { t } = useI18n() @@ -83,15 +84,18 @@ export const useCrudSchemas = ( tableColumns: [], formSchema: [], detailSchema: [], - tableFormColumns:[] + tableFormColumns:[], + tableMainColumns:[], }) const searchSchema = filterSearchSchema(crudSchema, allSchemas) allSchemas.searchSchema = searchSchema || [] + const tableColumns = filterTableSchema(crudSchema) allSchemas.tableColumns = tableColumns || [] - + allSchemas.tableMainColumns = tableColumns.filter(item=>!item.hiddenInMain) || [] + const formSchema = filterFormSchema(crudSchema, allSchemas) allSchemas.formSchema = formSchema diff --git a/src/types/form.d.ts b/src/types/form.d.ts index 980c8cc6d..4b6eb4594 100644 --- a/src/types/form.d.ts +++ b/src/types/form.d.ts @@ -39,6 +39,8 @@ export type FormSchema = { value?: FormValueType // 是否隐藏 hidden?: boolean + //主表中展示子表数据 + hiddenInMain?: boolean // 远程加载下拉项 api?: () => AxiosPromise }