fix(pl): 按车辆类型统一派车日历卡片配色以区分自有三方和待派车。
This commit is contained in:
1 parent
cb0344498a
commit
043e2ef661
11 files changed
+268
-27
No files matched your search
@@ -2,6 +2,8 @@ import request, { pickBxData } from '@/utils/http/bx'
|
||||
|
||||
export type DispatchCalendarKind = 'acid' | 'alkali' | 'other' | 'site'
|
||||
|
||||
export type DispatchCalendarVehicleType = 'self' | 'carrier' | 'pending' | 'unknown'
|
||||
|
||||
export interface DispatchCalendarBody {
|
||||
dispatchDate: string
|
||||
vehicleId: string
|
||||
@@ -16,6 +18,7 @@ export interface DispatchCalendarBody {
|
||||
export interface DispatchCalendarRecord extends DispatchCalendarBody {
|
||||
id: string
|
||||
sourceRecordId?: string | null
|
||||
readonly vehicleType?: DispatchCalendarVehicleType
|
||||
licensePlate: string
|
||||
productName: string
|
||||
createTime: string | null
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
v-if="group.rows.length === 1"
|
||||
type="button"
|
||||
class="item"
|
||||
:class="`tone-${productTone(group.rows[0].productName)}`"
|
||||
:class="`vehicle-${manualVehicleType(group.rows[0])}`"
|
||||
data-testid="manual-record"
|
||||
@click="emit('select', group.rows[0])"
|
||||
>
|
||||
@@ -38,7 +38,7 @@
|
||||
<span class="route">{{ group.rows[0].origin }} → {{ group.rows[0].destination }}</span>
|
||||
<span v-if="group.rows[0].remark" class="remark">{{ group.rows[0].remark }}</span>
|
||||
</component>
|
||||
<div v-else class="pair">
|
||||
<div v-else class="pair" :class="`vehicle-${manualVehicleType(group.rows[0])}`">
|
||||
<div
|
||||
><span class="plate">{{ group.plate }}</span> {{ group.rows.length }}车</div
|
||||
>
|
||||
@@ -70,7 +70,7 @@
|
||||
import { Cell as VanCell } from 'vant'
|
||||
import 'vant/es/cell/style'
|
||||
import type { DispatchCalendarRecord } from '@/api/pl/dispatch-calendar'
|
||||
import { manualQuantityLabel, type manualCalendarDays } from './manual-model'
|
||||
import { manualQuantityLabel, manualVehicleType, type manualCalendarDays } from './manual-model'
|
||||
import { productTone } from './model'
|
||||
|
||||
defineProps<{ day: ReturnType<typeof manualCalendarDays>[number]; mobile?: boolean }>()
|
||||
@@ -158,23 +158,22 @@
|
||||
|
||||
.item {
|
||||
display: block;
|
||||
background: #e8f3ec;
|
||||
}
|
||||
|
||||
.item.tone-sand {
|
||||
background: #ece8e0;
|
||||
.vehicle-self {
|
||||
background: var(--manual-vehicle-self-bg, #e8f3ec);
|
||||
}
|
||||
|
||||
.item.tone-rose {
|
||||
background: #f3e4e8;
|
||||
.vehicle-carrier {
|
||||
background: #e7f0f8;
|
||||
}
|
||||
|
||||
.item.tone-amber {
|
||||
background: #efe6d0;
|
||||
.vehicle-pending {
|
||||
background: #fee2e2;
|
||||
}
|
||||
|
||||
.item.tone-unknown {
|
||||
background: #fff4d6;
|
||||
.vehicle-unknown {
|
||||
background: #f1f5f9;
|
||||
}
|
||||
|
||||
.plate {
|
||||
@@ -205,7 +204,6 @@
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding-bottom: 6px;
|
||||
background: var(--manual-day-primary-bg, #e7f0f8);
|
||||
}
|
||||
|
||||
.pair-trip {
|
||||
@@ -224,7 +222,7 @@
|
||||
.is-mobile {
|
||||
--manual-day-primary: #0a9f6d;
|
||||
--manual-day-primary-text: #087f57;
|
||||
--manual-day-primary-bg: #e9f9f2;
|
||||
--manual-vehicle-self-bg: #e9f9f2;
|
||||
}
|
||||
|
||||
.is-mobile :deep(.van-cell__value) {
|
||||
|
||||
@@ -2,10 +2,27 @@ import type {
|
||||
CalendarPage,
|
||||
CalendarPageQuery,
|
||||
DispatchCalendarBody,
|
||||
DispatchCalendarRecord
|
||||
DispatchCalendarRecord,
|
||||
DispatchCalendarVehicleType
|
||||
} from '@/api/pl/dispatch-calendar'
|
||||
import { dateKey, monthCells } from './model'
|
||||
|
||||
/** 待派车使用专用ID;旧响应和未知类型保持中性色,不从车牌快照推断。 */
|
||||
export function manualVehicleType(row: {
|
||||
vehicleId: string
|
||||
vehicleType?: string | null
|
||||
}): DispatchCalendarVehicleType {
|
||||
if (row.vehicleId === '__pending_vehicle__') return 'pending'
|
||||
switch (row.vehicleType) {
|
||||
case 'self':
|
||||
case 'carrier':
|
||||
case 'pending':
|
||||
return row.vehicleType
|
||||
default:
|
||||
return 'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
/** 完整分页:中途缺页或重复页报错,不能把部分月份当作完整数据。 */
|
||||
export async function loadCalendarPages<T extends { id: string }>(
|
||||
fetchPage: (query: CalendarPageQuery) => Promise<CalendarPage<T>>,
|
||||
|
||||
Reference in new issue
Block a user