Commit 9661293a by fanyj

修改权限

parent 5dba9f5a
......@@ -84,6 +84,7 @@ const AssetManageTree = (props) => {
const [metadataRelatedTemplate, setMetadataRelatedTemplate] = useState()
const [ viewSelectedKey, setViewSelectedKey ] = useState(viewModes[0].key);
const [permissions, setPermissions] = useState([])
const [addtype,setAddType] = useState('children')
const [modal, contextHolder] = Modal.useModal();
......@@ -492,11 +493,13 @@ const AssetManageTree = (props) => {
return dir;
}
const addDir = () => {
const addDir = (type) => {
const types = type?type:'catalog';
if (currentDir?.resourceType==='custom') return;
setUpdateDirectoryAction('add');
setUpdateDirectoryModalVisible(true);
setAddType(types)
}
const onDetailClick = () => {
......@@ -890,11 +893,11 @@ const AssetManageTree = (props) => {
{
viewSelectedKeyRef.current === 'dir' && (
<PermissionButton
defaultPermission={havePermission||addDirInfo}
tip="新增目录"
defaultPermission={havePermission}
tip="新增目录"
type="text"
icon={<PlusOutlined className={(currentDir?.resourceType==='custom')?'disable': 'default'} style={{ fontSize:16,cursor: (currentDirType==='custom')?'not-allowed':'pointer' }} />}
onClick={addDir}
onClick={()=>{addDir('catalog')}}
// size="small"
style={{width:18}}
/>
......@@ -1034,6 +1037,7 @@ const AssetManageTree = (props) => {
visible={ updateDirectoryModalVisible }
onCancel={ onUpdateDirectoryCancel }
action={ updateDirectoryAction }
addtype={addtype}
dirId={ (updateDirectoryAction==='add')?currentDirId:currentRightClickDir.nodeId }
/>
<ImportDirectory
......@@ -1054,6 +1058,9 @@ const AssetManageTree = (props) => {
{(havePermission||currentRightClickDir?.allowUpdateDir)&&<RcItem id="edit" onClick={editDir}>
修改目录
</RcItem>}
{(havePermission||currentRightClickDir?.allowAddDir)&&<RcItem id="edit" onClick={()=>{addDir('children')}}>
新增子节点
</RcItem>}
{
havePermission&&(
<>
......
......@@ -1265,7 +1265,7 @@ const AssetTable = (props) => {
tip={(checkedKeys||[]).length===0?'请先选择资源':''}
disabled={(checkedKeys||[]).length===0}
>
收藏
订阅
</PermissionButton>
{
reference===AssetManageReference && <PermissionButton
......
......@@ -33,7 +33,7 @@ const CodeInput = ({ value = '', onChange, restrict = false, action }) => {
const UpdateDirectoryModal = (props) => {
const { visible, onCancel, dirId, action } = props;
const { visible, onCancel, dirId, action,addtype } = props;
const [loading, setLoading] = useState(false);
const [ form ] = Form.useForm();
......@@ -255,8 +255,8 @@ const UpdateDirectoryModal = (props) => {
style={{ marginBottom }}
>
<Radio.Group>
<Radio value='theme'>栏目</Radio>
<Radio value='directory' disabled={ !dirId }>目录</Radio>
{addtype==='catalog'&&<Radio value='theme'>栏目</Radio>}
{addtype==='children'&&<Radio value='directory' disabled={ !dirId }>目录</Radio>}
</Radio.Group>
</Form.Item>
}
......
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