feat(admin): 增加启动与导航反馈并保护工作标签状态

This commit is contained in:
2026-12-01 20:01:40 +08:00
parent d8a16b0778
commit f02d47468b
22 changed files with 869 additions and 141 deletions
@@ -14,6 +14,7 @@
<el-date-picker
v-model="dateRangeModel"
type="daterange"
popper-class="list-time-filter-calendar"
value-format="YYYY-MM-DD"
range-separator="至"
start-placeholder="开始日期"
@@ -38,6 +39,7 @@
v-if="timeType === 'custom'"
v-model="dateRangeModel"
type="daterange"
popper-class="list-time-filter-calendar"
value-format="YYYY-MM-DD"
range-separator="至"
start-placeholder="开始日期"
@@ -94,3 +96,26 @@ const emit = defineEmits<{
margin-bottom: 0;
}
</style>
<!-- The picker is teleported outside its form. Limit this override to the shared
list filter, the new admin profile and narrow screens; keep both months reachable. -->
<style lang="scss">
@media (max-width: 640px) {
:root[data-admin-ui='v2'] .list-time-filter-calendar .el-date-range-picker {
width: min(360px, calc(100vw - 24px));
.el-picker-panel__body-wrapper {
max-height: min(62vh, 480px);
overflow-y: auto;
overscroll-behavior: contain;
}
.el-picker-panel__body { min-width: 0; }
.el-date-range-picker__content {
display: block;
width: 100%;
padding: 8px 12px;
&.is-left { border-right: 0; border-bottom: 1px solid var(--el-border-color-lighter); }
}
}
}
</style>
+39 -4
View File
@@ -1,12 +1,12 @@
<template>
<div class="pagination">
<div class="pagination zyt-pagination" :class="{ 'zyt-pagination--standard': effectiveLayout === standardLayout }">
<el-pagination
v-bind="props"
:pager-count="5"
v-model:currentPage="pager.page"
v-model:pageSize="pager.size"
:page-sizes="pageSizes"
:layout="layout"
:layout="effectiveLayout"
:total="pager.count"
:hide-on-single-page="false"
@size-change="sizeChange"
@@ -23,9 +23,10 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
modelValue: () => ({}),
pageSizes: () => [15, 20, 30, 40],
layout: 'total, sizes, prev, pager, next, jumper'
pageSizes: () => [15, 20, 30, 40]
})
const standardLayout = 'total, sizes, prev, pager, next, jumper'
const effectiveLayout = computed(() => props.layout ?? standardLayout)
const emit = defineEmits<{
(event: 'change'): void
@@ -48,3 +49,37 @@ const pageChange = () => {
emit('change')
}
</script>
<style lang="scss">
// A sidebar, dialog or split view can leave less room than the viewport.
:root[data-admin-ui='v2'] .zyt-pagination {
container: zyt-pages / inline-size;
width: 100%;
min-width: 0;
> .el-pagination { justify-content: flex-end; flex-wrap: wrap; }
}
@container zyt-pages (max-width: 740px) {
.zyt-pagination > .el-pagination {
--el-pagination-item-gap: 0px;
gap: 6px;
.el-pagination__rightwrapper, .el-pager { max-width: 100%; flex-wrap: wrap; }
.el-pager { display: flex; justify-content: center; }
// The classic stylesheet hides these slots on mobile. Keep only the
// slots actually requested by this instance's layout.
.el-pagination__sizes, .el-pagination__jump { display: inline-flex !important; }
}
// Only our default order gets explicit rows. Custom layouts keep their DOM order.
.zyt-pagination--standard > .el-pagination {
display: grid;
grid-template-columns: 32px repeat(2, minmax(0, 1fr)) 32px;
column-gap: 0;
max-width: 360px;
margin-inline-start: auto;
.el-pagination__total, .el-pagination__sizes, .el-pager { grid-column: span 2; }
.el-pagination__total { white-space: normal; overflow-wrap: anywhere; }
.el-pagination__sizes { justify-self: end; max-width: 100%; }
.el-pagination__sizes .el-select { max-width: 100%; }
.el-pagination__jump { grid-column: 1 / -1; justify-self: end; }
}
}
</style>
@@ -0,0 +1,33 @@
<template>
<aside v-if="failedRoute" class="route-load-notice" aria-label="页面加载提示">
<div role="status">
<strong>页面未能打开</strong>
<p>当前页面已保留。请检查网络后重试;如需刷新,请先保存正在填写的内容。</p>
</div>
<div class="notice-actions">
<el-button size="small" @click="reportRouteLoad()">关闭提示</el-button>
<el-button size="small" type="primary" @click="retry">重试打开</el-button>
</div>
</aside>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'
import { failedRoute, reportRouteLoad } from '@/utils/route-load-notice'
const router = useRouter()
function retry() {
const target = failedRoute.value
if (target) void router.push(target).catch(() => { /* router.onError owns the feedback */ })
}
</script>
<style scoped>
.route-load-notice {
position: fixed; z-index: 2050; inset-inline-end: 16px; bottom: max(16px, env(safe-area-inset-bottom));
width: min(360px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--el-border-color);
border-radius: var(--zyt-radius, 10px); color: var(--el-text-color-primary);
background: var(--el-bg-color-overlay); box-shadow: var(--el-box-shadow-light);
}
.route-load-notice p { margin: 4px 0 12px; color: var(--el-text-color-regular); font-size: 13px; }
.notice-actions { display: flex; justify-content: flex-end; gap: 8px; }
.notice-actions .el-button + .el-button { margin: 0; }
</style>