Commit 9c9cef40 by zhaochengxiang

增加规范权限

parent 1b45d9e0
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, useMemo } from 'react';
import { Tabs, Spin } from 'antd'; import { Tabs, Spin } from 'antd';
import { dispatch } from '../../../model'; import { dispatch } from '../../../model';
...@@ -25,6 +25,27 @@ const ModelConfig = () => { ...@@ -25,6 +25,27 @@ const ModelConfig = () => {
getPermissions(); getPermissions();
}, []) }, [])
const [showRule, showRuleTemplate] = useMemo(() => {
let [_showRule, _showRuleTemplate] = [false, false]
const ruleIndex = (permissions??[]).findIndex(item => item.privilegedObjectName === '规范配置')
if (ruleIndex !== -1) {
const ruleAllPermissionIndex = (permissions[ruleIndex].optionList??[]).findIndex(item => item.name === '全部权限')
if (ruleAllPermissionIndex !== -1) {
_showRule = permissions[ruleIndex].optionList[ruleAllPermissionIndex].enabled
}
}
const ruleTemplateIndex = (permissions??[]).findIndex(item => item.privilegedObjectName === '规则库管理')
if (ruleTemplateIndex !== -1) {
const ruleRuleAllPermissionIndex = (permissions[ruleTemplateIndex].optionList??[]).findIndex(item => item.name === '全部权限')
if (ruleRuleAllPermissionIndex !== -1) {
_showRuleTemplate = permissions[ruleTemplateIndex].optionList[ruleRuleAllPermissionIndex].enabled
}
}
return [_showRule, _showRuleTemplate]
}, [permissions])
const getPermissions = () => { const getPermissions = () => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -56,12 +77,16 @@ const ModelConfig = () => { ...@@ -56,12 +77,16 @@ const ModelConfig = () => {
<TabPane tab='数据表类型配置' key='2'> <TabPane tab='数据表类型配置' key='2'>
<TemplateCURD /> <TemplateCURD />
</TabPane> </TabPane>
<TabPane tab='规范配置' key='3'> {
<RuleCURD /> showRule && <TabPane tab='规范配置' key='3'>
</TabPane> <RuleCURD />
<TabPane tab='规则库管理' key='4'> </TabPane>
<RuleTemplateCURD /> }
</TabPane> {
showRuleTemplate && <TabPane tab='规则库管理' key='4'>
<RuleTemplateCURD />
</TabPane>
}
<TabPane tab='分区配置' key='5'> <TabPane tab='分区配置' key='5'>
<PartitionCURD /> <PartitionCURD />
</TabPane> </TabPane>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment