Commit d5978ce5 by zhaochengxiang

状态视角下新增模型问题

parent 1ecf1813
...@@ -299,3 +299,16 @@ export function formatVersionDate(t) { ...@@ -299,3 +299,16 @@ export function formatVersionDate(t) {
var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()); var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
return YY + MM + DD +"_"+hh + mm + ss; return YY + MM + DD +"_"+hh + mm + ss;
} }
export function formatVersionHistoryDate(t) {
if (t === null) return '';
var date = new Date(t);
var YY = date.getFullYear() + '/';
var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '/';
var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
return YY + MM + DD +" "+hh + mm + ss;
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Timeline, Spin } from 'antd'; import { Timeline, Spin } from 'antd';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import { formatVersionDate } from '../../../../util'; import { formatVersionHistoryDate } from '../../../../util';
import { Action, ModelerId, VersionId } from '../../../../util/constant'; import { Action, ModelerId, VersionId } from '../../../../util/constant';
const VersionHistory = (props) => { const VersionHistory = (props) => {
...@@ -48,7 +48,6 @@ const VersionHistory = (props) => { ...@@ -48,7 +48,6 @@ const VersionHistory = (props) => {
{ {
(versions||[]).map((version, index) => { (versions||[]).map((version, index) => {
let name = version.name||''; let name = version.name||'';
name = name + '_' + formatVersionDate(version.ts);
if (index === 0 && version.id !== '-1') { if (index === 0 && version.id !== '-1') {
name = name+'(当前版本)'; name = name+'(当前版本)';
} }
...@@ -56,10 +55,17 @@ const VersionHistory = (props) => { ...@@ -56,10 +55,17 @@ const VersionHistory = (props) => {
name = name+'(当前版本)'; name = name+'(当前版本)';
} }
return <Timeline.Item key={index} > return <Timeline.Item key={index} color={ version.id==='-1'?'red': 'blue' } >
<div>
<div>
<a onClick={()=>{ onVersionItemClick(version); }}> <a onClick={()=>{ onVersionItemClick(version); }}>
{name} {name}
</a> </a>
</div>
<div className='pt-2'>
<span>{formatVersionHistoryDate(version.ts)}</span>
</div>
</div>
</Timeline.Item> </Timeline.Item>
}) })
} }
......
...@@ -197,18 +197,10 @@ class Model extends React.Component { ...@@ -197,18 +197,10 @@ class Model extends React.Component {
this.setState({ constraintDetailDrawerVisible: true }); this.setState({ constraintDetailDrawerVisible: true });
} }
// setFilterData = () => {
// const { tableData, currentModelState } = this.state;
// const _filterData = (tableData||[]).filter(item => (currentModelState===''||currentModelState===item.state?.id));
// this.setState({ filterTableData: _filterData });
// }
onImportUnconditionBtnClick = () => { onImportUnconditionBtnClick = () => {
const { catalogId } = this.state; const { catalogId, currentView } = this.state;
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId||''}`); window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}`);
} }
onImportExcelBtnClick = () => { onImportExcelBtnClick = () => {
...@@ -220,9 +212,9 @@ class Model extends React.Component { ...@@ -220,9 +212,9 @@ class Model extends React.Component {
} }
onImportWordBtnClick = () => { onImportWordBtnClick = () => {
const { catalogId } = this.state; const { catalogId, currentView } = this.state;
if ((catalogId||'') === '') { if (currentView!=='dir' || (catalogId||'') === '') {
showMessage('info', '请先选择模型目录'); showMessage('info', '请先选择模型目录');
return; return;
} }
...@@ -231,7 +223,7 @@ class Model extends React.Component { ...@@ -231,7 +223,7 @@ class Model extends React.Component {
} }
onImportModelBtnClick = () => { onImportModelBtnClick = () => {
const { catalogId, selectModelerIds } = this.state; const { catalogId, selectModelerIds, currentView } = this.state;
if ((selectModelerIds||[]).length === 0) { if ((selectModelerIds||[]).length === 0) {
showMessage('info', '请先选择一个模型'); showMessage('info', '请先选择一个模型');
...@@ -243,7 +235,7 @@ class Model extends React.Component { ...@@ -243,7 +235,7 @@ class Model extends React.Component {
return; return;
} }
window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${catalogId||''}&${ModelerId}=${selectModelerIds[0]}`); window.open(`/data-govern/data-model-action?${Action}=add&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}&${ModelerId}=${selectModelerIds[0]}`);
} }
onImportDDLBtnClick = () => { onImportDDLBtnClick = () => {
...@@ -362,12 +354,12 @@ class Model extends React.Component { ...@@ -362,12 +354,12 @@ class Model extends React.Component {
} }
onImportModalCancel = (hints = []) => { onImportModalCancel = (hints = []) => {
const { catalogId, importModalAction } = this.state; const { catalogId, importModalAction, currentView } = this.state;
this.setState({ importModalVisible: false }, () => { this.setState({ importModalVisible: false }, () => {
if ((hints||[]).length > 0) { if ((hints||[]).length > 0) {
setTimeout(() => { setTimeout(() => {
window.open(`/data-govern/data-model-action?${Action}=${importModalAction}&${CatalogId}=${catalogId}&${Hints}=${encodeURIComponent((hints||[]).join(','))}`); window.open(`/data-govern/data-model-action?${Action}=${importModalAction}&${CatalogId}=${(currentView==='dir')?(catalogId||''):''}&${Hints}=${encodeURIComponent((hints||[]).join(','))}`);
}, 1000); }, 1000);
} }
}); });
......
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