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
93ffa456
Commit
93ffa456
authored
May 24, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddl导出详情
parent
bc88e3b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
206 additions
and
5 deletions
+206
-5
datamodeler.js
src/service/datamodeler.js
+1
-1
export-ddl.jsx
src/view/Manage/Model/Component/export-ddl.jsx
+205
-4
No files found.
src/service/datamodeler.js
View file @
93ffa456
...
@@ -242,7 +242,7 @@ export function exportTableDDLAbstractList(payload) {
...
@@ -242,7 +242,7 @@ export function exportTableDDLAbstractList(payload) {
}
}
export
function
getExportTableDDL
(
payload
)
{
export
function
getExportTableDDL
(
payload
)
{
return
Post
JSON
(
"/shandatamodeler/easyDataModelerExport/getExportTableDDL"
,
payload
);
return
Post
(
"/shandatamodeler/easyDataModelerExport/getExportTableDDL"
,
payload
);
}
}
export
function
validateDataModel
(
payload
)
{
export
function
validateDataModel
(
payload
)
{
...
...
src/view/Manage/Model/Component/export-ddl.jsx
View file @
93ffa456
import
React
from
"react"
import
React
from
"react"
import
{
Modal
,
Button
}
from
'antd'
import
{
Modal
,
Button
,
Row
,
Col
,
Space
,
Select
,
Input
,
Form
,
Tooltip
}
from
'antd'
import
{
dispatch
}
from
'../../../../model'
import
{
dispatch
}
from
'../../../../model'
import
{
formatVersionDate
}
from
"../../../../util"
const
FC
=
(
props
)
=>
{
const
FC
=
(
props
)
=>
{
const
{
ids
,
visible
,
onCancel
}
=
props
const
{
ids
,
visible
,
onCancel
}
=
props
...
@@ -46,6 +47,8 @@ export default FC
...
@@ -46,6 +47,8 @@ export default FC
const
Basic
=
React
.
forwardRef
(
function
({
ids
},
ref
)
{
const
Basic
=
React
.
forwardRef
(
function
({
ids
},
ref
)
{
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
data
,
setData
]
=
React
.
useState
()
const
[
data
,
setData
]
=
React
.
useState
()
const
[
configs
,
setConfigs
]
=
React
.
useState
()
const
[
currentConfig
,
setConfig
]
=
React
.
useState
()
React
.
useImperativeHandle
(
ref
,
()
=>
({
React
.
useImperativeHandle
(
ref
,
()
=>
({
...
@@ -57,6 +60,31 @@ const Basic = React.forwardRef(function ({ ids }, ref) {
...
@@ -57,6 +60,31 @@ const Basic = React.forwardRef(function ({ ids }, ref) {
}
}
},
[
ids
])
},
[
ids
])
React
.
useEffect
(()
=>
{
const
newConfigs
=
(
data
??[]).
map
(
item
=>
({
alertDLL
:
false
,
//false全量 true增量
...
item
,
ddlFilter
:
{
columnCnName
:
true
,
columnComment
:
true
,
index
:
true
,
indexName
:
true
,
primaryKey
:
true
,
primaryKeyConstraint
:
true
,
tableAlert
:
true
,
tableCnName
:
true
,
tableComment
:
true
,
tableCreate
:
true
,
tableDrop
:
true
,
tableSchema
:
true
,
},
}))
setConfigs
(
newConfigs
)
if
((
newConfigs
??[]).
length
>
0
)
{
setConfig
(
newConfigs
[
0
])
}
},
[
data
])
const
exportTableDDLAbstractList
=
()
=>
{
const
exportTableDDLAbstractList
=
()
=>
{
setLoading
(
true
)
setLoading
(
true
)
dispatch
({
dispatch
({
...
@@ -75,8 +103,181 @@ const Basic = React.forwardRef(function ({ ids }, ref) {
...
@@ -75,8 +103,181 @@ const Basic = React.forwardRef(function ({ ids }, ref) {
}
}
return
(
return
(
<>
<
Row
>
<
Col
>
{
data
?.
map
(
item
=>
(
<
div
>
<
Space
>
<
div
>
{
item
.
modelEnName
}
</
div
>
<
div
>
{
item
.
dbType
}
</
div
>
<
Select
defaultValue=
{
false
}
size=
'small'
onChange=
{
(
val
)
=>
{
const
index
=
(
configs
??[]).
findIndex
(
_item
=>
item
.
easyDataModelerDataModelId
===
_item
.
easyDataModelerDataModelId
)
if
(
index
!==
-
1
)
{
const
newConfig
=
{
...
configs
[
index
],
alertDLL
:
val
}
setConfigs
((
prev
)
=>
{
return
(
prev
??[]).
splice
(
index
,
1
,
newConfig
)
})
setConfig
(
newConfig
)
}
}
}
>
<
Select
.
Option
value=
{
false
}
>
全量
</
Select
.
Option
>
{
item
.
supportAlertDLL
&&
<
Select
.
Option
value=
{
true
}
>
增量
</
Select
.
Option
>
}
</
Select
>
</
Space
>
</
div
>
))
}
</
Col
>
<
Col
>
<
DDLDetail
config=
{
currentConfig
}
setConfig=
{
(
val
)
=>
{
const
index
=
(
configs
??[]).
findIndex
(
item
=>
item
.
easyDataModelerDataModelId
===
val
?.
easyDataModelerDataModelId
)
if
(
index
!==
-
1
)
{
setConfigs
((
prev
)
=>
{
return
(
prev
??[]).
splice
(
index
,
1
,
val
)
})
setConfig
(
val
)
}
}
}
/>
</
Col
>
</
Row
>
)
})
const
DDLDetail
=
({
config
,
setConfig
})
=>
{
const
[
loadingVersions
,
setLoadingVersions
]
=
React
.
useState
(
false
)
const
[
versions
,
setVersions
]
=
React
.
useState
()
const
[
incVersions
,
setIncVersions
]
=
React
.
useState
()
const
[
loadingDDL
,
setLoadingDDL
]
=
React
.
useState
(
false
)
const
[
ddl
,
setDDL
]
=
React
.
useState
()
React
.
useEffect
(()
=>
{
if
(
config
?.
easyDataModelerDataModelId
)
{
getVersions
()
}
},
[
config
?.
alertDLL
,
config
?.
easyDataModelerDataModelId
])
React
.
useEffect
(()
=>
{
if
((
config
?.
alertDLL
&&
config
?.
leftVersionId
&&
config
?.
rightVersionId
)
||
(
!
config
?.
alertDLL
&&
config
?.
leftVersionId
))
{
getDDL
()
}
},
[
config
?.
alertDLL
,
config
?.
leftVersionId
,
config
?.
rightVersionId
,
config
?.
ddlFilter
])
const
getVersions
=
()
=>
{
setLoadingVersions
(
true
)
dispatch
({
type
:
'datamodel.getVersions'
,
payload
:
{
params
:
{
id
:
config
?.
easyDataModelerDataModelId
,
}
},
callback
:
data
=>
{
setLoadingVersions
(
false
)
const
newData
=
[]
for
(
const
[
index
,
item
]
of
(
data
??[]).
entries
())
{
let
name
=
item
.
name
??
''
name
=
name
+
'_'
+
formatVersionDate
(
item
.
ts
)
if
((
index
===
0
&&
item
.
id
!==
'-1'
)
||
(
index
===
1
&&
data
[
0
].
id
===
'-1'
))
{
name
=
name
+
'(当前版本)'
}
newData
.
push
({
...
item
,
name
})
}
setVersions
(
newData
)
if
(
config
?.
alertDLL
)
{
//增量
if
(
newData
.
length
>
1
)
{
setIncVersions
((
newData
??[]).
slice
(
0
,
1
))
setConfig
?.({
...
config
,
leftVersionId
:
newData
[
1
].
id
,
rightVersionId
:
newData
[
0
].
id
,
})
}
}
else
{
//全量
if
(
newData
.
length
>
0
)
{
setConfig
?.({
...
config
,
leftVersionId
:
newData
[
0
].
id
,
})
}
}
},
error
:
()
=>
{
setLoadingVersions
(
false
)
}
})
}
const
getDDL
=
()
=>
{
setLoadingDDL
(
true
)
dispatch
({
type
:
'datamodel.getExportTableDDL'
,
payload
:
{
data
:
config
,
},
callback
:
data
=>
{
setLoadingDDL
(
false
)
setDDL
(
data
)
},
error
:
()
=>
{
setLoadingDDL
(
false
)
}
})
}
const
onBasicChange
=
(
val
)
=>
{
setConfig
({
...
config
,
leftVersionId
:
val
,
rightVersionId
:
''
,
})
const
index
=
(
versions
??[]).
findIndex
(
item
=>
item
.
id
===
val
)
if
(
index
!==
-
1
)
{
setIncVersions
((
versions
||
[]).
slice
(
0
,
index
))
}
}
const
onIncChange
=
(
val
)
=>
{
setConfig
({
...
config
,
rightVersionId
:
val
,
})
}
return
(
<>
<
Form
layout=
'inline'
>
<
Form
.
Item
label=
'基线版本'
>
<
Select
loading=
{
loadingVersions
}
value=
{
config
?.
leftVersionId
}
style=
{
{
width
:
300
}
}
onChange=
{
onBasicChange
}
>
{
versions
?.
map
((
item
,
index
)
=>
(
<
Select
.
Option
key=
{
index
}
value=
{
item
.
id
}
disabled=
{
index
===
0
}
>
<
Tooltip
title=
{
(
index
===
0
)?
'最近版本只能在增量版本中被选中'
:
''
}
>
{
item
.
name
}
</
Tooltip
>
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
{
config
?.
alertDLL
&&
<
Form
.
Item
label=
'增量版本'
>
<
Select
value=
{
config
?.
rightVersionId
}
style=
{
{
width
:
300
}
}
disabled=
{
!
config
?.
leftVersionId
}
onChange=
{
onIncChange
}
>
{
(
incVersions
||
[]).
map
((
item
,
index
)
=>
(
<
Select
.
Option
key=
{
index
}
value=
{
item
.
id
}
>
{
item
.
name
}
</
Select
.
Option
>
))
}
</
Select
>
</
Form
.
Item
>
}
</
Form
>
<
Input
.
TextArea
value=
{
ddl
??
''
}
autoSize=
{
{
minRows
:
4
,
maxRows
:
20
}
}
/>
</>
</>
)
)
})
}
\ 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