Commit 0867498b by zhaochengxiang

资源权限

parent 7b5fd0d3
...@@ -35,6 +35,8 @@ const operationMap = { ...@@ -35,6 +35,8 @@ const operationMap = {
addAsAsset: '新增为资产', addAsAsset: '新增为资产',
distribute: '分配', distribute: '分配',
reDistribute: '转分配', reDistribute: '转分配',
autoDistribute: '自动分配',
batchEdit: '批量编辑',
check: '复核', check: '复核',
changeToNotAsset: '转为非资产', changeToNotAsset: '转为非资产',
changeToUncombed: '转为未梳理', changeToUncombed: '转为未梳理',
...@@ -223,8 +225,8 @@ const FC = (props) => { ...@@ -223,8 +225,8 @@ const FC = (props) => {
} }
}, [data]) }, [data])
const [addAble, addAsAssetAble, distributeAble, checkAble, importAble, exportAble, changeDirectoryAble, deleteAble] = React.useMemo(() => { const [addAble, addAsAssetAble, distributeAble, autoDistributeAble, batchEditAble,checkAble, importAble, exportAble, changeDirectoryAble, deleteAble] = React.useMemo(() => {
let [_addAble, _addAsAssetAble, _distributeAble, _checkAble, _importAble, _exportAble, _changeDiretoryAble, _deleteAble] = [false, false, false, false, false, false, false, false] let [_addAble, _addAsAssetAble, _distributeAble, _autoDistributeAble, _batchEditAble, _checkAble, _importAble, _exportAble, _changeDiretoryAble, _deleteAble] = [false, false, false, false, false, false, false, false, false, false]
_addAble = (permissions??[]).findIndex(item => item==='add') !== -1 _addAble = (permissions??[]).findIndex(item => item==='add') !== -1
...@@ -248,10 +250,12 @@ const FC = (props) => { ...@@ -248,10 +250,12 @@ const FC = (props) => {
_exportAble = allowExport _exportAble = allowExport
} }
let [allowAddAsAsset, allowDistribute, allowCheck, allowChangeDirectory, allowDelete] = [true, true, true, true, true] let [allowAddAsAsset, allowDistribute, allowAutoDistribute, allowBatchEdit, allowCheck, allowChangeDirectory, allowDelete] = [true, true, true, true, true, true, true]
for (const row of selectedRows) { for (const row of selectedRows) {
const addAsAssetIndex = (row.allowButtons??[]).findIndex(item => item==='addAsAsset') const addAsAssetIndex = (row.allowButtons??[]).findIndex(item => item==='addAsAsset')
const distributeIndex = (row.allowButtons??[]).findIndex(item => item==='distribute') const distributeIndex = (row.allowButtons??[]).findIndex(item => item==='distribute')
const autoDistributeIndex = (row.allowButtons??[]).findIndex(item => item==='autoDistribute')
const batchEditIndex = (row.allowButtons??[]).findIndex(item => item==='batchEdit')
const checkIndex = (row.allowButtons??[]).findIndex(item => item==='check') const checkIndex = (row.allowButtons??[]).findIndex(item => item==='check')
const changeDirecotoryIndex = (row.allowButtons??[]).findIndex(item => item==='changeDir') const changeDirecotoryIndex = (row.allowButtons??[]).findIndex(item => item==='changeDir')
const deleteIndex = (row.allowButtons??[]).findIndex(item => item==='delete') const deleteIndex = (row.allowButtons??[]).findIndex(item => item==='delete')
...@@ -261,6 +265,12 @@ const FC = (props) => { ...@@ -261,6 +265,12 @@ const FC = (props) => {
if (distributeIndex === -1) { if (distributeIndex === -1) {
allowDistribute = false allowDistribute = false
} }
if (autoDistributeIndex === -1) {
allowAutoDistribute = false
}
if (batchEditIndex === -1) {
allowBatchEdit = false
}
if (checkIndex === -1) { if (checkIndex === -1) {
allowCheck = false allowCheck = false
} }
...@@ -274,11 +284,13 @@ const FC = (props) => { ...@@ -274,11 +284,13 @@ const FC = (props) => {
_addAsAssetAble = allowAddAsAsset _addAsAssetAble = allowAddAsAsset
_distributeAble = allowDistribute _distributeAble = allowDistribute
_autoDistributeAble = allowAutoDistribute
_batchEditAble = allowBatchEdit
_checkAble = allowCheck _checkAble = allowCheck
_changeDiretoryAble = allowChangeDirectory _changeDiretoryAble = allowChangeDirectory
_deleteAble = allowDelete _deleteAble = allowDelete
return [_addAble, _addAsAssetAble, _distributeAble, _checkAble, _importAble, _exportAble, _changeDiretoryAble, _deleteAble] return [_addAble, _addAsAssetAble, _distributeAble, _autoDistributeAble, _batchEditAble, _checkAble, _importAble, _exportAble, _changeDiretoryAble, _deleteAble]
}, [permissions, selectedRows]) }, [permissions, selectedRows])
const menuData = React.useMemo(() => { const menuData = React.useMemo(() => {
...@@ -619,7 +631,7 @@ const FC = (props) => { ...@@ -619,7 +631,7 @@ const FC = (props) => {
}) })
} }
const onTaskAutoAllocationClick = () => { const onAutoDistributeTaskClick = () => {
} }
...@@ -859,8 +871,8 @@ const FC = (props) => { ...@@ -859,8 +871,8 @@ const FC = (props) => {
onAddToAssetClick() onAddToAssetClick()
} else if (key === 'distribute') { } else if (key === 'distribute') {
onDistributeTaskClick() onDistributeTaskClick()
} else if (key === 'taskAutoAllocation') { } else if (key === 'autoDistribute') {
onTaskAutoAllocationClick() onAutoDistributeTaskClick()
} else if (key === 'batchEdit') { } else if (key === 'batchEdit') {
onBatchEditClick() onBatchEditClick()
}else if (key === 'check') { }else if (key === 'check') {
...@@ -923,8 +935,8 @@ const FC = (props) => { ...@@ -923,8 +935,8 @@ const FC = (props) => {
</div> </div>
</PermissionMenuItem> </PermissionMenuItem>
<PermissionMenuItem <PermissionMenuItem
key='taskAutoAllocation' key='autoDistribute'
defaultPermission={true} defaultPermission={autoDistributeAble}
disabled={(selectedRows??[]).length===0} disabled={(selectedRows??[]).length===0}
tip={(selectedRows??[]).length===0?'请先选择资源':''} tip={(selectedRows??[]).length===0?'请先选择资源':''}
> >
...@@ -934,7 +946,7 @@ const FC = (props) => { ...@@ -934,7 +946,7 @@ const FC = (props) => {
</PermissionMenuItem> </PermissionMenuItem>
<PermissionMenuItem <PermissionMenuItem
key='batchEdit' key='batchEdit'
defaultPermission={true} defaultPermission={batchEditAble}
disabled={(selectedRows??[]).length===0} disabled={(selectedRows??[]).length===0}
tip={(selectedRows??[]).length===0?'请先选择资源':''} tip={(selectedRows??[]).length===0?'请先选择资源':''}
> >
...@@ -1038,15 +1050,15 @@ const FC = (props) => { ...@@ -1038,15 +1050,15 @@ const FC = (props) => {
任务分配 任务分配
</PermissionButton> </PermissionButton>
<PermissionButton <PermissionButton
defaultPermission={true} defaultPermission={autoDistributeAble}
onClick={onTaskAutoAllocationClick} onClick={onAutoDistributeTaskClick}
disabled={(selectedRows??[]).length===0} disabled={(selectedRows??[]).length===0}
tip={(selectedRows??[]).length===0?'请先选择资源':''} tip={(selectedRows??[]).length===0?'请先选择资源':''}
> >
自动分配 自动分配
</PermissionButton> </PermissionButton>
<PermissionButton <PermissionButton
defaultPermission={true} defaultPermission={batchEditAble}
onClick={onBatchEditClick} onClick={onBatchEditClick}
disabled={(selectedRows??[]).length===0} disabled={(selectedRows??[]).length===0}
tip={(selectedRows??[]).length===0?'请先选择资源':''} tip={(selectedRows??[]).length===0?'请先选择资源':''}
......
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