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
666a8e31
Commit
666a8e31
authored
Nov 27, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基本信息校验规范
parent
a272d511
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
54 deletions
+95
-54
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+95
-54
No files found.
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
666a8e31
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Button
,
Divider
,
Tooltip
,
Checkbox
}
from
'antd'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Button
,
Divider
,
Tooltip
,
Checkbox
,
Space
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
}
from
'@ant-design/icons'
;
import
{
DownOutlined
,
UpOutlined
,
ExclamationCircleOutlined
,
WarningOutlined
}
from
'@ant-design/icons'
;
import
{
Subject
}
from
'rxjs'
;
import
{
Subject
}
from
'rxjs'
;
import
{
highlightSearchContentByTerms
,
generateUUID
}
from
'../../../../util'
;
import
{
highlightSearchContentByTerms
,
generateUUID
,
IsArr
}
from
'../../../../util'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
{
dispatch
,
dispatchLatest
}
from
'../../../../model'
;
import
DebounceInput
from
'./DebounceInput'
;
import
DebounceInput
from
'./DebounceInput'
;
...
@@ -51,7 +51,6 @@ export const ImportActionHeaderSubject = new Subject();
...
@@ -51,7 +51,6 @@ export const ImportActionHeaderSubject = new Subject();
const
ImportActionHeader
=
(
props
)
=>
{
const
ImportActionHeader
=
(
props
)
=>
{
const
{
editable
,
form
,
modelerData
,
constraints
,
templates
,
onConstraintChange
,
onTemplateChange
,
validateReports
,
onChange
,
terms
,
supportedPartitionTypes
}
=
props
;
const
{
editable
,
form
,
modelerData
,
constraints
,
templates
,
onConstraintChange
,
onTemplateChange
,
validateReports
,
onChange
,
terms
,
supportedPartitionTypes
}
=
props
;
const
[
causes
,
setCauses
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
const
[
autoTranslate
,
setAutoTranslate
]
=
useState
(
false
);
const
[
autoTranslate
,
setAutoTranslate
]
=
useState
(
false
);
...
@@ -85,27 +84,6 @@ const ImportActionHeader = (props) => {
...
@@ -85,27 +84,6 @@ const ImportActionHeader = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
const
causes
=
[];
(
validateReports
||
[]).
forEach
(
report
=>
{
if
(
report
.
type
===
'DataModel'
)
{
(
report
.
reportItems
||
[]).
forEach
((
item
)
=>
{
causes
.
push
(
item
.
cause
||
''
);
})
}
});
if
(
editable
)
{
form
?.
setFields
([{
name
:
'name'
,
errors
:
causes
}]);
}
else
{
setCauses
(
causes
);
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
validateReports
])
useEffect
(()
=>
{
setAutoTranslate
((
modelerData
.
name
||
''
)
===
''
);
setAutoTranslate
((
modelerData
.
name
||
''
)
===
''
);
if
(
modelerData
)
{
if
(
modelerData
)
{
form
?.
setFieldsValue
(
modelerData
);
form
?.
setFieldsValue
(
modelerData
);
...
@@ -348,22 +326,25 @@ const ImportActionHeader = (props) => {
...
@@ -348,22 +326,25 @@ const ImportActionHeader = (props) => {
onValuesChange=
{
onValuesChange
}
onValuesChange=
{
onValuesChange
}
>
>
<
Row
gutter=
{
10
}
>
<
Row
gutter=
{
10
}
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
<
Form
.
Item
label=
"中文名称"
label=
{
<
ItemTitle
name=
'cnName'
cnName=
'中文名称'
validateReports=
{
validateReports
}
/>
}
name=
"cnName"
name=
"cnName"
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入中文名称!'
}]
}
>
>
<
InputDebounce
/>
<
InputDebounce
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
<
Form
.
Item
label=
"英文名称"
label=
{
<
ItemTitle
name=
'name'
cnName=
'英文名称'
validateReports=
{
validateReports
}
/>
}
name=
"name"
name=
"name"
rules=
{
[{
required
:
true
,
message
:
'请输入英文名称!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入英文名称!'
}]
}
>
>
<
AutoComplete
options=
{
options
}
onSearch=
{
onSearch
}
/>
<
AutoComplete
options=
{
options
}
onSearch=
{
onSearch
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
...
@@ -380,7 +361,7 @@ const ImportActionHeader = (props) => {
...
@@ -380,7 +361,7 @@ const ImportActionHeader = (props) => {
</
Col
>
</
Col
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Col
xs=
{
24
}
sm=
{
24
}
lg=
{
12
}
xl=
{
8
}
>
<
Form
.
Item
<
Form
.
Item
label=
"数据内容"
label=
{
<
ItemTitle
name=
'remark'
cnName=
'数据内容'
validateReports=
{
validateReports
}
/>
}
name=
"remark"
name=
"remark"
rules=
{
[{
required
:
true
,
message
:
'请输入数据内容!'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入数据内容!'
}]
}
style=
{
{
marginBottom
:
15
}
}
style=
{
{
marginBottom
:
15
}
}
...
@@ -527,25 +508,10 @@ const ImportActionHeader = (props) => {
...
@@ -527,25 +508,10 @@ const ImportActionHeader = (props) => {
)
:
(
)
:
(
<
React
.
Fragment
>
<
React
.
Fragment
>
<
Descriptions
column=
{
3
}
>
<
Descriptions
column=
{
3
}
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
中文名称
</
div
>
}
>
{
highlightSearchContentByTerms
(
modelerData
.
cnName
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
><
ItemTitle
name=
'cnName'
cnName=
'中文名称'
validateReports=
{
validateReports
}
/></
div
>
}
>
{
highlightSearchContentByTerms
(
modelerData
.
cnName
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
英文名称
</
div
>
}
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
><
ItemTitle
name=
'name'
cnName=
'英文名称'
validateReports=
{
validateReports
}
/></
div
>
}
>
{
highlightSearchContentByTerms
(
modelerData
.
name
||
''
,
terms
)
}
</
Descriptions
.
Item
>
{
<
div
>
<
div
>
{
highlightSearchContentByTerms
(
modelerData
.
name
||
''
,
terms
)
}
</
div
>
{
(
causes
||
[]).
map
((
cause
,
index
)
=>
{
return
(
<
div
key=
{
index
}
style=
{
{
color
:
'#ff4d4f'
}
}
>
{
cause
||
''
}
</
div
>
)
})
}
</
div
>
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
规范
</
div
>
}
>
{
modelerData
.
easyDataModelerModelingConstraint
?(
modelerData
.
easyDataModelerModelingConstraint
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
规范
</
div
>
}
>
{
modelerData
.
easyDataModelerModelingConstraint
?(
modelerData
.
easyDataModelerModelingConstraint
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
数据内容
</
div
>
}
>
{
highlightSearchContentByTerms
(
modelerData
.
remark
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
<
ItemTitle
name=
'remark'
cnName=
'数据内容'
validateReports=
{
validateReports
}
/>
</
div
>
}
>
{
highlightSearchContentByTerms
(
modelerData
.
remark
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
数据表类型
</
div
>
}
>
{
modelerData
.
tableType
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
{
<
div
style=
{
{
textAlign
:
'right'
,
width
:
85
}
}
>
数据表类型
</
div
>
}
>
{
modelerData
.
tableType
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
Descriptions
>
{
{
...
@@ -891,4 +857,78 @@ const UpdateSelect = ({ value = '', onChange, ...restProps }) => {
...
@@ -891,4 +857,78 @@ const UpdateSelect = ({ value = '', onChange, ...restProps }) => {
}
}
</
Select
>
</
Select
>
);
);
}
const
ItemTitle
=
({
name
,
cnName
,
validateReports
})
=>
{
return
(
<
Space
size=
{
2
}
>
{
cnName
}
<
ValidateTip
validateReports=
{
validateReports
}
type=
'DataModel'
propertyName=
{
name
}
/>
</
Space
>
)
}
export
const
ValidateTip
=
({
validateReports
,
type
,
propertyName
})
=>
{
const
reports
=
useMemo
(()
=>
{
const
index
=
(
validateReports
??[]).
findIndex
(
item
=>
item
.
type
===
type
)
if
(
index
!==
-
1
)
{
const
items
=
(
validateReports
[
index
].
reportItems
??[]).
filter
(
item
=>
item
.
checkRule
?.
ruleTemplate
?.
checkProperty
?.
originalPropertyEnName
===
propertyName
)
return
items
.
map
(
item
=>
{
const
[
preCheckProperty
,
checkProperty
]
=
[
item
.
checkRule
?.
ruleTemplate
?.
preCheckProperty
,
item
.
checkRule
?.
ruleTemplate
?.
checkProperty
]
let
tip
=
''
if
(
preCheckProperty
)
{
tip
=
`
${
preCheckProperty
?.
propertyCnName
??
''
}
$
{
preCheckProperty
.
expressionTypeCnName
??
''
}
$
{
preCheckProperty
.
verifyExpression
?.
cnName
??
''
}
`
if (IsArr(preCheckProperty?.verifyExpression?.value)) {
tip = `
$
{
tip
}
$
{
preCheckProperty
?.
verifyExpression
?.
value
.
join
(
';'
)}
`
} else {
tip = `
$
{
tip
}
$
{
preCheckProperty
?.
verifyExpression
?.
value
}
`
}
}
if (checkProperty) {
tip = tip?`
$
{
tip
}
`:''
tip = `
$
{
tip
}
$
{
checkProperty
?.
propertyCnName
??
''
}
$
{
checkProperty
.
expressionTypeCnName
??
''
}
$
{
checkProperty
.
verifyExpression
?.
cnName
??
''
}
`
if (IsArr(checkProperty?.verifyExpression?.value)) {
tip = `
$
{
tip
}
$
{
checkProperty
?.
verifyExpression
?.
value
.
join
(
';'
)}
`
} else {
tip = `
$
{
tip
}
$
{
checkProperty
?.
verifyExpression
?.
value
}
`
}
}
return ({
alertTypeName: item.checkRule?.alertTypeName,
alertTypeId: item.checkRule?.alertTypeId,
tip
})
})
}
return []
}, [validateReports, type, propertyName])
return (
<React.Fragment>
{
(reports??[]).length === 0 ? null : <Tooltip title={
<div>
{
(reports??[]).map((item, index) => (
<Row key={index}>
<Space>
{ (item.alertTypeId === 'enforced') ? <WarningOutlined style={{ color: '#E94848' }} /> : <ExclamationCircleOutlined style={{ color: '#F7AB00' }} /> }
<span>{item.tip}</span>
</Space>
</Row>
))
}
</div>
}>
{
(reports??[]).findIndex(item => item.alertTypeId === 'enforced') !== -1 ? <WarningOutlined style={{ color: '#E94848' }} /> : <ExclamationCircleOutlined style={{ color: '#F7AB00' }} />
}
</Tooltip>
}
</React.Fragment>
)
}
}
\ 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