Commit 97a2ed1b by zhaochengxiang

模型版本对比增加显示差异过滤

parent a97633ae
import React, { useEffect, useState } from 'react';
import { Form, Select, Spin, Tooltip } from 'antd';
import { Form, Select, Spin, Tooltip, Checkbox } from 'antd';
import showdown from 'showdown';
import { dispatch, dispatchLatest } from '../../../../model';
......@@ -19,7 +19,8 @@ const VersionCompare = (props) => {
const [ incVersions, setIncVersions ] = useState([]);
const [ loading, setLoading ] = useState(false);
const [ loadingCompare, setLoadingCompare ] = useState(false);
const [ onlyShowChange, setOnlyShowChange ] = useState(false);
useEffect(() => {
if ((id||'') !== '') {
getVersions();
......@@ -78,15 +79,19 @@ const VersionCompare = (props) => {
const onIncChange = (value) => {
setIncVersion(value);
getCompare(basicVersion, value);
}
const getCompare = (value1=basicVersion, value2=incVersion, value3=onlyShowChange) => {
setLoadingCompare(true);
dispatchLatest({
type: 'datamodel.compare',
payload: {
params: {
id,
versionId1: basicVersion,
versionId2: value
versionId1: value1,
versionId2: value2,
includeSame: !value3
}
},
callback: data => {
......@@ -109,6 +114,13 @@ const VersionCompare = (props) => {
})
}
const onOnlyShowChange = (e) => {
setOnlyShowChange(e.target.checked);
if (basicVersion!=='' && incVersion!=='') {
getCompare(basicVersion, incVersion, e.target.checked);
}
}
return (
<div className='model-version-compare'>
<Form layout='inline'>
......@@ -148,6 +160,9 @@ const VersionCompare = (props) => {
}
</Select>
</Form.Item>
<Form.Item>
<Checkbox onChange={onOnlyShowChange} value={onlyShowChange}>仅显示差异</Checkbox>
</Form.Item>
</Form>
<div className='py-5'>
......
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