73 lines
2.6 KiB
React
73 lines
2.6 KiB
React
/*
|
||
Copyright (C) 2025 QuantumNous
|
||
|
||
This program is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU Affero General Public License as
|
||
published by the Free Software Foundation, either version 3 of the
|
||
License, or (at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU Affero General Public License for more details.
|
||
|
||
You should have received a copy of the GNU Affero General Public License
|
||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
||
For commercial licensing, please contact support@quantumnous.com
|
||
*/
|
||
import React from 'react';
|
||
import { useTranslation } from 'react-i18next';
|
||
import OrgSubpageTabs from './components/OrgSubpageTabs';
|
||
import OrgSkillLibrary from './OrgSkillLibrary';
|
||
import OrgPrivateSkills from './OrgPrivateSkills';
|
||
|
||
/**
|
||
* 技能中心:企业技能库 + 企业自研 Skill 的合并入口。
|
||
*
|
||
* 两个页签共用同一权限口径(isAdmin && canManageSkills),差异只在站点级
|
||
* 模块开关,由 showLibrary / showPrivate 控制。
|
||
*
|
||
* 平台技能的"引入企业"有两条路径:企业管理员可在平台技能超市
|
||
* (/skill-market,原独立的企业技能市场页已并入其中,旧路由重定向过去)
|
||
* 就地启用;企业技能库页内的「引入技能」抽屉则是平台超管与被顶栏配置挡在
|
||
* 超市之外的 org_only 管理员的入口。两条路径写同一端点、同一审计。
|
||
*/
|
||
const OrgSkillCenter = ({
|
||
orgId,
|
||
orgRole,
|
||
canAssignSkills = false,
|
||
showLibrary = true,
|
||
showPrivate = true,
|
||
}) => {
|
||
const { t } = useTranslation();
|
||
return (
|
||
<OrgSubpageTabs
|
||
tabs={[
|
||
showLibrary && {
|
||
key: 'library',
|
||
label: t('企业技能库'),
|
||
// orgRole 用于识别平台超管(超市页解析不出其企业上下文,页内引入
|
||
// 抽屉是其唯一的"代客开通"入口);canAssignSkills 决定引入成功后的
|
||
// 指引指向哪里——超管的该权限位后端恒 false,不能让文案把人指向
|
||
// 一个结构上进不去的页面。两者都复用父层已取的 /api/org/info。
|
||
node: (
|
||
<OrgSkillLibrary
|
||
orgId={orgId}
|
||
orgRole={orgRole}
|
||
canAssignSkills={canAssignSkills}
|
||
/>
|
||
),
|
||
},
|
||
showPrivate && {
|
||
key: 'private',
|
||
label: t('企业自研 Skill'),
|
||
node: <OrgPrivateSkills orgId={orgId} />,
|
||
},
|
||
]}
|
||
/>
|
||
);
|
||
};
|
||
|
||
export default OrgSkillCenter;
|