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
ce68e3de
Commit
ce68e3de
authored
Nov 27, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型校验规范
parent
666a8e31
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
167 deletions
+42
-167
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+7
-5
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+7
-72
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+28
-90
No files found.
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
ce68e3de
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
,
Button
,
Divider
,
Tooltip
,
Checkbox
,
Space
}
from
'antd'
;
import
{
DownOutlined
,
UpOutlined
,
ExclamationCircle
Outlined
,
WarningOutlin
ed
}
from
'@ant-design/icons'
;
import
{
DownOutlined
,
UpOutlined
,
ExclamationCircle
Filled
,
WarningFill
ed
}
from
'@ant-design/icons'
;
import
{
Subject
}
from
'rxjs'
;
import
{
highlightSearchContentByTerms
,
generateUUID
,
IsArr
}
from
'../../../../util'
;
...
...
@@ -868,9 +868,11 @@ const ItemTitle = ({ name, cnName, validateReports }) => {
)
}
export
const
ValidateTip
=
({
validateReports
,
type
,
propertyName
})
=>
{
export
const
ValidateTip
=
({
validateReports
,
type
,
propertyName
,
iid
})
=>
{
const
reports
=
useMemo
(()
=>
{
const
index
=
(
validateReports
??[]).
findIndex
(
item
=>
item
.
type
===
type
)
const
index
=
(
validateReports
??[]).
findIndex
(
item
=>
(
(
item
.
type
===
type
)
&&
(
!
item
.
iid
||
item
.
iid
===
iid
)
))
if
(
index
!==
-
1
)
{
const
items
=
(
validateReports
[
index
].
reportItems
??[]).
filter
(
item
=>
item
.
checkRule
?.
ruleTemplate
?.
checkProperty
?.
originalPropertyEnName
===
propertyName
)
...
...
@@ -916,7 +918,7 @@ export const ValidateTip = ({ validateReports, type, propertyName }) => {
(reports??[]).map((item, index) => (
<Row key={index}>
<Space>
{ (item.alertTypeId === 'enforced') ? <Warning
Outlined style={{ color: '#E94848' }} /> : <ExclamationCircleOutlin
ed style={{ color: '#F7AB00' }} /> }
{ (item.alertTypeId === 'enforced') ? <Warning
Filled style={{ color: '#E94848' }} /> : <ExclamationCircleFill
ed style={{ color: '#F7AB00' }} /> }
<span>{item.tip}</span>
</Space>
</Row>
...
...
@@ -925,7 +927,7 @@ export const ValidateTip = ({ validateReports, type, propertyName }) => {
</div>
}>
{
(reports??[]).findIndex(item => item.alertTypeId === 'enforced') !== -1 ? <Warning
Outlined style={{ color: '#E94848' }} /> : <ExclamationCircleOutlin
ed style={{ color: '#F7AB00' }} />
(reports??[]).findIndex(item => item.alertTypeId === 'enforced') !== -1 ? <Warning
Filled style={{ color: '#E94848' }} /> : <ExclamationCircleFill
ed style={{ color: '#F7AB00' }} />
}
</Tooltip>
}
...
...
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
ce68e3de
...
...
@@ -11,6 +11,7 @@ import DebounceInput from './DebounceInput';
import
{
addEventListenerForSidebar
,
removeEventListenerForSidebar
}
from
'./Help'
;
import
{
showMessage
,
highlightSearchContentByTerms
,
inputWidth
}
from
'../../../../util'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
import
{
ValidateTip
}
from
'./ImportActionHeader'
;
const
{
Option
}
=
Select
;
...
...
@@ -666,9 +667,12 @@ const ImportActionIndex = (props) => {
ellipsis
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
return
(
<
React
.
Fragment
>
<
ValidateTip
type=
'Index'
propertyName=
'name'
validateReports=
{
validateReports
}
iid=
{
record
.
name
}
/>
<
Tooltip
title=
{
text
||
''
}
>
<
span
style=
{
{
fontWeight
:
'bold'
}
}
>
{
highlightSearchContentByTerms
(
text
,
termsRef
.
current
)
}
</
span
>
<
span
>
{
highlightSearchContentByTerms
(
text
,
termsRef
.
current
)
}
</
span
>
</
Tooltip
>
</
React
.
Fragment
>
)
}
},
...
...
@@ -772,79 +776,10 @@ const ImportActionIndex = (props) => {
},
]
const
validateColumn
=
{
title
:
'规范'
,
dataIndex
:
'validate'
,
width
:
180
,
ellipsis
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
let
shortCauses
=
[];
let
causes
=
[];
(
validateReports
||
[]).
forEach
((
report
)
=>
{
if
(
report
.
type
===
'Index'
&&
report
.
iid
===
record
.
name
)
{
(
report
.
reportItems
||
[]).
forEach
((
item
)
=>
{
shortCauses
.
push
(
item
.
shortCause
||
''
);
causes
.
push
(
item
.
cause
||
''
);
})
}
});
return
(
<
div
className=
'd-flex'
key=
{
index
}
style=
{
{
alignItems
:
'center'
,
justifyContent
:
'space-between'
}
}
>
<
div
>
{
shortCauses
&&
shortCauses
.
map
((
shortCause
,
index
)
=>
{
return
(
<
Tooltip
key=
{
index
}
title=
{
shortCause
}
>
<
div
className=
'textOverflow'
style=
{
{
width
:
130
,
color
:
'#f5222d'
}
}
title=
{
shortCause
}
key=
{
index
}
>
<
span
>
{
shortCause
||
''
}
</
span
>
</
div
>
</
Tooltip
>
);
})
}
</
div
>
{
(
causes
||
[]).
length
>
0
&&
<
Popover
content=
{
<
div
style=
{
{
maxWidth
:
200
,
maxHeight
:
200
,
wordWrap
:
'break-word'
,
overflow
:
'auto'
}
}
>
{
causes
&&
causes
.
map
((
cause
,
index
)
=>
{
return
(
<
Typography
.
Paragraph
key=
{
index
}
>
{
cause
||
''
}
</
Typography
.
Paragraph
>
)
})
}
</
div
>
}
title=
"规则详情"
>
<
a
href=
"#"
>
详情
</
a
>
</
Popover
>
}
</
div
>
)
}
};
const
includeValidateColumn
=
[
...
columns
,
validateColumn
]
const
includeValidateEditableColumn
=
[
...
editableColumn
,
validateColumn
]
const
mergedColumns
=
()
=>
{
const
hasValidateReports
=
(
validateReports
||
[]).
filter
(
report
=>
report
.
type
===
'Index'
).
length
>
0
;
if
(
editable
)
{
let
_columns
=
hasValidateReports
?
includeValidateEditableColumn
:
editableColumn
;
let
_columns
=
editableColumn
;
return
_columns
.
map
((
col
)
=>
{
if
(
!
col
.
editable
)
{
...
...
@@ -866,7 +801,7 @@ const ImportActionIndex = (props) => {
});
}
return
hasValidateReports
?
includeValidateColumn
:
columns
;
return
columns
;
}
const
moveRow
=
useCallback
(
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
ce68e3de
...
...
@@ -17,6 +17,7 @@ import DebounceInput from './DebounceInput';
import
SuggestTable
from
'./SuggestTable'
;
import
{
AttentionSvg
,
UnAttentionSvg
}
from
'./ModelSvg'
;
import
{
EditModelContext
}
from
'./ContextManage'
;
import
{
ValidateTip
}
from
'./ImportActionHeader'
;
import
'./ImportActionTable.less'
;
import
'react-contexify/dist/ReactContexify.css'
;
...
...
@@ -312,13 +313,14 @@ export const ImportActionTable = (props) => {
ellipsis
:
true
,
require
:
true
,
fixed
:
'left'
,
render
:
(
text
,
_
,
__
)
=>
{
render
:
(
text
,
record
,
__
)
=>
{
return
(
<
React
.
Fragment
>
<
ValidateTip
type=
'DataModelAttribute'
propertyName=
'cnName'
validateReports=
{
validateReports
}
iid=
{
record
.
iid
}
/>
<
Tooltip
title=
{
text
||
''
}
>
<
span
>
{
highlightSearchContentByTerms
(
text
,
termsRef
.
current
)
}
</
span
>
<
span
>
{
highlightSearchContentByTerms
(
text
,
termsRef
.
current
)
}
</
span
>
</
Tooltip
>
</
React
.
Fragment
>
)
}
},
...
...
@@ -331,9 +333,12 @@ export const ImportActionTable = (props) => {
require
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
return
(
<
React
.
Fragment
>
<
ValidateTip
type=
'DataModelAttribute'
propertyName=
'name'
validateReports=
{
validateReports
}
iid=
{
record
.
iid
}
/>
<
Tooltip
title=
{
text
||
''
}
>
<
span
style=
{
{
fontWeight
:
'bold'
}
}
>
{
highlightSearchContentByTerms
(
text
,
termsRef
.
current
)
}
</
span
>
<
span
>
{
highlightSearchContentByTerms
(
text
,
termsRef
.
current
)
}
</
span
>
</
Tooltip
>
</
React
.
Fragment
>
)
}
},
...
...
@@ -436,13 +441,14 @@ export const ImportActionTable = (props) => {
ellipsis: true,
require: true,
width: 200,
render: (text,
_
, __) => {
render: (text,
record
, __) => {
return (
<React.Fragment>
<ValidateTip type='DataModelAttribute' propertyName='remark' validateReports={validateReports} iid={record.iid} />
<Tooltip title={text||''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(text, termsRef.current)}
</Typography.Text>
<span>{highlightSearchContentByTerms(text, termsRef.current)}</span>
</Tooltip>
</React.Fragment>
)
}
},
...
...
@@ -468,13 +474,14 @@ export const ImportActionTable = (props) => {
editable: true,
ellipsis: true,
width: 200,
render: (text,
_
, __) => {
render: (text,
record
, __) => {
return (
<React.Fragment>
<ValidateTip type='DataModelAttribute' propertyName='definition' validateReports={validateReports} iid={record.iid} />
<Tooltip title={text||''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(text, termsRef.current)}
</Typography.Text>
<span>{highlightSearchContentByTerms(text, termsRef.current)}</span>
</Tooltip>
</React.Fragment>
)
}
},
...
...
@@ -484,13 +491,14 @@ export const ImportActionTable = (props) => {
editable: true,
ellipsis: true,
width: 100,
render: (text,
_
, __) => {
render: (text,
record
, __) => {
return (
<React.Fragment>
<ValidateTip type='DataModelAttribute' propertyName='valueRange' validateReports={validateReports} iid={record.iid} />
<Tooltip title={text||''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(text, termsRef.current)}
</Typography.Text>
<span>{highlightSearchContentByTerms(text, termsRef.current)}</span>
</Tooltip>
</React.Fragment>
)
}
},
...
...
@@ -1026,79 +1034,9 @@ export const ImportActionTable = (props) => {
},
]
const validateColumn = {
title: '规范',
dataIndex: 'validate',
//小屏幕下隐藏规范, 给编辑多点空间
width: (tableWidth<1300 && editable)?0:200,
fixed: 'right',
render: (text, record, index) => {
let shortCauses = [];
let causes = [];
(validateReports||[]).forEach((report) => {
if (report.type==='DataModelAttribute' && report.iid === record.iid) {
(report.reportItems||[]).forEach((item) => {
shortCauses.push(item.shortCause||'');
causes.push(item.cause||'');
})
}
});
return (
<div className='d-flex' key={index} style={{ alignItems: 'center', justifyContent: 'space-between' }}>
<div>
{
shortCauses && shortCauses.map((shortCause, index) => {
return (
<Tooltip title={shortCause}>
<div className='textOverflow' style={{ width: 130, color: '#f5222d' }} key={index}>
<span>{shortCause||''}</span>
</div>
</Tooltip>
);
})
}
</div>
{
(causes||[]).length>0 && <Popover
content={
<div style={{ maxWidth: 200, maxHeight: 200, wordWrap: 'break-word', overflow: 'auto' }}>
{
causes && causes.map((cause, index) => {
return (
<Typography.Paragraph key={index} >
{cause||''}
</Typography.Paragraph>
)
})
}
</div>
}
title="规则详情"
>
<a href="#">详情</a>
</Popover>
}
</div>
)
}
};
const includeValidateColumn = [
...cols,
validateColumn
]
const includeValidateEditableColumn = [
...editableColumn,
validateColumn
]
const mergedColumns = () => {
const hasValidateReports = (validateReports||[]).filter(report => report.type==='DataModelAttribute').length>0;
if (editable) {
let _columns =
hasValidateReports ? includeValidateEditableColumn:
editableColumn;
let _columns = editableColumn;
_columns = _columns.map((col) => {
if (!col.editable) {
...
...
@@ -1140,10 +1078,10 @@ export const ImportActionTable = (props) => {
setColumns(_columns);
} else {
let _columns =
hasValidateReports ? includeValidateColumn:
cols;
let _columns = cols;
if (action === 'flow') {
_columns =
hasValidateReports ? includeValidateEditableColumn:
editableColumn;
_columns = editableColumn;
}
// _columns = _columns.filter((col) => col.dataIndex!=='needAttention');
...
...
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