Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
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
web_component
submodule
Commits
0880a177
Commit
0880a177
authored
Apr 09, 2020
by
满振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改searchView
parent
64395ea0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
7 deletions
+39
-7
index.js
components/DataView/index.js
+39
-6
index.js
components/SearchView/index.js
+0
-1
No files found.
components/DataView/index.js
View file @
0880a177
...
...
@@ -135,7 +135,7 @@ function changeDateRange(props, changedValues, allValues) {
return
allValues
;
}
function
formatSelect
(
val
,
options
)
{
export
function
formatSelect
(
val
,
options
)
{
if
(
Array
.
isArray
(
val
)
&&
val
.
length
>
0
)
{
return
val
.
map
((
item
)
=>
{
return
{
...
...
@@ -557,11 +557,37 @@ export default class DataView extends React.Component {
}
return
data
;
};
filterSubComChangeParams
=
(
key
)
=>
{
const
{
searchCols
,
advancedSearchCols
}
=
this
.
props
;
const
sumSearchCols
=
[...(
searchCols
||
[]),
...(
advancedSearchCols
||
[])];
let
fn
=
null
;
if
(
!
Array
.
isArray
(
sumSearchCols
))
return
null
;
const
filterFun
=
(
data
)
=>
{
if
(
data
.
key
===
key
&&
Object
.
prototype
.
toString
(
data
)
===
'[object Object]'
)
{
const
componentAttr
=
data
.
componentAttr
||
{};
const
onChangeParams
=
componentAttr
.
onChangeParams
;
if
(
onChangeParams
&&
typeof
onChangeParams
===
'function'
)
{
fn
=
onChangeParams
;
return
;
}
}
if
(
Array
.
isArray
(
data
))
{
data
.
map
(
ls
=>
filterFun
(
ls
));
}
}
filterFun
(
sumSearchCols
);
return
fn
;
}
// 更改查询条件
_changeSearchForm
=
(
props
,
changedValues
,
allValues
)
=>
{
const
newData
=
changeDateRange
(
props
,
changedValues
,
allValues
);
this
.
setState
({
_changeSearchForm
=
async
(
props
,
changedValues
,
allValues
)
=>
{
let
newData
=
changeDateRange
(
props
,
changedValues
,
allValues
);
// 回调配置项里面changeParams方法
const
onChangeParams
=
this
.
filterSubComChangeParams
(
Object
.
keys
(
changedValues
)[
0
]);
if
(
onChangeParams
)
{
newData
=
await
onChangeParams
(
changedValues
,
newData
)
||
newData
}
await
this
.
setState
({
searchForm
:
newData
,
currentSiftNum
:
0
,
});
...
...
@@ -596,9 +622,16 @@ export default class DataView extends React.Component {
};
// 删除指定搜索条件
_onRemoveItem
=
(
values
)
=>
{
_onRemoveItem
=
async
(
values
)
=>
{
const
{
searchForm
}
=
this
.
state
;
const
formData
=
removeItem
(
searchForm
,
values
);
let
formData
=
removeItem
(
searchForm
,
values
);
// 回调配置项里面changeParams方法
const
onChangeParams
=
this
.
filterSubComChangeParams
(
values
.
key
);
if
(
onChangeParams
)
{
const
obj
=
{}
obj
[
values
.
key
]
=
undefined
;
formData
=
await
onChangeParams
(
obj
,
formData
)
||
formData
}
this
.
setState
(
{
searchForm
:
formData
,
...
...
components/SearchView/index.js
View file @
0880a177
...
...
@@ -346,7 +346,6 @@ class SearchView extends React.Component {
if
(
this
.
props
.
modal
===
'modal'
)
{
return
this
.
_renderModalForm
(
col
);
}
return
(
<
div
className
=
{
styles
.
colInner
}
>
{
!!
label
&&
<
div
className
=
{
styles
.
label
}
>
{
label
}
<
/div>
}
...
...
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