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
e3eb3124
Commit
e3eb3124
authored
Jul 16, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高亮逻辑修改
parent
61325f2f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
10 deletions
+37
-10
index.js
src/util/index.js
+34
-3
MapContent.jsx
src/view/Manage/Map/MapContent.jsx
+2
-6
index.jsx
src/view/Manage/Model/index.jsx
+1
-1
No files found.
src/util/index.js
View file @
e3eb3124
...
@@ -183,14 +183,44 @@ function highlightSearchContent(content) {
...
@@ -183,14 +183,44 @@ function highlightSearchContent(content) {
)
)
}
}
export
function
searchContentAddDecorate
(
content
,
terms
)
{
if
(
!
content
||
content
===
''
)
return
''
;
if
((
terms
||
[]).
length
===
0
||
typeof
(
content
)
!==
'string'
)
return
content
;
let
start
=
-
1
;
let
useTerm
=
''
;
terms
.
forEach
(
term
=>
{
const
index
=
content
.
indexOf
(
term
);
if
(
index
!==
-
1
)
{
if
(
start
===
-
1
)
{
start
=
index
;
useTerm
=
term
;
}
else
if
(
index
<
start
)
{
start
=
index
;
useTerm
=
term
;
}
}
})
if
(
start
>
-
1
)
{
const
beforeStr
=
content
.
substr
(
0
,
start
);
const
middleStr
=
content
.
substr
(
start
,
useTerm
.
length
);
const
afterStr
=
content
.
substr
(
start
+
useTerm
.
length
);
return
`
${
beforeStr
}
<em>
${
middleStr
}
</em>
${
searchContentAddDecorate
(
afterStr
,
terms
)}
`
;
}
return
content
;
}
export
function
highlightSearchContentByTerms
(
content
,
terms
)
{
export
function
highlightSearchContentByTerms
(
content
,
terms
)
{
if
(
!
content
||
content
===
''
)
return
''
;
if
(
!
content
||
content
===
''
)
return
''
;
if
((
terms
||
[]).
length
===
0
||
typeof
(
content
)
!==
'string'
)
return
content
;
if
((
terms
||
[]).
length
===
0
||
typeof
(
content
)
!==
'string'
)
return
content
;
let
processContent
=
content
;
let
processContent
=
content
;
(
terms
||
[]).
forEach
(
term
=>
{
processContent
=
searchContentAddDecorate
(
processContent
,
terms
);
processContent
=
processContent
.
replace
(
term
,
`<em>
${
term
}
</em>`
);
})
return
highlightSearchContent
(
processContent
);
return
highlightSearchContent
(
processContent
);
}
}
\ No newline at end of file
src/view/Manage/Map/MapContent.jsx
View file @
e3eb3124
...
@@ -186,10 +186,6 @@ class MapContent extends React.Component {
...
@@ -186,10 +186,6 @@ class MapContent extends React.Component {
onSquareItemClick
=
(
item
)
=>
{
onSquareItemClick
=
(
item
)
=>
{
const
{
breadcrumbContents
}
=
this
.
state
;
const
{
breadcrumbContents
}
=
this
.
state
;
this
.
loadedRowsMap
=
{};
this
.
setState
({
breadcrumbContents
:
[...
breadcrumbContents
,
{
name
:
item
.
dirName
||
''
,
data
:
item
}]
},
()
=>
{
dispatchLatest
({
dispatchLatest
({
type
:
'map.getTableModelByDirIid'
,
type
:
'map.getTableModelByDirIid'
,
payload
:
{
payload
:
{
...
@@ -198,16 +194,16 @@ class MapContent extends React.Component {
...
@@ -198,16 +194,16 @@ class MapContent extends React.Component {
},
},
callback
:
data
=>
{
callback
:
data
=>
{
this
.
loadedRowsMap
=
{};
this
.
convertRemoteData
(
data
||
[],
item
.
id
,
item
.
dirId
);
this
.
convertRemoteData
(
data
||
[],
item
.
id
,
item
.
dirId
);
item
.
children
=
(
data
||
[]).
filter
(
item
=>
item
.
dbType
!==
'More'
);
item
.
children
=
(
data
||
[]).
filter
(
item
=>
item
.
dbType
!==
'More'
);
this
.
setState
({
this
.
setState
({
breadcrumbContents
:
[...
breadcrumbContents
,
{
name
:
item
.
dirName
||
''
,
data
:
item
}],
curTableModelData
:
item
.
children
||
[],
curTableModelData
:
item
.
children
||
[],
haveMoreData
:
(
item
.
children
||
[]).
length
===
defaultLoadCount
,
haveMoreData
:
(
item
.
children
||
[]).
length
===
defaultLoadCount
,
});
});
}
}
})
})
})
}
}
onBreadcrumbItemClick
=
(
content
,
index
)
=>
{
onBreadcrumbItemClick
=
(
content
,
index
)
=>
{
...
...
src/view/Manage/Model/index.jsx
View file @
e3eb3124
...
@@ -276,7 +276,7 @@ class Model extends React.Component {
...
@@ -276,7 +276,7 @@ class Model extends React.Component {
<
span
>
模型创建:
</
span
>
<
span
>
模型创建:
</
span
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelBtnClick
}
>
Excel导入
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelBtnClick
}
>
Excel导入
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelCopyBtnClick
}
>
Excel复制粘贴
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportExcelCopyBtnClick
}
>
Excel复制粘贴
</
Button
>
<
Button
type=
"primary"
onClick=
{
this
.
onImportDDLBtnClick
}
>
DDL导入
</
Button
>
{
/* <Button type="primary" onClick={this.onImportDDLBtnClick}>DDL导入</Button> */
}
</
Space
>
</
Space
>
<
Space
>
<
Space
>
<
span
>
模型导出:
</
span
>
<
span
>
模型导出:
</
span
>
...
...
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