fix: condition

This commit is contained in:
霍世杰 2025-03-04 09:25:28 +08:00
parent add06ecbdb
commit a2da2edcb5

View File

@ -112,21 +112,20 @@ export class PluginMobileServer extends Plugin {
parentId: ctx.action.params.values,
},
});
if (tabs.length > 1 || !tabs[0].hidden) {
return;
}
const repository = this.app.db.getRepository('rolesMobileRoutes');
const whereOrValues = {
roleName: ctx.action.params.associatedIndex,
mobileRouteId: tabs[0].id,
};
const rolesMobileRoute = await repository.findOne({ where: whereOrValues });
if (tabs.length === 1 && tabs[0].hidden) {
const repository = this.app.db.getRepository('rolesMobileRoutes');
const whereOrValues = {
roleName: ctx.action.params.associatedIndex,
mobileRouteId: tabs[0].id,
};
const rolesMobileRoute = await repository.findOne({ where: whereOrValues });
if (actionName === 'add') {
!rolesMobileRoute && (await repository.create({ values: whereOrValues }));
}
if (actionName === 'remove') {
rolesMobileRoute && (await repository.destroy({ filter: whereOrValues }));
if (actionName === 'add') {
!rolesMobileRoute && (await repository.create({ values: whereOrValues }));
}
if (actionName === 'remove') {
rolesMobileRoute && (await repository.destroy({ filter: whereOrValues }));
}
}
};
this.app.resourceManager.registerActionHandlers({