Commit ce7a394b by zhaochengxiang

资产权限

parent 2eda3693
......@@ -420,172 +420,175 @@ const AssetAction = (props) => {
</div>
}
{
(action!=='add' && (id||'')!=='') && <div>
<div className='pl-common py-compact-common'>
<Descriptions column={1}>
<Descriptions.Item
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产路径</div>}
style={{ paddingBottom: 15 }}
>
<div className='flex' style={{ flexDirection: 'column' }}>
{
(assetPaths||[]).map((item, key) => {
return (
<a key={key} onClick={() => { jumpToPath(item); }}>
<span style={{ color: (item?.dataAssetName===assets.currentPath)?'#f50':'' }}>{item?.dataAssetName||''}</span>
</a>
);
})
}
(!loading && assets?.allowButtons && ((assets?.allowButtons||[]).findIndex(item => item==='preview') === -1)) ? <div className='m-1'>暂无权限</div> : <React.Fragment>
{
(action!=='add' && (id||'')!=='') && <div>
<div className='pl-common py-compact-common'>
<Descriptions column={1}>
<Descriptions.Item
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产路径</div>}
style={{ paddingBottom: 15 }}
>
<div className='flex' style={{ flexDirection: 'column' }}>
{
(assetPaths||[]).map((item, key) => {
return (
<a key={key} onClick={() => { jumpToPath(item); }}>
<span style={{ color: (item?.dataAssetName===assets.currentPath)?'#f50':'' }}>{item?.dataAssetName||''}</span>
</a>
);
})
}
</div>
</Descriptions.Item>
<Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 15 }}>
<AppContext.Consumer>
{
value => {
return (currentAction==='add'||currentAction==='edit')?<Tag styleType='complex' id={id} creator={value?.user?.userName||''} onAssetTag={onAssetTag} />:<Tag id={id} creator={value?.user?.userName||''} />
}
}
</AppContext.Consumer>
</Descriptions.Item>
<Descriptions.Item
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>关联关系</div>}
style={{ paddingBottom: 0 }}
>
<div className='flex' style={{ flexDirection: 'column' }}>
{
(resourceRelations||[]).map((item, key) => {
return (
<a key={key} onClick={() => { jumpToRelation(item); }}>{item?.dataAssetName||''}</a>
);
})
}
</div>
</Descriptions.Item>
</Descriptions>
</div>
</Descriptions.Item>
<Descriptions.Item label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>资产标签</div>} style={{ paddingBottom: 15 }}>
<AppContext.Consumer>
{
value => {
return (currentAction==='add'||currentAction==='edit')?<Tag styleType='complex' id={id} creator={value?.user?.userName||''} onAssetTag={onAssetTag} />:<Tag id={id} creator={value?.user?.userName||''} />
}
!readOnly && <Separate height={8} />
}
</AppContext.Consumer>
</Descriptions.Item>
<Descriptions.Item
label={<div className='title-text' style={{ textAlign: 'right', width: 60 }}>关联关系</div>}
style={{ paddingBottom: 0 }}
</div>
}
<div
style={{
flex: 1,
overflow: 'auto',
}}
>
<Spin
spinning={loading}
style={{ marginTop: 30 }}
>
<div className='flex' style={{ flexDirection: 'column' }}>
{
(resourceRelations||[]).map((item, key) => {
(attributes||[]).map((attribute, index) => {
let sameAttributeElements = (elements||[]).filter(element => element.type===attribute);
if (currentAction!=='add' && !fullScreen && attributesFoldMap[attribute]) {
sameAttributeElements = (sameAttributeElements||[]).filter(element => element.foldAble==='否');
}
return (
<a key={key} onClick={() => { jumpToRelation(item); }}>{item?.dataAssetName||''}</a>
<div key={index}>
<div
className='flex pl-common'
style={{
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: '#fff',
height: 46,
borderBottom: '1px solid #f0f0f0',
}}
>
<div
className='flex'
style={{
alignItems: 'center'
}}
>
<div className='primary-bg-color' style={{ width: 3, height: 14, marginRight: 5 }} />
<div className='title-text' style={{ fontWeight: 'bold' }}>{attribute||''}</div>
</div>
{
currentAction!=='add'&&!fullScreen && (
attributesFoldMap[attribute] ? <Button
type='text'
style={{ padding: 0 }}
onClick={() => { onFoldButtonClick(attribute, false) }}
icon={<DownOutlined className='default' />}
/> : <Button
type='text'
style={{ padding: 0 }}
onClick={() => { onFoldButtonClick(attribute, true) }}
icon={<UpOutlined className='default' />}
/>
)
}
</div>
<div className='px-common py-compact-common'>
{
(currentAction==='add'||currentAction==='edit') ? <Form {...formItemLayout} form={form}>
<AppContext.Consumer>
{
value => {
value?.onGlobalStateChange&&value?.onGlobalStateChange((state, prev) => {
if (state.message === 'data-govern-show-metadata-list-callback-message') {
setMetadataId(state.data?.metadataId||'');
onMetadataChange && onMetadataChange(state.data?.metadataId||'');
form?.setFieldsValue({ '资产项': state.data?.metadataInfoJson||'' });
if ((state.data?.metadataId||'') !== '') {
fillElementValueBeforeCreate(state.data?.metadataId||'');
}
}
});
return (
(sameAttributeElements||[]).map((element, _index) => {
return (
<Form.Item
label={<div className='title-color'>{element.name||''}</div>}
name={element.name}
key={_index}
style={{ marginBottom: (_index===sameAttributeElements.length-1)? 0 : 15 }}
>
{ (element.name==='资产项') ? <MetadataInfo /> : <Input disabled={element.manualMaintain==='否'} /> }
</Form.Item>
);
})
);
}}
</AppContext.Consumer>
</Form> : <Descriptions column={1}>
{
(sameAttributeElements||[]).map((item, index) => {
return (
<Descriptions.Item label={<div className='title-common' style={{ textAlign: 'right', width: 60 }}>{item.name||''}</div>} key={index} style={{ paddingBottom: (index===sameAttributeElements.length-1)? 0 : 10 }}>
{
item.name==='资产项' ? <MetadataInfo config={false} value={item.value||''} /> : <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>
}
</Descriptions.Item>
);
})
}
</Descriptions>
}
</div>
{
currentAction!=='add' && (index < (attributes.length-1)) && !readOnly && <Separate height={8} />
}
</div>
);
})
}
</div>
</Descriptions.Item>
</Descriptions>
</div>
{
!readOnly && <Separate height={8} />
}
</div>
}
</Spin>
</div>
</React.Fragment>
}
<div
style={{
flex: 1,
overflow: 'auto',
}}
>
<Spin
spinning={loading}
style={{ marginTop: 30 }}
>
{
(attributes||[]).map((attribute, index) => {
let sameAttributeElements = (elements||[]).filter(element => element.type===attribute);
if (currentAction!=='add' && !fullScreen && attributesFoldMap[attribute]) {
sameAttributeElements = (sameAttributeElements||[]).filter(element => element.foldAble==='否');
}
return (
<div key={index}>
<div
className='flex pl-common'
style={{
justifyContent: 'space-between',
alignItems: 'center',
backgroundColor: '#fff',
height: 46,
borderBottom: '1px solid #f0f0f0',
}}
>
<div
className='flex'
style={{
alignItems: 'center'
}}
>
<div className='primary-bg-color' style={{ width: 3, height: 14, marginRight: 5 }} />
<div className='title-text' style={{ fontWeight: 'bold' }}>{attribute||''}</div>
</div>
{
currentAction!=='add'&&!fullScreen && (
attributesFoldMap[attribute] ? <Button
type='text'
style={{ padding: 0 }}
onClick={() => { onFoldButtonClick(attribute, false) }}
icon={<DownOutlined className='default' />}
/> : <Button
type='text'
style={{ padding: 0 }}
onClick={() => { onFoldButtonClick(attribute, true) }}
icon={<UpOutlined className='default' />}
/>
)
}
</div>
<div className='px-common py-compact-common'>
{
(currentAction==='add'||currentAction==='edit') ? <Form {...formItemLayout} form={form}>
<AppContext.Consumer>
{
value => {
value?.onGlobalStateChange&&value?.onGlobalStateChange((state, prev) => {
if (state.message === 'data-govern-show-metadata-list-callback-message') {
setMetadataId(state.data?.metadataId||'');
onMetadataChange && onMetadataChange(state.data?.metadataId||'');
form?.setFieldsValue({ '资产项': state.data?.metadataInfoJson||'' });
if ((state.data?.metadataId||'') !== '') {
fillElementValueBeforeCreate(state.data?.metadataId||'');
}
}
});
return (
(sameAttributeElements||[]).map((element, _index) => {
return (
<Form.Item
label={<div className='title-color'>{element.name||''}</div>}
name={element.name}
key={_index}
style={{ marginBottom: (_index===sameAttributeElements.length-1)? 0 : 15 }}
>
{ (element.name==='资产项') ? <MetadataInfo /> : <Input disabled={element.manualMaintain==='否'} /> }
</Form.Item>
);
})
);
}}
</AppContext.Consumer>
</Form> : <Descriptions column={1}>
{
(sameAttributeElements||[]).map((item, index) => {
return (
<Descriptions.Item label={<div className='title-common' style={{ textAlign: 'right', width: 60 }}>{item.name||''}</div>} key={index} style={{ paddingBottom: (index===sameAttributeElements.length-1)? 0 : 10 }}>
{
item.name==='资产项' ? <MetadataInfo config={false} value={item.value||''} /> : <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>
}
</Descriptions.Item>
);
})
}
</Descriptions>
}
</div>
{
currentAction!=='add' && (index < (attributes.length-1)) && !readOnly && <Separate height={8} />
}
</div>
);
})
}
</Spin>
</div>
<AppContext.Consumer>
{
value => {
......
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