|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|