Commit e39ed6a6 by zhaochengxiang

检出

parent 8a59aaa1
......@@ -32,6 +32,7 @@
"react-virtualized": "^9.22.3",
"redux": "^4.0.1",
"redux-saga": "^1.0.5",
"showdown": "^1.9.1",
"smooth-scroll": "^16.1.3",
"web-vitals": "^1.0.1"
},
......
......@@ -165,7 +165,7 @@ const EditModel = (props) => {
<Space>
<Button onClick={onHistory} >版本历史</Button>
{
(editable==='true'||permitCheckOut==='true') && <Button type='primary' onClick={edit} >
(editable==='true') && <Button type='primary' onClick={edit} >
编辑
</Button>
}
......
......@@ -20,7 +20,8 @@ const HistoryAndVersionDrawer = (props) => {
}}
visible={visible}
>
<Tabs defaultActiveKey="1" type="card" size='small'>
{
visible && <Tabs defaultActiveKey="1" type="card" size='small'>
<TabPane tab="版本历史" key="1">
<VersionHistory id={id} />
</TabPane>
......@@ -28,6 +29,7 @@ const HistoryAndVersionDrawer = (props) => {
<VersionCompare id={id} />
</TabPane>
</Tabs>
}
</Drawer>
);
}
......
......@@ -9,7 +9,7 @@ import ImportActionPartition from './ImportActionPartition';
import { dispatch } from '../../../../model';
const ImportAction = (props) => {
const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, permitCheckOut, stateId, versionId } = props;
const { action, hints, onChange, form, modelerId, terms, ddl, roughModelerData, stateId, versionId } = props;
const [ constraints, setConstraints ] = useState([]);
const [ constraint, setConstraint ] = useState({});
......@@ -136,8 +136,6 @@ const ImportAction = (props) => {
type = 'datamodel.modelCopy';
} else if (action === 'flow') {
type = 'datamodel.getDataModelWithRecommendedDefinitionAndTermDiscovery';
} else if (action==='edit' && permitCheckOut === 'true') {
type = 'datamodel.getCheckOutDataModel';
} else if (action === 'detail-version') {
type = 'datamodel.getDataModelByVersionId';
params = {
......
import React, { useState, useEffect, useRef } from "react";
import { Space, Button, Tooltip, Modal, Divider, Pagination, Table } from 'antd';
import { EditOutlined, DeleteOutlined, DownOutlined, UpOutlined, HistoryOutlined } from '@ant-design/icons';
import { EditOutlined, DeleteOutlined, DownOutlined, UpOutlined, HistoryOutlined, PullRequestOutlined } from '@ant-design/icons';
import SmoothScroll from 'smooth-scroll';
import classnames from 'classnames';
......@@ -78,14 +78,17 @@ const ModelTable = (props) => {
{
title: '操作',
key: 'action',
width: 200,
width: 230,
render: (_,record) => {
return (
<Space size='small'>
{
<React.Fragment>
<Tooltip placement='bottom' title={'修改'}>
<Button icon={<EditOutlined />} size='small' disabled={!record.editable&&!record.permitCheckOut} onClick={() => { editItem(record); }} />
<Button icon={<EditOutlined />} size='small' disabled={!record.editable} onClick={() => { editItem(record); }} />
</Tooltip>
<Tooltip placement='bottom' title={'检出'}>
<Button icon={<PullRequestOutlined />} size='small' disabled={!record.permitCheckOut} onClick={() => { checkoutItem(record); }} />
</Tooltip>
<Tooltip placement='bottom' title={'删除'}>
<Button icon={<DeleteOutlined />} size='small' disabled={!record.deletable} onClick={() => { deleteItem(record); }} />
......@@ -202,6 +205,19 @@ const ModelTable = (props) => {
onItemAction && onItemAction(record, 'edit');
}
const checkoutItem = (record) => {
dispatchLatest({
type: 'datamodel.getCheckOutDataModel',
payload: {
id: record.id||''
},
callback: () => {
showMessage('success', `检出${record.cnName||''}成功`);
onChange && onChange();
}
})
}
const detailItem = (record) => {
onItemAction && onItemAction(record, 'detail');
}
......@@ -235,7 +251,7 @@ const ModelTable = (props) => {
onSelect && onSelect(newSelectedRowKeys);
}
} else {
if (action.id === '4') {
if (action.id === '2') {
onChange && onChange();
} else {
getDataModel();
......
import React, { useEffect, useState } from 'react';
import { Form, Select, Spin } from 'antd';
import showdown from 'showdown';
import { highlightVersionChangeInformation } from '../../../../util';
import { dispatch, dispatchLatest } from '../../../../model';
import { formatVersionDate } from '../../../../util';
const { Option } = Select;
const basicChangeInformation = '编码:<DD>t_branch</DD>-><AA>t_branch_zcx</AA> \n 名称:<DD>t_branch</DD>-><AA>t_branch_zcx</AA>';
const fieldChangeInformation = '编码:<DD>t_branch</DD>-><AA>t_branch_zcx</AA> \n 名称:<DD>t_branch</DD>-><AA>t_branch_zcx</AA>';
const VersionCompare = (props) => {
const { id } = props;
......@@ -19,7 +15,6 @@ const VersionCompare = (props) => {
const [ basicVersions, setBasicVersions ] = useState([]);
const [ incVersion, setIncVersion ] = useState('');
const [ incVersions, setIncVersions ] = useState([]);
const [ changeInformation, setChangeInformation ] = useState('');
const [ loading, setLoading ] = useState(false);
const [ loadingCompare, setLoadingCompare ] = useState(false);
......@@ -89,7 +84,13 @@ const VersionCompare = (props) => {
},
callback: data => {
setLoadingCompare(false);
setChangeInformation(data||'');
var target = document.getElementById('container');
var converter = new showdown.Converter();
var html = converter.makeHtml(data||'');
target.innerHTML = html;
},
error: () => {
setLoadingCompare(false);
......@@ -123,17 +124,13 @@ const VersionCompare = (props) => {
</Select>
</Form.Item>
</Form>
<Spin spinning={loadingCompare}>
{
(changeInformation||''!=='') && (
<React.Fragment>
<div>变化信息</div>
<div>{changeInformation}</div>
</React.Fragment>
)
}
<div className='py-3'>
<Spin spinning={loadingCompare} >
<div id="container" style={{ }}></div>
</Spin>
</div>
</div>
);
}
......
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