feat: 全选样式修改

pull/1/head
刘释隆 1 year ago
parent cdb96899d0
commit 934dd58401

@ -198,13 +198,27 @@ const selectIds = ref<string[]>([]);
function onCheckAllChange(value) { function onCheckAllChange(value) {
const ids: string[] = []; const ids: string[] = [];
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix) { if (!item.fix) {
item.checked = value; item.checked = value;
ids.push(item.id); 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 : []; selectIds.value = value ? ids : [];
} }
@ -310,6 +324,20 @@ function removeHandler(id: string, type: "fix" | "unfix") {
fixLeftList.value[index].checked = false; 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
);
});
</script> </script>
<template> <template>
@ -344,11 +372,12 @@ function removeHandler(id: string, type: "fix" | "unfix") {
</template> </template>
</n-input> </n-input>
<div class="draggable-ul left-wrap"> <div class="draggable-ul left-wrap">
<div class="draggable-li"> <div class="draggable-li" :class="{ checkAll: indeterminate }">
<n-checkbox <n-checkbox
v-model:checked="checkAll" v-model:checked="checkAll"
label="全部" label="全部"
@update:checked="onCheckAllChange" @update:checked="onCheckAllChange"
:indeterminate="indeterminate"
/> />
</div> </div>
<div class="content"> <div class="content">
@ -380,7 +409,7 @@ function removeHandler(id: string, type: "fix" | "unfix") {
:bordered="false" :bordered="false"
> >
<template #header-extra> <template #header-extra>
<span class="textbtnStyle" @click="clearDragSource"></span> <span class="textbtnStyle" @click="clearDragSource"></span>
</template> </template>
<div> <div>
<n-input placeholder="搜索关键字"> <n-input placeholder="搜索关键字">
@ -402,7 +431,7 @@ function removeHandler(id: string, type: "fix" | "unfix") {
:class="{ fix: item.fix }" :class="{ fix: item.fix }"
class="cursor-move draggable-item" class="cursor-move draggable-item"
> >
<SvgIcon name="drag" size="24" /> <SvgIcon name="drag" size="14" color="#666666" />
<span class="ml-2">{{ item.name }}</span> <span class="ml-2">{{ item.name }}</span>
<SvgIcon <SvgIcon
v-if="!item.fix" v-if="!item.fix"
@ -426,7 +455,7 @@ function removeHandler(id: string, type: "fix" | "unfix") {
:class="{ fix: item.fix }" :class="{ fix: item.fix }"
class="cursor-move draggable-item" class="cursor-move draggable-item"
> >
<SvgIcon name="drag" size="24" /> <SvgIcon name="drag" size="14" color="#666666" />
<span class="ml-2">{{ item.name }}</span> <span class="ml-2">{{ item.name }}</span>
<SvgIcon <SvgIcon
v-if="!item.fix" v-if="!item.fix"
@ -446,7 +475,7 @@ function removeHandler(id: string, type: "fix" | "unfix") {
<template #footer> <template #footer>
<div class="wrapper-footer"> <div class="wrapper-footer">
<n-button type="info" @click="handleSumbit"> </n-button> <n-button type="info" @click="handleSumbit"> </n-button>
<n-button secondary style="margin-left: 15px" @click="closeModal"> <n-button secondary style="margin-left: 15px" @click="closeModal">
取消 取消
</n-button> </n-button>
@ -483,7 +512,7 @@ function removeHandler(id: string, type: "fix" | "unfix") {
position: relative; position: relative;
color: #333333; color: #333333;
font-size: 14px; font-size: 14px;
background: #F8F8F8; background: #f8f8f8;
&:before { &:before {
background-color: #1980ff; background-color: #1980ff;
@ -513,7 +542,8 @@ function removeHandler(id: string, type: "fix" | "unfix") {
.textbtnStyle { .textbtnStyle {
cursor: pointer; cursor: pointer;
color: #1980ff; color: #507AFD;
} }
.drag-wrapper { .drag-wrapper {
@ -544,7 +574,7 @@ function removeHandler(id: string, type: "fix" | "unfix") {
color: #333; color: #333;
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: 1px solid #e8e8e8; // border-bottom: 1px solid #e8e8e8;
} }
.disable-check { .disable-check {
@ -571,10 +601,24 @@ function removeHandler(id: string, type: "fix" | "unfix") {
::v-deep(.n-button--info-type) { ::v-deep(.n-button--info-type) {
background: #507afd !important; background: #507afd !important;
} }
.left-wrap{ .left-wrap {
border: 1px solid #cbd3de; border: 1px solid #cbd3de;
} }
// ::v-deep(.n-card__content){ // ::v-deep(.n-card__content){
// padding: 20px 24px 0 24px !important; // padding: 20px 24px 0 24px !important;
// } // }
::v-deep(.checkAll .n-checkbox.n-checkbox--indeterminate .n-checkbox-box) {
background: none;
border: none;
}
::v-deep(.checkAll .n-checkbox-box__border) {
border: 1px solid #e8e8e8 !important;
}
::v-deep(.checkAll .n-checkbox-icon) {
border: 3px solid #fff;
background: #1980ff;
}
::v-deep(.checkAll .n-checkbox-icon svg) {
display: none !important;
}
</style> </style>

@ -138,7 +138,7 @@ async function query(page: number, pageSize: number) {
currPage: 1, currPage: 1,
sortname: "", sortname: "",
}); });
const { data, pageCount } = result; const { data, pageCount,totalCount } = result;
total.value = totalCount; total.value = totalCount;
tableData.value = data; tableData.value = data;
pagination.page = page; pagination.page = page;

@ -305,7 +305,7 @@ onMounted(() => {
:bordered="false" :bordered="false"
> >
<div class="input_wrap"> <div class="input_wrap">
<n-input placeholder="搜索关键词" @input="leftInputHandler"> <n-input placeholder="关键词搜索" @input="leftInputHandler">
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1-color999" /> <SvgIcon size="14px" name="magnifying-1-color999" />
</template> </template>
@ -341,7 +341,7 @@ onMounted(() => {
<span class="textbtnStyle" @click="clearDragSource"></span> <span class="textbtnStyle" @click="clearDragSource"></span>
</template> </template>
<div class="input_wrap"> <div class="input_wrap">
<n-input placeholder="搜索关键词" @input="rightInputHandler"> <n-input placeholder="关键词搜索" @input="rightInputHandler">
<template #suffix> <template #suffix>
<SvgIcon size="14px" name="magnifying-1-color999" /> <SvgIcon size="14px" name="magnifying-1-color999" />
</template> </template>

Loading…
Cancel
Save