diff --git a/src/api/camera/camera.ts b/src/api/camera/camera.ts index d9ca5a59..a329ea2f 100644 --- a/src/api/camera/camera.ts +++ b/src/api/camera/camera.ts @@ -50,6 +50,9 @@ export function create(data: { model?: string serial_number?: string stream_type?: string + custom_name?: string + status?: number + remark?: string }) { return request({ url: '/system', @@ -80,6 +83,9 @@ export function update(data: { model?: string serial_number?: string stream_type?: string + custom_name?: string + status?: number + remark?: string }) { return request({ url: '/system', @@ -128,3 +134,23 @@ export function del(data: { id: number }) { isSystemApi: true } as any) } + +/** 设置摄像头 OSD 文字叠加 */ +export function setOsd(data: { + id: number + text: string + x?: number + y?: number +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'camera.setOsd', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/views/data/newpackingflow/config/packingflow-config.ts b/src/views/data/newpackingflow/config/packingflow-config.ts index 1225df54..2573e457 100644 --- a/src/views/data/newpackingflow/config/packingflow-config.ts +++ b/src/views/data/newpackingflow/config/packingflow-config.ts @@ -137,6 +137,26 @@ export function formatTime(value: any): string { } } +/** 计算打包时长(结束时间 - 开始时间),返回格式化字符串 */ +export function calcPackDuration(startTime: any, endTime: any): string { + if (!startTime || !endTime) return '—' + try { + const start = new Date(startTime) + const end = new Date(endTime) + if (isNaN(start.getTime()) || isNaN(end.getTime())) return '—' + const diff = end.getTime() - start.getTime() + if (diff < 0) return '—' + const hours = Math.floor(diff / 3600000) + const minutes = Math.floor((diff % 3600000) / 60000) + const seconds = Math.floor((diff % 60000) / 1000) + if (hours > 0) return `${hours}小时${minutes}分${seconds}秒` + if (minutes > 0) return `${minutes}分${seconds}秒` + return `${seconds}秒` + } catch { + return '—' + } +} + // ============================================================ // TAG_RESOLVERS — 标签颜色解析器 // ============================================================ @@ -250,6 +270,14 @@ export const FIELD_DICT: Record = { slot: { type: 'text', format: 'datetime' }, detailLabel: '结束时间' }, + pack_duration: { + key: 'pack_duration', + label: '打包时长', + scanBox: null, + table: { width: 120, align: 'center' }, + slot: { type: 'text' }, + detailLabel: '打包时长' + }, create_time: { key: 'create_time', label: '创建时间', @@ -671,7 +699,7 @@ export const tabPages: TabPageRawConfig[] = [ tableColumnKeys: [ 'id', 'order_id', 'waybill_code', 'wave_no', 'operator_text', 'workbench_name', 'pack_quantity', 'pack_mode', 'status', - 'start_time', 'end_time', 'create_time', 'videos' + 'start_time', 'end_time', 'pack_duration', 'create_time', 'videos' ], upperTableDefaults: { title: '打包任务列表', @@ -691,7 +719,7 @@ export const tabPages: TabPageRawConfig[] = [ { title: '时间信息', columnCount: 2, - fieldKeys: ['start_time', 'end_time', 'create_time'] + fieldKeys: ['start_time', 'end_time', 'pack_duration', 'create_time'] } ], api: { @@ -702,7 +730,8 @@ export const tabPages: TabPageRawConfig[] = [ if (!codeOk) throw new Error(res.message || '查询失败') const list = (res.data?.list ?? []).map((item: any) => ({ ...item, - waybill_code: extractWaybillCode(item) + waybill_code: extractWaybillCode(item), + pack_duration: calcPackDuration(item.start_time, item.end_time) })) return { list, diff --git a/src/views/data/packingflow/packingflow-config.ts b/src/views/data/packingflow/packingflow-config.ts index 1529d676..65482b4d 100644 --- a/src/views/data/packingflow/packingflow-config.ts +++ b/src/views/data/packingflow/packingflow-config.ts @@ -120,6 +120,20 @@ export const packingColumns = [ { prop: 'status', label: '任务状态', width: 100 }, { prop: 'start_time', label: '开始时间', width: 170, sortable: true, formatter: (row: any) => row.start_time ? dayjs(row.start_time).format('YYYY-MM-DD HH:mm:ss') : '—' }, { prop: 'end_time', label: '结束时间', width: 170, sortable: true, formatter: (row: any) => row.end_time ? dayjs(row.end_time).format('YYYY-MM-DD HH:mm:ss') : '—' }, + { prop: 'pack_duration', label: '打包时长', width: 120, formatter: (row: any) => { + if (!row.start_time || !row.end_time) return '—' + const start = dayjs(row.start_time) + const end = dayjs(row.end_time) + if (!start.isValid() || !end.isValid()) return '—' + const diff = end.diff(start) + if (diff < 0) return '—' + const hours = Math.floor(diff / 3600000) + const minutes = Math.floor((diff % 3600000) / 60000) + const seconds = Math.floor((diff % 60000) / 1000) + if (hours > 0) return `${hours}小时${minutes}分${seconds}秒` + if (minutes > 0) return `${minutes}分${seconds}秒` + return `${seconds}秒` + }}, { prop: 'create_time', label: '创建时间', width: 170, sortable: true, formatter: (row: any) => row.create_time ? dayjs(row.create_time).format('YYYY-MM-DD HH:mm:ss') : '—' }, { prop: 'update_time', label: '更新时间', width: 170, sortable: true, formatter: (row: any) => row.update_time ? dayjs(row.update_time).format('YYYY-MM-DD HH:mm:ss') : '—' }, { prop: 'express_info', label: '快递信息', minWidth: 140, formatter: (row: any) => getExpressInfo(row) }, diff --git a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue index 4ed98552..e2fdb29e 100644 --- a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue +++ b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue @@ -1056,8 +1056,14 @@ function stripRedundantPrintFields(waveGroups: unknown[]): unknown[] { return { ...o, contents } }) : p.orders - // 保留 platform 层的所有字段(包括 order_ids、platform_name、sys_logistics_name、order_count) - return { ...p, orders } + const { + platform_name: _pn, + sys_logistics_name: _sln, + order_count: _oc, + order_ids: _oi, + ...restPlatform + } = p + return { ...restPlatform, orders } }) : wg.platforms return { ...wg, platforms } diff --git a/src/views/video/newcamara/components/CameraPreviewDialog.vue b/src/views/video/newcamara/components/CameraPreviewDialog.vue index e06f2805..fa36115f 100644 --- a/src/views/video/newcamara/components/CameraPreviewDialog.vue +++ b/src/views/video/newcamara/components/CameraPreviewDialog.vue @@ -28,6 +28,25 @@
{{ loading ? '正在获取流地址…' : streamSrc ? '正在连接录像机…' : '正在连接…' }}
+ + +
+
OSD 文字叠加
+ + + + + + + + + + + + 设置 OSD + + +