feat: 【任务审批--自定义任务弹窗】点击全选勾选全部数据后,取消列表任意一个数据勾选,此时上面全选按钮状态未切换为部分选中状态仍为全部选中状态bug修复

pull/1/head
刘释隆 1 year ago
parent 56579989dd
commit 94a6398b28

@ -137,13 +137,16 @@ function onCheckAllChange(value) {
}
selectIds.value = value ? ids : [];
}
function onCheckChange(checked: any, item: any) {
const index = selectIds.value.indexOf(item.id);
item.checked = checked;
let currentIndex = offList.value.findIndex(v=>v.id == item.id)
offList.value[currentIndex].checked = item.checked;
if (index === -1 && checked) selectIds.value.push(item.id);
else selectIds.value.splice(index, 1);
}

@ -18,8 +18,6 @@ const props = defineProps({
default: () => [],
},
})
console.log(props.showFieldList)
console.log(props.listItem)
const svgName = computed(() => {
return props.selected ? 'task-select' : 'task'
})

@ -288,9 +288,6 @@ watch(
async (newValue, oldValue) => {
const packageid = taskStore.getPackageid
const taskId = taskStore.getActiveId
console.log(packageid)
console.log(taskId)
if (isEmpty(taskId))
return
taskDetailInfo.value = await getTaskDetailInfo(taskId, packageid)

@ -94,7 +94,15 @@ function generateDefaultList() {
}
const show = ref(false);
const checkAll = ref(false);
const checkAll = computed(()=>{
let baseNum = 0;
offList.value.map((v) => {
if (v.fix) {
baseNum += 1;
}
});
return onList.value.length == offList.value.length-baseNum
});
function showModal() {
show.value = true;
@ -140,7 +148,6 @@ function onCheckAllChange(value) {
for (const item of offShowList.value) {
if (!item.fix) {
item.checked = value;
ids.push(item.id);
}
}
selectIds.value = value ? ids : [];
@ -150,7 +157,7 @@ function onCheckAllChange(value) {
onList.value.push(v);
}
});
onShowList.value = cloneDeep(onList.value)
onShowList.value = cloneDeep(onList.value);
} else {
onList.value = [];
onShowList.value = [];
@ -159,12 +166,14 @@ function onCheckAllChange(value) {
function onCheckChange(checked: any, item: any) {
const index = selectIds.value.indexOf(item.id);
item.checked = checked;
let currentIndex = offList.value.findIndex(v=>v.id == item.id)
offList.value[currentIndex].checked = item.checked;
if (index === -1 && checked) selectIds.value.push(item.id);
else selectIds.value.splice(index, 1);
let currentIndex = offList.value.findIndex((v) => v.id == item.id);
offList.value[currentIndex].checked = checked;
if (index === -1 && checked) {
selectIds.value.push(item.id);
} else {
selectIds.value.splice(index, 1);
}
}
const showIds = computed(() => {
@ -207,6 +216,7 @@ watch(
index--;
}
}
console.log(onShowList.value, list, "onShowList");
}
}
);
@ -245,7 +255,7 @@ function removeHandler(id: string) {
index = offList.value.findIndex((v) => v.id == id);
offList.value[index].checked = false;
offShowList.value = cloneDeep(offList.value)
offShowList.value = cloneDeep(offList.value);
}
const getData = async (type = "") => {
const userStore = useUser();
@ -314,7 +324,7 @@ const indeterminate = computed(() => {
baseNum += 1;
}
});
return onList.value.length > 0 && offList.value.length - baseNum > onList.value.length;
return onShowList.value.length > 0 && offShowList.value.length - baseNum > onShowList.value.length;
});
const queryData = (value, type) => {
if (value) {
@ -326,11 +336,11 @@ const queryData = (value, type) => {
}
} else {
// getData(type);
if(type == "off") {
if (type == "off") {
offShowList.value = cloneDeep(offList.value);
}else{
} else {
onShowList.value = cloneDeep(onList.value);
fixShowList.value = cloneDeep(fixList.value)
fixShowList.value = cloneDeep(fixList.value);
}
}
};

Loading…
Cancel
Save