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
78f2d2d1
Commit
78f2d2d1
authored
Jul 30, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本对比
parent
0b62b68b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
34 deletions
+57
-34
HistoryAndVersionDrawer.jsx
src/view/Manage/Model/Component/HistoryAndVersionDrawer.jsx
+22
-3
VersionCompare.jsx
src/view/Manage/Model/Component/VersionCompare.jsx
+35
-31
No files found.
src/view/Manage/Model/Component/HistoryAndVersionDrawer.jsx
View file @
78f2d2d1
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Drawer
,
Tabs
}
from
'antd'
;
import
{
Drawer
,
Tabs
,
Space
,
Checkbox
,
Button
}
from
'antd'
;
import
VersionHistory
from
'./VersionHistory'
;
import
VersionHistory
from
'./VersionHistory'
;
import
VersionCompare
from
'./VersionCompare'
;
import
VersionCompare
from
'./VersionCompare'
;
...
@@ -8,6 +8,17 @@ const { TabPane } = Tabs;
...
@@ -8,6 +8,17 @@ const { TabPane } = Tabs;
const
HistoryAndVersionDrawer
=
(
props
)
=>
{
const
HistoryAndVersionDrawer
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
id
}
=
props
;
const
{
onCancel
,
visible
,
id
}
=
props
;
const
[
activeKey
,
setActiveKey
]
=
React
.
useState
(
'1'
)
const
[
onlyShowChange
,
setOnlyShowChange
]
=
React
.
useState
(
false
)
const
[
alterTrigger
,
setAlterTrigger
]
=
React
.
useState
(
false
)
const
onOnlyShowChange
=
(
e
)
=>
{
setOnlyShowChange
(
e
.
target
.
checked
);
}
const
onAlterClick
=
()
=>
{
setAlterTrigger
(
!
alterTrigger
)
}
return
(
return
(
<
Drawer
<
Drawer
...
@@ -16,17 +27,25 @@ const HistoryAndVersionDrawer = (props) => {
...
@@ -16,17 +27,25 @@ const HistoryAndVersionDrawer = (props) => {
closable=
{
true
}
closable=
{
true
}
width=
{
'90%'
}
width=
{
'90%'
}
onClose=
{
()
=>
{
onClose=
{
()
=>
{
setActiveKey
(
'1'
);
onCancel
&&
onCancel
();
onCancel
&&
onCancel
();
}
}
}
}
visible=
{
visible
}
visible=
{
visible
}
>
>
{
{
visible
&&
<
Tabs
defaultActiveKey=
"1"
type=
"card"
size=
'small'
>
visible
&&
<
Tabs
activeKey=
{
activeKey
}
type=
"card"
size=
'small'
tabBarExtraContent=
{
activeKey
===
'2'
?<
Space
>
<
Checkbox
onChange=
{
onOnlyShowChange
}
checked=
{
onlyShowChange
}
>
仅显示差异
</
Checkbox
>
<
Button
size=
'small'
onClick=
{
onAlterClick
}
>
生成ALTER
</
Button
>
</
Space
>:
null
}
onChange=
{
(
val
)
=>
{
setActiveKey
(
val
)
}
}
>
<
TabPane
tab=
"版本历史"
key=
"1"
>
<
TabPane
tab=
"版本历史"
key=
"1"
>
<
VersionHistory
id=
{
id
}
/>
<
VersionHistory
id=
{
id
}
/>
</
TabPane
>
</
TabPane
>
<
TabPane
tab=
"版本对比"
key=
"2"
>
<
TabPane
tab=
"版本对比"
key=
"2"
>
<
VersionCompare
id=
{
id
}
/>
<
VersionCompare
id=
{
id
}
onlyShowChange=
{
onlyShowChange
}
alterTrigger=
{
alterTrigger
}
/>
</
TabPane
>
</
TabPane
>
</
Tabs
>
</
Tabs
>
}
}
...
...
src/view/Manage/Model/Component/VersionCompare.jsx
View file @
78f2d2d1
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
Form
,
Select
,
Spin
,
Tooltip
,
Checkbox
,
Typography
,
Space
,
Button
}
from
'antd'
;
import
{
Form
,
Select
,
Spin
,
Tooltip
,
Checkbox
,
Typography
,
Space
,
Button
,
Row
,
Col
}
from
'antd'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
formatVersionDate
,
showMessage
}
from
'../../../../util'
;
import
{
formatVersionDate
,
showMessage
}
from
'../../../../util'
;
...
@@ -15,7 +15,7 @@ const { Option } = Select;
...
@@ -15,7 +15,7 @@ const { Option } = Select;
const
VersionCompare
=
(
props
)
=>
{
const
VersionCompare
=
(
props
)
=>
{
const
{
id
}
=
props
;
const
{
id
,
onlyShowChange
,
alterTrigger
}
=
props
;
const
[
basicVersion
,
setBasicVersion
]
=
useState
(
''
);
const
[
basicVersion
,
setBasicVersion
]
=
useState
(
''
);
const
[
basicVersions
,
setBasicVersions
]
=
useState
([]);
const
[
basicVersions
,
setBasicVersions
]
=
useState
([]);
...
@@ -24,7 +24,6 @@ const VersionCompare = (props) => {
...
@@ -24,7 +24,6 @@ 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
(
true
);
const
[
ddlAlterParams
,
setAlterParams
]
=
useState
({
const
[
ddlAlterParams
,
setAlterParams
]
=
useState
({
visible
:
false
,
visible
:
false
,
id
:
undefined
,
id
:
undefined
,
...
@@ -33,6 +32,8 @@ const VersionCompare = (props) => {
...
@@ -33,6 +32,8 @@ const VersionCompare = (props) => {
incVersion
:
undefined
,
incVersion
:
undefined
,
})
})
const
mountRef
=
React
.
useRef
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
if
((
id
||
''
)
!==
''
)
{
if
((
id
||
''
)
!==
''
)
{
getVersions
();
getVersions
();
...
@@ -41,6 +42,26 @@ const VersionCompare = (props) => {
...
@@ -41,6 +42,26 @@ const VersionCompare = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
id
])
},
[
id
])
useEffect
(()
=>
{
if
(
basicVersion
!==
''
&&
incVersion
!==
''
)
{
getCompare
(
basicVersion
,
incVersion
,
onlyShowChange
);
}
},
[
onlyShowChange
])
useEffect
(()
=>
{
if
(
mountRef
.
current
)
{
setAlterParams
({
visible
:
true
,
id
,
versions
:
basicVersions
,
defaultBasicVersion
:
basicVersion
,
defaultIncVersion
:
incVersion
,
})
}
mountRef
.
current
=
true
},
[
alterTrigger
])
const
getVersions
=
()
=>
{
const
getVersions
=
()
=>
{
setLoading
(
true
);
setLoading
(
true
);
dispatch
({
dispatch
({
...
@@ -133,28 +154,13 @@ const VersionCompare = (props) => {
...
@@ -133,28 +154,13 @@ const VersionCompare = (props) => {
})
})
}
}
const
onAlterClick
=
()
=>
{
setAlterParams
({
visible
:
true
,
id
,
versions
:
basicVersions
,
defaultBasicVersion
:
basicVersion
,
defaultIncVersion
:
incVersion
,
})
}
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
>
<
Form
.
Item
label=
'基线版本'
>
<
Row
gutter=
{
15
}
>
<
Select
loading=
{
loading
}
value=
{
basicVersion
}
style=
{
{
width
:
300
}
}
onChange=
{
onBasicChange
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
'基线版本'
style=
{
{
marginBottom
:
0
}
}
>
<
Select
loading=
{
loading
}
value=
{
basicVersion
}
style=
{
{
width
:
'100%'
}
}
onChange=
{
onBasicChange
}
>
{
{
(
basicVersions
||
[]).
map
((
version
,
index
)
=>
{
(
basicVersions
||
[]).
map
((
version
,
index
)
=>
{
...
@@ -178,8 +184,10 @@ const VersionCompare = (props) => {
...
@@ -178,8 +184,10 @@ const VersionCompare = (props) => {
}
}
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
label=
'增量版本'
>
</
Col
>
<
Select
value=
{
incVersion
}
style=
{
{
width
:
300
}
}
disabled=
{
basicVersion
===
''
}
onChange=
{
onIncChange
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
'增量版本'
style=
{
{
marginBottom
:
0
}
}
>
<
Select
value=
{
incVersion
}
style=
{
{
width
:
'100%'
}
}
disabled=
{
basicVersion
===
''
}
onChange=
{
onIncChange
}
>
{
{
(
incVersions
||
[]).
map
((
version
,
index
)
=>
{
(
incVersions
||
[]).
map
((
version
,
index
)
=>
{
return
(
return
(
...
@@ -189,12 +197,8 @@ const VersionCompare = (props) => {
...
@@ -189,12 +197,8 @@ const VersionCompare = (props) => {
}
}
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
>
</
Col
>
<
Space
>
</
Row
>
<
Checkbox
onChange=
{
onOnlyShowChange
}
checked=
{
onlyShowChange
}
>
仅显示差异
</
Checkbox
>
<
Button
onClick=
{
onAlterClick
}
>
生成ALTER
</
Button
>
</
Space
>
</
Form
.
Item
>
</
Form
>
</
Form
>
<
div
className=
'py-5'
>
<
div
className=
'py-5'
>
...
...
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