Commit 253d1568 authored by manzhenhua's avatar manzhenhua

Merge branch 'master' of http://apollo.mttop.cn/gitlab/web_component/submodule into master

parents 6f15f588 bff71dbd
...@@ -44,18 +44,22 @@ export default class TableColumn extends PureComponent<ColumnProps> { ...@@ -44,18 +44,22 @@ export default class TableColumn extends PureComponent<ColumnProps> {
} }
const onToggle = () => { const onToggle = () => {
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
const data = _.cloneDeep(selectIds); // 初始为传过来的选中数据
const data = _.cloneDeep(selectedRows);
dataSource.map((item: any) => { dataSource.map((item: any) => {
// 当前操作是否操作了选中数据
const index = data.findIndex((temp: any) => { const index = data.findIndex((temp: any) => {
return temp === item.id; return temp.id === item.id;
}); });
if (checked) { if (checked) {
// 反选,从data中删除
index > -1 && data.splice(index, 1); index > -1 && data.splice(index, 1);
} else { } else {
// 全选,data中没有的新增
index === -1 && data.push(item); index === -1 && data.push(item);
} }
}); });
// data为最终选中的数据(此处使用完整数据不使用id,为了兼容之前的业务逻辑)
onChange(data); onChange(data);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment