Commit 718a34e6 by zhaochengxiang

模型修改

parent 3414372b
...@@ -2,10 +2,12 @@ ...@@ -2,10 +2,12 @@
export const AnchorId = 'id'; export const AnchorId = 'id';
export const AnchorTimestamp = 'timestamp'; export const AnchorTimestamp = 'timestamp';
export const AnchorDirId = 'did'; export const AnchorDirId = 'did';
export const AnchorRequireId = 'rid';
//编辑模型 //编辑模型
export const Action = 'action'; export const Action = 'action';
export const CatalogId = 'cid'; export const CatalogId = 'cid';
export const RequireId = 'rid';
export const ModelerId = 'mid'; export const ModelerId = 'mid';
export const Hints = 'hints'; export const Hints = 'hints';
export const ModelerData = 'mdata'; export const ModelerData = 'mdata';
......
...@@ -118,10 +118,16 @@ const FC = (props) => { ...@@ -118,10 +118,16 @@ const FC = (props) => {
visible={ visible } visible={ visible }
centered centered
width='90%' width='90%'
onCancel={() => { onCancel?.(); } } onCancel={() => {
setCurrentTreeId(undefined);
onCancel?.();
}}
footer={ footer={
<Space> <Space>
<Button onClick={() => onCancel?.() }>取消</Button> <Button onClick={() => {
setCurrentTreeId(undefined);
onCancel?.();
}}>取消</Button>
</Space> </Space>
} }
bodyStyle={{ padding: '24px', height: '70vh', overflow: 'auto' }} bodyStyle={{ padding: '24px', height: '70vh', overflow: 'auto' }}
......
...@@ -5,16 +5,16 @@ import { useMount, useUnmount } from 'ahooks'; ...@@ -5,16 +5,16 @@ import { useMount, useUnmount } from 'ahooks';
import ImportAction from './ImportAction'; import ImportAction from './ImportAction';
import CatalogModal from './CatalogModal'; import CatalogModal from './CatalogModal';
import { dispatchLatest } from '../../../../model'; import { dispatchLatest, dispatch } from '../../../../model';
import { getQueryParam, showMessage, showNotifaction } from '../../../../util'; import { getQueryParam, showMessage, showNotifaction } from '../../../../util';
import { Action, CatalogId, ModelerId, Hints, ModelerData, PermitCheckOut, Editable, StateId, VersionId, Holder, DDL } from '../../../../util/constant'; import { Action, CatalogId, ModelerId, Hints, ModelerData, PermitCheckOut, Editable, StateId, VersionId, Holder, DDL, RequireId } from '../../../../util/constant';
import HistoryAndVersionDrawer from './HistoryAndVersionDrawer'; import HistoryAndVersionDrawer from './HistoryAndVersionDrawer';
import './EditModel.less'; import './EditModel.less';
const EditModel = (props) => { const EditModel = (props) => {
const [ actionData, setActionData ] = useState({ action: '', catalogId: '', modelerId: '', hints: [], roughModelerData: null, permitCheckOut: false, editable: false, stateId: '', versionId: '', ddl: '' }); const [ actionData, setActionData ] = useState({ action: '', catalogId: '', modelerId: '', hints: [], roughModelerData: null, permitCheckOut: false, editable: false, stateId: '', versionId: '', ddl: '', requireId: '' });
const [ modelerData, setModelerData ] = useState({}); const [ modelerData, setModelerData ] = useState({});
const [ terms, setTerms ] = useState([]); const [ terms, setTerms ] = useState([]);
...@@ -25,7 +25,7 @@ const EditModel = (props) => { ...@@ -25,7 +25,7 @@ const EditModel = (props) => {
const actionRef = useRef(''); const actionRef = useRef('');
const { action, catalogId, modelerId, hints, roughModelerData, permitCheckOut, editable, stateId, versionId, holder, ddl } = actionData; const { action, catalogId, modelerId, hints, roughModelerData, permitCheckOut, editable, stateId, versionId, holder, ddl, requireId } = actionData;
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -41,6 +41,8 @@ const EditModel = (props) => { ...@@ -41,6 +41,8 @@ const EditModel = (props) => {
const _versionId = getQueryParam(VersionId, props.location.search); const _versionId = getQueryParam(VersionId, props.location.search);
const _holder = getQueryParam(Holder, props.location.search); const _holder = getQueryParam(Holder, props.location.search);
const _ddl = getQueryParam(DDL, props.location.search); const _ddl = getQueryParam(DDL, props.location.search);
const _requireId = getQueryParam(RequireId, props.location.search);
let _hints = []; let _hints = [];
if ((_hintsStr||'') !== '') { if ((_hintsStr||'') !== '') {
...@@ -54,7 +56,7 @@ const EditModel = (props) => { ...@@ -54,7 +56,7 @@ const EditModel = (props) => {
judgeAttributeRepeat(_roughModelerData.easyDataModelerDataModelAttributes); judgeAttributeRepeat(_roughModelerData.easyDataModelerDataModelAttributes);
} }
setActionData({ action: _action, catalogId: _catalogId, modelerId: _modelerId, hints: _hints, roughModelerData: _roughModelerData, permitCheckOut: (_permitCheckOut==='true'), editable: (_editable==='true'), stateId: _stateId, versionId: _versionId, holder: _holder, ddl: _ddl }); setActionData({ action: _action, catalogId: _catalogId, modelerId: _modelerId, hints: _hints, roughModelerData: _roughModelerData, permitCheckOut: (_permitCheckOut==='true'), editable: (_editable==='true'), stateId: _stateId, versionId: _versionId, holder: _holder, ddl: _ddl, requireId: _requireId });
actionRef.current = _action; actionRef.current = _action;
const interval = setInterval(() => { const interval = setInterval(() => {
...@@ -167,6 +169,21 @@ const EditModel = (props) => { ...@@ -167,6 +169,21 @@ const EditModel = (props) => {
actionRef.current = 'detail'; actionRef.current = 'detail';
LocalStorage.set('modelChange', !(LocalStorage.get('modelChange')||false)); LocalStorage.set('modelChange', !(LocalStorage.get('modelChange')||false));
if (requireId) {
dispatch({
type: 'datamodel.requirementBind',
payload: {
data: {
techJobId: parseInt(requireId),
assocStringIdList: [data.id]
}
},
callback: () => {
LocalStorage.set('modelChange', !(LocalStorage.get('modelChange')||false));
}
});
}
}, },
error: () => { error: () => {
setConfirmLoading(false); setConfirmLoading(false);
......
...@@ -7,7 +7,7 @@ import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify" ...@@ -7,7 +7,7 @@ import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"
import UpdateTreeItemModal from './UpdateTreeItemModal'; import UpdateTreeItemModal from './UpdateTreeItemModal';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import { showMessage, getQueryParam } from '../../../../util'; import { showMessage, getQueryParam } from '../../../../util';
import { AnchorId, AnchorDirId, AnchorTimestamp } from '../../../../util/constant'; import { AnchorId, AnchorDirId, AnchorTimestamp, AnchorRequireId } from '../../../../util/constant';
import './ModelTree.less'; import './ModelTree.less';
import 'react-contexify/dist/ReactContexify.css'; import 'react-contexify/dist/ReactContexify.css';
...@@ -56,6 +56,7 @@ const ModelTree = (props) => { ...@@ -56,6 +56,7 @@ const ModelTree = (props) => {
const timestamp = getQueryParam(AnchorTimestamp, props.location?.search||''); const timestamp = getQueryParam(AnchorTimestamp, props.location?.search||'');
const id = getQueryParam(AnchorId, props.location?.search||''); const id = getQueryParam(AnchorId, props.location?.search||'');
const did = getQueryParam(AnchorDirId, props.location?.search||''); const did = getQueryParam(AnchorDirId, props.location?.search||'');
const rid = getQueryParam(AnchorRequireId, props.location?.search||'');
useEffect(() => { useEffect(() => {
getShowSyncAndDomains(); getShowSyncAndDomains();
...@@ -73,6 +74,10 @@ const ModelTree = (props) => { ...@@ -73,6 +74,10 @@ const ModelTree = (props) => {
getDataModelLocationThenGetDirTreeData(); getDataModelLocationThenGetDirTreeData();
} else if ((did||'') !== '') { } else if ((did||'') !== '') {
getDirTreeData(did); getDirTreeData(did);
} else if (rid) {
setViewSelectedKey('requirement');
onViewChange && onViewChange('requirement');
getRequirementTreeData(rid);
} else { } else {
getDirTreeData(); getDirTreeData();
} }
...@@ -227,7 +232,7 @@ const ModelTree = (props) => { ...@@ -227,7 +232,7 @@ const ModelTree = (props) => {
}); });
} }
const getRequirementTreeData = () => { const getRequirementTreeData = (defaultSelectedId='') => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
type: 'datamodel.requirementList', type: 'datamodel.requirementList',
...@@ -237,13 +242,25 @@ const ModelTree = (props) => { ...@@ -237,13 +242,25 @@ const ModelTree = (props) => {
callback: data => { callback: data => {
setLoading(false); setLoading(false);
let _treeData = []; let _treeData = [];
let defaultItem = null;
data?.forEach(item => { data?.forEach(item => {
_treeData.push({title: item.requireName, key: item.id, name: item.requireName}); const newItem = {title: item.requireName, key: item.id, name: item.requireName};
_treeData.push(newItem);
if (item.id === parseInt(defaultSelectedId)) {
defaultItem = newItem;
}
}); });
setTreeData(_treeData); setTreeData(_treeData);
setItem(_treeData.length>0?_treeData[0]:{}); if (defaultItem) {
onSelect && onSelect(_treeData.length>0?_treeData[0].key:''); setItem(defaultItem);
onSelect && onSelect(defaultItem.key);
} else {
setItem(_treeData.length>0?_treeData[0]:{});
onSelect && onSelect(_treeData.length>0?_treeData[0].key:'');
}
}, },
error: () => { error: () => {
setLoading(false); setLoading(false);
......
...@@ -15,7 +15,7 @@ import HistoryAndVersionDrawer from './Component/HistoryAndVersionDrawer'; ...@@ -15,7 +15,7 @@ import HistoryAndVersionDrawer from './Component/HistoryAndVersionDrawer';
import StartFlowModal from './Component/StartFlowModal'; import StartFlowModal from './Component/StartFlowModal';
import { showMessage, showNotifaction, inputWidth, DeleteTipModal } from '../../../util'; import { showMessage, showNotifaction, inputWidth, DeleteTipModal } from '../../../util';
import { dispatch, dispatchLatestHomepage } from '../../../model'; import { dispatch, dispatchLatestHomepage } from '../../../model';
import { Action, CatalogId, ModelerId, Hints, ModelerData, PermitCheckOut, Editable, StateId, Holder, DDL } from '../../../util/constant'; import { Action, CatalogId, ModelerId, Hints, ModelerData, PermitCheckOut, Editable, StateId, Holder, DDL, RequireId } from '../../../util/constant';
import { AppContext } from '../../../App'; import { AppContext } from '../../../App';
import DebounceInput from './Component/DebounceInput'; import DebounceInput from './Component/DebounceInput';
import MetadataAnalysis from '../../QianKun/MetadataAnalysis'; import MetadataAnalysis from '../../QianKun/MetadataAnalysis';
...@@ -313,20 +313,32 @@ class Model extends React.Component { ...@@ -313,20 +313,32 @@ class Model extends React.Component {
if (confirm) { if (confirm) {
if ((hints||[]).length > 0) { if ((hints||[]).length > 0) {
setTimeout(() => { if (currentView === 'requirement') {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}&${Hints}=${encodeURIComponent((hints||[]).join(','))}`); setTimeout(() => {
}, 1000); window.open(`/data-govern/data-model-action?${Action}=add&${RequireId}=${catalogId||''}&${Hints}=${encodeURIComponent((hints||[]).join(','))}`);
}, 1000);
} else {
setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}&${Hints}=${encodeURIComponent((hints||[]).join(','))}`);
}, 1000);
}
} else { } else {
setTimeout(() => { if (currentView === 'requirement') {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}`); setTimeout(() => {
}, 1000); window.open(`/data-govern/data-model-action?${Action}=add&${RequireId}=${catalogId||''}`);
}, 1000);
} else {
setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}`);
}, 1000);
}
} }
} }
}); });
} }
onImportModalCancelByWord = (refresh = false, wordData = {}) => { onImportModalCancelByWord = (refresh = false, wordData = {}) => {
const { catalogId } = this.state; const { catalogId, currentView } = this.state;
this.setState({ importModalVisible: false }, () => { this.setState({ importModalVisible: false }, () => {
refresh && this.onTableChange(); refresh && this.onTableChange();
...@@ -339,29 +351,39 @@ class Model extends React.Component { ...@@ -339,29 +351,39 @@ class Model extends React.Component {
if ((wordData.content||[]).length > 5) { if ((wordData.content||[]).length > 5) {
showMessage('info', '最多只能同时编辑5条信息'); showMessage('info', '最多只能同时编辑5条信息');
} }
setTimeout(() => { if (currentView === 'requirement') {
setTimeout(() => {
wordData.content.slice(0, 5).forEach(data => { wordData.content.slice(0, 5).forEach(data => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId}&${ModelerData}=${encodeURIComponent(JSON.stringify(data))}`, '_blank'); window.open(`/data-govern/data-model-action?${Action}=add&${RequireId}=${catalogId}&${ModelerData}=${encodeURIComponent(JSON.stringify(data))}`, '_blank');
}) })
}, 2000);
}, 2000); } else {
setTimeout(() => {
wordData.content.slice(0, 5).forEach(data => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId}&${ModelerData}=${encodeURIComponent(JSON.stringify(data))}`, '_blank');
})
}, 2000);
}
} }
}); });
} }
onImportModalCancelByDDL = (confirm = false, ddl = '') => { onImportModalCancelByDDL = (confirm = false, ddl = '') => {
const { catalogId } = this.state; const { catalogId, currentView } = this.state;
this.setState({ importModalVisible: false }, () => { this.setState({ importModalVisible: false }, () => {
if (confirm && (ddl||'') !== '') { if (confirm && (ddl||'') !== '') {
if (currentView === 'requirement') {
setTimeout(() => { setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId}&${DDL}=${encodeURIComponent(ddl)}`, '_blank'); window.open(`/data-govern/data-model-action?${Action}=add&${RequireId}=${catalogId}&${DDL}=${encodeURIComponent(ddl)}`, '_blank');
}, 1000); }, 1000);
} else {
setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId}&${DDL}=${encodeURIComponent(ddl)}`, '_blank');
}, 1000);
}
} }
}); });
...@@ -553,12 +575,13 @@ class Model extends React.Component { ...@@ -553,12 +575,13 @@ class Model extends React.Component {
}} }}
> >
<Space> <Space>
<Space>
<Button onClick={() => { this.setState({ importModalVisible: true }); }}>新建</Button>
</Space>
{ {
(currentView!=='requirement') && <React.Fragment> (currentView!=='requirement') && <React.Fragment>
<Space>
<Button onClick={() => { this.setState({ importModalVisible: true }); }}>新建</Button>
</Space>
<Space> <Space>
<Tooltip title={(selectModelerIds||[]).length===0?'请先选择模型':''}> <Tooltip title={(selectModelerIds||[]).length===0?'请先选择模型':''}>
<Button onClick={this.onExportOtherBtnClick} disabled={(selectModelerIds||[]).length===0}>导出</Button> <Button onClick={this.onExportOtherBtnClick} disabled={(selectModelerIds||[]).length===0}>导出</Button>
...@@ -602,7 +625,7 @@ class Model extends React.Component { ...@@ -602,7 +625,7 @@ class Model extends React.Component {
<Space> <Space>
{ {
(currentView==='dir'|| currentView==='state' ||keyword!=='') && <Space> (keyword!=='') && <Space>
<Radio.Group onChange={this.handleShowModeChange} value={showMode}> <Radio.Group onChange={this.handleShowModeChange} value={showMode}>
<Radio.Button value="list">列表展示</Radio.Button> <Radio.Button value="list">列表展示</Radio.Button>
<Radio.Button value="graph">图形展示</Radio.Button> <Radio.Button value="graph">图形展示</Radio.Button>
......
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