refactor layout
This commit is contained in:
+240
-138
@@ -1,141 +1,197 @@
|
||||
<template>
|
||||
<div v-can="permissionCodes.eventRecord.read" class="registration-record-list">
|
||||
<div class="filters glass">
|
||||
<div class="search-date">
|
||||
<t-input
|
||||
v-model.trim="keyword"
|
||||
class="search-input"
|
||||
type="search"
|
||||
borderless
|
||||
placeholder="搜索客户、姓名拼音、编码、事件、备注、登记人"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
content="选择客户"
|
||||
@click.stop="customerSelectorVisible = true"
|
||||
/>
|
||||
</template>
|
||||
</t-input>
|
||||
<t-dropdown-menu class="date-filter">
|
||||
<t-dropdown-item
|
||||
v-model="dateFilterType"
|
||||
:label="dateFilterLabel"
|
||||
:options="dateOptions"
|
||||
@change="selectDateFilter"
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
</div>
|
||||
<t-dropdown-menu class="filter-menu">
|
||||
<t-dropdown-item
|
||||
v-model="actionFilter"
|
||||
:label="eventFilterLabel"
|
||||
options-columns="2"
|
||||
:options="actionOptions"
|
||||
multiple
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="verificationFilter"
|
||||
:label="verificationFilterLabel"
|
||||
:options="verificationOptions"
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="optionFilter"
|
||||
:label="optionFilterLabel"
|
||||
:footer="!optionFilterOptions.length ? optionFilterUnavailableFooter : undefined"
|
||||
options-columns="2"
|
||||
:options="optionFilterOptions"
|
||||
multiple
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
</div>
|
||||
<t-pull-down-refresh
|
||||
v-model="isRefreshing"
|
||||
:refresh-timeout="30000"
|
||||
@refresh="reloadRecords"
|
||||
@scrolltolower="loadRecords"
|
||||
<div class="page-layout navbar registration-record-list">
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
title="登记事件记录管理"
|
||||
left-arrow
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<div class="list-wrapper">
|
||||
<t-cell-group v-entrance-transition class="summary" theme="card">
|
||||
<t-cell
|
||||
title="开始时间"
|
||||
:note="dateRange[0] || '-'"
|
||||
arrow
|
||||
@click="openStartTime"
|
||||
/>
|
||||
<t-cell
|
||||
title="结束时间"
|
||||
:note="dateRange[1] || '-'"
|
||||
arrow
|
||||
@click="openEndTime"
|
||||
/>
|
||||
<t-cell title="事件" :note="eventFilterLabel" />
|
||||
<t-cell v-if="optionFilterLabel !== '全部选项'" title="选项" :note="optionFilterLabel" />
|
||||
<t-cell title="记录数" :note="Text.display(pageResult.total)" />
|
||||
<t-cell title="客户数" :note="Text.display(pageResult.customerCount)" />
|
||||
<t-cell v-if="summaryNumberValueText" title="数值合计" :note="summaryNumberValueText" />
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="hasSelectedOption && optionStatList.length" title="选项统计" class="option-stat" theme="card">
|
||||
<t-cell
|
||||
v-for="item in optionStatList"
|
||||
:key="`${item.groupId}-${item.optionId}`"
|
||||
:title="`${item.groupName || '选项组'}:${item.optionLabel || '未命名选项'}`"
|
||||
:note="`${item.recordCount || 0} 条`"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-cell-group
|
||||
v-if="pageResult.list.length"
|
||||
class="record-list"
|
||||
theme="card"
|
||||
<template #right>
|
||||
<div
|
||||
class="nav-actions"
|
||||
v-if="(canShowActionMenu) && pageNavBarActionList.length"
|
||||
>
|
||||
<event-record-cell
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
v-for="item in pageResult.list"
|
||||
:key="item.id"
|
||||
:record="item"
|
||||
@updated="reloadRecords"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<div v-else class="center-tips" v-text="isLoading ? '正在加载登记事件记录' : '暂无登记事件记录'" />
|
||||
<div v-if="pageResult.list.length" class="center-tips" v-text="loadStateText" />
|
||||
</div>
|
||||
</t-pull-down-refresh>
|
||||
<t-popover
|
||||
v-model:visible="pageNavBarActionVisible"
|
||||
placement="bottom-right"
|
||||
:show-arrow="false"
|
||||
theme="light"
|
||||
>
|
||||
<t-button
|
||||
class="trigger"
|
||||
variant="text"
|
||||
:aria-label="'更多操作'"
|
||||
type="button"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon name="ellipsis" />
|
||||
</template>
|
||||
</t-button>
|
||||
<template #content>
|
||||
<div class="menu">
|
||||
<t-button
|
||||
v-for="action in pageNavBarActionList"
|
||||
:key="action.key"
|
||||
class="menu-item"
|
||||
variant="text"
|
||||
type="button"
|
||||
:theme="action.theme"
|
||||
:loading="action.loading"
|
||||
:disabled="action.disabled || action.loading"
|
||||
@click="handlePageNavBarAction(action)"
|
||||
>
|
||||
<template v-if="action.icon" #icon>
|
||||
<t-icon :name="action.icon" />
|
||||
</template>
|
||||
<span v-text="action.text" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-popover>
|
||||
</div>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.eventRecord.read" class="page-content scroll list">
|
||||
<t-pull-down-refresh
|
||||
class="pull-refresh"
|
||||
v-model="isRefreshing"
|
||||
:refresh-timeout="30000"
|
||||
@refresh="reloadRecords"
|
||||
@scrolltolower="loadRecords"
|
||||
>
|
||||
<div class="filters glass">
|
||||
<div class="search-date">
|
||||
<t-input
|
||||
v-model.trim="keyword"
|
||||
class="search-input"
|
||||
type="search"
|
||||
borderless
|
||||
placeholder="搜索客户、姓名拼音、编码、事件、备注、登记人"
|
||||
>
|
||||
<template #suffix-icon>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
content="选择客户"
|
||||
@click.stop="customerSelectorVisible = true"
|
||||
/>
|
||||
</template>
|
||||
</t-input>
|
||||
<t-dropdown-menu class="date-filter">
|
||||
<t-dropdown-item
|
||||
v-model="dateFilterType"
|
||||
:label="dateFilterLabel"
|
||||
:options="dateOptions"
|
||||
@change="selectDateFilter"
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
</div>
|
||||
<t-dropdown-menu class="filter-menu">
|
||||
<t-dropdown-item
|
||||
v-model="actionFilter"
|
||||
:label="eventFilterLabel"
|
||||
options-columns="2"
|
||||
:options="actionOptions"
|
||||
multiple
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="verificationFilter"
|
||||
:label="verificationFilterLabel"
|
||||
:options="verificationOptions"
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="optionFilter"
|
||||
:label="optionFilterLabel"
|
||||
:footer="!optionFilterOptions.length ? optionFilterUnavailableFooter : undefined"
|
||||
options-columns="2"
|
||||
:options="optionFilterOptions"
|
||||
multiple
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
</div>
|
||||
<div class="list-wrapper">
|
||||
<t-cell-group v-entrance-transition class="summary" theme="card">
|
||||
<t-cell
|
||||
title="开始时间"
|
||||
:note="dateRange[0] || '-'"
|
||||
arrow
|
||||
@click="openStartTime"
|
||||
/>
|
||||
<t-cell
|
||||
title="结束时间"
|
||||
:note="dateRange[1] || '-'"
|
||||
arrow
|
||||
@click="openEndTime"
|
||||
/>
|
||||
<t-cell title="事件" :note="eventFilterLabel" />
|
||||
<t-cell v-if="optionFilterLabel !== '全部选项'" title="选项" :note="optionFilterLabel" />
|
||||
<t-cell title="记录数" :note="Text.display(pageResult.total)" />
|
||||
<t-cell title="客户数" :note="Text.display(pageResult.customerCount)" />
|
||||
<t-cell v-if="summaryNumberValueText" title="数值合计" :note="summaryNumberValueText" />
|
||||
</t-cell-group>
|
||||
<t-cell-group v-if="hasSelectedOption && optionStatList.length" title="选项统计" class="option-stat" theme="card">
|
||||
<t-cell
|
||||
v-for="item in optionStatList"
|
||||
:key="`${item.groupId}-${item.optionId}`"
|
||||
:title="`${item.groupName || '选项组'}:${item.optionLabel || '未命名选项'}`"
|
||||
:note="`${item.recordCount || 0} 条`"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<t-cell-group
|
||||
v-if="pageResult.list.length"
|
||||
class="record-list"
|
||||
theme="card"
|
||||
>
|
||||
<event-record-cell
|
||||
v-entrance-transition="{ step: 30 }"
|
||||
v-for="item in pageResult.list"
|
||||
:key="item.id"
|
||||
:record="item"
|
||||
@updated="reloadRecords"
|
||||
/>
|
||||
</t-cell-group>
|
||||
<div v-else class="center-tips" v-text="isLoading ? '正在加载登记事件记录' : '暂无登记事件记录'" />
|
||||
<div v-if="pageResult.list.length" class="center-tips" v-text="loadStateText" />
|
||||
</div>
|
||||
</t-pull-down-refresh>
|
||||
</main>
|
||||
|
||||
<customer-selector
|
||||
v-model="customerId"
|
||||
v-model:visible="customerSelectorVisible"
|
||||
@change="handleCustomerChange"
|
||||
/>
|
||||
<t-popup v-model="startVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-if="startVisible"
|
||||
v-model="startDraft"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
:mode="['date', 'minute']"
|
||||
title="开始时间"
|
||||
:default-value="dateRange[0]"
|
||||
@cancel="cancelStartTime"
|
||||
@confirm="confirmStartTime"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="endVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-if="endVisible"
|
||||
v-model="endDraft"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="结束时间"
|
||||
:default-value="dateRange[1]"
|
||||
@cancel="cancelEndTime"
|
||||
@confirm="confirmEndTime"
|
||||
/>
|
||||
</t-popup>
|
||||
</div>
|
||||
<nav-bar-action-menu v-if="canShowActionMenu" :actions="actionList" />
|
||||
<customer-selector
|
||||
v-model="customerId"
|
||||
v-model:visible="customerSelectorVisible"
|
||||
@change="handleCustomerChange"
|
||||
/>
|
||||
<t-popup v-model="startVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-if="startVisible"
|
||||
v-model="startDraft"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
:mode="['date', 'minute']"
|
||||
title="开始时间"
|
||||
:default-value="dateRange[0]"
|
||||
@cancel="cancelStartTime"
|
||||
@confirm="confirmStartTime"
|
||||
/>
|
||||
</t-popup>
|
||||
<t-popup v-model="endVisible" placement="bottom">
|
||||
<t-date-time-picker
|
||||
v-if="endVisible"
|
||||
v-model="endDraft"
|
||||
:mode="['date', 'minute']"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
title="结束时间"
|
||||
:default-value="dateRange[1]"
|
||||
@cancel="cancelEndTime"
|
||||
@confirm="confirmEndTime"
|
||||
/>
|
||||
</t-popup>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { NavBarAction } from "@/types/NavBarAction";
|
||||
import type { DropdownValue } from "tdesign-mobile-vue";
|
||||
import { Time, Text, WebToolkit } from "timi-web";
|
||||
import { useUserStore } from "timi-web-api";
|
||||
@@ -143,16 +199,23 @@ import EventAPI from "@/api/EventAPI";
|
||||
import EventRecordAPI from "@/api/EventRecordAPI";
|
||||
import CustomerSelector from "@/components/CustomerSelector.vue";
|
||||
import EventRecordCell from "@/pages/event/component/EventRecordCell.vue";
|
||||
import { useNavBarStore } from "@/store/navBarStore";
|
||||
import type { EventItem, EventStatus } from "@/types/EventItem";
|
||||
import type { EventOptionStat, EventRecordPage, EventRecordPageResult, VerificationStatus } from "@/types/EventRecord";
|
||||
import type { NavBarAction } from "@/types/NavBarAction";
|
||||
import { isRetiredEvent } from "@/utils/event";
|
||||
import { formatEventNumberValue } from "@/utils/eventValue";
|
||||
import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
import { Message } from "@/utils/message.ts";
|
||||
|
||||
const pageNavBarActionVisible = ref(false);
|
||||
const pageNavBarActionList = computed<NavBarAction[]>(() => (unref(actionList) as NavBarAction[]).filter(action => action.visible !== false));
|
||||
|
||||
async function handlePageNavBarAction(action: NavBarAction): Promise<void> {
|
||||
pageNavBarActionVisible.value = false;
|
||||
await action.action();
|
||||
}
|
||||
|
||||
import type { EventItem, EventStatus } from "@/types/EventItem";
|
||||
|
||||
type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom";
|
||||
type VerificationFilter = "ALL" | VerificationStatus;
|
||||
|
||||
@@ -163,7 +226,6 @@ defineOptions({
|
||||
const pageSize = 20;
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const navBarStore = useNavBarStore();
|
||||
const userStore = useUserStore();
|
||||
const dateOptions: Array<{ label: string; value: DateFilterType }> = [
|
||||
{ label: "今天", value: "today" },
|
||||
@@ -669,15 +731,13 @@ function buildUnixRange(): [number, number] {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
navBarStore.clearRight();
|
||||
navBarStore.setCustomRightVisible(canShowActionMenu.value);
|
||||
|
||||
await loadActions();
|
||||
initialized = true;
|
||||
await reloadRecords();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
navBarStore.clearRight();
|
||||
window.clearTimeout(keywordTimer);
|
||||
});
|
||||
</script>
|
||||
@@ -805,4 +865,46 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.nav-actions {
|
||||
--td-popover-padding: 0 .5rem;
|
||||
|
||||
width: 6rem;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
:deep(.t-popover__content) { border-radius: .875rem; }
|
||||
|
||||
.trigger { padding: 0; }
|
||||
|
||||
.menu {
|
||||
gap: .25rem;
|
||||
display: grid;
|
||||
padding: .5rem 0;
|
||||
min-width: 9rem;
|
||||
|
||||
.menu-item {
|
||||
--td-button-medium-height: 32px;
|
||||
--td-button-medium-padding-horizontal: 10px;
|
||||
|
||||
gap: .25rem;
|
||||
width: 100%;
|
||||
font-weight: unset;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
.nav-actions {
|
||||
:deep(.t-popover__content) {
|
||||
color: #e2e8f0;
|
||||
background: rgba(30, 41, 59, .98);
|
||||
}
|
||||
|
||||
.menu-item { color: #e2e8f0; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user