fix: 修改table表格全选状态不正确&调整表格全选对齐样式

This commit is contained in:
xinxin.wu 2024-04-10 15:45:43 +08:00 committed by 刘瑞斌
parent e0bc4c67bc
commit 024495f85f
4 changed files with 29 additions and 3 deletions

View File

@ -33,6 +33,8 @@
v-if="attrs.selectorType === 'checkbox'"
:total="attrs.showPagination ? (attrs.msPagination as MsPaginationI).total : (attrs.data as MsTableDataItem<TableData>[]).length"
:selected-keys="props.selectedKeys"
:selector-status="props.selectorStatus"
:exclude-keys="[...props.excludeKeys]"
:current-data="attrs.data as Record<string,any>[]"
:show-select-all="!!attrs.showPagination && props.showSelectorAll"
:disabled="(attrs.data as []).length === 0"
@ -50,6 +52,7 @@
v-model:model-value="record.tableChecked"
@change="(val) => handleRadioChange(val as boolean, record)"
/>
<div v-if="attrs.showPagination" class="w-[16px]"></div>
</template>
</a-table-column>
<a-table-column

View File

@ -41,6 +41,8 @@
currentData: MsTableDataItem<Record<string, any>>[];
showSelectAll: boolean;
disabled: boolean;
selectorStatus: SelectAllEnum;
excludeKeys: string[];
}>(),
{
current: 0,
@ -52,7 +54,14 @@
const checked = computed({
get: () => {
return props.selectedKeys.size > 0 && props.selectedKeys.size === props.total;
if (props.selectorStatus !== 'all') {
return props.selectedKeys.size > 0 && props.selectedKeys.size === props.total;
}
if (props.selectorStatus === 'all') {
return !props.excludeKeys?.length
? true
: props.selectedKeys.size > 0 && props.selectedKeys.size === props.total;
}
},
set: (value) => {
return value;
@ -60,7 +69,12 @@
});
const indeterminate = computed(() => {
// 0
return props.selectedKeys.size > 0 && props.selectedKeys.size < props.total;
if (props.selectorStatus === 'current') {
return props.selectedKeys.size > 0 && props.selectedKeys.size < props.total;
}
if (props.selectorStatus === 'all') {
return !props.excludeKeys?.length ? false : props.selectedKeys.size > 0 && props.selectedKeys.size < props.total;
}
});
const handleSelect = (v: string | number | Record<string, any> | undefined) => {

View File

@ -203,6 +203,8 @@
sortIndex: 1,
fixed: 'left',
showTooltip: true,
showDrag: false,
columnSelectorDisabled: true,
},
{
title: 'project.taskCenter.resourceName',
@ -211,6 +213,7 @@
width: 300,
showDrag: false,
showTooltip: true,
columnSelectorDisabled: true,
},
{
title: 'system.project.name',
@ -219,6 +222,7 @@
showTooltip: true,
showDrag: true,
width: 200,
showInTable: false,
},
{
title: 'system.organization.organizationName',
@ -227,6 +231,7 @@
showTooltip: true,
showDrag: true,
width: 200,
showInTable: false,
},
{
title: 'project.taskCenter.executionResult',
@ -257,6 +262,7 @@
showInTable: true,
showDrag: true,
showTooltip: true,
width: 200,
},
{
title: 'project.taskCenter.operator',
@ -265,6 +271,7 @@
showInTable: true,
showDrag: true,
showTooltip: true,
width: 200,
},
{
title: 'project.taskCenter.operating',
@ -287,7 +294,7 @@
{
tableKey: TableKeyEnum.TASK_API_CASE,
scroll: {
x: '100%',
x: 1400,
},
showSetting: true,
selectable: true,

View File

@ -123,6 +123,7 @@
width: 140,
showInTable: true,
showTooltip: true,
columnSelectorDisabled: true,
},
{
title: 'project.taskCenter.resourceName',
@ -131,6 +132,7 @@
width: 200,
showDrag: true,
showTooltip: true,
columnSelectorDisabled: true,
},
{
title: 'project.taskCenter.resourceClassification',