mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-06 05:59:25 +08:00
fix: properly handle hidden field in tab routing (#6366)
* fix: format code and improve readability in routesTableSchema.tsx * fix: properly handle hidden field in tab routing
This commit is contained in:
parent
1c07aecdb4
commit
28500dd114
@ -411,6 +411,18 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const childrenObj: any = {};
|
||||||
|
if (tabSchemaUid) {
|
||||||
|
childrenObj.children = [
|
||||||
|
{
|
||||||
|
schemaUid: tabSchemaUid,
|
||||||
|
type: NocoBaseDesktopRouteType.tabs,
|
||||||
|
tabSchemaName,
|
||||||
|
hidden: !form.values?.enableTabs,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
const res = await createRoute({
|
const res = await createRoute({
|
||||||
..._.omit(form.values, ['href', 'params', 'url']),
|
..._.omit(form.values, ['href', 'params', 'url']),
|
||||||
schemaUid:
|
schemaUid:
|
||||||
@ -419,18 +431,9 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
|||||||
: menuSchemaUid,
|
: menuSchemaUid,
|
||||||
menuSchemaUid,
|
menuSchemaUid,
|
||||||
options,
|
options,
|
||||||
|
...childrenObj,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (tabSchemaUid) {
|
|
||||||
await createRoute({
|
|
||||||
schemaUid: tabSchemaUid,
|
|
||||||
parentId: res?.data?.data?.id,
|
|
||||||
type: NocoBaseDesktopRouteType.tabs,
|
|
||||||
tabSchemaName,
|
|
||||||
hidden: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.setVisible(false);
|
ctx.setVisible(false);
|
||||||
actionCallback?.(res?.data?.data);
|
actionCallback?.(res?.data?.data);
|
||||||
await form.reset();
|
await form.reset();
|
||||||
@ -1207,6 +1210,7 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
|||||||
const resource = useMemo(() => api.resource(collectionName), [api]);
|
const resource = useMemo(() => api.resource(collectionName), [api]);
|
||||||
const { getDataBlockRequest } = useDataBlockRequestGetter();
|
const { getDataBlockRequest } = useDataBlockRequestGetter();
|
||||||
const { deleteRouteSchema } = useDeleteRouteSchema();
|
const { deleteRouteSchema } = useDeleteRouteSchema();
|
||||||
|
const { refresh: refreshMenu } = useAllAccessDesktopRoutes();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
@ -1217,6 +1221,7 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getDataBlockRequest().refresh();
|
getDataBlockRequest().refresh();
|
||||||
|
refreshMenu();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user