remove store filter
This commit is contained in:
@@ -1,14 +1,6 @@
|
||||
<template>
|
||||
<div v-can="permissionCodes.customer.read" class="customer-list">
|
||||
<div class="filter bg-white">
|
||||
<t-dropdown-menu v-if="isGlobalManager" class="store">
|
||||
<t-dropdown-item
|
||||
v-model="selectedStoreId"
|
||||
:label="storeFilterLabel"
|
||||
:options="storeOptions"
|
||||
@change="selectStoreFilter"
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
<t-input
|
||||
v-model.trim="keyword"
|
||||
class="search"
|
||||
@@ -107,7 +99,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||
import { type Page, type PageResult, Time, Toolkit, useUserStore } from "timi-web";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import GenderIcon from "@/components/GenderIcon.vue";
|
||||
@@ -132,28 +123,6 @@ const isExporting = ref(false);
|
||||
const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
|
||||
const canReadTag = computed(() => userStore.hasPermissions(corePermissionCodes.tag.read));
|
||||
|
||||
// ---------- 门店筛选 ----------
|
||||
|
||||
const selectedStoreId = ref(currentStoreStore.currentStoreId);
|
||||
const storeOptions = computed(() => currentStoreStore.storeList
|
||||
.map(item => ({
|
||||
label: item.name || item.code || "未命名门店",
|
||||
value: item.id || ""
|
||||
}))
|
||||
.filter(item => item.value));
|
||||
const storeFilterLabel = computed(() => storeOptions.value.find(item => item.value === selectedStoreId.value)?.label || "选择门店");
|
||||
|
||||
async function selectStoreFilter(value: DropdownValue): Promise<void> {
|
||||
if (Array.isArray(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const storeId = String(value);
|
||||
selectedStoreId.value = storeId;
|
||||
currentStoreStore.selectStore(storeId);
|
||||
await refresh();
|
||||
}
|
||||
|
||||
// ---------- 标签筛选 ----------
|
||||
|
||||
const selectedTagList = ref<Tag[]>([]);
|
||||
@@ -196,7 +165,7 @@ const fetch = Toolkit.debounce(async () => {
|
||||
const result = await CustomerAPI.list({
|
||||
...page,
|
||||
keyword: keyword.value,
|
||||
storeId: selectedStoreId.value,
|
||||
storeId: currentStoreStore.currentStoreId,
|
||||
tagIdList: selectedTagIdList.value
|
||||
});
|
||||
pageResult.total = result.total;
|
||||
@@ -221,7 +190,6 @@ async function refresh(): Promise<void> {
|
||||
async function loadData(): Promise<void> {
|
||||
if (isGlobalManager.value) {
|
||||
await currentStoreStore.loadStoreList();
|
||||
selectedStoreId.value = currentStoreStore.currentStoreId;
|
||||
} else {
|
||||
await currentStoreStore.loadLoginStore();
|
||||
}
|
||||
@@ -254,7 +222,7 @@ onUnmounted(() => {
|
||||
async function toCreate(): Promise<void> {
|
||||
await router.push({
|
||||
path: "/management/customers/create",
|
||||
query: isGlobalManager.value && selectedStoreId.value ? { storeId: selectedStoreId.value } : undefined
|
||||
query: isGlobalManager.value && currentStoreStore.currentStoreId ? { storeId: currentStoreStore.currentStoreId } : undefined
|
||||
});
|
||||
}
|
||||
|
||||
@@ -291,13 +259,6 @@ async function doExport(): Promise<void> {
|
||||
box-shadow: var(--td-shadow-1);
|
||||
align-items: center;
|
||||
|
||||
.store {
|
||||
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
border: 1px solid rgba(148, 163, 184, .28);
|
||||
|
||||
Reference in New Issue
Block a user