|
|
@ -1,16 +1,17 @@
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed, defineOptions, ref, watch } from 'vue'
|
|
|
|
import { computed, defineOptions, ref, watch } from 'vue'
|
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
|
import { difference } from 'lodash-es'
|
|
|
|
import { clone, debounce, difference } from 'lodash-es'
|
|
|
|
import { setFilter } from '@/api/home/filter'
|
|
|
|
import { setFilter } from '@/api/home/filter'
|
|
|
|
import { asideMap } from '@/config/aside'
|
|
|
|
import { asideMap } from '@/config/aside'
|
|
|
|
import { useConfig } from '@/store/modules/asideConfig'
|
|
|
|
import { useConfig } from '@/store/modules/asideConfig'
|
|
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'CustomFilterModal' })
|
|
|
|
defineOptions({ name: 'CustomFilterModal' })
|
|
|
|
|
|
|
|
|
|
|
|
const show = ref(false)
|
|
|
|
const show = ref(true)
|
|
|
|
const configStore = useConfig()
|
|
|
|
const configStore = useConfig()
|
|
|
|
const checkAll = ref(false)
|
|
|
|
const checkAll = ref(false)
|
|
|
|
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
function showModal() {
|
|
|
|
function showModal() {
|
|
|
|
show.value = true
|
|
|
|
show.value = true
|
|
|
@ -72,12 +73,16 @@ function generatList(config, customConfig) {
|
|
|
|
|
|
|
|
|
|
|
|
// 系统配置为Y,且不是默认配置
|
|
|
|
// 系统配置为Y,且不是默认配置
|
|
|
|
if (!isDefaultFilter) {
|
|
|
|
if (!isDefaultFilter) {
|
|
|
|
|
|
|
|
const isChecked = asideMap[key].isDefaultFilter || showKeys.includes(key)
|
|
|
|
|
|
|
|
|
|
|
|
offList.push({
|
|
|
|
offList.push({
|
|
|
|
id: key,
|
|
|
|
id: key,
|
|
|
|
name: name || '未配置',
|
|
|
|
name: name || '未配置',
|
|
|
|
fix: isDefaultFilter,
|
|
|
|
fix: isDefaultFilter,
|
|
|
|
checked: asideMap[key].isDefaultFilter,
|
|
|
|
checked: isChecked,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isChecked && selectIds.value.push(key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -125,8 +130,6 @@ async function handleSumbit(e: MouseEvent) {
|
|
|
|
closeModal()
|
|
|
|
closeModal()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onCheckAllChange(value) {
|
|
|
|
function onCheckAllChange(value) {
|
|
|
|
const ids: string[] = []
|
|
|
|
const ids: string[] = []
|
|
|
|
|
|
|
|
|
|
|
@ -228,10 +231,21 @@ function removeHandler(id: string) {
|
|
|
|
if (index !== -1)
|
|
|
|
if (index !== -1)
|
|
|
|
onList.value.splice(index, 1)
|
|
|
|
onList.value.splice(index, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const offKeyword = ref('')
|
|
|
|
|
|
|
|
const onKeyword = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const leftInputHandler = debounce((keyword) => {
|
|
|
|
|
|
|
|
offKeyword.value = keyword
|
|
|
|
|
|
|
|
}, 300)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rightInputHandler = debounce((keyword) => {
|
|
|
|
|
|
|
|
onKeyword.value = keyword
|
|
|
|
|
|
|
|
}, 300)
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<n-modal v-model:show="show" transform-origin="center">
|
|
|
|
<n-modal v-model:show="show" transform-origin="center" :mask-closable="false">
|
|
|
|
<n-card class="cardstyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
|
|
|
|
<n-card class="cardstyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
|
|
|
|
<div class="wrapper">
|
|
|
|
<div class="wrapper">
|
|
|
|
<span class="wrapper-title">自定义筛选</span>
|
|
|
|
<span class="wrapper-title">自定义筛选</span>
|
|
|
@ -241,14 +255,14 @@ function removeHandler(id: string) {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<n-grid cols="2" class="mt-4 proCard" responsive="screen" :x-gap="24">
|
|
|
|
<n-grid cols="24" class="mt-4 proCard" responsive="screen" :x-gap="24">
|
|
|
|
<n-grid-item>
|
|
|
|
<n-grid-item span="11">
|
|
|
|
<NCard
|
|
|
|
<NCard
|
|
|
|
:title="allCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small"
|
|
|
|
:title="allCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small"
|
|
|
|
:bordered="false"
|
|
|
|
:bordered="false"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<n-input placeholder="搜索关键字">
|
|
|
|
<n-input placeholder="搜索关键字" @input="leftInputHandler">
|
|
|
|
<template #suffix>
|
|
|
|
<template #suffix>
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -259,7 +273,7 @@ function removeHandler(id: string) {
|
|
|
|
<n-checkbox v-model:checked="checkAll" label="全部" @update:checked="onCheckAllChange" />
|
|
|
|
<n-checkbox v-model:checked="checkAll" label="全部" @update:checked="onCheckAllChange" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
v-for="item in offList" :key="item.id" :class="{ 'disable-check': item.fix }"
|
|
|
|
v-for="item in offList" v-show="item.name.includes(offKeyword) || offKeyword === ''" :key="item.id" :class="{ 'disable-check': item.fix }"
|
|
|
|
class="draggable-li"
|
|
|
|
class="draggable-li"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<n-checkbox
|
|
|
|
<n-checkbox
|
|
|
@ -272,7 +286,10 @@ function removeHandler(id: string) {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</NCard>
|
|
|
|
</NCard>
|
|
|
|
</n-grid-item>
|
|
|
|
</n-grid-item>
|
|
|
|
<n-grid-item>
|
|
|
|
<n-grid-item style="display: flex;align-items: center;" span="2">
|
|
|
|
|
|
|
|
<SvgIcon size="20" name="switchsvg" />
|
|
|
|
|
|
|
|
</n-grid-item>
|
|
|
|
|
|
|
|
<n-grid-item span="11">
|
|
|
|
<NCard
|
|
|
|
<NCard
|
|
|
|
:title="selectCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small"
|
|
|
|
:title="selectCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small"
|
|
|
|
:bordered="false"
|
|
|
|
:bordered="false"
|
|
|
@ -281,7 +298,7 @@ function removeHandler(id: string) {
|
|
|
|
<span class="textbtnStyle" @click="clearDragSource">清空</span>
|
|
|
|
<span class="textbtnStyle" @click="clearDragSource">清空</span>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<n-input placeholder="搜索关键字">
|
|
|
|
<n-input placeholder="搜索关键字" @input="rightInputHandler">
|
|
|
|
<template #suffix>
|
|
|
|
<template #suffix>
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -289,9 +306,10 @@ function removeHandler(id: string) {
|
|
|
|
<n-scrollbar style="max-height: 500px;border: 1px solid #cad2dd;border-radius: 2px;" class="scroll">
|
|
|
|
<n-scrollbar style="max-height: 500px;border: 1px solid #cad2dd;border-radius: 2px;" class="scroll">
|
|
|
|
<VueDraggable v-model="onList" class="draggable-ul" :animation="150" group="shared">
|
|
|
|
<VueDraggable v-model="onList" class="draggable-ul" :animation="150" group="shared">
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
v-for="item in onList" :key="item.id" :class="{ fix: item.fix }"
|
|
|
|
v-for="item in onList" v-show="item.name.includes(onKeyword) || onKeyword === ''" :key="item.id" :class="{ fix: item.fix }"
|
|
|
|
class="cursor-move draggable-li"
|
|
|
|
class="cursor-move draggable-li"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
<SvgIcon name="drag" size="24" />
|
|
|
|
<span class="ml-2">{{ item.name }}</span>
|
|
|
|
<span class="ml-2">{{ item.name }}</span>
|
|
|
|
<SvgIcon
|
|
|
|
<SvgIcon
|
|
|
|
v-if="!item.fix" size="16px" style="display:block;margin-left: auto;cursor: pointer;"
|
|
|
|
v-if="!item.fix" size="16px" style="display:block;margin-left: auto;cursor: pointer;"
|
|
|
@ -363,6 +381,7 @@ function removeHandler(id: string) {
|
|
|
|
|
|
|
|
|
|
|
|
.cardstyle {
|
|
|
|
.cardstyle {
|
|
|
|
width: 620px;
|
|
|
|
width: 620px;
|
|
|
|
|
|
|
|
height: 800px;
|
|
|
|
--n-padding-bottom: 20px;
|
|
|
|
--n-padding-bottom: 20px;
|
|
|
|
--n-padding-left: 24px;
|
|
|
|
--n-padding-left: 24px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|