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
e2fec0c2
Commit
e2fec0c2
authored
Mar 19, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量合并到基线
parent
ce14da50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
66 deletions
+124
-66
merge-to-master.jsx
src/view/Manage/Model/Component/merge-to-master.jsx
+124
-66
No files found.
src/view/Manage/Model/Component/merge-to-master.jsx
View file @
e2fec0c2
import
React
from
'react'
import
{
Modal
,
Button
,
Spin
,
Form
,
Checkbox
,
Typography
,
Tooltip
}
from
'antd'
import
{
Modal
,
Button
,
Spin
,
Form
,
Checkbox
,
Typography
,
Tooltip
,
Row
,
Col
,
Tree
,
}
from
'antd'
import
{
dispatch
}
from
'../../../../model'
import
VersionCompareHeader
from
'./VersionCompareHeader'
...
...
@@ -8,6 +8,7 @@ import VersionCompareIndex from './VersionCompareIndex'
import
{
defaultColumnTitles
}
from
'./VersionCompare'
import
FilterColumnAction
from
'./FilterColumnAction'
import
'../../AssetManage/add-resources.less'
import
'./VersionCompare.less'
const
FC
=
(
props
)
=>
{
...
...
@@ -49,16 +50,17 @@ const FC = (props) => {
return
(
<
Modal
className=
'add-resources'
visible=
{
visible
}
footer=
{
footer
}
width=
'80%'
bodyStyle=
{
{
padding
:
'15px'
,
overflowX
:
'auto'
,
height
:
'80vh
'
}
}
bodyStyle=
{
{
padding
:
'15px'
,
height
:
'80vh'
,
overflow
:
'auto
'
}
}
title=
'合并到基线'
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
>
<
Spin
spinning=
{
waiting
}
>
<
Diff
items=
{
items
}
/>
<
Basic
items=
{
items
}
/>
</
Spin
>
</
Modal
>
)
...
...
@@ -66,7 +68,54 @@ const FC = (props) => {
export
default
FC
export
const
Diff
=
React
.
forwardRef
(
function
({
items
},
ref
)
{
export
const
Basic
=
React
.
forwardRef
(
function
({
items
},
ref
)
{
const
[
currentItem
,
setItem
]
=
React
.
useState
()
React
.
useEffect
(()
=>
{
if
((
items
??[]).
length
>
0
)
{
setItem
(
items
[
0
])
}
},
[
items
])
const
treeData
=
React
.
useMemo
(()
=>
{
return
(
items
??[]).
map
(
item
=>
({
title
:
item
.
name
,
key
:
item
.
id
}))
},
[
items
])
return
(
<
div
>
{
(
items
??[]).
length
===
1
&&
<
Diff
item=
{
currentItem
}
/>
}
{
(
items
??[]).
length
>
1
&&
<
Row
gutter=
{
10
}
>
<
Col
span=
{
4
}
>
<
Tree
className=
'tree'
selectedKeys=
{
currentItem
?[
currentItem
?.
id
]:[]
}
treeData=
{
treeData
}
onSelect=
{
(
vals
)
=>
{
if
((
vals
??[]).
length
>
0
)
{
const
filterItems
=
(
items
??[]).
filter
(
item
=>
(
vals
??[]).
indexOf
(
item
.
id
)
!==
-
1
)
if
((
filterItems
??[]).
length
>
0
)
{
setItem
(
filterItems
[
0
])
}
}
}
}
/>
</
Col
>
<
Col
span=
{
20
}
>
<
Diff
item=
{
currentItem
}
/>
</
Col
>
</
Row
>
}
</
div
>
)
})
export
const
Diff
=
({
item
})
=>
{
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
data
,
setData
]
=
React
.
useState
()
const
[
onlyShowChange
,
setOnlyShowChange
]
=
React
.
useState
(
true
)
...
...
@@ -74,66 +123,79 @@ export const Diff = React.forwardRef(function ({ items }, ref) {
const
[
attrColumns
,
setAttrColumns
]
=
React
.
useState
()
React
.
useEffect
(()
=>
{
if
(
(
items
??[]).
length
>
0
)
{
if
(
item
)
{
getDiffForked
()
}
},
[
items
,
onlyShowChange
])
},
[
item
,
onlyShowChange
])
React
.
useEffect
(()
=>
{
if
(
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
(
<
Typography
.
Paragraph
>
<
Tooltip
title=
{
attrValue
?.
value
||
''
}
>
<
Typography
.
Text
className=
{
stateClassName
}
ellipsis=
{
true
}
>
{
attrValue
?.
value
||
''
}
</
Typography
.
Text
>
</
Tooltip
>
</
Typography
.
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
}];
setAttrColumns
(
newAttrColumns
)
}
},
[
data
])
const
attrFilterColumns
=
React
.
useMemo
(()
=>
{
return
(
attrColumns
??[]).
filter
(
column
=>
column
.
option
===
false
||
(
attrSelectedTitles
??[]).
indexOf
(
column
.
title
)
!==
-
1
)
},
[
attrSelectedTitles
,
attrColumns
])
const
onFilterChange
=
(
values
)
=>
{
setAttrSelectedTitles
(
values
)
}
const
onOnlyShowChange
=
(
e
)
=>
{
setOnlyShowChange
(
e
.
target
.
checked
)
}
const
getDiffForked
=
()
=>
{
setLoading
(
true
)
dispatch
({
type
:
'datamodel.getBranchDiffForked'
,
payload
:
{
id
:
item
s
[
0
]
.
id
,
id
:
item
?
.
id
,
includeSame
:
!
onlyShowChange
,
},
callback
:
data
=>
{
setLoading
(
false
)
setData
(
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
(
<
Typography
.
Paragraph
>
<
Tooltip
title=
{
attrValue
?.
value
||
''
}
>
<
Typography
.
Text
className=
{
stateClassName
}
ellipsis=
{
true
}
>
{
attrValue
?.
value
||
''
}
</
Typography
.
Text
>
</
Tooltip
>
</
Typography
.
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
}];
setAttrColumns
(
newAttrColumns
)
},
error
:
()
=>
{
setLoading
(
false
)
...
...
@@ -141,25 +203,21 @@ export const Diff = React.forwardRef(function ({ items }, ref) {
})
}
const
onOnlyShowChange
=
(
e
)
=>
{
setOnlyShowChange
(
e
.
target
.
checked
)
}
const
onFilterChange
=
(
values
)
=>
{
setAttrSelectedTitles
(
values
)
}
return
(
<
div
className=
'model-version-compare'
>
<
Form
layout=
'inline'
>
<
Form
.
Item
label=
'分支版本'
>
</
Form
.
Item
>
<
Form
.
Item
label=
'基线版本'
>
</
Form
.
Item
>
<
Form
.
Item
>
<
Checkbox
onChange=
{
onOnlyShowChange
}
checked=
{
onlyShowChange
}
>
仅显示差异
</
Checkbox
>
</
Form
.
Item
>
</
Form
>
<
div
className=
'flex'
>
<
div
style=
{
{
flex
:
1
,
paddingRight
:
10
,
overflow
:
'hidden'
}
}
>
分支版本
</
div
>
<
div
style=
{
{
flex
:
1
,
paddingLeft
:
10
,
overflow
:
'hidden'
}
}
>
<
div
className=
'flex'
style=
{
{
justifyContent
:
'space-between'
,
alignItems
:
'center'
}
}
>
<
span
>
基线版本
</
span
>
<
Checkbox
onChange=
{
onOnlyShowChange
}
checked=
{
onlyShowChange
}
>
仅显示差异
</
Checkbox
>
</
div
>
</
div
>
</
div
>
<
div
className=
'py-5'
>
<
Spin
spinning=
{
loading
}
>
...
...
@@ -181,4 +239,4 @@ export const Diff = React.forwardRef(function ({ items }, ref) {
</
div
>
</
div
>
)
})
\ No newline at end of file
}
\ No newline at end of file
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