fix: 修改table表格全选状态不正确&调整表格全选对齐样式
This commit is contained in:
parent
e0bc4c67bc
commit
024495f85f
|
@ -33,6 +33,8 @@
|
||||||
v-if="attrs.selectorType === 'checkbox'"
|
v-if="attrs.selectorType === 'checkbox'"
|
||||||
:total="attrs.showPagination ? (attrs.msPagination as MsPaginationI).total : (attrs.data as MsTableDataItem<TableData>[]).length"
|
:total="attrs.showPagination ? (attrs.msPagination as MsPaginationI).total : (attrs.data as MsTableDataItem<TableData>[]).length"
|
||||||
:selected-keys="props.selectedKeys"
|
:selected-keys="props.selectedKeys"
|
||||||
|
:selector-status="props.selectorStatus"
|
||||||
|
:exclude-keys="[...props.excludeKeys]"
|
||||||
:current-data="attrs.data as Record<string,any>[]"
|
:current-data="attrs.data as Record<string,any>[]"
|
||||||
:show-select-all="!!attrs.showPagination && props.showSelectorAll"
|
:show-select-all="!!attrs.showPagination && props.showSelectorAll"
|
||||||
:disabled="(attrs.data as []).length === 0"
|
:disabled="(attrs.data as []).length === 0"
|
||||||
|
@ -50,6 +52,7 @@
|
||||||
v-model:model-value="record.tableChecked"
|
v-model:model-value="record.tableChecked"
|
||||||
@change="(val) => handleRadioChange(val as boolean, record)"
|
@change="(val) => handleRadioChange(val as boolean, record)"
|
||||||
/>
|
/>
|
||||||
|
<div v-if="attrs.showPagination" class="w-[16px]"></div>
|
||||||
</template>
|
</template>
|
||||||
</a-table-column>
|
</a-table-column>
|
||||||
<a-table-column
|
<a-table-column
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
currentData: MsTableDataItem<Record<string, any>>[];
|
currentData: MsTableDataItem<Record<string, any>>[];
|
||||||
showSelectAll: boolean;
|
showSelectAll: boolean;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
selectorStatus: SelectAllEnum;
|
||||||
|
excludeKeys: string[];
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
current: 0,
|
current: 0,
|
||||||
|
@ -52,7 +54,14 @@
|
||||||
|
|
||||||
const checked = computed({
|
const checked = computed({
|
||||||
get: () => {
|
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) => {
|
set: (value) => {
|
||||||
return value;
|
return value;
|
||||||
|
@ -60,7 +69,12 @@
|
||||||
});
|
});
|
||||||
const indeterminate = computed(() => {
|
const indeterminate = computed(() => {
|
||||||
// 已选中的数量大于 0 且小于总数时是半选状态
|
// 已选中的数量大于 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) => {
|
const handleSelect = (v: string | number | Record<string, any> | undefined) => {
|
||||||
|
|
|
@ -203,6 +203,8 @@
|
||||||
sortIndex: 1,
|
sortIndex: 1,
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
showDrag: false,
|
||||||
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.taskCenter.resourceName',
|
title: 'project.taskCenter.resourceName',
|
||||||
|
@ -211,6 +213,7 @@
|
||||||
width: 300,
|
width: 300,
|
||||||
showDrag: false,
|
showDrag: false,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.project.name',
|
title: 'system.project.name',
|
||||||
|
@ -219,6 +222,7 @@
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
|
showInTable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.organization.organizationName',
|
title: 'system.organization.organizationName',
|
||||||
|
@ -227,6 +231,7 @@
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
|
showInTable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.taskCenter.executionResult',
|
title: 'project.taskCenter.executionResult',
|
||||||
|
@ -257,6 +262,7 @@
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.taskCenter.operator',
|
title: 'project.taskCenter.operator',
|
||||||
|
@ -265,6 +271,7 @@
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.taskCenter.operating',
|
title: 'project.taskCenter.operating',
|
||||||
|
@ -287,7 +294,7 @@
|
||||||
{
|
{
|
||||||
tableKey: TableKeyEnum.TASK_API_CASE,
|
tableKey: TableKeyEnum.TASK_API_CASE,
|
||||||
scroll: {
|
scroll: {
|
||||||
x: '100%',
|
x: 1400,
|
||||||
},
|
},
|
||||||
showSetting: true,
|
showSetting: true,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
|
|
|
@ -123,6 +123,7 @@
|
||||||
width: 140,
|
width: 140,
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.taskCenter.resourceName',
|
title: 'project.taskCenter.resourceName',
|
||||||
|
@ -131,6 +132,7 @@
|
||||||
width: 200,
|
width: 200,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
columnSelectorDisabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'project.taskCenter.resourceClassification',
|
title: 'project.taskCenter.resourceClassification',
|
||||||
|
|
Loading…
Reference in New Issue