Commit 97a2ed1b by zhaochengxiang

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

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