diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index 3be0d862..18a83437 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -263,18 +263,18 @@ watch( { deep: true } ); -const changeAll = (checked: any) => { - const ids = props.dataSource.map((item: any) => { - return item[props.id]; - }); - let arr = [...tableSelectedKeys.value]; - arr.splice(0, ids.length); - if (checked) { - ids.forEach((id) => { - arr.push(id); +const changeAll = (isChecked: boolean) => { + // Selected + if(isChecked) { + const datasources = props.dataSource.filter((item: any, index: number) => { + return !props.getCheckboxProps(item, index).disabled; }); - } - tableSelectedKeys.value = arr; + const ids = datasources.map((item) => {return item[props.id]}); + tableSelectedKeys.value = [...ids]; + } else { + // unSelected + tableSelectedKeys.value = []; + } }; watch( diff --git a/package/component/src/component/transfer/index.vue b/package/component/src/component/transfer/index.vue index f781fd74..d64b8f77 100644 --- a/package/component/src/component/transfer/index.vue +++ b/package/component/src/component/transfer/index.vue @@ -48,12 +48,12 @@ const hasRightChecked = ref(false); const allLeftChange = (isChecked: boolean) => { if (isChecked) { - const ids = leftDataSource.value.map((item: any) => { - if(!item.disabled) { - return item[props.id]; - } + const datasources = leftDataSource.value.filter((item: any) => { + return !item.disabled }); - leftSelectedKeys.value = ids; + const ids = datasources.map((item) => {return item[props.id]}); + console.log(JSON.stringify(ids)) + leftSelectedKeys.value = [...ids]; } else { leftSelectedKeys.value = []; } @@ -81,12 +81,12 @@ watch( const allRightChange = (checked: any) => { if (checked) { - const ids = rightDataSource.value.map((item: any) => { - if(!item.disabled) { - return item[props.id]; - } + const datasources = rightDataSource.value.filter((item: any) => { + return !item.disabled }); - rightSelectedKeys.value = ids; + const ids = datasources.map((item) => { return item[props.id]}) + console.log(JSON.stringify(ids)) + rightSelectedKeys.value = [...ids]; } else { rightSelectedKeys.value = []; }