Commit d5978ce5 by zhaochengxiang

状态视角下新增模型问题

parent 1ecf1813
......@@ -298,4 +298,17 @@ export function formatVersionDate(t) {
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;
}
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';
import { Timeline, Spin } from 'antd';
import { dispatch } from '../../../../model';
import { formatVersionDate } from '../../../../util';
import { formatVersionHistoryDate } from '../../../../util';
import { Action, ModelerId, VersionId } from '../../../../util/constant';
const VersionHistory = (props) => {
......@@ -48,7 +48,6 @@ const VersionHistory = (props) => {
{
(versions||[]).map((version, index) => {
let name = version.name||'';
name = name + '_' + formatVersionDate(version.ts);
if (index === 0 && version.id !== '-1') {
name = name+'(当前版本)';
}
......@@ -56,10 +55,17 @@ const VersionHistory = (props) => {
name = name+'(当前版本)';
}
return <Timeline.Item key={index} >
<a onClick={()=>{ onVersionItemClick(version); }}>
{name}
</a>
return <Timeline.Item key={index} color={ version.id==='-1'?'red': 'blue' } >
<div>
<div>
<a onClick={()=>{ onVersionItemClick(version); }}>
{name}
</a>
</div>
<div className='pt-2'>
<span>{formatVersionHistoryDate(version.ts)}</span>
</div>
</div>
</Timeline.Item>
})
}
......
......@@ -197,18 +197,10 @@ class Model extends React.Component {
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 = () => {
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 = () => {
......@@ -220,9 +212,9 @@ class Model extends React.Component {
}
onImportWordBtnClick = () => {
const { catalogId } = this.state;
const { catalogId, currentView } = this.state;
if ((catalogId||'') === '') {
if (currentView!=='dir' || (catalogId||'') === '') {
showMessage('info', '请先选择模型目录');
return;
}
......@@ -231,7 +223,7 @@ class Model extends React.Component {
}
onImportModelBtnClick = () => {
const { catalogId, selectModelerIds } = this.state;
const { catalogId, selectModelerIds, currentView } = this.state;
if ((selectModelerIds||[]).length === 0) {
showMessage('info', '请先选择一个模型');
......@@ -243,7 +235,7 @@ class Model extends React.Component {
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 = () => {
......@@ -362,12 +354,12 @@ class Model extends React.Component {
}
onImportModalCancel = (hints = []) => {
const { catalogId, importModalAction } = this.state;
const { catalogId, importModalAction, currentView } = this.state;
this.setState({ importModalVisible: false }, () => {
if ((hints||[]).length > 0) {
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);
}
});
......
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