Commit 77a7811d by zhaochengxiang

批量打标签

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