add event record calendar to record list
This commit is contained in:
@@ -163,7 +163,8 @@ const dateOptions: Array<{ label: string; value: DateFilterType }> = [
|
||||
|
||||
// ---------- 筛选 ----------
|
||||
|
||||
const keyword = ref(getQueryText("keyword"));
|
||||
const keyword = ref(getInitialKeyword());
|
||||
const customerId = ref(getQueryText("customerId"));
|
||||
const dateFilterType = ref<DateFilterType>(parseDateFilterType(route.query.dateType));
|
||||
const dateRange = ref(parseDateRange(dateFilterType.value));
|
||||
const actionFilter = ref<string[]>([]);
|
||||
@@ -350,12 +351,17 @@ async function toDetail(id: string): Promise<void> {
|
||||
}
|
||||
await router.push({
|
||||
path: `/management/registration-event-records/${id}`,
|
||||
query: buildFilterQuery()
|
||||
query: buildFilterQuery(String(getCurrentRouteDepth() + 1))
|
||||
});
|
||||
}
|
||||
|
||||
async function toCreate(): Promise<void> {
|
||||
await router.push("/management/registration-event-records/create");
|
||||
await router.push({
|
||||
path: "/management/registration-event-records/create",
|
||||
query: {
|
||||
transitionDepth: String(getCurrentRouteDepth() + 1)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function confirmRemoveRecord(record: EventRecordListItemView): Promise<void> {
|
||||
@@ -428,6 +434,7 @@ function buildRangeReq(): Omit<EventRecordPage, "index" | "size"> {
|
||||
return {
|
||||
beginAt,
|
||||
endAt,
|
||||
customerId: customerId.value || undefined,
|
||||
keyword: keyword.value.trim() || undefined,
|
||||
eventIdList: selectedAllEvent ? undefined : actionFilter.value
|
||||
};
|
||||
@@ -458,14 +465,41 @@ function parseEventIdList(value: unknown): string[] {
|
||||
return text.split(",").map(item => item.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
function buildFilterQuery(): Record<string, string> {
|
||||
return {
|
||||
function buildFilterQuery(transitionDepth = getQueryText("transitionDepth")): Record<string, string> {
|
||||
const query = {
|
||||
keyword: keyword.value.trim(),
|
||||
dateType: dateFilterType.value,
|
||||
beginAt: dateRange.value[0] || "",
|
||||
endAt: dateRange.value[1] || "",
|
||||
customerId: customerId.value,
|
||||
customerName: getQueryText("customerName"),
|
||||
eventIds: actionFilter.value.join(",")
|
||||
};
|
||||
if (isValidTransitionDepth(transitionDepth)) {
|
||||
return {
|
||||
...query,
|
||||
transitionDepth
|
||||
};
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
function getInitialKeyword(): string {
|
||||
return getQueryText("keyword") || getQueryText("customerName");
|
||||
}
|
||||
|
||||
function getCurrentRouteDepth(): number {
|
||||
const transitionDepth = getQueryText("transitionDepth").trim();
|
||||
if (isValidTransitionDepth(transitionDepth)) {
|
||||
return Number(transitionDepth);
|
||||
}
|
||||
|
||||
return Number(route.meta.depth ?? 0);
|
||||
}
|
||||
|
||||
function isValidTransitionDepth(value: string): boolean {
|
||||
const depth = Number(value);
|
||||
return value !== "" && Number.isInteger(depth) && 0 <= depth && depth <= 20;
|
||||
}
|
||||
|
||||
async function replaceFilterQuery(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user