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
af85507b
Commit
af85507b
authored
May 24, 2024
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DDL导出详情
parent
3e08fe15
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
51 deletions
+120
-51
datamodeler.js
src/service/datamodeler.js
+2
-2
download.ts
src/util/Component/download.ts
+23
-0
axios.js
src/util/axios.js
+3
-0
export-ddl.jsx
src/view/Manage/Model/Component/export-ddl.jsx
+92
-49
No files found.
src/service/datamodeler.js
View file @
af85507b
import
{
PostFile
,
GetJSON
,
PostJSON
,
Post
,
Get
,
Delete
,
Delete1
,
Delete2
}
from
"../util/axios"
import
{
PostFile
,
GetJSON
,
PostJSON
,
Post
,
Get
,
Delete
,
Delete1
,
Delete2
,
callFetchRaw
}
from
"../util/axios"
export
function
loadDataModelCatalog
()
{
return
GetJSON
(
"/datamodeler/easyDataModelerCURD/loadDataModelCatalog"
);
...
...
@@ -246,7 +246,7 @@ export function getExportTableDDL(payload) {
}
export
function
downloadExportTableDDLListZip
(
payload
)
{
return
PostFile
(
"/shandatamodeler/easyDataModelerExport/downloadExportTableDDLListZip"
,
payload
);
return
callFetchRaw
(
"post"
,
"/shandatamodeler/easyDataModelerExport/downloadExportTableDDLListZip"
,
payload
);
}
export
function
validateDataModel
(
payload
)
{
...
...
src/util/Component/download.ts
0 → 100644
View file @
af85507b
import
{
AxiosResponse
}
from
"axios"
export
default
function
(
res
:
AxiosResponse
<
any
>
)
{
const
blob
=
res
.
data
const
headers
=
res
.
headers
let
tempName
=
headers
[
"content-disposition"
]
?.
split
(
";"
)?.[
1
]
?.
split
(
"filename="
)?.[
1
];
tempName
=
decodeURI
(
tempName
);
// const blob = new Blob([content], { type: 'application/octet-stream' })
var
url
=
(
window
.
URL
&&
window
.
URL
.
createObjectURL
)
?
window
.
URL
.
createObjectURL
(
blob
)
:
window
.
webkitURL
.
createObjectURL
(
blob
);
const
link
=
document
.
createElement
(
'a'
);
link
.
style
.
display
=
'none'
;
link
.
href
=
url
;
link
.
setAttribute
(
'download'
,
tempName
);
//or any other extension
document
.
body
.
appendChild
(
link
);
link
.
click
();
URL
.
revokeObjectURL
(
link
.
href
)
// 释放URL 对象
document
.
body
.
removeChild
(
link
)
}
\ No newline at end of file
src/util/axios.js
View file @
af85507b
...
...
@@ -198,6 +198,9 @@ export const callFetchRaw = (method, url, options) => {
bodyFormData
.
append
(
key
,
params
[
key
]);
});
console
.
log
(
'options'
,
options
)
console
.
log
(
'reqConfig'
,
reqConfig
)
return
axios
.
request
({
method
,
url
,
...
...
src/view/Manage/Model/Component/export-ddl.jsx
View file @
af85507b
import
React
from
"react"
import
{
Modal
,
Button
,
Row
,
Col
,
Space
,
Select
,
Input
,
Form
,
Tooltip
}
from
'antd'
import
{
Modal
,
Button
,
Row
,
Col
,
Space
,
Select
,
Input
,
Form
,
Tooltip
,
Typography
,
Spin
}
from
'antd'
import
{
dispatch
}
from
'../../../../model'
import
{
formatVersionDate
}
from
"../../../../util"
import
download
from
"../../../../util/Component/download"
import
{
config
}
from
"rxjs"
const
FC
=
(
props
)
=>
{
const
{
ids
,
visible
,
onCancel
}
=
props
const
[
downloading
,
setDownloading
]
=
React
.
useState
(
false
)
const
basicRef
=
React
.
useRef
()
const
close
=
()
=>
{
setDownloading
(
false
)
onCancel
?.()
}
const
download
=
()
=>
{
const
onDownload
=
()
=>
{
setDownloading
(
true
)
dispatch
({
type
:
'datamodel.downloadExportTableDDLListZip'
,
payload
:
{
data
:
basicRef
.
current
.
configs
??[]
data
:
basicRef
.
current
.
configs
??[],
headers
:
{
'Content-Type'
:
'application/json'
,
},
responseType
:
'blob'
,
},
callback
:
(
data
)
=>
{
setDownloading
(
false
)
download
(
data
)
},
error
:
()
=>
{
setDownloading
(
false
)
}
})
}
...
...
@@ -33,10 +43,12 @@ const FC = (props) => {
onClick=
{
()
=>
close
()
}
>
取消
</
Button
>,
<
Button
key=
{
'save'
}
type=
'primary'
onClick=
{
()
=>
download
()
}
loading=
{
downloading
}
disabled=
{
downloading
}
onClick=
{
()
=>
onDownload
()
}
>
导出
</
Button
>
]
},
[
close
,
download
])
},
[
close
,
onDownload
,
downloading
])
return
(
<
Modal
...
...
@@ -101,7 +113,7 @@ const Basic = React.forwardRef(function ({ ids }, ref) {
dispatch
({
type
:
'datamodel.exportTableDDLAbstractList'
,
payload
:
{
data
:
ids
data
:
ids
,
},
callback
:
(
data
)
=>
{
setLoading
(
false
)
...
...
@@ -114,42 +126,69 @@ const Basic = React.forwardRef(function ({ ids }, ref) {
}
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
>
<
Spin
spinning=
{
loading
}
>
<
Row
gutter=
{
15
}
>
<
Col
flex=
'300px'
style=
{
{
height
:
'calc(80vh - 30px)'
,
overflow
:
'auto'
}
}
>
{
data
?.
map
((
item
,
index
)
=>
(
<
Row
gutter=
{
10
}
key=
{
index
}
className=
{
index
!==
0
?
'mt-2'
:
''
}
>
<
Col
flex=
'1'
style=
{
{
overflow
:
'hidden'
}
}
>
<
Tooltip
title=
{
item
.
modelEnName
}
>
<
Typography
.
Text
ellipsis=
{
true
}
>
<
a
style=
{
{
color
:
(
item
.
easyDataModelerDataModelId
===
currentConfig
?.
easyDataModelerDataModelId
)?
'#196AD2'
:
'#262626'
}
}
onClick=
{
()
=>
{
const
index
=
(
configs
??[]).
findIndex
(
_item
=>
item
.
easyDataModelerDataModelId
===
_item
.
easyDataModelerDataModelId
)
if
(
index
!==
-
1
)
{
setConfig
(
configs
[
index
])
}
}
}
>
{
item
.
modelEnName
}
</
a
>
</
Typography
.
Text
>
</
Tooltip
>
</
Col
>
<
Col
flex=
'80px'
>
{
item
.
dbType
}
</
Col
>
<
Col
flex=
'none'
>
<
Select
defaultValue=
{
false
}
size=
'small'
style=
{
{
width
:
80
}
}
onChange=
{
(
val
)
=>
{
const
index
=
(
configs
??[]).
findIndex
(
_item
=>
item
.
easyDataModelerDataModelId
===
_item
.
easyDataModelerDataModelId
)
if
(
index
!==
-
1
)
{
const
newConfig
=
{
...
configs
[
index
],
alertDLL
:
val
}
setConfigs
((
prev
)
=>
{
const
newConfigs
=
[...
prev
??[]]
newConfigs
.
splice
(
index
,
1
,
newConfig
)
return
newConfigs
})
if
(
configs
[
index
].
easyDataModelerDataModelId
===
currentConfig
?.
easyDataModelerDataModelId
)
{
setConfig
(
newConfig
)
}
}
}
}
>
<
Select
.
Option
value=
{
false
}
>
全量
</
Select
.
Option
>
{
item
.
supportAlertDLL
&&
<
Select
.
Option
value=
{
true
}
>
增量
</
Select
.
Option
>
}
</
Select
>
</
Col
>
</
Row
>
))
}
</
Col
>
<
Col
flex=
'1'
style=
{
{
overflow
:
'hidden'
}
}
>
<
DDLDetail
config=
{
currentConfig
}
setConfig=
{
(
val
)
=>
{
const
index
=
(
configs
??[]).
findIndex
(
item
=>
item
.
easyDataModelerDataModelId
===
val
?.
easyDataModelerDataModelId
)
if
(
index
!==
-
1
)
{
setConfigs
((
prev
)
=>
{
const
newConfigs
=
[...
prev
??[]]
newConfigs
.
splice
(
index
,
1
,
val
)
return
newConfigs
})
setConfig
(
val
)
}
}
}
/>
</
Col
>
</
Row
>
</
Spin
>
)
})
...
...
@@ -175,6 +214,7 @@ const DDLDetail = ({ config, setConfig }) => {
const
getVersions
=
()
=>
{
setLoadingVersions
(
true
)
setVersions
()
dispatch
({
type
:
'datamodel.getVersions'
,
payload
:
{
...
...
@@ -264,11 +304,11 @@ const DDLDetail = ({ config, setConfig }) => {
<>
<
Form
layout=
'inline'
>
<
Form
.
Item
label=
'基线版本'
>
<
Select
loading=
{
loadingVersions
}
value=
{
config
?.
leftVersionI
d
}
style=
{
{
width
:
300
}
}
onChange=
{
onBasicChange
}
>
<
Select
loading=
{
loadingVersions
}
value=
{
(
versions
??[]).
length
>
0
?
config
?.
leftVersionId
:
undefine
d
}
style=
{
{
width
:
300
}
}
onChange=
{
onBasicChange
}
>
{
versions
?.
map
((
item
,
index
)
=>
(
<
Select
.
Option
key=
{
index
}
value=
{
item
.
id
}
disabled=
{
index
===
0
}
>
<
Tooltip
title=
{
(
index
===
0
)?
'最近版本只能在增量版本中被选中'
:
''
}
>
<
Select
.
Option
key=
{
index
}
value=
{
item
.
id
}
disabled=
{
config
?.
alertDLL
&&
index
===
0
}
>
<
Tooltip
title=
{
(
config
?.
alertDLL
&&
index
===
0
)?
'最近版本只能在增量版本中被选中'
:
''
}
>
{
item
.
name
}
</
Tooltip
>
</
Select
.
Option
>
...
...
@@ -278,7 +318,7 @@ const DDLDetail = ({ config, setConfig }) => {
</
Form
.
Item
>
{
config
?.
alertDLL
&&
<
Form
.
Item
label=
'增量版本'
>
<
Select
value=
{
config
?.
rightVersionI
d
}
style=
{
{
width
:
300
}
}
disabled=
{
!
config
?.
leftVersionId
}
onChange=
{
onIncChange
}
>
<
Select
value=
{
(
incVersions
??[]).
length
>
0
?
config
?.
rightVersionId
:
undefine
d
}
style=
{
{
width
:
300
}
}
disabled=
{
!
config
?.
leftVersionId
}
onChange=
{
onIncChange
}
>
{
(
incVersions
||
[]).
map
((
item
,
index
)
=>
(
<
Select
.
Option
key=
{
index
}
value=
{
item
.
id
}
>
{
item
.
name
}
</
Select
.
Option
>
...
...
@@ -288,7 +328,9 @@ const DDLDetail = ({ config, setConfig }) => {
</
Form
.
Item
>
}
</
Form
>
<
Input
.
TextArea
value=
{
ddl
??
''
}
autoSize=
{
{
minRows
:
4
,
maxRows
:
20
}
}
/>
<
div
className=
'mt-2'
>
<
Input
.
TextArea
value=
{
ddl
??
''
}
style=
{
{
height
:
'calc(80vh - 70px)'
,
resize
:
'none'
}
}
/>
</
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