Browse Source

(*)机构存在关联时 不能删除机构

master
peng.peng 12 months ago
parent
commit
ac6f99c81c
  1. 28
      api/app/lib/controllers/organization/index.js
  2. 2
      web/client/src/sections/memberManagement/routes.js

28
api/app/lib/controllers/organization/index.js

@ -113,21 +113,21 @@ function deleteOrganization(opts) {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { id } = ctx.params; const { id } = ctx.params;
// const checkName1 = await models.MetadataDatabase.findOne({ where: { createBy: id } }); const checkName1 = await models.User.findOne({ where: { orgId: id } });
// const checkName2 = await models.MetadataFile.findOne({ where: { createBy: id } }); const checkName2 = await models.ResourceCatalog.findOne({ where: { orgId: id } });
// const checkName3 = await models.MetadataRestapi.findOne({ where: { createBy: id } }); // const checkName3 = await models.MetadataRestapi.findOne({ where: { createBy: id } });
// if (checkName1 || checkName2 || checkName3) { if (checkName1 || checkName2) {
// ctx.status = 400; ctx.status = 400;
// ctx.body = { message: '该机构下存在依赖资源无法删除!' } ctx.body = { message: '该机构下存在依赖资源无法删除!' }
// } else { } else {
await models.Organization.destroy({ await models.Organization.destroy({
where: { where: {
id: id id: id
} }
}) })
ctx.status = 204; ctx.status = 204;
ctx.body = { message: '删除机构成功' } ctx.body = { message: '删除机构成功' }
// } }
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);

2
web/client/src/sections/memberManagement/routes.js

@ -15,7 +15,7 @@ export default [{
}, { }, {
path: '/organization', path: '/organization',
key: 'organization', key: 'organization',
component: MemberManagement, component: Organization,
breadcrumb: '机构管理' breadcrumb: '机构管理'
}] }]
} }

Loading…
Cancel
Save