Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
8d487280
Commit
8d487280
authored
Mar 02, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型版本对比
parent
57318285
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
40 deletions
+122
-40
FilterColumnAction.jsx
src/view/Manage/Model/Component/FilterColumnAction.jsx
+53
-0
VersionCompare.jsx
src/view/Manage/Model/Component/VersionCompare.jsx
+64
-5
VersionCompare.less
src/view/Manage/Model/Component/VersionCompare.less
+1
-0
VersionCompareTable.jsx
src/view/Manage/Model/Component/VersionCompareTable.jsx
+4
-35
No files found.
src/view/Manage/Model/Component/FilterColumnAction.jsx
0 → 100644
View file @
8d487280
import
{
useState
}
from
'react'
;
import
{
Popover
,
Table
}
from
'antd'
;
import
{
MenuOutlined
}
from
'@ant-design/icons'
;
const
{
Column
}
=
Table
;
const
ColumnSelect
=
(
props
)
=>
{
const
{
columns
,
onChange
,
defaultSelectedKeys
}
=
props
;
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
(
defaultSelectedKeys
);
const
changeSelect
=
(
selectedRowKeys
)
=>
{
setSelectedKeys
(
selectedRowKeys
);
onChange
&&
onChange
(
selectedRowKeys
);
}
const
rowSelection
=
{
selectedRowKeys
:
selectedKeys
,
onChange
:
changeSelect
}
return
(
<
div
style=
{
{
width
:
230
}
}
>
<
Table
rowKey=
"title"
rowSelection=
{
rowSelection
}
showHeader=
{
true
}
pagination=
{
false
}
size=
"small"
scroll=
{
{
y
:
350
}
}
dataSource=
{
columns
}
>
<
Column
title=
"字段名字"
dataIndex=
"title"
key=
"title"
/>
</
Table
>
</
div
>
)
}
const
FilterColumnAction
=
(
props
)
=>
{
return
(
<
Popover
title=
"选择显示字段"
placement=
"leftTop"
content=
{
<
ColumnSelect
{
...
props
}
/>
}
>
<
MenuOutlined
/>
</
Popover
>
);
}
export
default
FilterColumnAction
;
\ No newline at end of file
src/view/Manage/Model/Component/VersionCompare.jsx
View file @
8d487280
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
Form
,
Select
,
Spin
,
Tooltip
,
Checkbox
}
from
'antd'
;
import
{
Form
,
Select
,
Spin
,
Tooltip
,
Checkbox
,
Typography
}
from
'antd'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
formatVersionDate
}
from
'../../../../util'
;
import
{
formatVersionDate
}
from
'../../../../util'
;
import
VersionCompareHeader
from
'./VersionCompareHeader'
;
import
VersionCompareHeader
from
'./VersionCompareHeader'
;
import
VersionCompareTable
from
'./VersionCompareTable'
;
import
VersionCompareTable
from
'./VersionCompareTable'
;
import
VersionCompareIndex
from
'./VersionCompareIndex'
;
import
VersionCompareIndex
from
'./VersionCompareIndex'
;
import
FilterColumnAction
from
'./FilterColumnAction'
;
import
'./VersionCompare.less'
;
import
'./VersionCompare.less'
;
const
{
Text
,
Paragraph
}
=
Typography
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
defaultColumnTitles
=
[
'序号'
,
'中文名称'
,
'英文名称'
,
'类型'
,
'业务含义'
];
const
VersionCompare
=
(
props
)
=>
{
const
VersionCompare
=
(
props
)
=>
{
...
@@ -22,8 +25,12 @@ const VersionCompare = (props) => {
...
@@ -22,8 +25,12 @@ const VersionCompare = (props) => {
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
compareData
,
setCompareData
]
=
useState
(
null
);
const
[
compareData
,
setCompareData
]
=
useState
(
null
);
const
[
loadingCompare
,
setLoadingCompare
]
=
useState
(
false
);
const
[
loadingCompare
,
setLoadingCompare
]
=
useState
(
false
);
const
[
onlyShowChange
,
setOnlyShowChange
]
=
useState
(
false
);
const
[
onlyShowChange
,
setOnlyShowChange
]
=
useState
(
true
);
const
[
attrFilterColumns
,
setAttrFilterColumns
]
=
useState
([]);
const
[
attrSelectedTitles
,
setAttrSelectedTitles
]
=
useState
(
defaultColumnTitles
);
const
attrColumnsRef
=
useRef
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
((
id
||
''
)
!==
''
)
{
if
((
id
||
''
)
!==
''
)
{
getVersions
();
getVersions
();
...
@@ -100,6 +107,51 @@ const VersionCompare = (props) => {
...
@@ -100,6 +107,51 @@ const VersionCompare = (props) => {
callback
:
data
=>
{
callback
:
data
=>
{
setLoadingCompare
(
false
);
setLoadingCompare
(
false
);
setCompareData
(
data
);
setCompareData
(
data
);
const
newAttrOptionColumns
=
[];
(
data
?.
heads
?.
columnHead
||
[]).
forEach
((
item
,
index
)
=>
{
newAttrOptionColumns
.
push
({
title
:
item
||
''
,
dataIndex
:
`column
${
index
}
`
,
render
:
(
attrValue
,
record
,
index
)
=>
{
let
stateClassName
=
''
;
if
(
attrValue
?.
state
===
'ADD'
||
attrValue
?.
state
===
'UPDATE'
)
{
stateClassName
=
'add'
;
}
else
if
(
attrValue
?.
state
===
'DELETE'
)
{
stateClassName
=
'delete'
;
}
return
(
<
Paragraph
>
<
Tooltip
title=
{
attrValue
?.
value
||
''
}
>
<
Text
className=
{
stateClassName
}
ellipsis=
{
true
}
>
{
attrValue
?.
value
||
''
}
</
Text
>
</
Tooltip
>
</
Paragraph
>
);
},
width
:
(
item
===
'序号'
)?
60
:
150
,
ellipsis
:
true
,
option
:
true
,
});
})
const
newAttrColumns
=
[...
newAttrOptionColumns
,
{
title
:
<
FilterColumnAction
columns=
{
newAttrOptionColumns
}
defaultSelectedKeys=
{
defaultColumnTitles
}
onChange=
{
onFilterChange
}
/>,
dataIndex
:
'columnFilter'
,
render
:
(
_
,
record
,
index
)
=>
{
return
''
;
},
width
:
40
,
ellipsis
:
true
,
option
:
false
}];
attrColumnsRef
.
current
=
newAttrColumns
;
const
newFilterColumns
=
newAttrColumns
.
filter
(
column
=>
column
.
option
===
false
||
attrSelectedTitles
.
indexOf
(
column
.
title
)
!==
-
1
);
setAttrFilterColumns
(
newFilterColumns
);
},
},
error
:
()
=>
{
error
:
()
=>
{
setLoadingCompare
(
false
);
setLoadingCompare
(
false
);
...
@@ -107,6 +159,13 @@ const VersionCompare = (props) => {
...
@@ -107,6 +159,13 @@ const VersionCompare = (props) => {
})
})
}
}
const
onFilterChange
=
(
values
)
=>
{
const
newFilterColumns
=
attrColumnsRef
.
current
.
filter
(
column
=>
column
.
option
===
false
||
values
.
indexOf
(
column
.
title
)
!==
-
1
);
setAttrSelectedTitles
(
values
);
setAttrFilterColumns
(
newFilterColumns
);
}
const
onOnlyShowChange
=
(
e
)
=>
{
const
onOnlyShowChange
=
(
e
)
=>
{
setOnlyShowChange
(
e
.
target
.
checked
);
setOnlyShowChange
(
e
.
target
.
checked
);
if
(
basicVersion
!==
''
&&
incVersion
!==
''
)
{
if
(
basicVersion
!==
''
&&
incVersion
!==
''
)
{
...
@@ -164,12 +223,12 @@ const VersionCompare = (props) => {
...
@@ -164,12 +223,12 @@ const VersionCompare = (props) => {
compareData
&&
<
div
className=
'flex'
>
compareData
&&
<
div
className=
'flex'
>
<
div
style=
{
{
flex
:
1
,
borderRight
:
'1px solid #EFEFEF'
,
paddingRight
:
10
,
overflow
:
'hidden'
}
}
>
<
div
style=
{
{
flex
:
1
,
borderRight
:
'1px solid #EFEFEF'
,
paddingRight
:
10
,
overflow
:
'hidden'
}
}
>
<
VersionCompareHeader
data=
{
compareData
}
/>
<
VersionCompareHeader
data=
{
compareData
}
/>
<
VersionCompareTable
data=
{
compareData
}
/>
<
VersionCompareTable
data=
{
compareData
}
columns=
{
attrFilterColumns
}
/>
<
VersionCompareIndex
data=
{
compareData
}
/>
<
VersionCompareIndex
data=
{
compareData
}
/>
</
div
>
</
div
>
<
div
style=
{
{
flex
:
1
,
paddingLeft
:
10
,
overflow
:
'hidden'
}
}
>
<
div
style=
{
{
flex
:
1
,
paddingLeft
:
10
,
overflow
:
'hidden'
}
}
>
<
VersionCompareHeader
data=
{
compareData
}
direction=
'right'
/>
<
VersionCompareHeader
data=
{
compareData
}
direction=
'right'
/>
<
VersionCompareTable
data=
{
compareData
}
direction=
'right'
/>
<
VersionCompareTable
data=
{
compareData
}
columns=
{
attrFilterColumns
}
direction=
'right'
/>
<
VersionCompareIndex
data=
{
compareData
}
direction=
'right'
/>
<
VersionCompareIndex
data=
{
compareData
}
direction=
'right'
/>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/view/Manage/Model/Component/VersionCompare.less
View file @
8d487280
.model-version-compare {
.model-version-compare {
.delete {
.delete {
color: red;
color: red;
text-decoration: line-through;
}
}
.add {
.add {
...
...
src/view/Manage/Model/Component/VersionCompareTable.jsx
View file @
8d487280
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
Typography
,
T
ooltip
,
T
able
}
from
'antd'
;
import
{
Typography
,
Table
}
from
'antd'
;
const
{
T
ext
,
Paragraph
,
T
itle
}
=
Typography
;
const
{
Title
}
=
Typography
;
const
VersionCompareTable
=
(
props
)
=>
{
const
VersionCompareTable
=
(
props
)
=>
{
const
{
data
,
direction
=
'left'
}
=
props
;
const
{
data
,
direction
=
'left'
,
columns
}
=
props
;
const
[
columns
,
setColumns
]
=
useState
([]);
const
[
tableData
,
setTableData
]
=
useState
([]);
const
[
tableData
,
setTableData
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
newColumns
=
[];
(
data
?.
heads
?.
columnHead
||
[]).
forEach
((
item
,
index
)
=>
{
newColumns
.
push
({
title
:
item
||
''
,
dataIndex
:
`column
${
index
}
`
,
render
:
(
attrValue
,
record
,
index
)
=>
{
let
stateClassName
=
''
;
if
(
attrValue
?.
state
===
'ADD'
||
attrValue
?.
state
===
'UPDATE'
)
{
stateClassName
=
'add'
;
}
else
if
(
attrValue
?.
state
===
'DELETE'
)
{
stateClassName
=
'delete'
;
}
return
(
<
Paragraph
>
<
Tooltip
title=
{
attrValue
?.
value
||
''
}
>
<
Text
className=
{
stateClassName
}
ellipsis=
{
true
}
>
{
attrValue
?.
value
||
''
}
</
Text
>
</
Tooltip
>
</
Paragraph
>
);
},
width
:
60
,
ellipsis
:
true
,
});
})
setColumns
(
newColumns
);
const
newTableData
=
[];
const
newTableData
=
[];
let
columnValue
=
[];
let
columnValue
=
[];
if
(
direction
===
'left'
)
{
if
(
direction
===
'left'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment