Commit 718a34e6 by zhaochengxiang

模型修改

parent 3414372b
......@@ -2,10 +2,12 @@
export const AnchorId = 'id';
export const AnchorTimestamp = 'timestamp';
export const AnchorDirId = 'did';
export const AnchorRequireId = 'rid';
//编辑模型
export const Action = 'action';
export const CatalogId = 'cid';
export const RequireId = 'rid';
export const ModelerId = 'mid';
export const Hints = 'hints';
export const ModelerData = 'mdata';
......
......@@ -118,10 +118,16 @@ const FC = (props) => {
visible={ visible }
centered
width='90%'
onCancel={() => { onCancel?.(); } }
onCancel={() => {
setCurrentTreeId(undefined);
onCancel?.();
}}
footer={
<Space>
<Button onClick={() => onCancel?.() }>取消</Button>
<Button onClick={() => {
setCurrentTreeId(undefined);
onCancel?.();
}}>取消</Button>
</Space>
}
bodyStyle={{ padding: '24px', height: '70vh', overflow: 'auto' }}
......
......@@ -5,16 +5,16 @@ import { useMount, useUnmount } from 'ahooks';
import ImportAction from './ImportAction';
import CatalogModal from './CatalogModal';
import { dispatchLatest } from '../../../../model';
import { dispatchLatest, dispatch } from '../../../../model';
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 './EditModel.less';
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 [ terms, setTerms ] = useState([]);
......@@ -25,7 +25,7 @@ const EditModel = (props) => {
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();
......@@ -41,6 +41,8 @@ const EditModel = (props) => {
const _versionId = getQueryParam(VersionId, props.location.search);
const _holder = getQueryParam(Holder, props.location.search);
const _ddl = getQueryParam(DDL, props.location.search);
const _requireId = getQueryParam(RequireId, props.location.search);
let _hints = [];
if ((_hintsStr||'') !== '') {
......@@ -54,7 +56,7 @@ const EditModel = (props) => {
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;
const interval = setInterval(() => {
......@@ -167,6 +169,21 @@ const EditModel = (props) => {
actionRef.current = 'detail';
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: () => {
setConfirmLoading(false);
......
......@@ -7,7 +7,7 @@ import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"
import UpdateTreeItemModal from './UpdateTreeItemModal';
import { dispatch } from '../../../../model';
import { showMessage, getQueryParam } from '../../../../util';
import { AnchorId, AnchorDirId, AnchorTimestamp } from '../../../../util/constant';
import { AnchorId, AnchorDirId, AnchorTimestamp, AnchorRequireId } from '../../../../util/constant';
import './ModelTree.less';
import 'react-contexify/dist/ReactContexify.css';
......@@ -56,6 +56,7 @@ const ModelTree = (props) => {
const timestamp = getQueryParam(AnchorTimestamp, props.location?.search||'');
const id = getQueryParam(AnchorId, props.location?.search||'');
const did = getQueryParam(AnchorDirId, props.location?.search||'');
const rid = getQueryParam(AnchorRequireId, props.location?.search||'');
useEffect(() => {
getShowSyncAndDomains();
......@@ -73,6 +74,10 @@ const ModelTree = (props) => {
getDataModelLocationThenGetDirTreeData();
} else if ((did||'') !== '') {
getDirTreeData(did);
} else if (rid) {
setViewSelectedKey('requirement');
onViewChange && onViewChange('requirement');
getRequirementTreeData(rid);
} else {
getDirTreeData();
}
......@@ -227,7 +232,7 @@ const ModelTree = (props) => {
});
}
const getRequirementTreeData = () => {
const getRequirementTreeData = (defaultSelectedId='') => {
setLoading(true);
dispatch({
type: 'datamodel.requirementList',
......@@ -237,13 +242,25 @@ const ModelTree = (props) => {
callback: data => {
setLoading(false);
let _treeData = [];
let defaultItem = null;
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);
if (defaultItem) {
setItem(defaultItem);
onSelect && onSelect(defaultItem.key);
} else {
setItem(_treeData.length>0?_treeData[0]:{});
onSelect && onSelect(_treeData.length>0?_treeData[0].key:'');
}
},
error: () => {
setLoading(false);
......
......@@ -15,7 +15,7 @@ import HistoryAndVersionDrawer from './Component/HistoryAndVersionDrawer';
import StartFlowModal from './Component/StartFlowModal';
import { showMessage, showNotifaction, inputWidth, DeleteTipModal } from '../../../util';
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 DebounceInput from './Component/DebounceInput';
import MetadataAnalysis from '../../QianKun/MetadataAnalysis';
......@@ -313,20 +313,32 @@ class Model extends React.Component {
if (confirm) {
if ((hints||[]).length > 0) {
if (currentView === 'requirement') {
setTimeout(() => {
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 {
if (currentView === 'requirement') {
setTimeout(() => {
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 = {}) => {
const { catalogId } = this.state;
const { catalogId, currentView } = this.state;
this.setState({ importModalVisible: false }, () => {
refresh && this.onTableChange();
......@@ -340,28 +352,38 @@ class Model extends React.Component {
showMessage('info', '最多只能同时编辑5条信息');
}
if (currentView === 'requirement') {
setTimeout(() => {
wordData.content.slice(0, 5).forEach(data => {
window.open(`/data-govern/data-model-action?${Action}=add&${RequireId}=${catalogId}&${ModelerData}=${encodeURIComponent(JSON.stringify(data))}`, '_blank');
})
}, 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 = '') => {
const { catalogId } = this.state;
const { catalogId, currentView } = this.state;
this.setState({ importModalVisible: false }, () => {
if (confirm && (ddl||'') !== '') {
if (currentView === 'requirement') {
setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=add&${RequireId}=${catalogId}&${DDL}=${encodeURIComponent(ddl)}`, '_blank');
}, 1000);
} else {
setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId}&${DDL}=${encodeURIComponent(ddl)}`, '_blank');
}, 1000);
}
}
});
......@@ -553,11 +575,12 @@ class Model extends React.Component {
}}
>
<Space>
{
(currentView!=='requirement') && <React.Fragment>
<Space>
<Button onClick={() => { this.setState({ importModalVisible: true }); }}>新建</Button>
</Space>
{
(currentView!=='requirement') && <React.Fragment>
<Space>
<Tooltip title={(selectModelerIds||[]).length===0?'请先选择模型':''}>
......@@ -602,7 +625,7 @@ class Model extends React.Component {
<Space>
{
(currentView==='dir'|| currentView==='state' ||keyword!=='') && <Space>
(keyword!=='') && <Space>
<Radio.Group onChange={this.handleShowModeChange} value={showMode}>
<Radio.Button value="list">列表展示</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