Commit 7c9703b9 by zhaochengxiang

资产编辑权限

parent 5a2d52e1
...@@ -61,6 +61,10 @@ export function* checkCodeIsExist(payload) { ...@@ -61,6 +61,10 @@ export function* checkCodeIsExist(payload) {
return yield call(service.checkCodeIsExist, payload); return yield call(service.checkCodeIsExist, payload);
} }
export function* checkDataAssetEditable(payload) {
return yield call(service.checkDataAssetEditable, payload);
}
export function* addDataAssetByDirIds(payload) { export function* addDataAssetByDirIds(payload) {
return yield call(service.addDataAssetByDirIds, payload); return yield call(service.addDataAssetByDirIds, payload);
} }
......
...@@ -56,6 +56,10 @@ export function checkCodeIsExist(payload) { ...@@ -56,6 +56,10 @@ export function checkCodeIsExist(payload) {
return Post("/dataassetmanager/dataAssetApi/checkDataAssetCodeIsExist", payload); return Post("/dataassetmanager/dataAssetApi/checkDataAssetCodeIsExist", payload);
} }
export function checkDataAssetEditable(payload) {
return Post("/dataassetmanager/dataAssetApi/checkDataAssetEditable", payload);
}
export function addDataAssetByDirIds(payload) { export function addDataAssetByDirIds(payload) {
return PostJSON("/dataassetmanager/dataAssetApi/addDataAssetByDirIds", payload); return PostJSON("/dataassetmanager/dataAssetApi/addDataAssetByDirIds", payload);
} }
......
...@@ -15,6 +15,7 @@ import IndexCode from './IndexCode'; ...@@ -15,6 +15,7 @@ import IndexCode from './IndexCode';
import { CancelSvg, EditSvg, SaveSvg, FullScreenSvg, CancelFullScreenSvg } from './AssetSvg'; import { CancelSvg, EditSvg, SaveSvg, FullScreenSvg, CancelFullScreenSvg } from './AssetSvg';
import SelectUser from '../../Model/Component/SelectUsers'; import SelectUser from '../../Model/Component/SelectUsers';
import SelectFilter from '../../Model/Component/SelectFilter'; import SelectFilter from '../../Model/Component/SelectFilter';
import { checkDataAssetEditable } from '../../../../service/dataassetmanager';
const AssetAction = (props) => { const AssetAction = (props) => {
const { id, dirId, action, terms, onChange, readOnly = false, form, onMetadataChange, onElementsChange } = props; const { id, dirId, action, terms, onChange, readOnly = false, form, onMetadataChange, onElementsChange } = props;
...@@ -40,6 +41,7 @@ const AssetAction = (props) => { ...@@ -40,6 +41,7 @@ const AssetAction = (props) => {
const [ treeData, setTreeData ] = useState([]); const [ treeData, setTreeData ] = useState([]);
const [ treeDataMap, setTreeDataMap ] = useState(undefined); const [ treeDataMap, setTreeDataMap ] = useState(undefined);
const [currentDomainGroup, setCurrentDomainGroup] = useState(undefined); const [currentDomainGroup, setCurrentDomainGroup] = useState(undefined);
const [canEdit, setEdit] = useState(false);
const app = useContext(AppContext); const app = useContext(AppContext);
...@@ -48,6 +50,7 @@ const AssetAction = (props) => { ...@@ -48,6 +50,7 @@ const AssetAction = (props) => {
getUsers(); getUsers();
getTreeData(); getTreeData();
getDepartments(); getDepartments();
checkDataAssetEditable();
if (action === 'add') { if (action === 'add') {
getElements(); getElements();
} else { } else {
...@@ -55,7 +58,7 @@ const AssetAction = (props) => { ...@@ -55,7 +58,7 @@ const AssetAction = (props) => {
if ((id||'')!=='') { if ((id||'')!=='') {
getAssetPaths(); getAssetPaths();
getResourceRelations(); getResourceRelations();
checkDataAssetEditable();
getAsset(); getAsset();
} else { } else {
...@@ -224,6 +227,20 @@ const AssetAction = (props) => { ...@@ -224,6 +227,20 @@ const AssetAction = (props) => {
}) })
} }
const checkDataAssetEditable = () => {
dispatch({
type: 'assetmanage.checkDataAssetEditable',
payload: {
params: {
dataAssetId: id,
}
},
callback: value => {
setEdit(value==='true'?true:false);
}
})
}
const getAsset = (userElements=null) => { const getAsset = (userElements=null) => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -639,7 +656,7 @@ const AssetAction = (props) => { ...@@ -639,7 +656,7 @@ const AssetAction = (props) => {
</div> </div>
} }
{ {
readOnly && app?.user?.roles && (app?.user?.roles?.indexOf('ROLE_dataAsset_editor') !== -1) && <div className='flex' style={{ justifyContent: 'right' }}> readOnly && canEdit && <div className='flex' style={{ justifyContent: 'right' }}>
{ {
currentAction==='detail' ? <Button type='primary' onClick={onActionButtonClick}>编辑</Button> : <Space> currentAction==='detail' ? <Button type='primary' onClick={onActionButtonClick}>编辑</Button> : <Space>
<Button type='primary' onClick={onCancelButtonClick}>取消</Button> <Button type='primary' onClick={onCancelButtonClick}>取消</Button>
......
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