Commit f7d064f5 by zhaochengxiang

资源新增

parent f44a8654
......@@ -5,10 +5,11 @@ import { dispatch } from '../../../../model';
import AssetAction from './AssetAction';
import './AddAssetModel.less';
import { AssetManageReference, ResourceManageReference } from '../../../../util/constant';
const AddAssetModel = (props) => {
const { onCancel, visible, nodeId } = props;
const { onCancel, visible, nodeId, reference = AssetManageReference } = props;
const [ confirmLoading, setConfirmLoading ] = useState(false);
const [ metadataId, setMetadataId ] = useState('');
const [ elements, setElements ] = useState([]);
......@@ -34,12 +35,17 @@ const AddAssetModel = (props) => {
}
});
const params = {
dirId: nodeId,
}
if ((metadataId||'')!=='') {
params.metadataId = metadataId;
let params = {}
if (reference === ResourceManageReference) {
params = {
dirIds: nodeId,
metadataId
};
} else {
params = {
dirId: nodeId,
metadataId
};
}
setConfirmLoading(true);
......@@ -55,7 +61,7 @@ const AddAssetModel = (props) => {
showMessage('warn', '已存在相同的资产编号,请重新输入');
} else {
dispatch({
type: 'assetmanage.addOrUpdateDataAsset',
type: (reference===ResourceManageReference)?'assetmanage.addOrUpdateResource':'assetmanage.addOrUpdateDataAsset',
payload: {
params,
data: { elements: newElements }
......
......@@ -81,6 +81,7 @@ const FC = (props) => {
const [resoureTagMap, setResourceTagMap] = React.useState()
const [addAssetParams, setAddAssetParams] = React.useState({
visible: false,
reference: undefined,
nodeId: undefined
})
const [addToAssetParams, setAddToAssetParams] = React.useState({
......@@ -619,6 +620,7 @@ const FC = (props) => {
const onAddClick = () => {
setAddAssetParams({
visible: true,
reference: ResourceManageReference,
nodeId: node?.nodeId
})
}
......@@ -1282,6 +1284,7 @@ const FC = (props) => {
onCancel={(refresh = false) => {
setAddAssetParams({
visible: false,
reference: undefined,
nodeId: undefined
})
refresh && getAssets()
......
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