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
52eb2a4e
Commit
52eb2a4e
authored
Jun 29, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高亮
parent
0d341976
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
84 additions
and
26 deletions
+84
-26
App.js
src/App.js
+4
-1
index.js
src/util/index.js
+39
-0
AssetDetail.jsx
src/view/Manage/AssetManage/Component/AssetDetail.jsx
+2
-2
AssetDetailItem.jsx
src/view/Manage/AssetManage/Component/AssetDetailItem.jsx
+3
-2
ImportAction.jsx
src/view/Manage/Model/Component/ImportAction.jsx
+4
-1
ImportActionHeader.jsx
src/view/Manage/Model/Component/ImportActionHeader.jsx
+5
-4
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+8
-11
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+17
-3
ImportModal.jsx
src/view/Manage/Model/Component/ImportModal.jsx
+2
-2
No files found.
src/App.js
View file @
52eb2a4e
...
...
@@ -22,10 +22,11 @@ export default class App extends React.Component {
const
{
params
}
=
this
.
props
;
let
message
=
''
,
id
=
''
;
let
message
=
''
,
id
=
''
,
terms
=
[]
;
if
(
params
)
{
message
=
params
.
message
||
''
;
id
=
params
.
id
||
''
;
terms
=
params
.
terms
||
[];
}
if
(
message
===
'showDataModelDetail'
)
{
...
...
@@ -34,6 +35,7 @@ export default class App extends React.Component {
modelerId
=
{
id
}
reference
=
'search'
action
=
'detail'
terms
=
{
terms
}
visible
=
{
true
}
/
>
);
...
...
@@ -45,6 +47,7 @@ export default class App extends React.Component {
id
=
{
id
}
reference
=
'search'
action
=
'detail'
terms
=
{
terms
}
visible
=
{
true
}
/
>
);
...
...
src/util/index.js
View file @
52eb2a4e
...
...
@@ -146,3 +146,41 @@ export const getQueryParam = (param, url) => {
if
(
!
results
[
2
])
return
''
return
decodeURIComponent
(
results
[
2
].
replace
(
/
\+
/g
,
' '
))
}
function
highlightSearchContent
(
content
)
{
if
(
content
===
null
||
content
===
''
)
return
''
;
const
startFlag
=
'<em>'
;
const
endFlag
=
'</em>'
;
const
start
=
content
.
indexOf
(
startFlag
);
const
end
=
content
.
indexOf
(
endFlag
);
const
beforeStr
=
content
.
substr
(
0
,
start
);
const
middleStr
=
content
.
substr
(
start
+
startFlag
.
length
,
end
-
start
-
startFlag
.
length
);
const
afterStr
=
content
.
substr
(
end
+
endFlag
.
length
);
return
(
<>
{
start
>
-
1
?
<
span
>
{
beforeStr
}
<
span
style
=
{{
color
:
'#f50'
}}
>
{
middleStr
}
<
/span
>
{
highlightSearchContent
(
afterStr
)}
<
/span> : <span>{content}</
span
>
}
<
/
>
)
}
export
function
highlightSearchContentByTerms
(
content
,
terms
)
{
if
(
content
===
null
||
content
===
''
)
return
''
;
if
((
terms
||
[]).
length
===
0
)
return
content
;
let
processContent
=
content
;
(
terms
||
[]).
forEach
(
term
=>
{
processContent
=
processContent
.
replace
(
term
,
`<em>
${
term
}
</em>`
);
})
return
highlightSearchContent
(
processContent
);
}
\ No newline at end of file
src/view/Manage/AssetManage/Component/AssetDetail.jsx
View file @
52eb2a4e
...
...
@@ -6,7 +6,7 @@ import { dispatch } from '../../../../model';
const
AssetDetail
=
(
props
)
=>
{
const
{
onCancel
,
visible
,
id
,
reference
=
null
}
=
props
;
const
{
onCancel
,
visible
,
id
,
reference
=
null
,
terms
}
=
props
;
const
[
asset
,
setAsset
]
=
useState
(
''
);
const
[
assetName
,
setAssetName
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
...
...
@@ -70,7 +70,7 @@ const AssetDetail = (props)=>{
}
{
reference
&&
<
Spin
spinning=
{
loading
}
>
<
AssetDetailItem
data=
{
asset
}
/>
<
AssetDetailItem
data=
{
asset
}
terms=
{
terms
}
/>
</
Spin
>
}
</>
...
...
src/view/Manage/AssetManage/Component/AssetDetailItem.jsx
View file @
52eb2a4e
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Avatar
,
Row
,
Col
,
Typography
,
Divider
}
from
'antd'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
'./AssetItem.less'
;
const
colors
=
[
...
...
@@ -17,7 +18,7 @@ const colors = [
const
AssetItem
=
(
props
)
=>
{
const
{
data
}
=
props
;
const
{
data
,
terms
}
=
props
;
const
[
typesOfElements
,
setTypesOfElements
]
=
useState
([]);
useEffect
(()
=>
{
...
...
@@ -68,7 +69,7 @@ const AssetItem = (props) => {
return
(
<
Col
className=
'mt-3'
key=
{
_index
}
md=
{
8
}
>
<
Typography
.
Paragraph
title=
{
`${element.name||''}: ${element.value||''}`
}
ellipsis
>
{
`${element.name||''}:
${element.value||''}`
}
{
`${element.name||''}:
`
}{
highlightSearchContentByTerms
(
element
.
value
||
''
,
terms
)
}
</
Typography
.
Paragraph
>
</
Col
>
);
...
...
src/view/Manage/Model/Component/ImportAction.jsx
View file @
52eb2a4e
...
...
@@ -10,7 +10,7 @@ import { dispatchLatest, dispatch } from '../../../../model';
const
{
Option
}
=
Select
;
const
ImportAction
=
(
props
)
=>
{
const
{
action
,
hints
,
onChange
,
form
,
modelerId
}
=
props
;
const
{
action
,
hints
,
onChange
,
form
,
modelerId
,
terms
}
=
props
;
const
[
constraints
,
setConstraints
]
=
useState
([]);
const
[
constraint
,
setConstraint
]
=
useState
({});
...
...
@@ -277,6 +277,7 @@ const ImportAction = (props) => {
validateReports=
{
validateReports
}
onTemplateChange=
{
onTemplateChange
}
onChange=
{
onHeaderChange
}
terms=
{
terms
}
/>
<
ImportActionTable
modelerData=
{
modelerData
||
{}
}
...
...
@@ -286,6 +287,7 @@ const ImportAction = (props) => {
supportedDatatypes=
{
supportedDatatypes
}
onChange=
{
onTableChange
}
editable=
{
action
!==
'detail'
}
terms=
{
terms
}
/>
<
ImportActionIndex
modelerData=
{
modelerData
||
{}
}
...
...
@@ -294,6 +296,7 @@ const ImportAction = (props) => {
validateReports=
{
validateReports
}
onChange=
{
onIndexChange
}
editable=
{
action
!==
'detail'
}
terms=
{
terms
}
/>
</
Spin
>
);
...
...
src/view/Manage/Model/Component/ImportActionHeader.jsx
View file @
52eb2a4e
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
Row
,
Col
,
Descriptions
,
Select
,
AutoComplete
}
from
'antd'
;
import
{
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
dispatch
}
from
'../../../../model'
;
const
{
Option
}
=
Select
;
...
...
@@ -26,7 +27,7 @@ const TemplateSelect = ({ value = {}, templates = [], onChange, ...restProps })
}
const
ImportActionHeader
=
(
props
)
=>
{
const
{
editable
,
form
,
modelerData
,
templates
,
onTemplateChange
,
validateReports
,
onChange
}
=
props
;
const
{
editable
,
form
,
modelerData
,
templates
,
onTemplateChange
,
validateReports
,
onChange
,
terms
}
=
props
;
const
[
causes
,
setCauses
]
=
useState
([]);
const
[
options
,
setOptions
]
=
useState
([]);
...
...
@@ -167,11 +168,11 @@ const ImportActionHeader = (props) => {
</
Form
>
)
:
(
<
Descriptions
>
<
Descriptions
.
Item
label=
"中文名称"
>
{
modelerData
.
cnName
||
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"中文名称"
>
{
highlightSearchContentByTerms
(
modelerData
.
cnName
||
''
,
terms
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"英文名称"
>
{
<
div
>
<
div
>
{
modelerData
.
name
||
''
}
</
div
>
<
div
>
{
highlightSearchContentByTerms
(
modelerData
.
name
||
''
,
terms
)
}
</
div
>
{
(
causes
||
[]).
map
((
cause
,
index
)
=>
{
return
(
...
...
@@ -186,7 +187,7 @@ const ImportActionHeader = (props) => {
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"数据表类型"
>
{
modelerData
.
easyDataModelerModelingTemplate
?(
modelerData
.
easyDataModelerModelingTemplate
.
cnName
||
''
):
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"描述"
>
{
modelerData
.
remark
||
''
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"描述"
>
{
highlightSearchContentByTerms
(
modelerData
.
remark
||
''
,
terms
)
}
</
Descriptions
.
Item
>
</
Descriptions
>
)
)
...
...
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
52eb2a4e
...
...
@@ -6,7 +6,7 @@ import { HTML5Backend } from 'react-dnd-html5-backend';
import
update
from
'immutability-helper'
;
import
'./ImportActionIndex.less'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
showMessage
,
highlightSearchContentByTerms
}
from
'../../../../util'
;
const
{
Option
}
=
Select
;
...
...
@@ -259,7 +259,7 @@ const DragableBodyRow = ({ index, moveRow, className, style, ...restProps }) =>
};
const
ImportActionIndex
=
(
props
)
=>
{
const
{
modelerData
,
onChange
,
editable
,
constraint
,
template
,
validateReports
}
=
props
;
const
{
modelerData
,
onChange
,
editable
,
constraint
,
template
,
validateReports
,
terms
}
=
props
;
const
[
attributes
,
setAttributes
]
=
useState
([]);
const
[
data
,
setData
]
=
useState
([]);
...
...
@@ -425,7 +425,7 @@ const ImportActionIndex = (props) => {
ellipsis
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
return
(
<
span
style=
{
{
fontWeight
:
'bold'
}
}
>
{
text
}
</
span
>
<
span
style=
{
{
fontWeight
:
'bold'
}
}
>
{
highlightSearchContentByTerms
(
text
,
terms
)
}
</
span
>
)
}
},
...
...
@@ -462,10 +462,12 @@ const ImportActionIndex = (props) => {
const
order
=
record
.
indexedAttributeOrders
[
index
]
||
''
;
const
_text
=
`字段: ${item.name||''} 排序: ${order||''}`
;
return
(
<
Row
key=
{
index
}
><
span
>
{
_text
}
</
span
></
Row
>
<
Row
key=
{
index
}
>
<
span
>
字段:
</
span
>
{
highlightSearchContentByTerms
(
item
.
name
||
''
,
terms
)
}
<
span
>
{
` 排序: ${order||''}`
}
</
span
>
</
Row
>
)
})
}
...
...
@@ -473,11 +475,6 @@ const ImportActionIndex = (props) => {
);
}
},
{
title
:
''
,
dataIndex
:
''
,
width
:
200
,
}
];
const
editableColumn
=
[
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
52eb2a4e
...
...
@@ -5,7 +5,7 @@ import { DndProvider, useDrag, useDrop } from 'react-dnd';
import
{
HTML5Backend
}
from
'react-dnd-html5-backend'
;
import
update
from
'immutability-helper'
;
import
{
generateUUID
}
from
'../../../../util'
;
import
{
generateUUID
,
highlightSearchContentByTerms
}
from
'../../../../util'
;
import
{
dispatchLatest
}
from
'../../../../model'
;
import
'./ImportActionTable.less'
;
...
...
@@ -219,7 +219,7 @@ const DragableBodyRow = ({ index, moveRow, className, style, ...restProps }) =>
};
const
ImportActionTable
=
(
props
)
=>
{
const
{
modelerData
,
onChange
,
editable
,
supportedDatatypes
,
constraint
,
template
,
validateReports
,
type
=
'model'
}
=
props
;
const
{
modelerData
,
onChange
,
editable
,
supportedDatatypes
,
constraint
,
template
,
validateReports
,
type
=
'model'
,
terms
}
=
props
;
const
[
data
,
setData
]
=
useState
([]);
const
[
form
]
=
Form
.
useForm
();
...
...
@@ -424,6 +424,13 @@ const ImportActionTable = (props) => {
dataIndex
:
'cnName'
,
editable
:
true
,
ellipsis
:
true
,
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
span
>
{
highlightSearchContentByTerms
(
text
,
terms
)
}
</
span
>
)
}
},
{
title
:
'英文名称'
,
...
...
@@ -433,7 +440,7 @@ const ImportActionTable = (props) => {
ellipsis
:
true
,
render
:
(
text
,
record
,
index
)
=>
{
return
(
<
span
style=
{
{
fontWeight
:
'bold'
}
}
>
{
text
}
</
span
>
<
span
style=
{
{
fontWeight
:
'bold'
}
}
>
{
highlightSearchContentByTerms
(
text
,
terms
)
}
</
span
>
)
}
},
...
...
@@ -529,6 +536,13 @@ const ImportActionTable = (props) => {
dataIndex
:
'remark'
,
editable
:
true
,
ellipsis
:
true
,
render
:
(
text
,
_
,
__
)
=>
{
return
(
<
span
>
{
highlightSearchContentByTerms
(
text
,
terms
)
}
</
span
>
)
}
},
];
...
...
src/view/Manage/Model/Component/ImportModal.jsx
View file @
52eb2a4e
...
...
@@ -11,7 +11,7 @@ import { dispatchLatest } from '../../../../model';
import
{
showMessage
}
from
'../../../../util'
;
const
ImportModal
=
(
props
)
=>
{
const
{
catalogId
,
visible
,
onCancel
,
action
,
addMode
,
modelerId
,
reference
=
null
}
=
props
;
const
{
catalogId
,
visible
,
onCancel
,
action
,
addMode
,
modelerId
,
reference
=
null
,
terms
}
=
props
;
const
[
step
,
setStep
]
=
useState
(
0
);
const
[
excelFiles
,
setExcelFiles
]
=
useState
([]);
const
[
hints
,
setHints
]
=
useState
([]);
...
...
@@ -259,7 +259,7 @@ const ImportModal = (props) => {
</
Modal
>
}
{
reference
===
'search'
&&
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
/>
reference
===
'search'
&&
<
ImportAction
hints=
{
hints
}
onChange=
{
onActionChange
}
action=
{
action
}
modelerId=
{
modelerId
}
form=
{
form
}
terms=
{
terms
}
/>
}
</>
)
...
...
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