fix: 实时监控显示优化
1. KPI 总里程不保留小数 2. 车辆卡片先展示部门再展示客户名称,客户名称不截断 3. 无部门时展示租赁状态(自营/租赁/挂靠等) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -358,7 +358,7 @@ export default function MonitoringView() {
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-4 text-xs text-slate-400">{v.customer}</td>
|
||||
<td className="p-4 text-xs text-slate-400">{v.department}</td>
|
||||
<td className="p-4 text-xs text-slate-400">{v.department || v.rentStatus || ''}</td>
|
||||
<td className="p-4 text-right">
|
||||
<div className="flex flex-col items-end">
|
||||
<div className="flex items-center gap-1.5">
|
||||
@@ -685,7 +685,7 @@ export default function MonitoringView() {
|
||||
{sortBy === 'today' ? '今日' : '累计'}总里程 (KM)
|
||||
</div>
|
||||
<div className="text-2xl font-black tracking-tighter flex items-baseline gap-1">
|
||||
{(sortBy === 'today' ? stats.totalToday : stats.totalAll).toLocaleString()}
|
||||
{Math.round(sortBy === 'today' ? stats.totalToday : stats.totalAll).toLocaleString()}
|
||||
{sortBy === 'today' && <span className="text-blue-400 text-[10px] font-bold">{'\u2191'}12%</span>}
|
||||
</div>
|
||||
<div className="absolute -right-4 -bottom-4 w-12 h-12 bg-blue-500/10 rounded-full blur-xl"></div>
|
||||
@@ -735,8 +735,8 @@ export default function MonitoringView() {
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="text-[9px] font-bold text-slate-600 truncate max-w-[80px]">{v.customer || '未分配'}</span>
|
||||
<span className="text-[8px] text-slate-300 font-bold uppercase">{v.department?.replace('业务', '')}</span>
|
||||
<span className="text-[8px] text-slate-300 font-bold">{v.department ? v.department.replace('业务', '') : v.rentStatus || ''}</span>
|
||||
<span className="text-[9px] font-bold text-slate-600 truncate">{v.customer || '未分配'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface MonitoringVehicle {
|
||||
customer: string | null;
|
||||
department: string | null;
|
||||
manager: string | null;
|
||||
rentStatus: string | null;
|
||||
}
|
||||
|
||||
export interface MonitoringStats {
|
||||
|
||||
@@ -9,13 +9,16 @@ const VEHICLE_INFO_SQL = `SELECT
|
||||
truck.plate_number AS plate,
|
||||
cus.customer_name AS customer,
|
||||
dep.dep_name AS department,
|
||||
u.user_name AS manager
|
||||
u.user_name AS manager,
|
||||
dic_status.dic_name AS rent_status
|
||||
FROM tab_truck truck
|
||||
LEFT JOIN tab_truck_status_info si ON si.truck_id = truck.id AND si.is_deleted = 0
|
||||
LEFT JOIN tab_contract c ON c.id = si.contract_id AND c.is_deleted = 0
|
||||
LEFT JOIN tab_customer cus ON cus.id = c.customer_id AND cus.is_deleted = 0
|
||||
LEFT JOIN tab_user u ON u.id = c.bd AND u.is_deleted = 0
|
||||
LEFT JOIN tab_department dep ON dep.id = u.dep_id AND dep.is_deleted = 0
|
||||
LEFT JOIN tab_dic dic_status ON dic_status.parent_code = 'dic_truck_rent_status'
|
||||
AND dic_status.dic_code = truck.truck_rent_status AND dic_status.is_deleted = 0
|
||||
WHERE truck.is_deleted = 0 AND truck.is_operation = 1`;
|
||||
|
||||
// ========== 实时监控缓存(每2分钟刷新) ==========
|
||||
@@ -30,6 +33,7 @@ interface CachedVehicle {
|
||||
customer: string | null;
|
||||
department: string | null;
|
||||
manager: string | null;
|
||||
rentStatus: string | null;
|
||||
}
|
||||
|
||||
interface MonitoringCache {
|
||||
@@ -95,6 +99,7 @@ async function refreshMonitoringCache() {
|
||||
customer: info?.customer || null,
|
||||
department: info?.department || null,
|
||||
manager: info?.manager || null,
|
||||
rentStatus: info?.rent_status || null,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user