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
316266f1
Commit
316266f1
authored
Apr 13, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
按规范区分数据表
parent
9c1212d2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
131 additions
and
37 deletions
+131
-37
datamodel.js
src/model/datamodel.js
+2
-2
datamodeler.js
src/service/datamodeler.js
+2
-2
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+27
-8
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+10
-6
TemplateAction.jsx
src/view/Manage/ModelConfig/Component/TemplateAction.jsx
+2
-0
TemplateActionHeader.jsx
...iew/Manage/ModelConfig/Component/TemplateActionHeader.jsx
+41
-9
TemplateCURD.jsx
src/view/Manage/ModelConfig/Component/TemplateCURD.jsx
+47
-10
No files found.
src/model/datamodel.js
View file @
316266f1
...
...
@@ -133,8 +133,8 @@ export function* getAllConstraints() {
return
yield
call
(
datamodelerService
.
constraints
);
}
export
function
*
getAllTemplates
()
{
return
yield
call
(
datamodelerService
.
templates
);
export
function
*
getAllTemplates
(
payload
)
{
return
yield
call
(
datamodelerService
.
templates
,
payload
);
}
export
function
*
getTemplate
(
payload
)
{
...
...
src/service/datamodeler.js
View file @
316266f1
...
...
@@ -85,8 +85,8 @@ export function constraints() {
}
//模版
export
function
templates
()
{
return
GetJSON
(
"/datamodeler/easyDataModelerTemplateCURD/getAllDataModelTemplates"
);
export
function
templates
(
payload
)
{
return
GetJSON
(
"/datamodeler/easyDataModelerTemplateCURD/getAllDataModelTemplates"
,
payload
);
}
export
function
getTemplate
(
payload
)
{
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
316266f1
...
...
@@ -59,24 +59,23 @@ const ImportAction = (props) => {
setLoading
(
true
);
dispatch
({
type
:
'datamodel.getAllConstraints
AndTemplates
'
,
type
:
'datamodel.getAllConstraints'
,
callback
:
data
=>
{
setConstraints
(
data
.
constraints
||
[]);
setTemplates
(
data
.
templates
||
[]);
setConstraints
(
data
);
if
(
action
===
'add'
)
{
setConstraint
((
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{});
setTemplate
({});
// setConstraint(data?.length>0?data
[0]:{});
//
setTemplate({});
if
((
hints
||
[]).
length
>
0
)
{
getDraft
(
(
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
{}
,
hints
);
getDraft
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,
hints
);
}
else
if
((
ddl
||
''
).
length
>
0
)
{
getDraftUsingDDL
(
(
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
{}
,
ddl
);
getDraftUsingDDL
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,
ddl
);
}
else
if
((
modelerId
||
''
)
!==
''
)
{
getCurrentDataModel
();
}
else
if
(
roughModelerData
)
{
setLoading
(
false
);
getExtraData
(
roughModelerData
);
}
else
{
getDraft
(
(
data
.
constraints
||
[]).
length
>
0
?
data
.
constraints
[
0
]:{},
{}
,[]);
getDraft
(
data
?.
length
>
0
?
data
[
0
]:{},
{}
,[]);
}
}
else
if
(
action
===
'edit'
||
action
===
'detail'
||
action
===
'flow'
||
action
===
'detail-version'
)
{
getCurrentDataModel
();
...
...
@@ -89,6 +88,26 @@ const ImportAction = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
action
,
hints
,
modelerId
,
ddl
]);
useEffect
(()
=>
{
if
(
constraint
?.
name
)
{
getTemplates
();
}
else
{
setTemplates
([]);
}
},
[
constraint
])
const
getTemplates
=
()
=>
{
dispatch
({
type
:
'datamodel.getAllTemplates'
,
payload
:
{
constraintName
:
constraint
.
name
},
callback
:
data
=>
{
setTemplates
(
data
);
}
})
}
const
getDraft
=
(
_constraint
,
_template
,
_hints
)
=>
{
dispatch
({
type
:
'datamodel.getDraft'
,
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
316266f1
...
...
@@ -370,6 +370,7 @@ const ImportActionHeader = (props) => {
const
[
maintenanceRecords
,
setMaintenanceRecords
]
=
useState
(
null
);
const
[
dataTypeList
,
setDataTypeList
]
=
useState
(
null
);
const
[
bindingLoadRangeList
,
setBindingLoadRangeList
]
=
useState
(
null
);
const
[
dataCircumstances
,
setDataCircumstances
]
=
useState
(
null
);
useEffect
(()
=>
{
getDataTypeList
();
...
...
@@ -404,6 +405,7 @@ const ImportActionHeader = (props) => {
setAutoTranslate
((
modelerData
.
name
||
''
)
===
''
);
if
(
modelerData
)
{
form
?.
setFieldsValue
(
modelerData
);
setDataCircumstances
(
modelerData
.
dataCircumstances
);
if
((
modelerData
.
id
||
''
)
!==
''
&&
maintenanceRecords
===
null
)
{
getMaintenanceRecords
();
...
...
@@ -715,12 +717,14 @@ const ImportActionHeader = (props) => {
</
Form
.
Item
>
</
Col
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
label=
"数据情况"
name=
"dataCircumstances"
>
<
Input
placeholder=
'描述数据表中数据的更新频率、每日增量情况、数据量级和历史数据'
/>
</
Form
.
Item
>
<
Tooltip
title=
{
dataCircumstances
?
null
:
'描述数据表中数据的更新频率、每日增量情况、数据量级和历史数据'
}
>
<
Form
.
Item
label=
"数据情况"
name=
"dataCircumstances"
>
<
Input
placeholder=
'描述数据表中数据的更新频率、每日增量情况、数据量级和历史数据'
/>
</
Form
.
Item
>
</
Tooltip
>
</
Col
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
...
...
src/view/Manage/ModelConfig/Component/TemplateAction.jsx
View file @
316266f1
...
...
@@ -26,6 +26,7 @@ const TemplateAction = (props) => {
cnName
:
''
,
name
:
''
,
remark
:
''
,
constraintName
:
''
,
});
}
if
(
action
===
'add'
)
{
...
...
@@ -55,6 +56,7 @@ const TemplateAction = (props) => {
cnName
:
data
.
cnName
||
''
,
name
:
data
.
name
||
''
,
remark
:
data
.
remark
||
''
,
constraintName
:
data
.
constraintName
||
''
});
}
},
...
...
src/view/Manage/ModelConfig/Component/TemplateActionHeader.jsx
View file @
316266f1
import
React
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
}
from
'antd'
;
import
{
dispatch
}
from
'../../../../model'
;
const
{
TextArea
}
=
Input
;
const
TemplateActionHeader
=
(
props
)
=>
{
const
{
editable
,
form
,
templateData
}
=
props
;
const
[
constraints
,
setConstraints
]
=
useState
([]);
useEffect
(()
=>
{
getConstraints
();
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
const
getConstraints
=
()
=>
{
dispatch
({
type
:
'datamodel.getAllConstraints'
,
callback
:
data
=>
{
setConstraints
(
data
);
},
})
}
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
5
},
sm
:
{
span
:
4
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
19
},
sm
:
{
span
:
20
},
},
};
...
...
@@ -23,7 +40,7 @@ const TemplateActionHeader = (props) => {
form=
{
form
}
{
...
formItemLayout
}
>
<
Row
>
<
Row
gutter=
{
20
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
"中文名称"
...
...
@@ -31,7 +48,7 @@ const TemplateActionHeader = (props) => {
labelAlign=
"left"
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
>
<
Input
/>
<
Input
placeholder=
'请输入中文名称'
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
12
}
>
...
...
@@ -41,11 +58,11 @@ const TemplateActionHeader = (props) => {
labelAlign=
"left"
rules=
{
[{
required
:
true
,
message
:
'请输入英文名称!'
}]
}
>
<
Input
/>
<
Input
placeholder=
'请输入英文名称'
/>
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Row
>
<
Row
gutter=
{
20
}
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
"描述"
...
...
@@ -53,7 +70,21 @@ const TemplateActionHeader = (props) => {
labelAlign=
"left"
rules=
{
[{
required
:
true
,
message
:
'请输入描述!'
}]
}
>
<
TextArea
rows=
{
4
}
/>
<
TextArea
rows=
{
4
}
placeholder=
'请输入描述'
/>
</
Form
.
Item
>
</
Col
>
<
Col
span=
{
12
}
>
<
Form
.
Item
label=
"规范"
name=
"constraintName"
labelAlign=
"left"
rules=
{
[{
required
:
true
,
message
:
'请选择规范!'
}]
}
>
<
Select
placeholder=
'请选择规范'
>
{
constraints
?.
map
((
constraint
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
constraint
.
name
}
>
{
constraint
.
cnName
}
</
Select
.
Option
>
)
}
</
Select
>
</
Form
.
Item
>
</
Col
>
</
Row
>
...
...
@@ -63,6 +94,7 @@ const TemplateActionHeader = (props) => {
<
Descriptions
.
Item
label=
"中文名称"
>
{
templateData
.
cnName
||
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"英文名称"
>
{
templateData
.
name
||
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"描述"
>
{
templateData
.
remark
||
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"规范"
>
{
templateData
.
constraintCnName
||
''
}
</
Descriptions
.
Item
>
</
Descriptions
>
)
)
...
...
src/view/Manage/ModelConfig/Component/TemplateCURD.jsx
View file @
316266f1
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Table
,
Button
,
Tooltip
,
Modal
,
Divider
}
from
'antd'
;
import
{
Table
,
Button
,
Tooltip
,
Modal
,
Divider
,
Select
,
Space
}
from
'antd'
;
import
{
Action
,
TemplateId
}
from
'../../../../util/constant'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
const
TemplateCURD
=
(
props
)
=>
{
const
[
constraints
,
setConstraints
]
=
useState
([]);
const
[
templates
,
setTemplates
]
=
useState
([]);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
currentConstraint
,
setCurrentConstraint
]
=
useState
(
undefined
);
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
useEffect
(()
=>
{
getConstraints
();
},
[])
useEffect
(()
=>
{
getTemplates
();
window
?.
addEventListener
(
"storage"
,
storageChange
);
window
?.
addEventListener
(
"storage"
,
(
e
)
=>
{
if
(
e
.
key
===
'templateChange'
)
{
getTemplates
();
}
});
return
()
=>
{
window
?.
removeEventListener
(
"storage"
,
storageChange
);
}
},
[
currentConstraint
])
},
[])
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'templateChange'
)
{
getTemplates
();
}
}
const
columns
=
[
{
...
...
@@ -61,10 +69,16 @@ const TemplateCURD = (props) => {
ellipsis
:
true
,
},
{
title
:
'规范'
,
dataIndex
:
'constraintCnName'
,
ellipsis
:
true
,
},
{
title
:
'更新时间'
,
dataIndex
:
'modifiedTs'
,
width
:
1
2
0
,
width
:
1
5
0
,
ellipsis
:
true
,
render
:
(
_
,
record
)
=>
record
.
modifiedTs
?
new
Date
(
record
.
modifiedTs
).
toLocaleString
()
:
''
},
{
title
:
'操作'
,
...
...
@@ -99,10 +113,22 @@ const TemplateCURD = (props) => {
}
];
const
getConstraints
=
()
=>
{
dispatch
({
type
:
'datamodel.getAllConstraints'
,
callback
:
data
=>
{
setConstraints
(
data
);
},
})
}
const
getTemplates
=
()
=>
{
setLoading
(
true
);
dispatch
({
type
:
'datamodel.getAllTemplates'
,
payload
:
{
constraintName
:
currentConstraint
},
callback
:
data
=>
{
setTemplates
(
data
||
[]);
setLoading
(
false
);
...
...
@@ -148,12 +174,23 @@ const TemplateCURD = (props) => {
return
(
<
div
>
<
div
className=
'd-flex mb-3'
style=
{
{
alignItems
:
'center'
}
}
>
<
div
className=
'd-flex mb-3'
style=
{
{
alignItems
:
'center'
,
justifyContent
:
'space-between'
}
}
>
<
Button
onClick=
{
onAddClick
}
>
新建
</
Button
>
<
Select
placeholder=
'请选择规范'
allowClear
style=
{
{
width
:
200
}
}
onChange=
{
(
val
)
=>
{
setCurrentConstraint
(
val
);
}
}
>
{
constraints
?.
map
((
constraint
,
index
)
=>
<
Select
.
Option
key=
{
index
}
value=
{
constraint
.
name
}
>
{
constraint
.
cnName
}
</
Select
.
Option
>
)
}
</
Select
>
</
div
>
<
Table
loading=
{
loading
}
...
...
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