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 }