Commit 77a7811d by zhaochengxiang

批量打标签

parent 0e44e45c
......@@ -135,7 +135,7 @@ const ModelNameColumn = (props) => {
}
const ModelTable = (props) => {
const { data, onChange, onItemAction, onSelect, onHistory, catalogId, keyword, onAutoCreateTable, offset = null, view, modelState, user, selectModelerIds, visibleColNames, tagSelectOptions } = props;
const { data, onChange, onItemAction, onSelect, onHistory, catalogId, keyword, onAutoCreateTable, offset = null, view, modelState, user, selectModelerIds, visibleColNames, tagSelectOptions, batchAddTagChange } = props;
const [ selectedRowKeys, setSelectedRowKeys ] = useState([]);
const [ expandedSelectedRowKeys, setExpandedSelectedRowKeys ] = useState([]);
......@@ -145,6 +145,7 @@ const ModelTable = (props) => {
const expandedDataMapRef = useRef(new Map());
const shouldScrollRef = useRef(false);
const mountRef = React.useRef(false);
const anchorId = getQueryParam(AnchorId, props?.location?.search);
const anchorTimestamp = getQueryParam(AnchorTimestamp, props?.location?.search);
......@@ -326,6 +327,14 @@ const ModelTable = (props) => {
}, [data])
useEffect(() => {
if (!mountRef.current) {
mountRef.current = true;
} else {
getResourceTag();
}
}, [batchAddTagChange])
useEffect(() => {
window?.addEventListener("storage", modelEventChange);
return () => {
window?.removeEventListener("storage", modelEventChange);
......
......@@ -3,7 +3,6 @@ import { Modal, Button, Select, Space, Input, Tooltip } from 'antd'
import produce from 'immer'
import { dispatch } from '../../../../model'
import { draft } from '../../../../service/datamodeler'
import Table from '../../../../util/Component/Table'
import { showMessage } from '../../../../util'
......
......@@ -282,7 +282,7 @@ export function TagSelect({ options, onChange }) {
)
}
export function TagSelectPopup({ visible, type, value, items, onCancel, onChange }) {
export function TagSelectPopup({ visible, type, value, items, onCancel, onChange, }) {
const [waiting, setWaiting] = React.useState(false)
const [selectedRows, setSelectedRows] = React.useState([])
const [showDataQuality, setShowDataQuality] = React.useState(false)
......@@ -320,7 +320,7 @@ export function TagSelectPopup({ visible, type, value, items, onCancel, onChange
type,
catalogId: (items??[]).length>0?items[0].resourceCatalogId:'',
creator: app?.user?.userName,
overrideAll: true,
overrideAll: (items??[]).length === 1 ? true : false,
}
},
callback: () => {
......
......@@ -22,7 +22,7 @@ import DebounceInput from './Component/DebounceInput';
import ColSettingModal from './Component/ColSettingModal';
import PermissionButton from '../../../util/Component/PermissionButton';
import SelectSearchProperties from './Component/select-search-properties';
import { TagSelect } from './Component/tag-help';
import { TagSelect, TagSelectPopup } from './Component/tag-help';
import './index.less';
......@@ -70,6 +70,11 @@ class Model extends React.Component {
selectSearchPropertiesVisible: false,
searchProperties: [],
tagSelectOptions: [],
tagSelectPopupParams: {
visible: false,
items: undefined
},
batchAddTagChange: false,
}
}
......@@ -598,63 +603,60 @@ class Model extends React.Component {
}}
>
<Space>
<Space>
<PermissionButton
defaultPermission={canAdd}
onClick={() => { this.setState({ importModalVisible: true }); }}
>
新建
</PermissionButton>
</Space>
<Space>
<PermissionButton
defaultPermission={canExport}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onExportOtherBtnClick}
disabled={(selectModelerIds||[]).length===0}
>
导出
</PermissionButton>
</Space>
<Space>
<PermissionButton
defaultPermission={canStartFlow}
tip={startFlowTip}
onClick={this.startFlow}
disabled={disableStartFlow}
>
送审
</PermissionButton>
</Space>
<Space>
<PermissionButton
defaultPermission={canAdd}
onClick={() => { this.setState({ importModalVisible: true }); }}
>
新建
</PermissionButton>
<PermissionButton
defaultPermission={canExport}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onExportOtherBtnClick}
disabled={(selectModelerIds||[]).length===0}
>
导出
</PermissionButton>
<PermissionButton
defaultPermission={canStartFlow}
tip={startFlowTip}
onClick={this.startFlow}
disabled={disableStartFlow}
>
送审
</PermissionButton>
<PermissionButton
defaultPermission={canChangeCatalog}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onRecatalogBtnClick}
disabled={(selectModelerIds||[]).length===0}
>
变更目录
</PermissionButton>
<Tooltip title={canDelete?((selectModelerIds||[]).length===0?'请先选择模型':''):'暂无权限'}>
<PermissionButton
defaultPermission={canChangeCatalog}
defaultPermission={canDelete}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onRecatalogBtnClick}
onClick={this.onBatchDeleteBtnClick}
disabled={(selectModelerIds||[]).length===0}
>
变更目录
删除
</PermissionButton>
</Space>
<Space>
<Tooltip title={canDelete?((selectModelerIds||[]).length===0?'请先选择模型':''):'暂无权限'}>
<PermissionButton
defaultPermission={canDelete}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onBatchDeleteBtnClick}
disabled={(selectModelerIds||[]).length===0}
>
删除
</PermissionButton>
</Tooltip>
</Space>
<Space>
<Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
</Space>
</Tooltip>
<Button onClick={() => {
this.setState({
tagSelectPopupParams: {
visible: true,
items: (selectModelerIds??[]).map(item => ({ resourceId: item }))
}
})
}}>添加标签</Button>
<Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
</Space>
<Space>
......@@ -684,6 +686,7 @@ class Model extends React.Component {
view={currentView}
data={filterTableData}
tagSelectOptions={this.state.tagSelectOptions}
batchAddTagChange={this.state.batchAddTagChange}
modelState={currentModelState}
offset={offset}
keyword={keyword}
......@@ -762,6 +765,23 @@ class Model extends React.Component {
visible={this.state.selectSearchPropertiesVisible}
onCancel={this.onSearchPropertiesCancel}
/>
<TagSelectPopup
{...this.state.tagSelectPopupParams}
onCancel={() => {
this.setState({
tagSelectPopupParams: {
visible: false,
items: undefined
}
})
}}
onChange={() => {
this.setState({
batchAddTagChange: !this.state.batchAddTagChange
})
}}
/>
</div>
}
</AppContext.Consumer>
......
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