y修复 新增用户的 时候 根据角色禁用选项
This commit is contained in:
@@ -54,6 +54,7 @@ export default function UserRolePage() {
|
|||||||
|
|
||||||
const [showSite, setShowSite] = useState(true);
|
const [showSite, setShowSite] = useState(true);
|
||||||
const [siteDisabled, setSiteDisabled] = useState(false);
|
const [siteDisabled, setSiteDisabled] = useState(false);
|
||||||
|
const [orgDisabled, setOrgDisabled] = useState(false);
|
||||||
const isEditSelf = currentUser?.userId == userInfo?.userId;
|
const isEditSelf = currentUser?.userId == userInfo?.userId;
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ export default function UserRolePage() {
|
|||||||
: { siteId: stationId }
|
: { siteId: stationId }
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
console.log(userInfo?.roleKey)
|
|
||||||
|
|
||||||
getUser(params).then(res => {
|
getUser(params).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
@@ -284,13 +285,17 @@ export default function UserRolePage() {
|
|||||||
|
|
||||||
const defaultOrgId = currentStation?.orgId ?? '';
|
const defaultOrgId = currentStation?.orgId ?? '';
|
||||||
const defaultSiteId = stationId ?? '';
|
const defaultSiteId = stationId ?? '';
|
||||||
|
const isSiteManager = userInfo?.roleKey == 'siteManager' && userInfo?.orgId == defaultOrgId;
|
||||||
|
const isOrgManager = userInfo?.roleKey == 'manager' && userInfo?.orgId == defaultOrgId;
|
||||||
|
|
||||||
|
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
orgId: defaultOrgId,
|
orgId: defaultOrgId,
|
||||||
siteId: defaultSiteId
|
siteId: defaultSiteId
|
||||||
});
|
});
|
||||||
|
|
||||||
setSiteDisabled(!!defaultSiteId);
|
setSiteDisabled(isSiteManager);
|
||||||
|
setOrgDisabled(isOrgManager || isSiteManager);
|
||||||
|
|
||||||
if (defaultOrgId) {
|
if (defaultOrgId) {
|
||||||
getSiteByOrg(defaultOrgId);
|
getSiteByOrg(defaultOrgId);
|
||||||
@@ -715,6 +720,8 @@ export default function UserRolePage() {
|
|||||||
getSiteByOrg(val);
|
getSiteByOrg(val);
|
||||||
form.setFieldsValue({ siteId: null });
|
form.setFieldsValue({ siteId: null });
|
||||||
}}
|
}}
|
||||||
|
disabled={orgDisabled}
|
||||||
|
|
||||||
>
|
>
|
||||||
{orgList.map(item => (
|
{orgList.map(item => (
|
||||||
<Select.Option key={item.id} value={item.id}>{item.orgName}</Select.Option>
|
<Select.Option key={item.id} value={item.id}>{item.orgName}</Select.Option>
|
||||||
@@ -726,9 +733,9 @@ export default function UserRolePage() {
|
|||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="siteId" label={t('systemSetting.s9')}>
|
<Form.Item name="siteId" label={t('systemSetting.s9')}>
|
||||||
<Select
|
<Select
|
||||||
placeholder={t('systemSetting.fixed2PleaseSelect2')}
|
placeholder={t('systemSetting.selectsite')}
|
||||||
allowClear
|
allowClear
|
||||||
//disabled={siteDisabled}
|
disabled={siteDisabled}
|
||||||
>
|
>
|
||||||
{siteList.map(item => (
|
{siteList.map(item => (
|
||||||
<Select.Option key={item.id} value={item.id}>{item.siteName}</Select.Option>
|
<Select.Option key={item.id} value={item.id}>{item.siteName}</Select.Option>
|
||||||
|
|||||||
@@ -2578,6 +2578,7 @@ const en = {
|
|||||||
addMenu: 'Add Menu',
|
addMenu: 'Add Menu',
|
||||||
editSite: 'Edit Station',
|
editSite: 'Edit Station',
|
||||||
addSite: 'Add Station',
|
addSite: 'Add Station',
|
||||||
|
selectsite:'Select Station',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ const zh = {
|
|||||||
execTime: '执行时间',
|
execTime: '执行时间',
|
||||||
saveTask: '保存任务',
|
saveTask: '保存任务',
|
||||||
abMode: '自定义模式',
|
abMode: '自定义模式',
|
||||||
|
|
||||||
saveFail: '保存失败',
|
saveFail: '保存失败',
|
||||||
activatedTime: '已激活时间',
|
activatedTime: '已激活时间',
|
||||||
aiAction1: 'AI',
|
aiAction1: 'AI',
|
||||||
@@ -2899,6 +2899,8 @@ const zh = {
|
|||||||
s9: '所属场站',
|
s9: '所属场站',
|
||||||
|
|
||||||
sn: '机场SN',
|
sn: '机场SN',
|
||||||
|
selectsite: '请选择场站',
|
||||||
|
|
||||||
|
|
||||||
sn001Sn002: '例如: SN001, SN002',
|
sn001Sn002: '例如: SN001, SN002',
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user