feat(ops): add cleaning work order management module
This commit is contained in:
128
apps/web-antd/src/api/ops/cleaning/index.ts
Normal file
128
apps/web-antd/src/api/ops/cleaning/index.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace OpsCleaningApi {
|
||||
/** 保洁员状态枚举 */
|
||||
export enum CleanerStatus {
|
||||
BUSY = 'BUSY', // 忙碌
|
||||
IDLE = 'IDLE', // 空闲
|
||||
OFFLINE = 'OFFLINE', // 离线
|
||||
PAUSED = 'PAUSED', // 暂停中
|
||||
}
|
||||
|
||||
/** 通知类型枚举 */
|
||||
export enum NotifyType {
|
||||
VIBRATE = 'VIBRATE', // 震动
|
||||
VOICE = 'VOICE', // 语音
|
||||
}
|
||||
|
||||
/** 升级优先级请求 */
|
||||
export interface UpgradePriorityReq {
|
||||
orderId: number; // 工单ID
|
||||
reason: string; // 升级原因
|
||||
}
|
||||
|
||||
/** 工牌通知请求 */
|
||||
export interface DeviceNotifyReq {
|
||||
cleanerId: number; // 保洁员ID
|
||||
type: NotifyType; // 通知类型
|
||||
content?: string; // 语音内容(仅语音通知需要)
|
||||
}
|
||||
|
||||
/** 保洁员状态信息 */
|
||||
export interface CleanerStatusItem {
|
||||
userId: number; // 用户ID
|
||||
userName: string; // 用户名称
|
||||
avatar?: string; // 头像
|
||||
status: CleanerStatus; // 状态
|
||||
currentAreaId?: number; // 当前区域ID
|
||||
currentAreaName?: string; // 当前区域名称
|
||||
batteryLevel: number; // 电量(0-100)
|
||||
lastHeartbeatTime: string; // 最后心跳时间
|
||||
todayCompletedCount?: number; // 今日完成工单数
|
||||
todayWorkMinutes?: number; // 今日工作时长(分钟)
|
||||
}
|
||||
|
||||
/** 保洁员状态列表查询参数 */
|
||||
export interface CleanerListQuery {
|
||||
areaId?: number; // 区域ID(可选)
|
||||
status?: CleanerStatus; // 状态筛选(可选)
|
||||
}
|
||||
|
||||
/** 保洁员状态列表响应 */
|
||||
export interface CleanerListResp {
|
||||
list: CleanerStatusItem[];
|
||||
}
|
||||
|
||||
/** 工单时间轴节点 */
|
||||
export interface TimelineItem {
|
||||
status: string; // 状态
|
||||
statusName: string; // 状态名称
|
||||
time: string; // 时间
|
||||
operator?: string; // 操作人
|
||||
description?: string; // 描述
|
||||
extra?: Record<string, any>; // 额外信息(如RSSI值、信标ID等)
|
||||
}
|
||||
|
||||
/** 工单时间轴响应 */
|
||||
export interface OrderTimelineResp {
|
||||
orderId: number;
|
||||
currentStatus: string;
|
||||
timeline: TimelineItem[];
|
||||
}
|
||||
|
||||
/** 保洁员工牌实时状态 */
|
||||
export interface BadgeRealtimeStatus {
|
||||
cleanerId: number; // 保洁员ID
|
||||
deviceId: number; // 设备ID
|
||||
deviceKey: string; // 设备Key
|
||||
status: CleanerStatus; // 设备状态
|
||||
batteryLevel: number; // 电量
|
||||
lastHeartbeatTime: string; // 最后心跳时间
|
||||
rssi?: number; // 信号强度
|
||||
isInArea: boolean; // 是否在区域内
|
||||
areaId?: number; // 当前区域ID
|
||||
areaName?: string; // 当前区域名称
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 保洁专属接口 ====================
|
||||
|
||||
/** 升级工单优先级 (P0 插队) */
|
||||
export function upgradePriority(data: OpsCleaningApi.UpgradePriorityReq) {
|
||||
return requestClient.post('/ops/clean/order/upgrade-priority', data);
|
||||
}
|
||||
|
||||
/** 发送工牌通知 (语音/震动) */
|
||||
export function sendDeviceNotify(data: OpsCleaningApi.DeviceNotifyReq) {
|
||||
return requestClient.post('/ops/clean/device/notify', data);
|
||||
}
|
||||
|
||||
/** 查询保洁员实时状态列表 */
|
||||
export function getCleanerStatusList(params?: OpsCleaningApi.CleanerListQuery) {
|
||||
return requestClient.get<OpsCleaningApi.CleanerListResp>(
|
||||
'/ops/clean/cleaner/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取工单时间轴 */
|
||||
export function getOrderTimeline(orderId: number) {
|
||||
return requestClient.get<OpsCleaningApi.OrderTimelineResp>(
|
||||
`/ops/clean/order/timeline/${orderId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取保洁员工牌实时状态 */
|
||||
export function getBadgeRealtimeStatus(cleanerId: number) {
|
||||
return requestClient.get<OpsCleaningApi.BadgeRealtimeStatus>(
|
||||
`/ops/clean/badge/realtime/${cleanerId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 手动完成工单(兜底操作) */
|
||||
export function manualCompleteOrder(orderId: number, remark?: string) {
|
||||
return requestClient.post('/ops/clean/order/manual-complete', {
|
||||
orderId,
|
||||
remark,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user