Commit a3c074d3 by zhaochengxiang

模型详情标签优化

parent 0c6cb4a5
......@@ -9,9 +9,11 @@ import { dispatch, dispatchLatest } from '../../../../model';
import Rule from '../../ModelConfig/Component/rule-readonly';
import DebounceInput from './DebounceInput';
import DataQuality, { DataQualityFeignTagList } from '../../../QianKun/data-quality'
import TagCell from './tag-help'
import './ImportActionHeader.less';
import { importActionSubject } from './ImportAction';
import produce from 'immer';
const { TextArea } = Input;
const { Option } = Select;
......@@ -62,6 +64,7 @@ const ImportActionHeader = (props) => {
visible: false,
defaultSelectedId: undefined,
})
const [resoureTagMap, setResourceTagMap] = React.useState()
useEffect(() => {
const $importActionSubject = importActionSubject.subscribe((props) => {
......@@ -97,6 +100,12 @@ const ImportActionHeader = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [modelerData])
useEffect(() => {
if (modelerData?.id) {
getResourceTag()
}
}, [modelerData?.id])
//分布
const distributionDescription = useMemo(() => {
let newDistributionDescription = ''
......@@ -199,6 +208,26 @@ const ImportActionHeader = (props) => {
})
}
const getResourceTag = () => {
if (modelerData?.id) {
dispatch({
type: 'tag.getResourceTagIn',
payload: {
params: {
resourceIds: [modelerData?.id],
includeAll: true,
includePrivate: true
}
},
callback: data => {
setResourceTagMap(data?.data)
}
});
} else {
setResourceTagMap()
}
}
const onSearch = (searchText) => {
const _searchText = searchText.replace(/ /g,'');
......@@ -398,18 +427,25 @@ const ImportActionHeader = (props) => {
</Form.Item>
</Col>
{
modelerData?.id && modelerData?.state?.id === '4' && <Col xs={24} sm={24} lg={12} xl={8}>
modelerData?.id && modelerData?.state?.id === '4' && <Col xs={24} sm={24} lg={12} xl={16}>
<Form.Item
label="标签"
style={{ marginBottom }}
>
<DataQuality
type={DataQualityFeignTagList}
data={{
type: 'model',
id: modelerData?.id,
}}
/>
<div style={{ width: 360 }}>
<TagCell
id={modelerData?.id}
type='model'
tags={resoureTagMap?.[modelerData?.id]}
onChange={(val) => {
setResourceTagMap((prevResourceTagMap) => {
return produce(prevResourceTagMap||{}, (draft) => {
draft[modelerData?.id] = val
})
})
}}
/>
</div>
</Form.Item>
</Col>
}
......
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