|
|
@ -17,7 +17,10 @@ const props = defineProps({
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const ruleForm = reactive({
|
|
|
|
|
|
|
|
keyword: "",
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
const ruleformRef = ref();
|
|
|
|
const emit = defineEmits<{
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(e: "show-filter"): void;
|
|
|
|
(e: "show-filter"): void;
|
|
|
|
(e: "show-custom"): void;
|
|
|
|
(e: "show-custom"): void;
|
|
|
@ -27,7 +30,7 @@ const emit = defineEmits<{
|
|
|
|
|
|
|
|
|
|
|
|
const data = ref<FilterEntity[]>([]);
|
|
|
|
const data = ref<FilterEntity[]>([]);
|
|
|
|
const unData = ref<FilterEntity[]>([]);
|
|
|
|
const unData = ref<FilterEntity[]>([]);
|
|
|
|
const loading = ref(false);
|
|
|
|
const loading = ref(false);
|
|
|
|
const canloadMore = true;
|
|
|
|
const canloadMore = true;
|
|
|
|
const el = ref<HTMLDivElement | null>(null);
|
|
|
|
const el = ref<HTMLDivElement | null>(null);
|
|
|
|
const popover = ref<ComponentRef | null>(null);
|
|
|
|
const popover = ref<ComponentRef | null>(null);
|
|
|
@ -74,8 +77,8 @@ useInfiniteScroll(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ distance: 10, interval: 300, canLoadMore: () => false }
|
|
|
|
{ distance: 10, interval: 300, canLoadMore: () => false }
|
|
|
|
);
|
|
|
|
);
|
|
|
|
const showClick =async () => {
|
|
|
|
const showClick = async () => {
|
|
|
|
getSearchedList('')
|
|
|
|
getSearchedList("");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
async function loadMore() {
|
|
|
|
async function loadMore() {
|
|
|
@ -92,7 +95,7 @@ async function featchList() {
|
|
|
|
loading.value = true;
|
|
|
|
loading.value = true;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const searchParam: FilterSearchParam = {
|
|
|
|
const searchParam: FilterSearchParam = {
|
|
|
|
search_searchname: { value: keyword.value, op: "like", type: "string" },
|
|
|
|
search_searchname: { value: ruleForm.keyword, op: "like", type: "string" },
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const result = await getConditionList(pagination, searchParam, props.type);
|
|
|
|
const result = await getConditionList(pagination, searchParam, props.type);
|
|
|
|
const { data } = result;
|
|
|
|
const { data } = result;
|
|
|
@ -121,11 +124,8 @@ function generateFilterEntityList(data) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const reg = new RegExp(keyword.value, "gi");
|
|
|
|
const reg = new RegExp(ruleForm.keyword, "gi");
|
|
|
|
const hilightText = searchname.replace(
|
|
|
|
const hilightText = searchname.replace(reg, `<span>${ruleForm.keyword}</span>`);
|
|
|
|
reg,
|
|
|
|
|
|
|
|
`<span>${keyword.value}</span>`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
id,
|
|
|
|
id,
|
|
|
@ -134,7 +134,7 @@ function generateFilterEntityList(data) {
|
|
|
|
isDefaultFilter: false,
|
|
|
|
isDefaultFilter: false,
|
|
|
|
filterList: list,
|
|
|
|
filterList: list,
|
|
|
|
reorder,
|
|
|
|
reorder,
|
|
|
|
searchname
|
|
|
|
searchname,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -143,12 +143,17 @@ function generateFilterEntityList(data) {
|
|
|
|
|
|
|
|
|
|
|
|
function selectHandler(item: FilterEntity) {
|
|
|
|
function selectHandler(item: FilterEntity) {
|
|
|
|
(popover.value as any).setShow(false);
|
|
|
|
(popover.value as any).setShow(false);
|
|
|
|
currentlySelectedAdvanced.value = item.searchname
|
|
|
|
currentlySelectedAdvanced.value = item.searchname;
|
|
|
|
emit("select", item.id);
|
|
|
|
emit("select", item.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const inputHandler = debounce((word) => {
|
|
|
|
const inputHandler = debounce((word) => {
|
|
|
|
getSearchedList(word)
|
|
|
|
ruleForm.keyword = word;
|
|
|
|
|
|
|
|
ruleformRef.value.validate();
|
|
|
|
|
|
|
|
if (word.length < 2 && word) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
getSearchedList(word);
|
|
|
|
}, 300);
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
|
|
function getSearchedList(word) {
|
|
|
|
function getSearchedList(word) {
|
|
|
@ -157,7 +162,7 @@ function getSearchedList(word) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pagination.pageSize = 10;
|
|
|
|
pagination.pageSize = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
keyword.value = word;
|
|
|
|
ruleForm.keyword = word;
|
|
|
|
featchList().then((list) => {
|
|
|
|
featchList().then((list) => {
|
|
|
|
let dataArr: FilterEntity[] = [];
|
|
|
|
let dataArr: FilterEntity[] = [];
|
|
|
|
let unDataArr: FilterEntity[] = [];
|
|
|
|
let unDataArr: FilterEntity[] = [];
|
|
|
@ -195,10 +200,26 @@ function favoriteHandler(event: MouseEvent, item: any) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
inputHandler(keyword.value);
|
|
|
|
inputHandler(ruleForm.keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rules = {
|
|
|
|
|
|
|
|
keyword: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
trigger: ["blur", "input", "change"],
|
|
|
|
|
|
|
|
level: "error",
|
|
|
|
|
|
|
|
validator(_rule, value) {
|
|
|
|
|
|
|
|
if (value.length >= 2) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return new Error("搜索关键字最少为两个");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function unFavoriteHandler(event: MouseEvent, item) {
|
|
|
|
function unFavoriteHandler(event: MouseEvent, item) {
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
event.stopPropagation();
|
|
|
|
event.stopPropagation();
|
|
|
@ -208,7 +229,7 @@ function unFavoriteHandler(event: MouseEvent, item) {
|
|
|
|
if (!isDefaultFilter) {
|
|
|
|
if (!isDefaultFilter) {
|
|
|
|
item.favorite = false;
|
|
|
|
item.favorite = false;
|
|
|
|
unfavorite(id);
|
|
|
|
unfavorite(id);
|
|
|
|
inputHandler(keyword.value);
|
|
|
|
inputHandler(ruleForm.keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -233,29 +254,37 @@ const moveEnd = () => {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #trigger>
|
|
|
|
<template #trigger>
|
|
|
|
<div class="wrapper-left-dropdown" @click="showClick">
|
|
|
|
<div class="wrapper-left-dropdown" @click="showClick">
|
|
|
|
<span style="font-size: 20px;color: #333333;font-weight: Medium;">{{currentlySelectedAdvanced}}</span>
|
|
|
|
<span style="font-size: 20px; color: #333333; font-weight: Medium">{{
|
|
|
|
<SvgIcon :style="{ marginLeft: '5px' }" name="down" size="14" />
|
|
|
|
currentlySelectedAdvanced
|
|
|
|
|
|
|
|
}}</span>
|
|
|
|
|
|
|
|
<SvgIcon :style="{ marginLeft: '5px' }" name="down" size="14" color="#999999"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<n-spin :show="loading">
|
|
|
|
<n-spin :show="loading">
|
|
|
|
<div class="wrapper-left-popover">
|
|
|
|
<div class="wrapper-left-popover">
|
|
|
|
<n-input
|
|
|
|
<n-form :rules="rules" ref="ruleformRef" :model="ruleForm">
|
|
|
|
:style="{ '--n-border': '0px' }"
|
|
|
|
<n-form-item path="keyword">
|
|
|
|
placeholder="请输入关键词"
|
|
|
|
<n-input
|
|
|
|
@input="inputHandler"
|
|
|
|
:style="{ '--n-border': '0px' }"
|
|
|
|
>
|
|
|
|
placeholder="请输入关键字"
|
|
|
|
<template #prefix>
|
|
|
|
@input="inputHandler"
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
:value="ruleForm.keyword"
|
|
|
|
</template>
|
|
|
|
:minlength="2"
|
|
|
|
<template #suffix>
|
|
|
|
>
|
|
|
|
<SvgIcon
|
|
|
|
<template #prefix>
|
|
|
|
size="14px"
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
style="cursor: pointer"
|
|
|
|
</template>
|
|
|
|
name="setting"
|
|
|
|
<template #suffix>
|
|
|
|
@click="emit('show-filter')"
|
|
|
|
<SvgIcon
|
|
|
|
/>
|
|
|
|
size="14px"
|
|
|
|
</template>
|
|
|
|
style="cursor: pointer"
|
|
|
|
</n-input>
|
|
|
|
name="setting"
|
|
|
|
|
|
|
|
@click="emit('show-filter')"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</n-input>
|
|
|
|
|
|
|
|
</n-form-item>
|
|
|
|
|
|
|
|
</n-form>
|
|
|
|
|
|
|
|
|
|
|
|
<ul ref="el" class="wrapper-left-list">
|
|
|
|
<ul ref="el" class="wrapper-left-list">
|
|
|
|
<li
|
|
|
|
<li
|
|
|
@ -264,23 +293,28 @@ const moveEnd = () => {
|
|
|
|
style="display: flex; align-items: center"
|
|
|
|
style="display: flex; align-items: center"
|
|
|
|
@click="selectHandler(item)"
|
|
|
|
@click="selectHandler(item)"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<SvgIcon name="drag" size="18" color="#333333" style="margin-right:3px"/>
|
|
|
|
<SvgIcon
|
|
|
|
|
|
|
|
name="drag"
|
|
|
|
|
|
|
|
size="18"
|
|
|
|
|
|
|
|
color="#333333"
|
|
|
|
|
|
|
|
style="margin-right: 3px"
|
|
|
|
|
|
|
|
/>
|
|
|
|
<SvgIcon
|
|
|
|
<SvgIcon
|
|
|
|
v-if="item.favorite && !item.isDefaultFilter"
|
|
|
|
v-if="item.favorite && !item.isDefaultFilter"
|
|
|
|
name="favorite-fill"
|
|
|
|
name="favorite-fill"
|
|
|
|
color="#fd9b0a"
|
|
|
|
color="#fd9b0a"
|
|
|
|
size="18"
|
|
|
|
size="18"
|
|
|
|
style="margin-right:3px"
|
|
|
|
style="margin-right: 3px"
|
|
|
|
@click="unFavoriteHandler($event, item)"
|
|
|
|
@click="unFavoriteHandler($event, item)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<SvgIcon
|
|
|
|
<SvgIcon
|
|
|
|
v-else-if="!item.favorite && !item.isDefaultFilter"
|
|
|
|
v-else-if="!item.favorite && !item.isDefaultFilter"
|
|
|
|
name="favorite-unfill"
|
|
|
|
name="favorite-unfill"
|
|
|
|
size="18"
|
|
|
|
size="18"
|
|
|
|
style="margin-right:3px"
|
|
|
|
style="margin-right: 3px"
|
|
|
|
@click="favoriteHandler($event, item)"
|
|
|
|
@click="favoriteHandler($event, item)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div v-html="item.name" style="color: #333333;"/>
|
|
|
|
<div v-html="item.name" style="color: #333333" />
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
<!-- filter=".draggable-li[draggable='false']" -->
|
|
|
|
<!-- filter=".draggable-li[draggable='false']" -->
|
|
|
|
<VueDraggable
|
|
|
|
<VueDraggable
|
|
|
@ -298,14 +332,14 @@ const moveEnd = () => {
|
|
|
|
class="cursor-move draggable-li fix"
|
|
|
|
class="cursor-move draggable-li fix"
|
|
|
|
:draggable="true"
|
|
|
|
:draggable="true"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<SvgIcon name="drag" size="18" style="margin-right:3px"/>
|
|
|
|
<SvgIcon name="drag" size="18" style="margin-right: 3px" />
|
|
|
|
<SvgIcon
|
|
|
|
<SvgIcon
|
|
|
|
v-if="item.favorite && !item.isDefaultFilter"
|
|
|
|
v-if="item.favorite && !item.isDefaultFilter"
|
|
|
|
name="favorite-fill"
|
|
|
|
name="favorite-fill"
|
|
|
|
color="#fd9b0a"
|
|
|
|
color="#fd9b0a"
|
|
|
|
size="18"
|
|
|
|
size="18"
|
|
|
|
fill="#666666"
|
|
|
|
fill="#666666"
|
|
|
|
style="cursor: pointer!important;margin-right:3px;"
|
|
|
|
style="cursor: pointer !important; margin-right: 3px"
|
|
|
|
@click="unFavoriteHandler($event, item)"
|
|
|
|
@click="unFavoriteHandler($event, item)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<SvgIcon
|
|
|
|
<SvgIcon
|
|
|
@ -313,10 +347,10 @@ const moveEnd = () => {
|
|
|
|
name="favorite-unfill"
|
|
|
|
name="favorite-unfill"
|
|
|
|
size="18"
|
|
|
|
size="18"
|
|
|
|
fill="#666666"
|
|
|
|
fill="#666666"
|
|
|
|
style="cursor: pointer!important;margin-right:3px;"
|
|
|
|
style="cursor: pointer !important; margin-right: 3px"
|
|
|
|
@click="favoriteHandler($event, item)"
|
|
|
|
@click="favoriteHandler($event, item)"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div v-html="item.name" style="color: #333333;"/>
|
|
|
|
<div v-html="item.name" style="color: #333333" />
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
</VueDraggable>
|
|
|
|
</VueDraggable>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|