diff --git a/src/views/final/comp/CustomTabelModal.vue b/src/views/final/comp/CustomTabelModal.vue index 4cbbcdc..a52c9f9 100644 --- a/src/views/final/comp/CustomTabelModal.vue +++ b/src/views/final/comp/CustomTabelModal.vue @@ -198,13 +198,27 @@ const selectIds = ref([]); function onCheckAllChange(value) { const ids: string[] = []; - for (const item of offList.value) { if (!item.fix) { item.checked = value; ids.push(item.id); } } + if (value) { + offList.value.map((v) => { + if (!v.checked) { + onList.value.push(v); + } + }); + } else { + onList.value = []; + fixLeftList.value = []; + offList.value.map((v) => { + if (v.fix) { + fixLeftList.value.push(v); + } + }); + } selectIds.value = value ? ids : []; } @@ -310,6 +324,20 @@ function removeHandler(id: string, type: "fix" | "unfix") { fixLeftList.value[index].checked = false; } } + +const indeterminate = computed(() => { + let baseNum = 0; + offList.value.map((v) => { + if (v.fix) { + baseNum += 1; + } + }); + return ( + onList.value.length + fixLeftList.value.length - baseNum > 0 && + offList.value.length - baseNum > + onList.value.length + fixLeftList.value.length - baseNum + ); +});
-
+
@@ -380,7 +409,7 @@ function removeHandler(id: string, type: "fix" | "unfix") { :bordered="false" >
@@ -402,7 +431,7 @@ function removeHandler(id: string, type: "fix" | "unfix") { :class="{ fix: item.fix }" class="cursor-move draggable-item" > - + {{ item.name }} - + {{ item.name }}