fix: filter classify

This commit is contained in:
putyy
2025-07-31 13:46:24 +08:00
committed by putyy
parent 54c0da081c
commit c47fcba36b
2 changed files with 12 additions and 7 deletions

View File

@@ -96,7 +96,7 @@
"quality_tip": "Effective for video accounts", "quality_tip": "Effective for video accounts",
"full_intercept": "Full Intercept", "full_intercept": "Full Intercept",
"full_intercept_tip": "Whether to fully intercept WeChat video accounts, No: only intercept video details", "full_intercept_tip": "Whether to fully intercept WeChat video accounts, No: only intercept video details",
"insert_tail": "insert tail", "insert_tail": "Insert tail",
"insert_tail_tip": "Intercept whether new data is added to the end of the list", "insert_tail_tip": "Intercept whether new data is added to the end of the list",
"upstream_proxy": "Upstream Proxy", "upstream_proxy": "Upstream Proxy",
"upstream_proxy_tip": "For combining with other proxy tools, format: http://username:password@your.proxy.server:port", "upstream_proxy_tip": "For combining with other proxy tools, format: http://username:password@your.proxy.server:port",

View File

@@ -65,6 +65,7 @@
:height-for-row="()=> 48" :height-for-row="()=> 48"
:checked-row-keys="checkedRowKeysValue" :checked-row-keys="checkedRowKeysValue"
@update:checked-row-keys="handleCheck" @update:checked-row-keys="handleCheck"
@update:filters="updateFilters"
style="--wails-draggable:no-drag" style="--wails-draggable:no-drag"
/> />
</div> </div>
@@ -85,7 +86,7 @@
import {NButton, NIcon, NImage, NInput, NSpace, NTooltip, NPopover} from "naive-ui" import {NButton, NIcon, NImage, NInput, NSpace, NTooltip, NPopover} from "naive-ui"
import {computed, h, onMounted, ref, watch} from "vue" import {computed, h, onMounted, ref, watch} from "vue"
import type {appType} from "@/types/app" import type {appType} from "@/types/app"
import type {DataTableRowKey, ImageRenderToolbarProps} from "naive-ui" import type {DataTableRowKey, ImageRenderToolbarProps, DataTableFilterState,DataTableBaseColumn} from "naive-ui"
import Preview from "@/components/Preview.vue" import Preview from "@/components/Preview.vue"
import ShowLoading from "@/components/ShowLoading.vue" import ShowLoading from "@/components/ShowLoading.vue"
// @ts-ignore // @ts-ignore
@@ -116,12 +117,12 @@ const certUrl = computed(() => {
return store.baseUrl + "/api/cert" return store.baseUrl + "/api/cert"
}) })
const data = ref<any[]>([]) const data = ref<any[]>([])
let filterClassify: string[] = [] const filterClassify = ref<string[]>([])
const filteredData = computed(() => { const filteredData = computed(() => {
let result = data.value let result = data.value
if (filterClassify.length > 0) { if (filterClassify.value.length > 0) {
result = result.filter(item => filterClassify.includes(item.Classify)) result = result.filter(item => filterClassify.value.includes(item.Classify))
} }
if (descriptionSearchValue.value) { if (descriptionSearchValue.value) {
@@ -186,7 +187,6 @@ const columns = ref<any[]>([
filterOptions: computed(() => Array.from(classify.value).slice(1)), filterOptions: computed(() => Array.from(classify.value).slice(1)),
filterMultiple: true, filterMultiple: true,
filter: (value: string, row: appType.MediaInfo) => { filter: (value: string, row: appType.MediaInfo) => {
if (!filterClassify.includes(value)) filterClassify.push(value)
return !!~row.Classify.indexOf(String(value)) return !!~row.Classify.indexOf(String(value))
}, },
render: (row: appType.MediaInfo) => { render: (row: appType.MediaInfo) => {
@@ -273,6 +273,7 @@ const columns = ref<any[]>([
title: () => h('div', {class: 'flex items-center'}, [ title: () => h('div', {class: 'flex items-center'}, [
t('index.description'), t('index.description'),
h(NPopover, { h(NPopover, {
style:"--wails-draggable:no-drag",
trigger: 'click', trigger: 'click',
placement: 'bottom', placement: 'bottom',
showArrow: true, showArrow: true,
@@ -531,6 +532,10 @@ const handleCheck = (rowKeys: DataTableRowKey[]) => {
checkedRowKeysValue.value = rowKeys checkedRowKeysValue.value = rowKeys
} }
const updateFilters = (filters: DataTableFilterState, initiatorColumn: DataTableBaseColumn)=>{
filterClassify.value = filters.Classify as string[]
}
const batchDown = async () => { const batchDown = async () => {
if (checkedRowKeysValue.value.length <= 0) { if (checkedRowKeysValue.value.length <= 0) {
window?.$message?.error(t("index.use_data")) window?.$message?.error(t("index.use_data"))
@@ -732,8 +737,8 @@ const handleImport = (content: string) => {
}) })
if (newItems.length > 0) { if (newItems.length > 0) {
data.value = [...newItems, ...data.value] data.value = [...newItems, ...data.value]
cacheData()
} }
cacheData()
showImport.value = false showImport.value = false
} }