【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框
parent
75bf9784e4
commit
a67f074690
|
@ -1,10 +1,17 @@
|
||||||
<!-- 自定义选择列,表头实现部分 -->
|
<!-- 自定义选择列,表头实现部分 -->
|
||||||
<template>
|
<template>
|
||||||
|
<!-- update-begin--author:liaozhiyang---date:20231130---for:【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框 -->
|
||||||
<template v-if="isRadio">
|
<template v-if="isRadio">
|
||||||
<!-- radio不存在全选,所以放个空标签 -->
|
<!-- radio不存在全选,所以放个空标签 -->
|
||||||
<span></span>
|
<span></span>
|
||||||
</template>
|
</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---for:【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框 -->
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
@ -23,6 +30,10 @@
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
hideSelectAll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
// update-begin--author:liaozhiyang---date:20231016---for:【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
|
// update-begin--author:liaozhiyang---date:20231016---for:【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
@ -123,6 +123,7 @@ export function useCustomSelection(
|
||||||
pageSize: currentPageSize.value,
|
pageSize: currentPageSize.value,
|
||||||
// 【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
|
// 【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
|
||||||
disabled: flattedData.value.length == 0,
|
disabled: flattedData.value.length == 0,
|
||||||
|
hideSelectAll: unref(propsRef)?.rowSelection?.hideSelectAll,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -130,8 +131,10 @@ export function useCustomSelection(
|
||||||
watch(
|
watch(
|
||||||
() => unref(propsRef)?.rowSelection?.selectedRowKeys,
|
() => unref(propsRef)?.rowSelection?.selectedRowKeys,
|
||||||
(val: string[]) => {
|
(val: string[]) => {
|
||||||
if (Array.isArray(val)) {
|
// 解决selectedRowKeys在页面调用处使用ref失效
|
||||||
setSelectedRowKeys(val);
|
const value = unref(val);
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
setSelectedRowKeys(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|
Loading…
Reference in New Issue