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
9457c756
Commit
9457c756
authored
Dec 05, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成Alter
parent
07e5e01b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
200 additions
and
3 deletions
+200
-3
datamodel.js
src/model/datamodel.js
+4
-0
datamodeler.js
src/service/datamodeler.js
+4
-0
VersionCompare.jsx
src/view/Manage/Model/Component/VersionCompare.jsx
+36
-3
version-ddl-alter.jsx
src/view/Manage/Model/Component/version-ddl-alter.jsx
+156
-0
No files found.
src/model/datamodel.js
View file @
9457c756
...
@@ -222,6 +222,10 @@ export function* exportDDLString(payload) {
...
@@ -222,6 +222,10 @@ export function* exportDDLString(payload) {
return
yield
call
(
datamodelerService
.
exportDDLString
,
payload
);
return
yield
call
(
datamodelerService
.
exportDDLString
,
payload
);
}
}
export
function
*
ddlChangeString
(
payload
)
{
return
yield
call
(
datamodelerService
.
ddlChangeString
,
payload
);
}
export
function
*
exportERWinString
(
payload
)
{
export
function
*
exportERWinString
(
payload
)
{
return
yield
call
(
datamodelerService
.
exportERWinString
,
payload
);
return
yield
call
(
datamodelerService
.
exportERWinString
,
payload
);
}
}
...
...
src/service/datamodeler.js
View file @
9457c756
...
@@ -209,6 +209,10 @@ export function exportDDLString(payload) {
...
@@ -209,6 +209,10 @@ export function exportDDLString(payload) {
return
GetJSON
(
"/shandatamodeler/easyDataModelerExport/ddlString"
,
payload
);
return
GetJSON
(
"/shandatamodeler/easyDataModelerExport/ddlString"
,
payload
);
}
}
export
function
ddlChangeString
(
payload
)
{
return
Get
(
"/shandatamodeler/easyDataModelerExport/ddlChangeString"
,
payload
);
}
export
function
exportERWinString
(
payload
)
{
export
function
exportERWinString
(
payload
)
{
return
GetJSON
(
"/shandatamodeler/easyDataModelerExport/erWinPluginString"
,
payload
);
return
GetJSON
(
"/shandatamodeler/easyDataModelerExport/erWinPluginString"
,
payload
);
}
}
...
...
src/view/Manage/Model/Component/VersionCompare.jsx
View file @
9457c756
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
Form
,
Select
,
Spin
,
Tooltip
,
Checkbox
,
Typography
}
from
'antd'
;
import
{
Form
,
Select
,
Spin
,
Tooltip
,
Checkbox
,
Typography
,
Space
,
Button
}
from
'antd'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
formatVersionDate
}
from
'../../../../util'
;
import
{
formatVersionDate
,
showMessage
}
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
FilterColumnAction
from
'./FilterColumnAction'
;
import
VersionDdlAlter
from
'./version-ddl-alter'
;
import
'./VersionCompare.less'
;
import
'./VersionCompare.less'
;
...
@@ -28,6 +29,13 @@ const VersionCompare = (props) => {
...
@@ -28,6 +29,13 @@ const VersionCompare = (props) => {
const
[
onlyShowChange
,
setOnlyShowChange
]
=
useState
(
true
);
const
[
onlyShowChange
,
setOnlyShowChange
]
=
useState
(
true
);
const
[
attrFilterColumns
,
setAttrFilterColumns
]
=
useState
([]);
const
[
attrFilterColumns
,
setAttrFilterColumns
]
=
useState
([]);
const
[
attrSelectedTitles
,
setAttrSelectedTitles
]
=
useState
(
defaultColumnTitles
);
const
[
attrSelectedTitles
,
setAttrSelectedTitles
]
=
useState
(
defaultColumnTitles
);
const
[
ddlAlterParams
,
setAlterParams
]
=
useState
({
visible
:
false
,
id
:
undefined
,
versions
:
undefined
,
basicVersion
:
undefined
,
incVersion
:
undefined
,
})
const
attrColumnsRef
=
useRef
([]);
const
attrColumnsRef
=
useRef
([]);
...
@@ -183,6 +191,16 @@ const VersionCompare = (props) => {
...
@@ -183,6 +191,16 @@ const VersionCompare = (props) => {
setAttrFilterColumns
(
newFilterColumns
);
setAttrFilterColumns
(
newFilterColumns
);
}
}
const
onAlterClick
=
()
=>
{
setAlterParams
({
visible
:
true
,
id
,
versions
:
basicVersions
,
defaultBasicVersion
:
basicVersion
,
defaultIncVersion
:
incVersion
,
})
}
const
onOnlyShowChange
=
(
e
)
=>
{
const
onOnlyShowChange
=
(
e
)
=>
{
setOnlyShowChange
(
e
.
target
.
checked
);
setOnlyShowChange
(
e
.
target
.
checked
);
if
(
basicVersion
!==
''
&&
incVersion
!==
''
)
{
if
(
basicVersion
!==
''
&&
incVersion
!==
''
)
{
...
@@ -230,7 +248,10 @@ const VersionCompare = (props) => {
...
@@ -230,7 +248,10 @@ const VersionCompare = (props) => {
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
<
Form
.
Item
>
<
Form
.
Item
>
<
Checkbox
onChange=
{
onOnlyShowChange
}
checked=
{
onlyShowChange
}
>
仅显示差异
</
Checkbox
>
<
Space
>
<
Checkbox
onChange=
{
onOnlyShowChange
}
checked=
{
onlyShowChange
}
>
仅显示差异
</
Checkbox
>
<
Button
onClick=
{
onAlterClick
}
>
生成ALTER
</
Button
>
</
Space
>
</
Form
.
Item
>
</
Form
.
Item
>
</
Form
>
</
Form
>
...
@@ -252,6 +273,18 @@ const VersionCompare = (props) => {
...
@@ -252,6 +273,18 @@ const VersionCompare = (props) => {
}
}
</
Spin
>
</
Spin
>
</
div
>
</
div
>
<
VersionDdlAlter
{
...
ddlAlterParams
}
onCancel=
{
()
=>
{
setAlterParams
({
visible
:
false
,
id
:
undefined
,
versions
:
undefined
,
basicVersion
:
undefined
,
incVersion
:
undefined
,
})
}
}
/>
</
div
>
</
div
>
);
);
}
}
...
...
src/view/Manage/Model/Component/version-ddl-alter.jsx
0 → 100644
View file @
9457c756
import
React
from
"react"
import
{
Modal
,
Spin
,
Button
,
Form
,
Select
,
Tooltip
,
Input
}
from
"antd"
import
{
dispatch
}
from
'../../../../model'
const
FC
=
(
props
)
=>
{
const
{
visible
,
id
,
versions
,
defaultBasicVersion
,
defaultIncVersion
,
onCancel
}
=
props
const
basicRef
=
React
.
useRef
()
const
close
=
()
=>
{
onCancel
?.()
}
return
(
<
Modal
visible=
{
visible
}
footer=
{
null
}
width=
'80%'
bodyStyle=
{
{
padding
:
'15px'
,
overflowX
:
'auto'
,
maxHeight
:
'80vh'
}
}
title=
'生成ALTER'
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
>
<
Basic
ref=
{
basicRef
}
id=
{
id
}
versions=
{
versions
}
defaultBasicVersion=
{
defaultBasicVersion
}
defaultIncVersion=
{
defaultIncVersion
}
/>
</
Modal
>
)
}
export
default
FC
export
const
Basic
=
React
.
forwardRef
(
function
({
id
,
versions
,
defaultBasicVersion
,
defaultIncVersion
},
ref
)
{
const
[
basicVersion
,
setBasicVersion
]
=
React
.
useState
(
defaultBasicVersion
)
const
[
incVersion
,
setIncVersion
]
=
React
.
useState
(
defaultIncVersion
)
const
[
loadingDDLGenerators
,
setLoadingGenerators
]
=
React
.
useState
(
false
)
const
[
ddlGenerators
,
setGenerators
]
=
React
.
useState
()
const
[
currentGeneratorValue
,
setGeneratorValue
]
=
React
.
useState
()
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
ddl
,
setDDL
]
=
React
.
useState
()
React
.
useEffect
(()
=>
{
getDDLGenerators
()
},
[])
React
.
useEffect
(()
=>
{
if
(
basicVersion
&&
incVersion
&&
currentGeneratorValue
)
{
getDDL
()
}
else
{
setDDL
()
}
},
[
basicVersion
,
incVersion
,
currentGeneratorValue
])
const
incVersions
=
React
.
useMemo
(()
=>
{
const
index
=
(
versions
??[]).
findIndex
(
item
=>
item
.
id
===
basicVersion
)
if
(
index
!==
-
1
)
{
return
(
versions
??[]).
slice
(
0
,
index
)
}
return
[]
},
[
versions
,
basicVersion
])
const
getDDLGenerators
=
()
=>
{
setLoadingGenerators
(
true
)
dispatch
({
type
:
'datamodel.ddlGenerators'
,
callback
:
data
=>
{
setLoadingGenerators
(
false
)
setGenerators
(
data
)
if
((
data
??[]).
length
>
0
)
{
setGeneratorValue
(
data
[
0
].
name
)
}
},
error
:
()
=>
{
setLoadingGenerators
(
false
)
}
})
}
const
getDDL
=
()
=>
{
setLoading
(
true
)
dispatch
({
type
:
'datamodel.ddlChangeString'
,
payload
:
{
easyDataModelerDataModelId
:
id
,
leftVersionId
:
basicVersion
,
rightVersionId
:
incVersion
,
ddlGeneratorName
:
currentGeneratorValue
,
},
callback
:
data
=>
{
setLoading
(
false
)
setDDL
(
data
)
},
error
:
()
=>
{
setLoading
(
false
)
}
})
}
const
onBasicChange
=
(
value
)
=>
{
setBasicVersion
(
value
)
setIncVersion
()
}
const
onIncChange
=
(
value
)
=>
{
setIncVersion
(
value
)
}
const
onGeneratorChange
=
(
value
)
=>
{
setGeneratorValue
(
value
)
}
return
(
<
div
>
<
Form
layout=
'inline'
>
<
Form
.
Item
label=
'基线版本'
>
<
Select
value=
{
basicVersion
}
style=
{
{
width
:
300
}
}
onChange=
{
onBasicChange
}
>
{
(
versions
??[]).
map
((
version
,
index
)
=>
(
<
Select
.
Option
key=
{
index
}
value=
{
version
.
id
}
disabled=
{
index
===
0
}
>
<
Tooltip
title=
{
index
===
0
?
'最近版本只能在增量版本中被选中'
:
''
}
>
{
version
.
name
}
</
Tooltip
>
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
'增量版本'
>
<
Select
value=
{
incVersion
}
style=
{
{
width
:
300
}
}
disabled=
{
basicVersion
===
''
}
onChange=
{
onIncChange
}
>
{
(
incVersions
||
[]).
map
((
version
,
index
)
=>
{
return
(
<
Select
.
Option
key=
{
index
}
value=
{
version
.
id
}
>
{
version
.
name
}
</
Select
.
Option
>
);
})
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
'数据库类型'
>
<
Select
loading=
{
loadingDDLGenerators
}
value=
{
currentGeneratorValue
}
style=
{
{
width
:
150
}
}
onChange=
{
onGeneratorChange
}
>
{
(
ddlGenerators
??[]).
map
((
item
,
index
)
=>
(
<
Select
.
Option
key=
{
index
}
value=
{
item
.
name
}
>
{
item
.
cnName
}
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
</
Form
>
<
div
className=
'mt-5'
>
<
Spin
spinning=
{
loading
}
>
<
Input
.
TextArea
value=
{
ddl
}
autoSize=
{
{
minRows
:
4
,
maxRows
:
20
}
}
/>
</
Spin
>
</
div
>
</
div
>
)
})
\ 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