【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框

pull/975/head
zhangdaiscott 2023-12-01 21:25:21 +08:00
parent 75bf9784e4
commit a67f074690
2 changed files with 17 additions and 3 deletions

View File

@ -1,10 +1,17 @@
<!-- 自定义选择列表头实现部分 -->
<template>
<!-- update-begin--author:liaozhiyang---date:20231130---forissues/5595BasicTable组件hideSelectAll: true无法隐藏全选框 -->
<template v-if="isRadio">
<!-- radio不存在全选所以放个空标签 -->
<span></span>
</template>
<a-checkbox :disabled="disabled" v-else :checked="checked" :indeterminate="isHalf" @update:checked="onChange" />
<template v-else>
<template v-if="hideSelectAll">
<span></span>
</template>
<a-checkbox :disabled="disabled" v-else :checked="checked" :indeterminate="isHalf" @update:checked="onChange" />
</template>
<!-- update-end--author:liaozhiyang---date:20231130---forissues/5595BasicTable组件hideSelectAll: true无法隐藏全选框 -->
</template>
<script setup lang="ts">
import { computed } from 'vue';
@ -23,6 +30,10 @@
type: Number,
required: true,
},
hideSelectAll: {
type: Boolean,
default: false,
},
// update-begin--author:liaozhiyang---date:20231016---forQQYUN-6774checkbox
disabled: {
type: Boolean,

View File

@ -123,6 +123,7 @@ export function useCustomSelection(
pageSize: currentPageSize.value,
// 【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
disabled: flattedData.value.length == 0,
hideSelectAll: unref(propsRef)?.rowSelection?.hideSelectAll,
};
});
@ -130,8 +131,10 @@ export function useCustomSelection(
watch(
() => unref(propsRef)?.rowSelection?.selectedRowKeys,
(val: string[]) => {
if (Array.isArray(val)) {
setSelectedRowKeys(val);
// 解决selectedRowKeys在页面调用处使用ref失效
const value = unref(val);
if (Array.isArray(value)) {
setSelectedRowKeys(value);
}
},
{ immediate: true }