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
3636cf1e
Commit
3636cf1e
authored
Jul 26, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增编辑模型打开一个单独的页面
parent
dc445885
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
339 additions
and
319 deletions
+339
-319
App.js
src/App.js
+4
-1
constant.js
src/util/constant.js
+8
-0
EditModel.jsx
src/view/Manage/Model/Component/EditModel.jsx
+151
-0
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+8
-5
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+100
-94
ImportActionHeader.less
src/view/Manage/Model/Component/ImportActionHeader.less
+10
-0
ImportModal.jsx
src/view/Manage/Model/Component/ImportModal.jsx
+40
-211
index.jsx
src/view/Manage/Model/index.jsx
+18
-8
No files found.
src/App.js
View file @
3636cf1e
...
@@ -16,6 +16,7 @@ import AssetRecycle from './view/Manage/AssetRecycle';
...
@@ -16,6 +16,7 @@ import AssetRecycle from './view/Manage/AssetRecycle';
import
DatasourceManage
from
'./view/Manage/DatasourceManage'
;
import
DatasourceManage
from
'./view/Manage/DatasourceManage'
;
import
AssetDetail
from
'./view/Manage/AssetManage/Component/AssetDetail'
;
import
AssetDetail
from
'./view/Manage/AssetManage/Component/AssetDetail'
;
import
ImportAction
from
'./view/Manage/Model/Component/ImportAction'
;
import
ImportAction
from
'./view/Manage/Model/Component/ImportAction'
;
import
EditModel
from
'./view/Manage/Model/Component/EditModel'
;
export
const
AppContext
=
React
.
createContext
();
export
const
AppContext
=
React
.
createContext
();
...
@@ -62,6 +63,8 @@ export class App extends React.Component {
...
@@ -62,6 +63,8 @@ export class App extends React.Component {
<
Route
path
=
{
`
${
ContextPath
}
/login`
}
component
=
{
Signin
}
exact
/>
<
Route
path
=
{
`
${
ContextPath
}
/login`
}
component
=
{
Signin
}
exact
/>
<
Route
path
=
{
`
${
ContextPath
}
/home`
}
component
=
{
Home
}
/
>
<
Route
path
=
{
`
${
ContextPath
}
/home`
}
component
=
{
Home
}
/
>
<
Route
path
=
{
`
${
ContextPath
}
/manage`
}
component
=
{
Manage
}
/
>
<
Route
path
=
{
`
${
ContextPath
}
/manage`
}
component
=
{
Manage
}
/
>
<
Route
path
=
{
`
${
ContextPath
}
/data-model-action`
}
component
=
{
EditModel
}
exact
/>
<
Route
path
=
{
'/center-home/view/datasource-manage'
}
component
=
{
DatasourceManage
}
exact
/>
<
Route
path
=
{
'/center-home/view/datasource-manage'
}
component
=
{
DatasourceManage
}
exact
/>
<
Route
path
=
{
'/center-home/view/data-model'
}
component
=
{
Model
}
exact
/>
<
Route
path
=
{
'/center-home/view/data-model'
}
component
=
{
Model
}
exact
/>
<
Route
path
=
{
'/center-home/view/asset-map'
}
component
=
{
Map
}
exact
/>
<
Route
path
=
{
'/center-home/view/asset-map'
}
component
=
{
Map
}
exact
/>
...
@@ -74,7 +77,7 @@ export class App extends React.Component {
...
@@ -74,7 +77,7 @@ export class App extends React.Component {
<
Route
path
=
{
'/center-home/menu/asset-map'
}
component
=
{
Map
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-map'
}
component
=
{
Map
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-manage'
}
component
=
{
AssetManage
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-manage'
}
component
=
{
AssetManage
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-browse'
}
component
=
{
AssetBrowse
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-browse'
}
component
=
{
AssetBrowse
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-recycle'
}
component
=
{
AssetRecycle
}
exact
/>
<
Route
path
=
{
'/center-home/menu/asset-recycle'
}
component
=
{
AssetRecycle
}
exact
/>
<
/Switch
>
<
/Switch
>
<
/Router
>
<
/Router
>
<
/AppContext.Provider
>
<
/AppContext.Provider
>
...
...
src/util/constant.js
View file @
3636cf1e
//全文检索
export
const
AnchorId
=
'id'
;
export
const
AnchorId
=
'id'
;
export
const
AnchorTimestamp
=
'timestamp'
;
export
const
AnchorTimestamp
=
'timestamp'
;
//编辑模型
export
const
Action
=
'action'
;
export
const
CatalogId
=
'cid'
;
export
const
ModelerId
=
'mid'
;
export
const
Hints
=
'hints'
;
\ No newline at end of file
src/view/Manage/Model/Component/EditModel.jsx
0 → 100644
View file @
3636cf1e
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Button
}
from
'antd'
;
import
ImportAction
from
'./ImportAction'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
getQueryParam
,
showMessage
}
from
'../../../../util'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../../util/constant'
;
const
EditModel
=
(
props
)
=>
{
const
[
action
,
setAction
]
=
useState
(
''
);
const
[
catalogId
,
setCatalogId
]
=
useState
(
''
);
const
[
modelerId
,
setModelerId
]
=
useState
(
''
);
const
[
hints
,
setHints
]
=
useState
([]);
const
[
modelerData
,
setModelerData
]
=
useState
({});
const
[
terms
,
setTerms
]
=
useState
([]);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
const
_action
=
getQueryParam
(
Action
,
props
.
location
.
search
);
const
_catalogId
=
getQueryParam
(
CatalogId
,
props
.
location
.
search
);
const
_modelerId
=
getQueryParam
(
ModelerId
,
props
.
location
.
search
);
const
_hintsStr
=
getQueryParam
(
Hints
,
props
.
location
.
search
);
let
_hints
=
[];
if
((
_hintsStr
||
''
)
!==
''
)
{
_hints
=
_hintsStr
.
split
(
','
);
}
setAction
(
_action
);
setCatalogId
(
_catalogId
);
setModelerId
(
_modelerId
);
setHints
(
_hints
);
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
const
save
=
async
()
=>
{
try
{
const
row
=
await
form
.
validateFields
();
const
newModelerData
=
{...
modelerData
,
...
row
};
setConfirmLoading
(
true
);
dispatchLatest
({
type
:
'datamodel.saveDataModel'
,
payload
:
{
data
:
newModelerData
},
callback
:
data
=>
{
dispatchLatest
({
type
:
'datamodel.bindCatalogDataModel'
,
payload
:
{
params
:
{
easyDataModelCatalogId
:
catalogId
,
easyDataModelerDataModelIds
:
data
.
id
||
''
}
},
callback
:
(
data
)
=>
{
setConfirmLoading
(
false
);
showMessage
(
"success"
,
(
action
===
'add'
)?
'新增模型成功'
:
'保存模型成功'
)
setModelerId
(
data
.
id
||
''
);
setAction
(
'detail'
);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
},
error
:
(
err
)
=>
{
setConfirmLoading
(
false
);
setTerms
([
err
.
ApiError
?.
message
||
''
]);
}
})
}
catch
(
errInfo
)
{
console
.
log
(
'Validate Failed:'
,
errInfo
);
}
}
const
edit
=
()
=>
{
setAction
(
'edit'
);
}
const
onActionChange
=
(
data
)
=>
{
setModelerData
(
data
);
}
let
title
=
''
;
if
(
action
===
'add'
)
{
title
=
'新增模型'
;
}
else
if
(
action
===
'edit'
)
{
title
=
'模型编辑'
;
}
else
if
(
action
===
'detail'
)
{
title
=
'模型详情'
;
}
let
actionBtn
=
null
;
if
(
action
===
'add'
||
action
===
'edit'
)
{
actionBtn
=
(
<
Button
type=
'primary'
onClick=
{
save
}
loading=
{
confirmLoading
}
>
保存
</
Button
>
)
}
else
if
(
action
===
'detail'
)
{
actionBtn
=
(
<
Button
type=
'primary'
onClick=
{
edit
}
>
编辑
</
Button
>
);
}
return
(
<
div
className=
'position-relative'
>
<
div
className=
'flex'
style=
{
{
width
:
'100%'
,
height
:
44
,
padding
:
'0 15px'
,
backgroundColor
:
'#fff'
,
alignItems
:
'center'
,
position
:
'fixed'
,
justifyContent
:
'space-between'
,
borderBottom
:
'1px solid #EFEFEF'
,
zIndex
:
100
}
}
>
<
span
style=
{
{
fontSize
:
16
,
fontWeight
:
'bold'
,
color
:
'#000'
}
}
>
{
title
}
</
span
>
{
actionBtn
}
</
div
>
<
div
className=
'position-absolute'
style=
{
{
top
:
44
}
}
>
<
div
className=
'position-relative'
style=
{
{
margin
:
15
}
}
>
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
/>
</
div
>
</
div
>
</
div
>
);
}
export
default
EditModel
;
\ No newline at end of file
src/view/Manage/Model/Component/ImportAction.jsx
View file @
3636cf1e
...
@@ -20,8 +20,8 @@ const ImportAction = (props) => {
...
@@ -20,8 +20,8 @@ const ImportAction = (props) => {
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
action
===
'add'
&&
(
hints
||
[]).
length
===
0
&&
(
ddl
||
''
).
length
===
0
)
return
;
if
(
!
action
||
(
action
===
'add'
&&
(
hints
||
[]).
length
===
0
&&
(
ddl
||
''
).
length
===
0
)
)
return
;
//初始化form状态
//初始化form状态
if
(
action
===
'add'
||
action
===
'edit'
)
{
if
(
action
===
'add'
||
action
===
'edit'
)
{
...
@@ -34,9 +34,7 @@ const ImportAction = (props) => {
...
@@ -34,9 +34,7 @@ const ImportAction = (props) => {
});
});
}
}
if
(
action
!==
'add'
)
{
setLoading
(
true
);
setLoading
(
true
);
}
dispatch
({
dispatch
({
type
:
'datamodel.getAllConstraintsAndTemplates'
,
type
:
'datamodel.getAllConstraintsAndTemplates'
,
...
@@ -73,6 +71,7 @@ const ImportAction = (props) => {
...
@@ -73,6 +71,7 @@ const ImportAction = (props) => {
}
}
},
},
callback
:
data
=>
{
callback
:
data
=>
{
setLoading
(
false
);
setModelerData
(
data
||
{});
setModelerData
(
data
||
{});
form
.
setFieldsValue
({
form
.
setFieldsValue
({
cnName
:
data
.
cnName
||
''
,
cnName
:
data
.
cnName
||
''
,
...
@@ -83,6 +82,9 @@ const ImportAction = (props) => {
...
@@ -83,6 +82,9 @@ const ImportAction = (props) => {
});
});
onChange
&&
onChange
(
data
||
{});
onChange
&&
onChange
(
data
||
{});
getSupportedDatatypes
();
getSupportedDatatypes
();
},
error
:
()
=>
{
setLoading
(
false
);
}
}
})
})
}
}
...
@@ -98,6 +100,7 @@ const ImportAction = (props) => {
...
@@ -98,6 +100,7 @@ const ImportAction = (props) => {
}
}
},
},
callback
:
data
=>
{
callback
:
data
=>
{
setLoading
(
false
);
setModelerData
(
data
||
{});
setModelerData
(
data
||
{});
form
.
setFieldsValue
({
form
.
setFieldsValue
({
cnName
:
data
.
cnName
||
''
,
cnName
:
data
.
cnName
||
''
,
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
3636cf1e
...
@@ -4,6 +4,8 @@ import { Form, Input, Row, Col, Descriptions, Select, AutoComplete } from 'antd'
...
@@ -4,6 +4,8 @@ import { Form, Input, Row, Col, Descriptions, Select, AutoComplete } from 'antd'
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
'./ImportActionHeader.less'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
ConstraintSelect
=
({
value
=
{},
constraints
=
[],
onChange
,
...
restProps
})
=>
{
const
ConstraintSelect
=
({
value
=
{},
constraints
=
[],
onChange
,
...
restProps
})
=>
{
...
@@ -153,100 +155,104 @@ const ImportActionHeader = (props) => {
...
@@ -153,100 +155,104 @@ const ImportActionHeader = (props) => {
}
}
return
(
return
(
editable
?
(
<
div
className=
'model-import-action-header'
>
<
Form
{
form=
{
form
}
editable
?
(
{
...
formItemLayout
}
<
Form
onValuesChange=
{
onValuesChange
}
form=
{
form
}
>
{
...
formItemLayout
}
<
Row
gutter=
{
10
}
>
onValuesChange=
{
onValuesChange
}
<
Col
span=
{
8
}
>
>
<
Form
.
Item
<
Row
gutter=
{
10
}
>
label=
"中文名称"
<
Col
span=
{
8
}
>
name=
"cnName"
<
Form
.
Item
labelAlign=
"left"
label=
"中文名称"
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
name=
"cnName"
>
labelAlign=
"left"
<
Input
style=
{
{
width
:
200
}
}
/>
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
</
Form
.
Item
>
>
</
Col
>
<
Input
style=
{
{
width
:
200
}
}
/>
<
Col
span=
{
8
}
>
</
Form
.
Item
>
<
Form
.
Item
</
Col
>
label=
"英文名称"
<
Col
span=
{
8
}
>
name=
"name"
<
Form
.
Item
labelAlign=
"left"
label=
"英文名称"
rules=
{
[{
required
:
true
,
message
:
'请输入英文名称!'
}]
}
name=
"name"
>
labelAlign=
"left"
<
AutoComplete
options=
{
options
}
onSearch=
{
onSearch
}
style=
{
{
width
:
200
}
}
/>
rules=
{
[{
required
:
true
,
message
:
'请输入英文名称!'
}]
}
{
/* <Input /> */
}
>
</
Form
.
Item
>
<
AutoComplete
options=
{
options
}
onSearch=
{
onSearch
}
style=
{
{
width
:
200
}
}
/>
</
Col
>
{
/* <Input /> */
}
<
Col
span=
{
8
}
>
</
Form
.
Item
>
<
Form
.
Item
</
Col
>
label=
"描述"
<
Col
span=
{
8
}
>
name=
"remark"
<
Form
.
Item
labelAlign=
"left"
label=
"描述"
rules=
{
[{
required
:
true
,
message
:
'请输入描述!'
}]
}
name=
"remark"
>
labelAlign=
"left"
<
Input
style=
{
{
width
:
200
}
}
/>
rules=
{
[{
required
:
true
,
message
:
'请输入描述!'
}]
}
</
Form
.
Item
>
>
</
Col
>
<
Input
style=
{
{
width
:
200
}
}
/>
</
Row
>
</
Form
.
Item
>
<
Row
gutter=
{
10
}
>
</
Col
>
<
Col
span=
{
8
}
>
</
Row
>
<
Form
.
Item
<
Row
gutter=
{
10
}
>
label=
"规范"
<
Col
span=
{
8
}
>
name=
"easyDataModelerModelingConstraint"
<
Form
.
Item
labelAlign=
"left"
label=
"规范"
rules=
{
[{
required
:
true
,
message
:
'请选择规范!'
}]
}
name=
"easyDataModelerModelingConstraint"
>
labelAlign=
"left"
<
ConstraintSelect
rules=
{
[{
required
:
true
,
message
:
'请选择规范!'
}]
}
constraints=
{
constraints
}
>
onChange=
{
onConstraintChange
}
<
ConstraintSelect
style=
{
{
width
:
200
}
}
constraints=
{
constraints
}
/>
onChange=
{
onConstraintChange
}
</
Form
.
Item
>
style=
{
{
width
:
200
}
}
</
Col
>
/>
<
Col
span=
{
8
}
>
</
Form
.
Item
>
<
Form
.
Item
</
Col
>
label=
"数据表类型"
<
Col
span=
{
8
}
>
name=
"easyDataModelerModelingTemplate"
<
Form
.
Item
labelAlign=
"left"
label=
"数据表类型"
rules=
{
[{
required
:
true
,
message
:
'请选择数据表类型!'
}]
}
name=
"easyDataModelerModelingTemplate"
>
labelAlign=
"left"
<
TemplateSelect
rules=
{
[{
required
:
true
,
message
:
'请选择数据表类型!'
}]
}
templates=
{
templates
}
>
onChange=
{
onTemplateChange
}
<
TemplateSelect
style=
{
{
width
:
200
}
}
templates=
{
templates
}
/>
onChange=
{
onTemplateChange
}
</
Form
.
Item
>
style=
{
{
width
:
200
}
}
</
Col
>
/>
</
Row
>
</
Form
.
Item
>
</
Form
>
</
Col
>
)
:
(
</
Row
>
<
Descriptions
>
</
Form
>
<
Descriptions
.
Item
label=
"中文名称"
>
{
highlightSearchContentByTerms
(
modelerData
.
cnName
||
''
,
terms
)
}
</
Descriptions
.
Item
>
)
:
(
<
Descriptions
.
Item
label=
"英文名称"
>
<
Descriptions
column=
{
5
}
>
{
<
Descriptions
.
Item
label=
"中文名称"
>
{
highlightSearchContentByTerms
(
modelerData
.
cnName
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
div
>
<
Descriptions
.
Item
label=
"英文名称"
>
<
div
>
{
highlightSearchContentByTerms
(
modelerData
.
name
||
''
,
terms
)
}
</
div
>
{
{
<
div
>
(
causes
||
[]).
map
((
cause
,
index
)
=>
{
<
div
>
{
highlightSearchContentByTerms
(
modelerData
.
name
||
''
,
terms
)
}
</
div
>
return
(
{
<
div
key=
{
index
}
style=
{
{
color
:
'#ff4d4f'
}
}
>
(
causes
||
[]).
map
((
cause
,
index
)
=>
{
{
cause
||
''
}
return
(
</
div
>
<
div
key=
{
index
}
style=
{
{
color
:
'#ff4d4f'
}
}
>
)
{
cause
||
''
}
})
</
div
>
}
)
</
div
>
})
}
}
</
Descriptions
.
Item
>
</
div
>
<
Descriptions
.
Item
label=
"描述"
>
{
highlightSearchContentByTerms
(
modelerData
.
remark
||
''
,
terms
)
}
</
Descriptions
.
Item
>
}
<
Descriptions
.
Item
label=
"规范"
>
{
modelerData
.
easyDataModelerModelingConstraint
?(
modelerData
.
easyDataModelerModelingConstraint
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"数据表类型"
>
{
modelerData
.
easyDataModelerModelingTemplate
?(
modelerData
.
easyDataModelerModelingTemplate
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"描述"
>
{
highlightSearchContentByTerms
(
modelerData
.
remark
||
''
,
terms
)
}
</
Descriptions
.
Item
>
</
Descriptions
>
<
Descriptions
.
Item
label=
"规范"
>
{
modelerData
.
easyDataModelerModelingConstraint
?(
modelerData
.
easyDataModelerModelingConstraint
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
)
<
Descriptions
.
Item
label=
"数据表类型"
>
{
modelerData
.
easyDataModelerModelingTemplate
?(
modelerData
.
easyDataModelerModelingTemplate
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
</
Descriptions
>
)
}
</
div
>
)
)
}
}
...
...
src/view/Manage/Model/Component/ImportActionHeader.less
0 → 100644
View file @
3636cf1e
.model-import-action-header {
.yy-form-item {
margin-bottom: 10px;
}
.yy-descriptions-row > th, .yy-descriptions-row > td {
padding-bottom: 10px;
}
}
\ No newline at end of file
src/view/Manage/Model/Component/ImportModal.jsx
View file @
3636cf1e
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
Modal
,
Button
,
Form
}
from
'antd'
;
import
{
Modal
,
Button
}
from
'antd'
;
// import ImportLog from './ImportLog';
import
ImportExcel
from
'./ImportExcel'
;
import
ImportExcel
from
'./ImportExcel'
;
import
ImportExcelCopy
from
'./ImportExcelCopy'
;
import
ImportExcelCopy
from
'./ImportExcelCopy'
;
import
ImportDDL
from
'./ImportDDL'
;
import
ImportMetadata
from
'./ImportMetadata'
;
import
ImportAction
from
'./ImportAction'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
showMessage
}
from
'../../../../util'
;
const
ImportModal
=
(
props
)
=>
{
const
ImportModal
=
(
props
)
=>
{
const
{
catalogId
,
visible
,
onCancel
,
action
,
addMode
,
modelerId
}
=
props
;
const
{
visible
,
onCancel
,
addMode
}
=
props
;
const
[
step
,
setStep
]
=
useState
(
0
);
const
[
excelFiles
,
setExcelFiles
]
=
useState
([]);
const
[
excelFiles
,
setExcelFiles
]
=
useState
([]);
const
[
hints
,
setHints
]
=
useState
([]);
const
[
hints
,
setHints
]
=
useState
([]);
const
[
ddl
,
setDDL
]
=
useState
(
''
);
const
[
modelerData
,
setModelerData
]
=
useState
({});
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
terms
,
setTerms
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
if
(
visible
)
{
if
(
action
===
'add'
)
{
setStep
(
0
);
}
else
{
setStep
(
1
);
}
}
},
[
visible
,
catalogId
,
action
])
const
prev
=
()
=>
{
const
onOk
=
()
=>
{
setStep
(
step
-
1
);
if
(
addMode
===
'excel'
)
{
}
const
next
=
()
=>
{
if
(
step
===
0
&&
addMode
===
'excel'
)
{
if
((
excelFiles
||
[]).
length
===
0
)
{
if
((
excelFiles
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先选择文件上传'
);
showMessage
(
'warn'
,
'请先选择文件上传'
);
}
else
{
}
else
{
...
@@ -50,8 +25,7 @@ const ImportModal = (props) => {
...
@@ -50,8 +25,7 @@ const ImportModal = (props) => {
payload
:
{
fileList
:
excelFiles
},
payload
:
{
fileList
:
excelFiles
},
callback
:
data
=>
{
callback
:
data
=>
{
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
setHints
(
data
||
[]);
onCancel
&&
onCancel
({
hints
:
data
||
[]
});
setStep
(
step
+
1
);
},
},
error
:
()
=>
{
error
:
()
=>
{
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
...
@@ -60,92 +34,30 @@ const ImportModal = (props) => {
...
@@ -60,92 +34,30 @@ const ImportModal = (props) => {
}
}
return
;
return
;
}
else
if
(
step
===
0
&&
addMode
===
'excel-copy'
)
{
}
else
if
(
addMode
===
'excel-copy'
)
{
if
((
hints
||
[]).
length
===
0
)
{
if
((
hints
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先从Excel文件中复制内容'
);
showMessage
(
'warn'
,
'请先从Excel文件中复制内容'
);
}
else
{
}
else
{
setStep
(
step
+
1
);
onCancel
&&
onCancel
(
hints
||
[]);
}
return
;
}
else
if
(
step
===
0
&&
addMode
===
'ddl'
)
{
if
((
ddl
||
[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先输入ddl'
);
}
else
{
setStep
(
step
+
1
);
}
}
return
;
return
;
}
}
setStep
(
step
+
1
);
}
}
const
cancel
=
()
=>
{
const
cancel
=
()
=>
{
reset
();
reset
();
onCancel
&&
onCancel
(
false
);
onCancel
&&
onCancel
();
}
const
save
=
async
()
=>
{
try
{
const
row
=
await
form
.
validateFields
();
const
newModelerData
=
{...
modelerData
,
...
row
};
setConfirmLoading
(
true
);
dispatchLatest
({
type
:
'datamodel.saveDataModel'
,
payload
:
{
data
:
newModelerData
},
callback
:
data
=>
{
dispatchLatest
({
type
:
'datamodel.bindCatalogDataModel'
,
payload
:
{
params
:
{
easyDataModelCatalogId
:
catalogId
,
easyDataModelerDataModelIds
:
data
.
id
||
''
}
},
callback
:
()
=>
{
setConfirmLoading
(
false
);
reset
();
onCancel
&&
onCancel
(
true
);
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
},
error
:
(
err
)
=>
{
setConfirmLoading
(
false
);
setTerms
([
err
.
ApiError
?.
message
||
''
]);
}
})
}
catch
(
errInfo
)
{
console
.
log
(
'Validate Failed:'
,
errInfo
);
}
}
}
const
reset
=
()
=>
{
const
reset
=
()
=>
{
setStep
(
0
);
setExcelFiles
([]);
setExcelFiles
([]);
setHints
([]);
setHints
([]);
setDDL
(
''
);
setModelerData
({});
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
}
}
const
onActionChange
=
(
data
)
=>
{
setModelerData
(
data
);
}
const
onImportExcelChange
=
(
files
)
=>
{
const
onImportExcelChange
=
(
files
)
=>
{
setExcelFiles
(
files
||
[]);
setExcelFiles
(
files
||
[]);
}
}
...
@@ -154,136 +66,53 @@ const ImportModal = (props) => {
...
@@ -154,136 +66,53 @@ const ImportModal = (props) => {
setHints
(
data
||
[]);
setHints
(
data
||
[]);
}
}
const
onImportDDLChange
=
(
data
)
=>
{
setDDL
(
data
);
}
let
title
=
''
;
let
title
=
''
;
if
(
action
===
'add'
)
{
if
(
addMode
===
'excel'
)
{
if
(
step
===
0
&&
addMode
===
'excel'
)
{
title
=
'Excel导入'
;
title
=
'Excel导入'
;
}
else
if
(
addMode
===
'excel-copy'
)
{
}
else
if
(
step
===
0
&&
addMode
===
'excel-copy'
)
{
title
=
'Excel复制粘贴导入'
;
title
=
'Excel复制粘贴导入'
;
}
else
if
(
addMode
===
'ddl'
)
{
}
else
if
(
step
===
0
&&
addMode
===
'ddl'
)
{
title
=
'DDL导入'
;
title
=
'DDL导入'
;
}
}
else
if
(
step
===
1
&&
addMode
===
'excel'
)
{
title
=
'模型创建-Excel导入'
;
const
footer
=
[
}
else
if
(
step
===
1
&&
addMode
===
'excel-copy'
)
{
<
Button
title
=
'模型创建-Excel复制粘贴导入'
;
key=
"0"
}
else
if
(
step
===
1
&&
addMode
===
'ddl'
)
{
type=
"primary"
title
=
'模型创建-DDL导入'
;
onClick=
{
cancel
}
}
>
}
else
if
(
action
===
'edit'
)
{
取消
title
=
'模型编辑'
;
</
Button
>,
}
else
if
(
action
===
'detail'
)
{
<
Button
title
=
'模型详情'
;
key=
"1"
}
type=
"primary"
loading=
{
confirmLoading
}
let
footer
=
null
;
onClick=
{
onOk
}
if
(
action
===
'add'
)
{
>
footer
=
[
确定
<
Button
</
Button
>,
key=
"0"
];
type=
"primary"
style=
{
{
display
:
(
step
!==
0
)?
''
:
'none'
}
}
onClick=
{
prev
}
>
上一步
</
Button
>,
<
Button
key=
"1"
type=
"primary"
loading=
{
confirmLoading
}
style=
{
{
display
:
(
step
===
0
)?
''
:
'none'
}
}
onClick=
{
next
}
>
下一步
</
Button
>,
<
Button
key=
"2"
type=
"primary"
loading=
{
confirmLoading
}
style=
{
{
display
:
(
step
===
1
)?
''
:
'none'
}
}
onClick=
{
save
}
>
保存
</
Button
>
];
}
else
if
(
action
===
'edit'
)
{
footer
=
[
<
Button
key=
"1"
type=
"primary"
onClick=
{
cancel
}
>
取消
</
Button
>,
<
Button
key=
"2"
type=
"primary"
loading=
{
confirmLoading
}
onClick=
{
save
}
>
保存
</
Button
>
];
}
else
if
(
action
===
'detail'
)
{
footer
=
[
<
Button
key=
"1"
type=
"primary"
onClick=
{
cancel
}
>
取消
</
Button
>
];
}
return
(
return
(
<
Modal
<
Modal
forceRender
forceRender
visible=
{
visible
}
visible=
{
visible
}
title=
{
title
}
title=
{
title
}
width=
{
step
===
1
?
1300
:
520
}
width=
{
520
}
maskClosable=
{
false
}
maskClosable=
{
false
}
onCancel=
{
()
=>
{
onCancel=
{
cancel
}
reset
();
onCancel
&&
onCancel
();
}
}
footer=
{
footer
}
footer=
{
footer
}
>
>
<>
{
{
addMode
===
'excel'
&&
(
addMode
===
'excel'
&&
(
<
div
style=
{
{
display
:
step
===
0
?
''
:
'none'
}
}
>
<
ImportExcel
onChange=
{
onImportExcelChange
}
{
...
props
}
/>
<
ImportExcel
onChange=
{
onImportExcelChange
}
{
...
props
}
/>
</
div
>
)
)
}
}
{
{
addMode
===
'excel-copy'
&&
(
addMode
===
'excel-copy'
&&
(
<
div
style=
{
{
display
:
step
===
0
?
''
:
'none'
}
}
>
<
ImportExcelCopy
onChange=
{
onImportExcelCopyChange
}
{
...
props
}
/>
<
ImportExcelCopy
onChange=
{
onImportExcelCopyChange
}
{
...
props
}
/>
</
div
>
)
}
{
addMode
===
'ddl'
&&
(
<
div
style=
{
{
display
:
step
===
0
?
''
:
'none'
}
}
>
<
ImportDDL
onChange=
{
onImportDDLChange
}
{
...
props
}
/>
</
div
>
)
)
}
}
{
step
===
0
&&
addMode
===
'erwin'
&&
<></>
}
{
step
===
0
&&
addMode
===
'metadata'
&&
<
ImportMetadata
/>
}
{
step
===
1
&&
<
ImportAction
hints=
{
hints
}
ddl=
{
ddl
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
/>
}
</>
</
Modal
>
</
Modal
>
)
)
}
}
...
...
src/view/Manage/Model/index.jsx
View file @
3636cf1e
...
@@ -12,6 +12,7 @@ import ImportWordModal from './Component/ImportWordModal';
...
@@ -12,6 +12,7 @@ import ImportWordModal from './Component/ImportWordModal';
import
ExportDDLModal
from
'./Component/ExportDDLModal'
;
import
ExportDDLModal
from
'./Component/ExportDDLModal'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
showMessage
,
showNotifaction
}
from
'../../../util'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
dispatch
}
from
'../../../model'
;
import
{
Action
,
CatalogId
,
ModelerId
,
Hints
}
from
'../../../util/constant'
;
import
'./index.less'
;
import
'./index.less'
;
...
@@ -36,6 +37,7 @@ class Model extends React.Component {
...
@@ -36,6 +37,7 @@ class Model extends React.Component {
selectModelerNames
:
[],
selectModelerNames
:
[],
keyword
:
''
,
keyword
:
''
,
exportErwinLoading
:
false
,
exportErwinLoading
:
false
,
hints
:
[]
}
}
}
}
...
@@ -75,7 +77,11 @@ class Model extends React.Component {
...
@@ -75,7 +77,11 @@ class Model extends React.Component {
}
}
onTableItemAction
=
(
id
,
action
)
=>
{
onTableItemAction
=
(
id
,
action
)
=>
{
this
.
setState
({
importModalVisible
:
true
,
importModalAction
:
action
,
modelerId
:
id
});
this
.
setState
({
importModalAction
:
action
,
modelerId
:
id
},
()
=>
{
const
{
catalogId
,
importModalAction
,
modelerId
}
=
this
.
state
;
window
.
open
(
`/data-govern/data-model-action?
${
Action
}
=
${
importModalAction
}
&
${
CatalogId
}
=
${
catalogId
}
&
${
ModelerId
}
=
${
modelerId
}
`
);
});
}
}
onSearchInputChange
=
(
e
)
=>
{
onSearchInputChange
=
(
e
)
=>
{
...
@@ -232,9 +238,16 @@ class Model extends React.Component {
...
@@ -232,9 +238,16 @@ class Model extends React.Component {
this
.
setState
({
constraintDetailModalVisible
:
false
});
this
.
setState
({
constraintDetailModalVisible
:
false
});
}
}
onImportModalCancel
=
(
refresh
=
false
)
=>
{
onImportModalCancel
=
(
hints
=
[])
=>
{
this
.
setState
({
importModalVisible
:
false
});
const
{
catalogId
,
importModalAction
,
modelerId
}
=
this
.
state
;
refresh
&&
this
.
onTableChange
();
this
.
setState
({
importModalVisible
:
false
},
()
=>
{
if
((
hints
||
[]).
length
>
0
)
{
setTimeout
(()
=>
{
window
.
open
(
`/data-govern/data-model-action?
${
Action
}
=
${
importModalAction
}
&
${
CatalogId
}
=
${
catalogId
}
&
${
ModelerId
}
=
${
modelerId
}
&
${
Hints
}
=
${(
hints
||
[]).
join
(
','
)}
`
);
},
1000
);
}
});
}
}
onImportWordModalCancel
=
(
refresh
=
false
)
=>
{
onImportWordModalCancel
=
(
refresh
=
false
)
=>
{
...
@@ -247,7 +260,7 @@ class Model extends React.Component {
...
@@ -247,7 +260,7 @@ class Model extends React.Component {
}
}
render
()
{
render
()
{
const
{
importModalVisible
,
catalogId
,
importModalAction
,
loadingTableData
,
modelerId
,
selectModelerIds
,
keyword
,
filterTableData
,
selectModelerNames
,
importModalAddMode
,
exportErwinLoading
,
exportDDLModalVisible
,
templateCURDModalVisible
,
wordTemplateModalVisible
,
constraintDetailModalVisible
,
importWordModalVisible
}
=
this
.
state
;
const
{
importModalVisible
,
catalogId
,
loadingTableData
,
selectModelerIds
,
keyword
,
filterTableData
,
selectModelerNames
,
importModalAddMode
,
exportErwinLoading
,
exportDDLModalVisible
,
templateCURDModalVisible
,
wordTemplateModalVisible
,
constraintDetailModalVisible
,
importWordModalVisible
}
=
this
.
state
;
const
content
=
(
const
content
=
(
<
ModelTable
loading=
{
loadingTableData
}
catalogId=
{
catalogId
}
data=
{
filterTableData
}
onChange=
{
this
.
onTableChange
}
onSelect=
{
this
.
onTableSelect
}
onItemAction=
{
this
.
onTableItemAction
}
{
...
this
.
props
}
/>
<
ModelTable
loading=
{
loadingTableData
}
catalogId=
{
catalogId
}
data=
{
filterTableData
}
onChange=
{
this
.
onTableChange
}
onSelect=
{
this
.
onTableSelect
}
onItemAction=
{
this
.
onTableItemAction
}
{
...
this
.
props
}
/>
...
@@ -330,11 +343,8 @@ class Model extends React.Component {
...
@@ -330,11 +343,8 @@ class Model extends React.Component {
<
ImportModal
<
ImportModal
visible=
{
importModalVisible
}
visible=
{
importModalVisible
}
action=
{
importModalAction
}
addMode=
{
importModalAddMode
}
addMode=
{
importModalAddMode
}
onCancel=
{
this
.
onImportModalCancel
}
onCancel=
{
this
.
onImportModalCancel
}
catalogId=
{
catalogId
}
modelerId=
{
modelerId
}
/>
/>
<
ImportWordModal
<
ImportWordModal
...
...
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