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
bff71dbd
Commit
bff71dbd
authored
Mar 24, 2021
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改全选反选错传id的bug
parent
0b5999fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Column.tsx
components/apolloTable/component/Column.tsx
+7
-3
No files found.
components/apolloTable/component/Column.tsx
View file @
bff71dbd
...
...
@@ -44,18 +44,22 @@ export default class TableColumn extends PureComponent<ColumnProps> {
}
const
onToggle
=
()
=>
{
if
(
typeof
onChange
===
'function'
)
{
const
data
=
_
.
cloneDeep
(
selectIds
);
// 初始为传过来的选中数据
const
data
=
_
.
cloneDeep
(
selectedRows
);
dataSource
.
map
((
item
:
any
)
=>
{
// 当前操作是否操作了选中数据
const
index
=
data
.
findIndex
((
temp
:
any
)
=>
{
return
temp
===
item
.
id
;
return
temp
.
id
===
item
.
id
;
});
if
(
checked
)
{
// 反选,从data中删除
index
>
-
1
&&
data
.
splice
(
index
,
1
);
}
else
{
// 全选,data中没有的新增
index
===
-
1
&&
data
.
push
(
item
);
}
});
// data为最终选中的数据(此处使用完整数据不使用id,为了兼容之前的业务逻辑)
onChange
(
data
);
}
};
...
...
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