From 5c1aeb2a6107a86b983f2c7227a0a173b76bd872 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Fri, 31 Jul 2026 09:35:35 +0800 Subject: [PATCH] 1 --- src/api/camera/camera.ts | 24 ++++++ .../config/packingflow-config.ts | 35 +++++++- .../data/packingflow/packingflow-config.ts | 14 ++++ .../WavePlatformPrintPreviewDialog.vue | 1 - .../components/CameraPreviewDialog.vue | 80 +++++++++++++++++++ .../newcamara/pages/CameraFormDialog.vue | 20 +++++ 6 files changed, 170 insertions(+), 4 deletions(-) diff --git a/src/api/camera/camera.ts b/src/api/camera/camera.ts index 07d5f541..6e7bb127 100644 --- a/src/api/camera/camera.ts +++ b/src/api/camera/camera.ts @@ -45,6 +45,8 @@ export function create(data: { model?: string serial_number?: string stream_type?: string + username?: string + password?: string custom_name?: string status?: number remark?: string @@ -73,6 +75,8 @@ export function update(data: { model?: string serial_number?: string stream_type?: string + username?: string + password?: string custom_name?: string status?: number remark?: string @@ -104,3 +108,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 7075967d..60a01af4 100644 --- a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue +++ b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue @@ -1060,7 +1060,6 @@ function stripRedundantPrintFields(waveGroups: unknown[]): unknown[] { platform_name: _pn, sys_logistics_name: _sln, order_count: _oc, - order_ids: _oi, ...restPlatform } = p return { ...restPlatform, orders } 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 + + +