Commit 9d3a2686 by zhaochengxiang

批量标签

parent 76308e7d
...@@ -12,7 +12,7 @@ import ImportAssetDrawer from './ImportAssetDrawer'; ...@@ -12,7 +12,7 @@ import ImportAssetDrawer from './ImportAssetDrawer';
import AssetEdit from './AddAssetModel'; import AssetEdit from './AddAssetModel';
import AssetDetailDrawer from "./AssetDetailDrawer"; import AssetDetailDrawer from "./AssetDetailDrawer";
import { dispatch, dispatchLatestHomepage } from '../../../../model'; import { dispatch, dispatchLatestHomepage } from '../../../../model';
import { showMessage, showNotifaction, getQueryParam, inputWidth, isSzseEnv } from '../../../../util'; import { showMessage, showNotifaction, getQueryParam, inputWidth, isSzseEnv, importCatalogAbility } from '../../../../util';
import { AnchorId, AnchorDirId, AnchorTimestamp, AssetBrowseReference, AssetManageReference, AssetRecycleReference, ResourceBrowseReference } from '../../../../util/constant'; import { AnchorId, AnchorDirId, AnchorTimestamp, AssetBrowseReference, AssetManageReference, AssetRecycleReference, ResourceBrowseReference } from '../../../../util/constant';
import { FullScreenSvg, CancelFullScreenSvg } from './AssetSvg'; import { FullScreenSvg, CancelFullScreenSvg } from './AssetSvg';
import AssetDeleteModal from './AssetDeleteModal'; import AssetDeleteModal from './AssetDeleteModal';
...@@ -20,6 +20,7 @@ import { AppContext } from "../../../../App"; ...@@ -20,6 +20,7 @@ import { AppContext } from "../../../../App";
import "./AssetTable.less"; import "./AssetTable.less";
import 'react-contexify/dist/ReactContexify.css'; import 'react-contexify/dist/ReactContexify.css';
import AddTagModal from "../../Tag/Component/AddTagModal";
const { Text } = Typography; const { Text } = Typography;
const { Search } = Input; const { Search } = Input;
...@@ -149,6 +150,7 @@ const AssetTable = (props) => { ...@@ -149,6 +150,7 @@ const AssetTable = (props) => {
const [ TableWidth, setTableWidth ] = useState(0); const [ TableWidth, setTableWidth ] = useState(0);
const [ compact, setCompact ] = useState(false); const [ compact, setCompact ] = useState(false);
const [ assetDeleteModalVisible, setAssetDeleteModalVisible ] = useState(false); const [ assetDeleteModalVisible, setAssetDeleteModalVisible ] = useState(false);
const [ addTagModalVisible, setAddTagModalVisible ] = useState(false);
const [ modal, contextHolder ] = Modal.useModal(); const [ modal, contextHolder ] = Modal.useModal();
const anchorId = getQueryParam(AnchorId, props?.location?.search); const anchorId = getQueryParam(AnchorId, props?.location?.search);
...@@ -535,6 +537,12 @@ const AssetTable = (props) => { ...@@ -535,6 +537,12 @@ const AssetTable = (props) => {
setFilterElementVisible(true); setFilterElementVisible(true);
} }
const onTagClick = () => {
if ((checkedKeys||[]).length === 0) return;
setAddTagModalVisible(true);
}
const onRecursiveChange = (e) => { const onRecursiveChange = (e) => {
setRecursive(!e.target.checked); setRecursive(!e.target.checked);
} }
...@@ -697,6 +705,16 @@ const AssetTable = (props) => { ...@@ -697,6 +705,16 @@ const AssetTable = (props) => {
}) })
} }
const onAddTagModalCancel = (refresh = false) => {
setAddTagModalVisible(false);
if (refresh) {
getDataAssets();
let event = new Event('storage');
event.key = 'tagChange';
window?.dispatchEvent(event);
}
}
const recoveryAssets = () => { const recoveryAssets = () => {
if ((checkedKeys||[]).length > 0) { if ((checkedKeys||[]).length > 0) {
modal.confirm({ modal.confirm({
...@@ -839,6 +857,14 @@ const AssetTable = (props) => { ...@@ -839,6 +857,14 @@ const AssetTable = (props) => {
可见列设置 可见列设置
</div> </div>
</Menu.Item> </Menu.Item>
{
(reference===AssetManageReference) && <Menu.Item disabled={(checkedKeys||[]).length===0}>
<div className='text-center' onClick={onTagClick}>
标签设置
</div>
</Menu.Item>
}
</Menu> </Menu>
); );
...@@ -880,7 +906,7 @@ const AssetTable = (props) => { ...@@ -880,7 +906,7 @@ const AssetTable = (props) => {
} }
{ {
(reference===AssetManageReference && nodeType!=='custom') && <Button onClick={importAsset}>导入</Button> (reference===AssetManageReference && nodeType!=='custom') && importCatalogAbility(app?.dataRoles) && <Button onClick={importAsset}>导入</Button>
} }
{ {
(reference===AssetManageReference || reference===AssetRecycleReference) && (reference===AssetManageReference || reference===AssetRecycleReference) &&
...@@ -919,6 +945,11 @@ const AssetTable = (props) => { ...@@ -919,6 +945,11 @@ const AssetTable = (props) => {
</React.Fragment> </React.Fragment>
} }
<Button onClick={onFilterElementClick}>可见列设置</Button> <Button onClick={onFilterElementClick}>可见列设置</Button>
{
(reference===AssetManageReference) && <Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
<Button onClick={onTagClick} disabled={(checkedKeys||[]).length===0} >标签设置</Button>
</Tooltip>
}
</React.Fragment> </React.Fragment>
} }
{/* { {/* {
...@@ -1057,6 +1088,14 @@ const AssetTable = (props) => { ...@@ -1057,6 +1088,14 @@ const AssetTable = (props) => {
onDelete={onAssetDeleteModalDelete} onDelete={onAssetDeleteModalDelete}
onDeleteAll={onAssetDeleteModalDeleteAll} onDeleteAll={onAssetDeleteModalDeleteAll}
/> />
<AddTagModal
visible={addTagModalVisible}
ids={checkedKeys||[]}
type='dataAsset'
creator={app.user?.userName}
isAdmin={true}
onCancel={onAddTagModalCancel}
/>
<RcMenu id={MENU_ID}> <RcMenu id={MENU_ID}>
{/* { {/* {
(contextMenuItem.resourceState==='notRelatedAsset') && <RcItem id="uncombed" onClick={handleItemClick}> (contextMenuItem.resourceState==='notRelatedAsset') && <RcItem id="uncombed" onClick={handleItemClick}>
......
...@@ -34,7 +34,7 @@ const ClassifySelect = ({ value = '', data = [], onChange, ...restProps }) => { ...@@ -34,7 +34,7 @@ const ClassifySelect = ({ value = '', data = [], onChange, ...restProps }) => {
} }
const AddTagModal = (props) => { const AddTagModal = (props) => {
const { visible, onCancel, id, type, creator, onAssetTag, isAdmin } = props; const { visible, onCancel, ids, type, creator, onAssetTag, isAdmin } = props;
const [ step, setStep ] = useState(0); const [ step, setStep ] = useState(0);
const [ keyword, setKeyword ] = useState(''); const [ keyword, setKeyword ] = useState('');
...@@ -145,7 +145,7 @@ const AddTagModal = (props) => { ...@@ -145,7 +145,7 @@ const AddTagModal = (props) => {
payload: { payload: {
params: { params: {
tagId: selectTag.tagId, tagId: selectTag.tagId,
resourceIds: id, resourceIds: (ids||[]).join(','),
type, type,
creator creator
} }
...@@ -181,7 +181,7 @@ const AddTagModal = (props) => { ...@@ -181,7 +181,7 @@ const AddTagModal = (props) => {
payload: { payload: {
params: { params: {
tagId: selectTag.tagId, tagId: selectTag.tagId,
resourceIds: id, resourceIds: (ids||[]).join(','),
type, type,
creator creator
} }
...@@ -210,7 +210,7 @@ const AddTagModal = (props) => { ...@@ -210,7 +210,7 @@ const AddTagModal = (props) => {
payload: { payload: {
params: { params: {
tagId: selectTag.tagId, tagId: selectTag.tagId,
resourceIds: id, resourceIds: (ids||[]).join(','),
type, type,
creator creator
} }
...@@ -264,7 +264,7 @@ const AddTagModal = (props) => { ...@@ -264,7 +264,7 @@ const AddTagModal = (props) => {
payload: { payload: {
params: { params: {
tagId: data.id, tagId: data.id,
resourceIds: id, resourceIds: (ids||[]).join(','),
type, type,
creator creator
} }
......
...@@ -153,7 +153,7 @@ const TagColumn = (props) => { ...@@ -153,7 +153,7 @@ const TagColumn = (props) => {
} }
<AddTagModal <AddTagModal
visible={addTagModalVisible} visible={addTagModalVisible}
id={id} ids={[id]}
type={type} type={type}
creator={creator} creator={creator}
isAdmin={isAdmin} isAdmin={isAdmin}
......
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