remove store filter

This commit is contained in:
Timi
2026-08-21 15:02:28 +08:00
parent c97913da2d
commit 413f12619b
8 changed files with 41 additions and 448 deletions
+5 -39
View File
@@ -2,13 +2,6 @@
<div v-can="permissionCodes.pointRule.read" class="point-rule-list">
<div class="filter-menu">
<t-dropdown-menu>
<t-dropdown-item
v-if="isGlobalManager"
v-model="selectedStoreId"
:label="selectedStoreName"
:options="storeOptions"
@change="selectStore"
/>
<t-dropdown-item
v-model="statusFilter"
label="规则状态"
@@ -79,8 +72,6 @@ import type { PointRule, PointRuleStatus } from "@/types/Point";
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
import { type Page, type PageResult, useUserStore } from "timi-web";
const allStoresValue = "__ALL_STORES__";
defineOptions({
name: "PointRuleList"
});
@@ -90,11 +81,10 @@ const navBarStore = useNavBarStore();
const userStore = useUserStore();
const currentStoreStore = useCurrentStoreStore();
// ---------- 筛选与门店 ----------
// ---------- 筛选 ----------
const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
const canUpdate = computed(() => userStore.hasPermissions(permissionCodes.pointRule.update));
const selectedStoreId = ref(allStoresValue);
const statusFilter = ref("ALL");
const statusOptions = [
{ label: "全部状态", value: "ALL" },
@@ -103,25 +93,6 @@ const statusOptions = [
{ label: "停用", value: "INACTIVE" },
{ label: "已删除", value: "DELETED" }
];
const storeOptions = computed(() => [
{ label: "全部门店", value: allStoresValue },
...currentStoreStore.storeList
.map(item => ({
label: item.name || item.code || "未命名门店",
value: item.id || ""
}))
.filter(item => item.value)
]);
const selectedStoreName = computed(() => storeOptions.value.find(item => item.value === selectedStoreId.value)?.label || "全部门店");
async function selectStore(value: DropdownValue): Promise<void> {
if (Array.isArray(value)) {
return;
}
selectedStoreId.value = String(value);
await loadEventList();
await reload();
}
async function selectStatus(value: DropdownValue): Promise<void> {
if (Array.isArray(value)) {
@@ -205,11 +176,8 @@ function buildRequest(): Page<PointRule> {
};
}
function buildListOptions(): { allStores?: boolean; storeId?: string } | undefined {
if (!isGlobalManager.value) {
return undefined;
}
return selectedStoreId.value === allStoresValue ? { allStores: true } : { storeId: selectedStoreId.value };
function buildListOptions(): { storeId: string } {
return { storeId: currentStoreStore.currentStoreId };
}
// ---------- 事件名称 ----------
@@ -275,7 +243,7 @@ function getStatusTheme(status?: PointRuleStatus): "default" | "success" | "warn
async function toCreate(): Promise<void> {
await router.push({
name: "PointRuleCreate",
query: selectedStoreId.value === allStoresValue ? undefined : { storeId: selectedStoreId.value }
query: currentStoreStore.currentStoreId ? { storeId: currentStoreStore.currentStoreId } : undefined
});
}
@@ -289,10 +257,8 @@ async function toEdit(rule: PointRule): Promise<void> {
async function preparePage(): Promise<void> {
if (isGlobalManager.value) {
await currentStoreStore.loadStoreList();
selectedStoreId.value = allStoresValue;
} else {
const store = await currentStoreStore.loadLoginStore();
selectedStoreId.value = store?.id || "";
await currentStoreStore.loadLoginStore();
}
await loadEventList();
await reload();