feat(web-admin): split recharge summary by fuel/ETC and fix pnpm workspace
Show fuel-only cards on fuel routes and ETC-only cards on ETC routes with a 5-column layout, and declare packages in pnpm-workspace.yaml so pnpm 9+ can build. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
7ebbaa2784
commit
a4d213231c
7 files changed
+132
-26
No files matched your search
@@ -9,15 +9,15 @@
|
||||
<article class="fuel-plate-card recharge-card recharge-notice">
|
||||
<div class="recharge-notice-head"> <div class="plate">消息通知</div><em>最新</em> </div>
|
||||
<div class="recharge-notice-list">
|
||||
<div v-for="notice in summary.notices" :key="notice.id" class="recharge-notice-item">
|
||||
<div v-for="notice in displayedNotices" :key="notice.id" class="recharge-notice-item">
|
||||
<time :datetime="notice.occurredAt">{{ notice.occurredAt.slice(0, 10) }}</time>
|
||||
<span
|
||||
>{{ notice.actorName }}{{ notice.roleName ? `(${notice.roleName})` : ''
|
||||
}}{{ notice.action }}{{ notice.licensePlate
|
||||
}}{{ notice.rechargeType === 'etc' ? 'ETC' : '加油卡' }}充值;</span
|
||||
}}{{ noticeTypeLabel(notice.rechargeType) }}充值;</span
|
||||
>
|
||||
</div>
|
||||
<div v-if="!summary.notices.length" class="recharge-notice-item muted">暂无消息</div>
|
||||
<div v-if="!displayedNotices.length" class="recharge-notice-item muted">暂无消息</div>
|
||||
</div>
|
||||
</article>
|
||||
<article
|
||||
@@ -45,7 +45,7 @@
|
||||
>{{ statusLabels[vehicle.vehicleStatus] || vehicle.vehicleStatus || '—' }}</el-tag
|
||||
>
|
||||
</div>
|
||||
<div class="recharge-split">
|
||||
<div class="recharge-split" :class="{ 'is-single': kinds.length === 1 }">
|
||||
<div v-for="kind in kinds" :key="kind.value" class="recharge-pane">
|
||||
<div class="recharge-pane-h">
|
||||
<h4>{{ kind.label }}</h4>
|
||||
@@ -94,10 +94,17 @@
|
||||
} from '@/api/pl/recharge-summary'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
import { formatPlVehiclePlateDisplay } from '@/utils/pl-display'
|
||||
import { rechargeComparison, rechargeSummaryQuery } from '@/utils/pl-recharge-summary'
|
||||
import {
|
||||
rechargeComparison,
|
||||
rechargeSummaryQuery,
|
||||
type RechargeSummaryMode
|
||||
} from '@/utils/pl-recharge-summary'
|
||||
import mittBus from '@/utils/sys/mittBus'
|
||||
|
||||
const props = defineProps<{ applyPath: string }>()
|
||||
const props = withDefaults(
|
||||
defineProps<{ applyPath: string; mode?: RechargeSummaryMode }>(),
|
||||
{ mode: 'fuel' }
|
||||
)
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const summary = ref<RechargeSummary | null>(null)
|
||||
@@ -107,12 +114,22 @@
|
||||
vehicle.vehicleType === 'self' && !['油桶', '叉车'].includes(vehicle.licensePlate.trim())
|
||||
)
|
||||
)
|
||||
const displayedNotices = computed(() => {
|
||||
const notices = summary.value?.notices || []
|
||||
if (props.mode === 'etc') return notices.filter((n) => n.rechargeType === 'etc')
|
||||
return notices.filter((n) => n.rechargeType !== 'etc')
|
||||
})
|
||||
const loading = ref(false)
|
||||
const error = ref(false)
|
||||
const kinds = [
|
||||
const kindDefs = [
|
||||
{ value: 'etc', label: 'ETC' },
|
||||
{ value: 'fuel', label: '加油卡' }
|
||||
] as const
|
||||
const kinds = computed(() =>
|
||||
kindDefs.filter((kind) =>
|
||||
props.mode === 'etc' ? kind.value === 'etc' : kind.value === 'fuel'
|
||||
)
|
||||
)
|
||||
const statusLabels: Record<string, string> = {
|
||||
available: '可用',
|
||||
maintaining: '维修中',
|
||||
@@ -122,6 +139,11 @@
|
||||
Number(value).toLocaleString('zh-CN', { maximumFractionDigits: 0 })
|
||||
let requestVersion = 0
|
||||
|
||||
function noticeTypeLabel(rechargeType: string) {
|
||||
if (rechargeType === 'etc') return 'ETC'
|
||||
return '加油卡'
|
||||
}
|
||||
|
||||
function metrics(amounts: RechargeAmounts) {
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -186,11 +186,13 @@
|
||||
}
|
||||
|
||||
.recharge-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
/* 单栏(油卡/ETC 分开展示):固定一行 5 张 */
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
|
||||
.recharge-card {
|
||||
cursor: default;
|
||||
padding: 12px 14px;
|
||||
}
|
||||
|
||||
.recharge-split {
|
||||
@@ -199,6 +201,10 @@
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.recharge-split.is-single {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.recharge-pane {
|
||||
min-width: 0;
|
||||
padding: 10px 12px;
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PlRechargeSummary v-if="!isFullPage && showRechargeSummary" :apply-path="rechargeApplyPath" />
|
||||
<PlRechargeSummary
|
||||
v-if="!isFullPage && showRechargeSummary && rechargeSummaryMode"
|
||||
:apply-path="rechargeApplyPath"
|
||||
:mode="rechargeSummaryMode"
|
||||
/>
|
||||
<ArtGroupLeafTabs v-if="!isFullPage && showGroupLeafTabs" />
|
||||
|
||||
<!-- 勿强制 minHeight:calc(100vh-…),否则门户布局会叠出多余纵向滚动条 -->
|
||||
@@ -71,7 +75,11 @@
|
||||
import { layoutOutletCacheKey, resolveLeafGroup } from '@/utils/router/leaf-group'
|
||||
import ArtGroupLeafTabs from '@/components/core/layouts/art-group-leaf-tabs/index.vue'
|
||||
import PlRechargeSummary from '@/components/business/pl-recharge-summary/index.vue'
|
||||
import { isRechargeSummaryRoute } from '@/utils/pl-recharge-summary'
|
||||
import {
|
||||
isRechargeSummaryRoute,
|
||||
rechargeSummaryModeFromPath,
|
||||
type RechargeSummaryMode
|
||||
} from '@/utils/pl-recharge-summary'
|
||||
|
||||
defineOptions({ name: 'ArtPageContent' })
|
||||
|
||||
@@ -93,12 +101,29 @@
|
||||
const showGroupLeafTabs = computed(() => (leafGroup.value?.leaves.length || 0) > 1)
|
||||
|
||||
const leafGroupId = computed(() => leafGroup.value?.groupId || '')
|
||||
const rechargeApplyPath = computed(() =>
|
||||
leafGroup.value?.leaves.find((leaf) => leaf.meta.menuCode === 'pl:vehicle-recharge-apply:list')?.path || ''
|
||||
const rechargeSummaryMode = computed<RechargeSummaryMode | null>(() => {
|
||||
const fromRoute = rechargeSummaryModeFromPath(route.path)
|
||||
if (fromRoute) return fromRoute
|
||||
for (const leaf of leafGroup.value?.leaves || []) {
|
||||
const mode = rechargeSummaryModeFromPath(leaf.path)
|
||||
if (mode) return mode
|
||||
}
|
||||
return null
|
||||
})
|
||||
const rechargeApplyMenuCode = computed(() =>
|
||||
rechargeSummaryMode.value === 'etc'
|
||||
? 'pl:etc-vehicle-recharge-apply:list'
|
||||
: 'pl:vehicle-recharge-apply:list'
|
||||
)
|
||||
const showRechargeSummary = computed(() =>
|
||||
isRechargeSummaryRoute(route.path) ||
|
||||
!!leafGroup.value?.leaves.some((leaf) => isRechargeSummaryRoute(leaf.path))
|
||||
const rechargeApplyPath = computed(
|
||||
() =>
|
||||
leafGroup.value?.leaves.find((leaf) => leaf.meta.menuCode === rechargeApplyMenuCode.value)
|
||||
?.path || ''
|
||||
)
|
||||
const showRechargeSummary = computed(
|
||||
() =>
|
||||
isRechargeSummaryRoute(route.path) ||
|
||||
!!leafGroup.value?.leaves.some((leaf) => isRechargeSummaryRoute(leaf.path))
|
||||
)
|
||||
|
||||
const useGroupOutletCache = computed(
|
||||
|
||||
Reference in new issue
Block a user