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,63 +603,60 @@ class Model extends React.Component { ...@@ -598,63 +603,60 @@ 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> <PermissionButton
defaultPermission={canExport}
<Space> tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
<PermissionButton onClick={this.onExportOtherBtnClick}
defaultPermission={canExport} disabled={(selectModelerIds||[]).length===0}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''} >
onClick={this.onExportOtherBtnClick} 导出
disabled={(selectModelerIds||[]).length===0} </PermissionButton>
>
导出 <PermissionButton
</PermissionButton> defaultPermission={canStartFlow}
</Space> tip={startFlowTip}
onClick={this.startFlow}
<Space> disabled={disableStartFlow}
<PermissionButton >
defaultPermission={canStartFlow} 送审
tip={startFlowTip} </PermissionButton>
onClick={this.startFlow}
disabled={disableStartFlow} <PermissionButton
> defaultPermission={canChangeCatalog}
送审 tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
</PermissionButton> onClick={this.onRecatalogBtnClick}
</Space> disabled={(selectModelerIds||[]).length===0}
>
<Space> 变更目录
</PermissionButton>
<Tooltip title={canDelete?((selectModelerIds||[]).length===0?'请先选择模型':''):'暂无权限'}>
<PermissionButton <PermissionButton
defaultPermission={canChangeCatalog} defaultPermission={canDelete}
tip={(selectModelerIds||[]).length===0?'请先选择模型':''} tip={(selectModelerIds||[]).length===0?'请先选择模型':''}
onClick={this.onRecatalogBtnClick} onClick={this.onBatchDeleteBtnClick}
disabled={(selectModelerIds||[]).length===0} disabled={(selectModelerIds||[]).length===0}
> >
变更目录 删除
</PermissionButton> </PermissionButton>
</Space> </Tooltip>
<Space> <Button onClick={() => {
<Tooltip title={canDelete?((selectModelerIds||[]).length===0?'请先选择模型':''):'暂无权限'}> this.setState({
<PermissionButton tagSelectPopupParams: {
defaultPermission={canDelete} visible: true,
tip={(selectModelerIds||[]).length===0?'请先选择模型':''} items: (selectModelerIds??[]).map(item => ({ resourceId: item }))
onClick={this.onBatchDeleteBtnClick} }
disabled={(selectModelerIds||[]).length===0} })
> }}>添加标签</Button>
删除 <Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
</PermissionButton>
</Tooltip>
</Space>
<Space>
<Button onClick={this.onVisibleColSettingClick}>可见列设置</Button>
</Space>
</Space> </Space>
<Space> <Space>
...@@ -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