add registration event sort

This commit is contained in:
Timi
2026-08-03 15:34:18 +08:00
parent c49e01be38
commit b30d0d1769
6 changed files with 533 additions and 83 deletions
+16 -2
View File
@@ -56,6 +56,7 @@ import { Toast } from "tdesign-mobile-vue";
import { Time, useUserStore, type Role } from "timi-web";
import RegistrationEventAPI from "@/api/RegistrationEventAPI";
import GaoUserAPI from "@/api/GaoUserAPI";
import { useNavBarStore } from "@/store/navBarStore";
import type { RegistrationEvent, RegistrationLimitType } from "@/types/RegistrationEvent";
import { gaoPermissionCodes } from "@/utils/gaoPermission";
@@ -64,6 +65,7 @@ defineOptions({
});
const router = useRouter();
const navBarStore = useNavBarStore();
const userStore = useUserStore();
const defaultColor = "#2f88ff";
const registrationEventList = ref<RegistrationEvent[]>([]);
@@ -74,6 +76,10 @@ function createRegistrationEvent(): void {
router.push("/management/registration-events/create");
}
async function goSort(): Promise<void> {
await router.push("/management/registration-events/sort");
}
function editRegistrationEvent(item: RegistrationEvent): void {
if (!item.id) {
return;
@@ -111,9 +117,9 @@ function getLimitText(item: RegistrationEvent): string {
const limitTextMap: Record<RegistrationLimitType, string> = {
NONE: "不限次数",
DAILY_HALF_DAY: "上午/下午各一次",
NATURAL_DAY: "每天一次",
INTERVAL_HOUR: `每隔 ${item.limitValue || 0} 小时`,
NATURAL_MONTH: "每月一次",
NATURAL_DAY: "每个自然日一次",
NATURAL_MONTH: "每个自然月一次",
TOTAL_LIMIT: `事件总上限 ${item.limitValue || 0} 次`,
CUSTOMER_TOTAL_LIMIT: `单客户总上限 ${item.limitValue || 0} 次`
};
@@ -156,6 +162,10 @@ async function loadData(): Promise<void> {
}
onMounted(async () => {
navBarStore.clearRight();
if (canUpdateRegistrationEvent.value) {
navBarStore.setRightText("排序", "var(--td-brand-color)", goSort);
}
try {
await loadData();
} catch {
@@ -166,6 +176,10 @@ onMounted(async () => {
});
}
});
onUnmounted(() => {
navBarStore.clearRight();
});
</script>
<style scoped lang="less">