Compare commits
No commits in common. "1827ea30de8290b4b4732e32c5469c5ddebe4f78" and "5c1aeb2a6107a86b983f2c7227a0a173b76bd872" have entirely different histories.
1827ea30de
...
5c1aeb2a61
BIN
dist.tar.gz
BIN
dist.tar.gz
Binary file not shown.
@ -40,16 +40,13 @@ export function create(data: {
|
|||||||
server_id: number
|
server_id: number
|
||||||
channel_id: number
|
channel_id: number
|
||||||
channel_name?: string
|
channel_name?: string
|
||||||
custom_name?: string
|
|
||||||
status?: number
|
|
||||||
username?: string
|
|
||||||
password?: string
|
|
||||||
remark?: string
|
|
||||||
ip?: string
|
ip?: string
|
||||||
port?: number
|
port?: number
|
||||||
model?: string
|
model?: string
|
||||||
serial_number?: string
|
serial_number?: string
|
||||||
stream_type?: string
|
stream_type?: string
|
||||||
|
username?: string
|
||||||
|
password?: string
|
||||||
custom_name?: string
|
custom_name?: string
|
||||||
status?: number
|
status?: number
|
||||||
remark?: string
|
remark?: string
|
||||||
@ -73,16 +70,13 @@ export function update(data: {
|
|||||||
server_id?: number
|
server_id?: number
|
||||||
channel_id?: number
|
channel_id?: number
|
||||||
channel_name?: string
|
channel_name?: string
|
||||||
custom_name?: string
|
|
||||||
status?: number
|
|
||||||
username?: string
|
|
||||||
password?: string
|
|
||||||
remark?: string
|
|
||||||
ip?: string
|
ip?: string
|
||||||
port?: number
|
port?: number
|
||||||
model?: string
|
model?: string
|
||||||
serial_number?: string
|
serial_number?: string
|
||||||
stream_type?: string
|
stream_type?: string
|
||||||
|
username?: string
|
||||||
|
password?: string
|
||||||
custom_name?: string
|
custom_name?: string
|
||||||
status?: number
|
status?: number
|
||||||
remark?: string
|
remark?: string
|
||||||
@ -100,26 +94,6 @@ export function update(data: {
|
|||||||
} as any)
|
} 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除摄像头(软删除) */
|
/** 删除摄像头(软删除) */
|
||||||
export function del(data: { id: number }) {
|
export function del(data: { id: number }) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -419,55 +419,6 @@ export function queryRecheckOrderSingleList(
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** order.recheckOrder.batchQuickRecheckByWave 请求参数 */
|
|
||||||
export type BatchQuickRecheckByWaveParams = {
|
|
||||||
wave_ids: number[] | string
|
|
||||||
waveIds?: number[] | string
|
|
||||||
wave_id?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/** order.recheckOrder.batchQuickRecheckByWave 响应 data */
|
|
||||||
export type BatchQuickRecheckByWaveResponse = {
|
|
||||||
success: unknown[]
|
|
||||||
failed: unknown[]
|
|
||||||
success_count: number
|
|
||||||
failed_count: number
|
|
||||||
}
|
|
||||||
|
|
||||||
function pickWaveIdsBody(data: BatchQuickRecheckByWaveParams): Record<string, number[] | string> {
|
|
||||||
if (Array.isArray(data.wave_ids) && data.wave_ids.length > 0) {
|
|
||||||
return { wave_ids: data.wave_ids }
|
|
||||||
}
|
|
||||||
if (typeof data.wave_ids === 'string' && data.wave_ids.trim() !== '') {
|
|
||||||
return { wave_ids: data.wave_ids.trim() }
|
|
||||||
}
|
|
||||||
if (Array.isArray(data.waveIds) && data.waveIds.length > 0) {
|
|
||||||
return { wave_ids: data.waveIds }
|
|
||||||
}
|
|
||||||
if (typeof data.waveIds === 'string' && data.waveIds.trim() !== '') {
|
|
||||||
return { wave_ids: data.waveIds.trim() }
|
|
||||||
}
|
|
||||||
if (data.wave_id !== undefined && data.wave_id !== null) {
|
|
||||||
return { wave_ids: [data.wave_id] }
|
|
||||||
}
|
|
||||||
throw new Error('波次 ID 不能为空(wave_ids / waveIds / wave_id)')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** order.recheckOrder.batchQuickRecheckByWave:按波次批量快捷复核 */
|
|
||||||
export function batchQuickRecheckByWave(data: BatchQuickRecheckByWaveParams): Promise<any> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'order.recheckOrder.batchQuickRecheckByWave',
|
|
||||||
v,
|
|
||||||
timestamp: Date.now()
|
|
||||||
},
|
|
||||||
data: pickWaveIdsBody(data),
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** order.recheckOrder.confirmIntercept:确认拦截,入参 order_id,匹配单个订单并标记拦截 */
|
/** order.recheckOrder.confirmIntercept:确认拦截,入参 order_id,匹配单个订单并标记拦截 */
|
||||||
export function confirmIntercept(data: ConfirmRecheckParams): Promise<any> {
|
export function confirmIntercept(data: ConfirmRecheckParams): Promise<any> {
|
||||||
return request({
|
return request({
|
||||||
@ -486,7 +437,6 @@ export function confirmIntercept(data: ConfirmRecheckParams): Promise<any> {
|
|||||||
export const orderRecheckOrder = {
|
export const orderRecheckOrder = {
|
||||||
scanOrder,
|
scanOrder,
|
||||||
batchQuickRecheck,
|
batchQuickRecheck,
|
||||||
batchQuickRecheckByWave,
|
|
||||||
confirmRecheck,
|
confirmRecheck,
|
||||||
confirmIntercept,
|
confirmIntercept,
|
||||||
queryRecheckOrderSingleList
|
queryRecheckOrderSingleList
|
||||||
|
|||||||
@ -348,44 +348,3 @@ export function notify_lock(data?: PrintNotifyLockParams) {
|
|||||||
data: data ?? {}
|
data: data ?? {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** print.markWavePrintStatus 请求参数 */
|
|
||||||
export type MarkWavePrintStatusParams = {
|
|
||||||
/** 波次ID(必填,正整数) */
|
|
||||||
wave_id: number
|
|
||||||
/** 目标状态:'printed'=标记已打印,'unprinted'=取消已打印标记。默认 'printed' */
|
|
||||||
status?: 'printed' | 'unprinted'
|
|
||||||
}
|
|
||||||
|
|
||||||
/** print.markWavePrintStatus 响应 data */
|
|
||||||
export type MarkWavePrintStatusResponse = {
|
|
||||||
wave_id?: number
|
|
||||||
status?: string
|
|
||||||
print_status?: string
|
|
||||||
total_orders?: number
|
|
||||||
affected_orders?: number
|
|
||||||
order_ids?: Array<number | string>
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 标记/取消标记整个波次订单的打印状态 */
|
|
||||||
export function markWavePrintStatus(data: MarkWavePrintStatusParams): Promise<any> {
|
|
||||||
const waveId = Number(data.wave_id)
|
|
||||||
if (!Number.isFinite(waveId) || waveId <= 0) {
|
|
||||||
return Promise.reject(new Error('print.markWavePrintStatus:wave_id 必须为正整数'))
|
|
||||||
}
|
|
||||||
const body: Record<string, unknown> = { wave_id: waveId }
|
|
||||||
if (data.status) {
|
|
||||||
body.status = data.status
|
|
||||||
}
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'print.markWavePrintStatus',
|
|
||||||
v,
|
|
||||||
timestamp: stamp()
|
|
||||||
},
|
|
||||||
data: body,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -74,8 +74,6 @@ export function shopsEdit(data: {
|
|||||||
export function shopGetAuthorizeSessionKey(data: {
|
export function shopGetAuthorizeSessionKey(data: {
|
||||||
id: number
|
id: number
|
||||||
callbackurl?: string
|
callbackurl?: string
|
||||||
appId?: string
|
|
||||||
toUserName?: string
|
|
||||||
}) {
|
}) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
|
|||||||
@ -164,81 +164,6 @@ export function getExpiryList(data: any): Promise<any> {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** storage.inventory.export 请求参数 */
|
|
||||||
export type InventoryExportParams = {
|
|
||||||
/** 导出模式:'stock_location'(默认,按商品+库位聚合)| 'storage'(按库存记录逐条导出) */
|
|
||||||
exportMode?: 'stock_location' | 'storage'
|
|
||||||
/** 统一 where 条件对象,与 storage.inventory.list 的 where 语义一致 */
|
|
||||||
where?: Record<string, any>
|
|
||||||
/** 排序参数 { sortField, sortOrder } */
|
|
||||||
sort?: {
|
|
||||||
sortField?: string
|
|
||||||
sortOrder?: 'ASC' | 'DESC'
|
|
||||||
}
|
|
||||||
/** 是否按批次查询导出,对齐查询模式 group_by_batch */
|
|
||||||
group_by_batch?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/** storage.inventory.export 响应 data */
|
|
||||||
export type InventoryExportResponse = {
|
|
||||||
task_id?: string
|
|
||||||
status?: string
|
|
||||||
progress?: number
|
|
||||||
message?: string
|
|
||||||
update_time?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交库存导出异步任务 */
|
|
||||||
export function exportInventory(data: InventoryExportParams = {}): Promise<any> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'storage.inventory.export',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** storage.inventory.exportTaskProgress 请求参数 */
|
|
||||||
export type ExportTaskProgressParams = {
|
|
||||||
task_id?: string
|
|
||||||
taskId?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/** storage.inventory.exportTaskProgress 响应 data */
|
|
||||||
export type ExportTaskProgressResponse = {
|
|
||||||
task_id?: string
|
|
||||||
status?: string
|
|
||||||
progress?: number
|
|
||||||
message?: string
|
|
||||||
result?: Record<string, unknown>
|
|
||||||
error?: string
|
|
||||||
download_url?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 按 task_id 查询库存导出任务进度 */
|
|
||||||
export function exportTaskProgress(data: ExportTaskProgressParams): Promise<any> {
|
|
||||||
const taskId = data.task_id || data.taskId
|
|
||||||
if (!taskId) {
|
|
||||||
throw new Error('task_id 不能为空')
|
|
||||||
}
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'storage.inventory.exportTaskProgress',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data: { task_id: taskId },
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
// export function transaction(data:any) {
|
// export function transaction(data:any) {
|
||||||
// return request({
|
// return request({
|
||||||
// url: '/system',
|
// url: '/system',
|
||||||
|
|||||||
@ -10,55 +10,29 @@
|
|||||||
{{ label }}
|
{{ label }}
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item
|
<el-dropdown-item command="handleExportWaybill">不含明细</el-dropdown-item>
|
||||||
v-for="item in resolvedItems"
|
<el-dropdown-item command="handleExportItem" divided>含明细</el-dropdown-item>
|
||||||
:key="item.action"
|
|
||||||
:command="item.action"
|
|
||||||
:divided="item.divided"
|
|
||||||
>
|
|
||||||
{{ item.label }}
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
withDefaults(
|
||||||
|
|
||||||
export interface ExportDropdownItem {
|
|
||||||
label: string
|
|
||||||
action: string
|
|
||||||
divided?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const DEFAULT_ITEMS: ExportDropdownItem[] = [
|
|
||||||
{ label: '不含明细', action: 'handleExportWaybill' },
|
|
||||||
{ label: '含明细', action: 'handleExportItem', divided: true }
|
|
||||||
]
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
label?: string
|
label?: string
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
defaultAction?: string
|
defaultAction?: string
|
||||||
items?: ExportDropdownItem[]
|
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
label: '导出',
|
label: '导出',
|
||||||
loading: false,
|
loading: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
defaultAction: 'handleExportWaybill',
|
defaultAction: 'handleExportWaybill'
|
||||||
items: () => []
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const resolvedItems = computed(() => {
|
|
||||||
if (props.items && props.items.length > 0) return props.items
|
|
||||||
return DEFAULT_ITEMS
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'action', action: string): void
|
(e: 'action', action: string): void
|
||||||
}>()
|
}>()
|
||||||
|
|||||||
@ -340,7 +340,7 @@ async function loadScanBoxOptions() {
|
|||||||
])
|
])
|
||||||
const expressRaw: any[] = expressRes?.data?.list ?? expressRes?.data ?? []
|
const expressRaw: any[] = expressRes?.data?.list ?? expressRes?.data ?? []
|
||||||
const platformRaw: any[] = platformRes?.data?.list ?? platformRes?.data ?? []
|
const platformRaw: any[] = platformRes?.data?.list ?? platformRes?.data ?? []
|
||||||
const storesRaw: any[] = (storesRes as any)?.data?.stores ?? (storesRes as any)?.stores ?? []
|
const storesRaw: any[] = storesRes?.stores ?? []
|
||||||
|
|
||||||
const expressOptions = expressRaw.map((item: any) => ({
|
const expressOptions = expressRaw.map((item: any) => ({
|
||||||
label: `${item.code ?? item.logistics_code ?? ''} — ${item.name ?? item.logistics_name ?? ''}`,
|
label: `${item.code ?? item.logistics_code ?? ''} — ${item.name ?? item.logistics_name ?? ''}`,
|
||||||
|
|||||||
@ -138,6 +138,10 @@
|
|||||||
<span class="order-info-text">{{ row.item_detail_machine || '—' }}</span>
|
<span class="order-info-text">{{ row.item_detail_machine || '—' }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-item_snapshot_key="{ row }">
|
||||||
|
<span class="order-info-text">{{ row.item_snapshot_key || '—' }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-item_snapshot="{ row }">
|
<template #column-item_snapshot="{ row }">
|
||||||
<span class="order-info-text">{{ getItemSnapshotText(row) }}</span>
|
<span class="order-info-text">{{ getItemSnapshotText(row) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -169,15 +173,6 @@
|
|||||||
>
|
>
|
||||||
批量拣货
|
批量拣货
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="warning"
|
|
||||||
size="small"
|
|
||||||
:loading="isTogglePrintStatusLoading(row)"
|
|
||||||
@click.stop="handleToggleWavePrintStatus(row)"
|
|
||||||
>
|
|
||||||
{{ getPrintStatusButtonText(row) }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@ -933,8 +928,6 @@ import {
|
|||||||
orderWaveFetchTaskProgress,
|
orderWaveFetchTaskProgress,
|
||||||
orderWaveGroupOrderFetchList
|
orderWaveGroupOrderFetchList
|
||||||
} from '@/api/order.wave/orderwave'
|
} from '@/api/order.wave/orderwave'
|
||||||
import { batchQuickRecheckByWave } from '@/api/order.recheckorder/recheckOrder'
|
|
||||||
import { markWavePrintStatus } from '@/api/print/print'
|
|
||||||
import { orderWaveBatchList, unwrapWaveBatchListResponse } from '@/api/order/order'
|
import { orderWaveBatchList, unwrapWaveBatchListResponse } from '@/api/order/order'
|
||||||
import type {
|
import type {
|
||||||
WaveBatchAutoGroupingResponse,
|
WaveBatchAutoGroupingResponse,
|
||||||
@ -994,8 +987,6 @@ const onlyTodoWaves = ref(false)
|
|||||||
const batchAutoGroupingLoading = ref(false)
|
const batchAutoGroupingLoading = ref(false)
|
||||||
const batchFinishAutoGroupingLoading = ref(false)
|
const batchFinishAutoGroupingLoading = ref(false)
|
||||||
const batchCancelLoading = ref(false)
|
const batchCancelLoading = ref(false)
|
||||||
const batchQuickRecheckByWaveLoading = ref(false)
|
|
||||||
const printStatusLoadingRowIds = ref<Set<number | string>>(new Set())
|
|
||||||
const batchPrintLoading = ref(false)
|
const batchPrintLoading = ref(false)
|
||||||
const batchOutboundPrintLoading = ref(false)
|
const batchOutboundPrintLoading = ref(false)
|
||||||
const batchPlatformPrintLoading = ref(false)
|
const batchPlatformPrintLoading = ref(false)
|
||||||
@ -1195,7 +1186,6 @@ const buttonLoadingMap = computed(() => ({
|
|||||||
batchAutoGroupingLoading: batchAutoGroupingLoading.value,
|
batchAutoGroupingLoading: batchAutoGroupingLoading.value,
|
||||||
batchFinishAutoGroupingLoading: batchFinishAutoGroupingLoading.value,
|
batchFinishAutoGroupingLoading: batchFinishAutoGroupingLoading.value,
|
||||||
batchCancelLoading: batchCancelLoading.value,
|
batchCancelLoading: batchCancelLoading.value,
|
||||||
batchQuickRecheckByWaveLoading: batchQuickRecheckByWaveLoading.value,
|
|
||||||
batchPrintLoading: batchPrintLoading.value,
|
batchPrintLoading: batchPrintLoading.value,
|
||||||
batchOutboundPrintLoading: batchOutboundPrintLoading.value,
|
batchOutboundPrintLoading: batchOutboundPrintLoading.value,
|
||||||
batchPlatformPrintLoading: batchPlatformPrintLoading.value,
|
batchPlatformPrintLoading: batchPlatformPrintLoading.value,
|
||||||
@ -1219,7 +1209,6 @@ const buttonLabelMap = computed(() => ({
|
|||||||
batchOutboundPrintTotal: `批量打印出库单(${selectedWaveOrderTotal.value})`,
|
batchOutboundPrintTotal: `批量打印出库单(${selectedWaveOrderTotal.value})`,
|
||||||
batchPlatformPrintTotal: `批量打印(平台)(${selectedWaveOrderTotal.value})`,
|
batchPlatformPrintTotal: `批量打印(平台)(${selectedWaveOrderTotal.value})`,
|
||||||
batchPickingPrintTotal: `批量打印拣货单(${selectionRows.value.length})`,
|
batchPickingPrintTotal: `批量打印拣货单(${selectionRows.value.length})`,
|
||||||
batchQuickRecheckByWaveTotal: `批量发货(${selectionRows.value.length})`,
|
|
||||||
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -1269,9 +1258,6 @@ const toolbarActionMap: Record<string, () => void> = {
|
|||||||
handleBatchCancel: () => {
|
handleBatchCancel: () => {
|
||||||
void handleBatchCancel()
|
void handleBatchCancel()
|
||||||
},
|
},
|
||||||
handleBatchQuickRecheckByWave: () => {
|
|
||||||
void handleBatchQuickRecheckByWave()
|
|
||||||
},
|
|
||||||
handleBatchAllocateExpress: () => {
|
handleBatchAllocateExpress: () => {
|
||||||
void handleBatchAllocateExpress()
|
void handleBatchAllocateExpress()
|
||||||
},
|
},
|
||||||
@ -2876,105 +2862,6 @@ async function handleBatchCancel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleBatchQuickRecheckByWave() {
|
|
||||||
if (!selectionRows.value.length) {
|
|
||||||
ElMessage.warning('请先勾选要批量发货的波次')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const waveIds = getSelectedWaveIds()
|
|
||||||
if (!waveIds.length) {
|
|
||||||
ElMessage.warning('当前勾选记录缺少可用的波次 ID')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ElMessageBox.confirm(
|
|
||||||
`确定要对 ${waveIds.length} 个波次执行批量发货(快捷复核)吗?`,
|
|
||||||
'批量发货',
|
|
||||||
{ type: 'warning', confirmButtonText: '确认发货', cancelButtonText: '取消' }
|
|
||||||
)
|
|
||||||
} catch {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
batchQuickRecheckByWaveLoading.value = true
|
|
||||||
try {
|
|
||||||
const res = await batchQuickRecheckByWave({ wave_ids: waveIds })
|
|
||||||
const data = res?.data || res
|
|
||||||
if (data && (data.success_count !== undefined || data.failed_count !== undefined)) {
|
|
||||||
const successCount = data.success_count || 0
|
|
||||||
const failedCount = data.failed_count || 0
|
|
||||||
if (failedCount > 0) {
|
|
||||||
ElMessage.warning(`批量发货完成:成功 ${successCount} 个,失败 ${failedCount} 个`)
|
|
||||||
} else {
|
|
||||||
ElMessage.success(`批量发货完成:成功 ${successCount} 个`)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.success('批量发货请求已提交')
|
|
||||||
}
|
|
||||||
selectionRows.value = []
|
|
||||||
hasSelection.value = false
|
|
||||||
await loadData()
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('batchQuickRecheckByWave failed:', error)
|
|
||||||
ElMessage.error(error?.message || '批量发货失败')
|
|
||||||
} finally {
|
|
||||||
batchQuickRecheckByWaveLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPrintStatusButtonText(row: any): string {
|
|
||||||
return getPrintStatusNormalized(row) === 'printed' ? '标记未打印' : '标记已打印'
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTogglePrintStatusLoading(row: any) {
|
|
||||||
const id = row?.wave_id ?? row?.id
|
|
||||||
return id != null && printStatusLoadingRowIds.value.has(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPrintStatusNormalized(row: any): string {
|
|
||||||
const raw = String(row?.print_assignment_status ?? '').trim().toLowerCase()
|
|
||||||
if (['printed', '已打印'].includes(raw)) return 'printed'
|
|
||||||
return raw || 'unprinted'
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleToggleWavePrintStatus(row: any) {
|
|
||||||
const waveId = row?.wave_id ?? row?.id
|
|
||||||
if (waveId == null) {
|
|
||||||
ElMessage.warning('当前记录缺少可用的波次 ID')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const waveNo = row?.wave_no ?? waveId
|
|
||||||
const currentStatus = getPrintStatusNormalized(row)
|
|
||||||
const isPrinted = currentStatus === 'printed'
|
|
||||||
const targetStatus = isPrinted ? 'unprinted' : 'printed'
|
|
||||||
const actionText = isPrinted ? '标记为未打印' : '标记为已打印'
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ElMessageBox.confirm(
|
|
||||||
`确定要${actionText}波次「${waveNo}」吗?`,
|
|
||||||
actionText,
|
|
||||||
{ type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消' }
|
|
||||||
)
|
|
||||||
} catch {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
printStatusLoadingRowIds.value.add(waveId)
|
|
||||||
try {
|
|
||||||
await markWavePrintStatus({ wave_id: Number(waveId), status: targetStatus })
|
|
||||||
ElMessage.success(`${actionText}成功`)
|
|
||||||
await loadData()
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('toggleWavePrintStatus failed:', error)
|
|
||||||
ElMessage.error(error?.message || `${actionText}失败`)
|
|
||||||
} finally {
|
|
||||||
printStatusLoadingRowIds.value.delete(waveId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openGroupOrderDialog() {
|
function openGroupOrderDialog() {
|
||||||
groupOrderDialogVisible.value = true
|
groupOrderDialogVisible.value = true
|
||||||
groupOrderFilters.distinguishExpress = true
|
groupOrderFilters.distinguishExpress = true
|
||||||
|
|||||||
@ -138,6 +138,10 @@
|
|||||||
<span class="order-info-text">{{ row.item_detail_machine || '—' }}</span>
|
<span class="order-info-text">{{ row.item_detail_machine || '—' }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-item_snapshot_key="{ row }">
|
||||||
|
<span class="order-info-text">{{ row.item_snapshot_key || '—' }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-item_snapshot="{ row }">
|
<template #column-item_snapshot="{ row }">
|
||||||
<span class="order-info-text">{{ getItemSnapshotText(row) }}</span>
|
<span class="order-info-text">{{ getItemSnapshotText(row) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -169,15 +173,6 @@
|
|||||||
>
|
>
|
||||||
批量拣货
|
批量拣货
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
type="warning"
|
|
||||||
size="small"
|
|
||||||
:loading="isTogglePrintStatusLoading(row)"
|
|
||||||
@click.stop="handleToggleWavePrintStatus(row)"
|
|
||||||
>
|
|
||||||
{{ getPrintStatusButtonText(row) }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@ -517,8 +512,6 @@ import {
|
|||||||
orderWaveSingleOrderFetchList,
|
orderWaveSingleOrderFetchList,
|
||||||
orderWaveFetchTaskProgress
|
orderWaveFetchTaskProgress
|
||||||
} from '@/api/order.wave/orderwave'
|
} from '@/api/order.wave/orderwave'
|
||||||
import { batchQuickRecheckByWave } from '@/api/order.recheckorder/recheckOrder'
|
|
||||||
import { markWavePrintStatus } from '@/api/print/print'
|
|
||||||
import { orderWaveBatchList, unwrapWaveBatchListResponse } from '@/api/order/order'
|
import { orderWaveBatchList, unwrapWaveBatchListResponse } from '@/api/order/order'
|
||||||
import type {
|
import type {
|
||||||
WaveBatchAutoGroupingResponse,
|
WaveBatchAutoGroupingResponse,
|
||||||
@ -562,8 +555,6 @@ const onlyTodoWaves = ref(false)
|
|||||||
const batchAutoGroupingLoading = ref(false)
|
const batchAutoGroupingLoading = ref(false)
|
||||||
const batchFinishAutoGroupingLoading = ref(false)
|
const batchFinishAutoGroupingLoading = ref(false)
|
||||||
const batchCancelLoading = ref(false)
|
const batchCancelLoading = ref(false)
|
||||||
const batchQuickRecheckByWaveLoading = ref(false)
|
|
||||||
const printStatusLoadingRowIds = ref<Set<number | string>>(new Set())
|
|
||||||
const batchPrintLoading = ref(false)
|
const batchPrintLoading = ref(false)
|
||||||
const batchOutboundPrintLoading = ref(false)
|
const batchOutboundPrintLoading = ref(false)
|
||||||
const batchPlatformPrintLoading = ref(false)
|
const batchPlatformPrintLoading = ref(false)
|
||||||
@ -696,7 +687,6 @@ const buttonLoadingMap = computed(() => ({
|
|||||||
batchAutoGroupingLoading: batchAutoGroupingLoading.value,
|
batchAutoGroupingLoading: batchAutoGroupingLoading.value,
|
||||||
batchFinishAutoGroupingLoading: batchFinishAutoGroupingLoading.value,
|
batchFinishAutoGroupingLoading: batchFinishAutoGroupingLoading.value,
|
||||||
batchCancelLoading: batchCancelLoading.value,
|
batchCancelLoading: batchCancelLoading.value,
|
||||||
batchQuickRecheckByWaveLoading: batchQuickRecheckByWaveLoading.value,
|
|
||||||
batchPrintLoading: batchPrintLoading.value,
|
batchPrintLoading: batchPrintLoading.value,
|
||||||
batchOutboundPrintLoading: batchOutboundPrintLoading.value,
|
batchOutboundPrintLoading: batchOutboundPrintLoading.value,
|
||||||
batchPlatformPrintLoading: batchPlatformPrintLoading.value,
|
batchPlatformPrintLoading: batchPlatformPrintLoading.value,
|
||||||
@ -718,7 +708,6 @@ const buttonLabelMap = computed(() => ({
|
|||||||
batchPrintTotal: `批量打印(${selectedWaveOrderTotal.value})`,
|
batchPrintTotal: `批量打印(${selectedWaveOrderTotal.value})`,
|
||||||
batchOutboundPrintTotal: `打印货单(${printableSelectionRows.value.length})`,
|
batchOutboundPrintTotal: `打印货单(${printableSelectionRows.value.length})`,
|
||||||
batchPlatformPrintTotal: `批量打印(平台)(${selectedWaveOrderTotal.value})`,
|
batchPlatformPrintTotal: `批量打印(平台)(${selectedWaveOrderTotal.value})`,
|
||||||
batchQuickRecheckByWaveTotal: `批量发货(${selectionRows.value.length})`,
|
|
||||||
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -770,9 +759,6 @@ const toolbarActionMap: Record<string, () => void> = {
|
|||||||
handleBatchCancel: () => {
|
handleBatchCancel: () => {
|
||||||
void handleBatchCancel()
|
void handleBatchCancel()
|
||||||
},
|
},
|
||||||
handleBatchQuickRecheckByWave: () => {
|
|
||||||
void handleBatchQuickRecheckByWave()
|
|
||||||
},
|
|
||||||
handleBatchAllocateExpress: () => {
|
handleBatchAllocateExpress: () => {
|
||||||
void handleBatchAllocateExpress()
|
void handleBatchAllocateExpress()
|
||||||
},
|
},
|
||||||
@ -2356,105 +2342,6 @@ async function handleBatchCancel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleBatchQuickRecheckByWave() {
|
|
||||||
if (!selectionRows.value.length) {
|
|
||||||
ElMessage.warning('请先勾选要批量发货的波次')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const waveIds = getSelectedWaveIds()
|
|
||||||
if (!waveIds.length) {
|
|
||||||
ElMessage.warning('当前勾选记录缺少可用的波次 ID')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ElMessageBox.confirm(
|
|
||||||
`确定要对 ${waveIds.length} 个波次执行批量发货(快捷复核)吗?`,
|
|
||||||
'批量发货',
|
|
||||||
{ type: 'warning', confirmButtonText: '确认发货', cancelButtonText: '取消' }
|
|
||||||
)
|
|
||||||
} catch {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
batchQuickRecheckByWaveLoading.value = true
|
|
||||||
try {
|
|
||||||
const res = await batchQuickRecheckByWave({ wave_ids: waveIds })
|
|
||||||
const data = res?.data || res
|
|
||||||
if (data && (data.success_count !== undefined || data.failed_count !== undefined)) {
|
|
||||||
const successCount = data.success_count || 0
|
|
||||||
const failedCount = data.failed_count || 0
|
|
||||||
if (failedCount > 0) {
|
|
||||||
ElMessage.warning(`批量发货完成:成功 ${successCount} 个,失败 ${failedCount} 个`)
|
|
||||||
} else {
|
|
||||||
ElMessage.success(`批量发货完成:成功 ${successCount} 个`)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.success('批量发货请求已提交')
|
|
||||||
}
|
|
||||||
selectionRows.value = []
|
|
||||||
hasSelection.value = false
|
|
||||||
await loadData()
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('batchQuickRecheckByWave failed:', error)
|
|
||||||
ElMessage.error(error?.message || '批量发货失败')
|
|
||||||
} finally {
|
|
||||||
batchQuickRecheckByWaveLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPrintStatusButtonText(row: any): string {
|
|
||||||
return getPrintStatusNormalized(row) === 'printed' ? '标记未打印' : '标记已打印'
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTogglePrintStatusLoading(row: any) {
|
|
||||||
const id = row?.wave_id ?? row?.id
|
|
||||||
return id != null && printStatusLoadingRowIds.value.has(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPrintStatusNormalized(row: any): string {
|
|
||||||
const raw = String(row?.print_assignment_status ?? '').trim().toLowerCase()
|
|
||||||
if (['printed', '已打印'].includes(raw)) return 'printed'
|
|
||||||
return raw || 'unprinted'
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleToggleWavePrintStatus(row: any) {
|
|
||||||
const waveId = row?.wave_id ?? row?.id
|
|
||||||
if (waveId == null) {
|
|
||||||
ElMessage.warning('当前记录缺少可用的波次 ID')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const waveNo = row?.wave_no ?? waveId
|
|
||||||
const currentStatus = getPrintStatusNormalized(row)
|
|
||||||
const isPrinted = currentStatus === 'printed'
|
|
||||||
const targetStatus = isPrinted ? 'unprinted' : 'printed'
|
|
||||||
const actionText = isPrinted ? '标记为未打印' : '标记为已打印'
|
|
||||||
|
|
||||||
try {
|
|
||||||
await ElMessageBox.confirm(
|
|
||||||
`确定要${actionText}波次「${waveNo}」吗?`,
|
|
||||||
actionText,
|
|
||||||
{ type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消' }
|
|
||||||
)
|
|
||||||
} catch {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
printStatusLoadingRowIds.value.add(waveId)
|
|
||||||
try {
|
|
||||||
await markWavePrintStatus({ wave_id: Number(waveId), status: targetStatus })
|
|
||||||
ElMessage.success(`${actionText}成功`)
|
|
||||||
await loadData()
|
|
||||||
} catch (error: any) {
|
|
||||||
console.error('toggleWavePrintStatus failed:', error)
|
|
||||||
ElMessage.error(error?.message || `${actionText}失败`)
|
|
||||||
} finally {
|
|
||||||
printStatusLoadingRowIds.value.delete(waveId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openGroupOrderDialog() {
|
function openGroupOrderDialog() {
|
||||||
groupOrderDialogVisible.value = true
|
groupOrderDialogVisible.value = true
|
||||||
groupOrderFilters.distinguishExpress = true
|
groupOrderFilters.distinguishExpress = true
|
||||||
|
|||||||
@ -51,28 +51,18 @@
|
|||||||
<div class="section">
|
<div class="section">
|
||||||
<div class="section-title">结构与订单信息</div>
|
<div class="section-title">结构与订单信息</div>
|
||||||
<el-descriptions :column="2" border size="small" class="detail-descriptions">
|
<el-descriptions :column="2" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="商品结构快照" :span="2">{{ getItemSnapshotText(row) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="订单信息" :span="2">{{ getOrderInfoSummary(row) }}</el-descriptions-item>
|
<el-descriptions-item label="订单信息" :span="2">{{ getOrderInfoSummary(row) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="订单列表" :span="2">{{ getOrderListPreview(row) }}</el-descriptions-item>
|
<el-descriptions-item label="订单列表" :span="2">{{ getOrderListPreview(row) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="创建时间">{{ formatDateTime(row.create_time || row.created_at || row.create_at) }}</el-descriptions-item>
|
<el-descriptions-item label="创建时间">{{ formatDateTime(row.create_time || row.created_at || row.create_at) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="更新时间">{{ formatDateTime(row.update_time || row.updated_at || row.update_at) }}</el-descriptions-item>
|
<el-descriptions-item label="更新时间">{{ formatDateTime(row.update_time || row.updated_at || row.update_at) }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="parsedItems.length" class="section">
|
|
||||||
<div class="section-title">商品结构快照</div>
|
|
||||||
<el-table :data="parsedItems" border size="small" class="snapshot-table">
|
|
||||||
<el-table-column prop="sku" label="SKU" min-width="100" />
|
|
||||||
<el-table-column prop="barcode" label="条码" min-width="130" />
|
|
||||||
<el-table-column prop="name" label="商品名称" min-width="120" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="quantity" label="数量" width="80" align="center" />
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
|
||||||
import {
|
import {
|
||||||
waveStatusTextMap,
|
waveStatusTextMap,
|
||||||
waveStorageAssignmentErrorPhraseMap,
|
waveStorageAssignmentErrorPhraseMap,
|
||||||
@ -85,42 +75,10 @@ import {
|
|||||||
getWaveAssignmentAggregateTagType
|
getWaveAssignmentAggregateTagType
|
||||||
} from '../config/wave-config'
|
} from '../config/wave-config'
|
||||||
|
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
row: Record<string, any> | null
|
row: Record<string, any> | null
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
interface SnapshotItem {
|
|
||||||
sku: string
|
|
||||||
barcode: string
|
|
||||||
name: string
|
|
||||||
quantity: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 解析 item_snapshot_key 字段,按 "::" 分隔字段、"|" 分隔商品 */
|
|
||||||
function parseItemSnapshotKey(raw: string | undefined | null): SnapshotItem[] {
|
|
||||||
if (!raw || !raw.trim()) return []
|
|
||||||
// 特殊值:非标准快照格式,直接跳过
|
|
||||||
if (raw === 'manual_single_ids') return []
|
|
||||||
const items = raw.split('|')
|
|
||||||
const result: SnapshotItem[] = []
|
|
||||||
for (const item of items) {
|
|
||||||
const parts = item.split('::')
|
|
||||||
if (parts.length < 5) continue
|
|
||||||
result.push({
|
|
||||||
sku: parts[0] || '—',
|
|
||||||
barcode: parts[1] || '—',
|
|
||||||
name: parts[2] || '—',
|
|
||||||
quantity: parts[4] || '—'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
const parsedItems = computed<SnapshotItem[]>(() => {
|
|
||||||
const raw = (props.row as any)?.item_snapshot_key
|
|
||||||
return parseItemSnapshotKey(raw)
|
|
||||||
})
|
|
||||||
|
|
||||||
function getWaveCode(row: any) {
|
function getWaveCode(row: any) {
|
||||||
return row?.wave_code || row?.batch_code || row?.wave_no || row?.batch_no || row?.code || row?.id || '—'
|
return row?.wave_code || row?.batch_code || row?.wave_no || row?.batch_no || row?.code || row?.id || '—'
|
||||||
}
|
}
|
||||||
@ -201,6 +159,10 @@ function getStorageAssignmentError(row: any) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getItemSnapshotText(row: any) {
|
||||||
|
return row?.item_snapshot_key || row?.item_detail_machine || row?.item_detail || '—'
|
||||||
|
}
|
||||||
|
|
||||||
function getOrderInfoSummary(row: any) {
|
function getOrderInfoSummary(row: any) {
|
||||||
if (Array.isArray(row?.order_list) && row.order_list.length) {
|
if (Array.isArray(row?.order_list) && row.order_list.length) {
|
||||||
const preview = row.order_list
|
const preview = row.order_list
|
||||||
|
|||||||
@ -1036,7 +1036,7 @@ async function notifyLockAfterBrowserPrint(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 精简 waveGroups 数据,移除 print.send 不需要的字段(仅移除 contents 内的 config) */
|
/** 精简 waveGroups 数据,移除 print.send 不需要的字段 */
|
||||||
function stripRedundantPrintFields(waveGroups: unknown[]): unknown[] {
|
function stripRedundantPrintFields(waveGroups: unknown[]): unknown[] {
|
||||||
return waveGroups.map((wg: any) => {
|
return waveGroups.map((wg: any) => {
|
||||||
if (!wg || typeof wg !== 'object') return wg
|
if (!wg || typeof wg !== 'object') return wg
|
||||||
@ -1060,7 +1060,6 @@ function stripRedundantPrintFields(waveGroups: unknown[]): unknown[] {
|
|||||||
platform_name: _pn,
|
platform_name: _pn,
|
||||||
sys_logistics_name: _sln,
|
sys_logistics_name: _sln,
|
||||||
order_count: _oc,
|
order_count: _oc,
|
||||||
order_ids: _oi,
|
|
||||||
...restPlatform
|
...restPlatform
|
||||||
} = p
|
} = p
|
||||||
return { ...restPlatform, orders }
|
return { ...restPlatform, orders }
|
||||||
|
|||||||
@ -338,11 +338,12 @@ export const waveBatchColumns = applyWaveListCopyActions([
|
|||||||
{ prop: 'review_assignment_status', label: '复核状态', minWidth: 110 },
|
{ prop: 'review_assignment_status', label: '复核状态', minWidth: 110 },
|
||||||
{ prop: 'unreviewed_order_count', label: '未复核数', minWidth: 96 },
|
{ prop: 'unreviewed_order_count', label: '未复核数', minWidth: 96 },
|
||||||
{ prop: 'logistics_name', label: '快递', minWidth: 120 },
|
{ prop: 'logistics_name', label: '快递', minWidth: 120 },
|
||||||
|
{ prop: 'item_snapshot_key', label: '商品快照键', minWidth: 320 },
|
||||||
{ prop: 'creator', label: '创建人', minWidth: 100 },
|
{ prop: 'creator', label: '创建人', minWidth: 100 },
|
||||||
{ prop: 'warehouse_id', label: '仓库ID', minWidth: 110 },
|
{ prop: 'warehouse_id', label: '仓库ID', minWidth: 110 },
|
||||||
{ prop: 'create_time', label: '创建时间', minWidth: 168 },
|
{ prop: 'create_time', label: '创建时间', minWidth: 168 },
|
||||||
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
|
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
|
||||||
{ prop: 'operation', label: '操作', minWidth: 280, fixed: 'right' }
|
{ prop: 'operation', label: '操作', minWidth: 180, fixed: 'right' }
|
||||||
])
|
])
|
||||||
|
|
||||||
/** 列表查询 where 白名单(与 sanitizeWaveWhere 一致) */
|
/** 列表查询 where 白名单(与 sanitizeWaveWhere 一致) */
|
||||||
@ -549,16 +550,6 @@ export const waveToolbarButtons: WaveToolbarButtonConfig[] = [
|
|||||||
loadingKey: 'batchCancelLoading',
|
loadingKey: 'batchCancelLoading',
|
||||||
action: 'handleBatchCancel'
|
action: 'handleBatchCancel'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'batchQuickRecheckByWave',
|
|
||||||
label: '批量发货(0)',
|
|
||||||
dynamicLabelKey: 'batchQuickRecheckByWaveTotal',
|
|
||||||
type: 'success',
|
|
||||||
size: 'small',
|
|
||||||
disabledKey: 'noSelection',
|
|
||||||
loadingKey: 'batchQuickRecheckByWaveLoading',
|
|
||||||
action: 'handleBatchQuickRecheckByWave'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'batchAllocateExpress',
|
key: 'batchAllocateExpress',
|
||||||
label: '快速分配快递号',
|
label: '快速分配快递号',
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import { TAG_RESOLVERS, translate, formatTime } from '../../config/waveorder-config'
|
import { TAG_RESOLVERS, translate } from '../../config/waveorder-config'
|
||||||
import type { DetailSectionConfig, DetailFieldConfig } from '../../config/waveorder-config'
|
import type { DetailSectionConfig, DetailFieldConfig } from '../../config/waveorder-config'
|
||||||
|
|
||||||
defineOptions({ name: 'WaveOrder2DetailPanel' })
|
defineOptions({ name: 'WaveOrder2DetailPanel' })
|
||||||
@ -88,14 +88,11 @@ function getRowData(): Record<string, any> | null {
|
|||||||
return props.row
|
return props.row
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 解析显示值:优先使用 translateField 翻译,然后 format 格式化,否则显示原始值 */
|
/** 解析显示值:优先使用 translateField 翻译,否则显示原始值 */
|
||||||
function resolveDisplayValue(field: DetailFieldConfig, value: any): string {
|
function resolveDisplayValue(field: DetailFieldConfig, value: any): string {
|
||||||
if (field.translateField) {
|
if (field.translateField) {
|
||||||
return translate(field.translateField, value)
|
return translate(field.translateField, value)
|
||||||
}
|
}
|
||||||
if (field.format === 'datetime') {
|
|
||||||
return formatTime(value)
|
|
||||||
}
|
|
||||||
return value ?? '—'
|
return value ?? '—'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -590,8 +590,6 @@ export interface DetailFieldConfig {
|
|||||||
tagResolver?: string
|
tagResolver?: string
|
||||||
/** 翻译字段名(查 VALUE_MAPS) */
|
/** 翻译字段名(查 VALUE_MAPS) */
|
||||||
translateField?: string
|
translateField?: string
|
||||||
/** 格式化类型:'datetime' 将时间戳转为 YYYY-MM-DD HH:mm:ss */
|
|
||||||
format?: 'datetime'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 明细面板分区配置 */
|
/** 明细面板分区配置 */
|
||||||
@ -812,8 +810,7 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
|||||||
translateField: def.slot?.translateField,
|
translateField: def.slot?.translateField,
|
||||||
tagResolver: def.slot?.tagResolver,
|
tagResolver: def.slot?.tagResolver,
|
||||||
tagType: def.slot?.tagType,
|
tagType: def.slot?.tagType,
|
||||||
renderType: def.slot?.type === 'tag' ? 'tag' : 'text',
|
renderType: def.slot?.type === 'tag' ? 'tag' : 'text'
|
||||||
format: def.slot?.format
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter((f): f is DetailFieldConfig => f !== null)
|
.filter((f): f is DetailFieldConfig => f !== null)
|
||||||
@ -938,17 +935,17 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
{
|
{
|
||||||
title: '基础信息',
|
title: '基础信息',
|
||||||
columnCount: 4,
|
columnCount: 4,
|
||||||
fieldKeys: ['wave_no', 'wave_type', 'wave_status', 'distinguish_express', 'logistics_name', 'creator', 'warehouse_id', 'create_time']
|
fieldKeys: ['wave_no', 'wave_type', 'wave_status', 'warehouse_id', 'total_orders', 'processed_orders', 'logistics_name', 'creator']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '订单统计',
|
title: '分配状态',
|
||||||
columnCount: 4,
|
|
||||||
fieldKeys: ['total_orders', 'order_count', 'processed_orders', 'unreviewed_order_count']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '流程状态',
|
|
||||||
columnCount: 3,
|
columnCount: 3,
|
||||||
fieldKeys: ['storage_assignment_status', 'express_assignment_status', 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', 'update_time']
|
fieldKeys: ['storage_assignment_status', 'express_assignment_status', 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', 'unreviewed_order_count']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结构与订单信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['create_time', 'update_time']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
api: {
|
api: {
|
||||||
@ -1024,17 +1021,17 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
{
|
{
|
||||||
title: '基础信息',
|
title: '基础信息',
|
||||||
columnCount: 4,
|
columnCount: 4,
|
||||||
fieldKeys: ['wave_no', 'wave_type', 'wave_status', 'distinguish_express', 'logistics_name', 'creator', 'warehouse_id', 'create_time']
|
fieldKeys: ['wave_no', 'wave_type', 'wave_status', 'warehouse_id', 'total_orders', 'processed_orders', 'logistics_name', 'creator']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '订单统计',
|
title: '分配状态',
|
||||||
columnCount: 4,
|
|
||||||
fieldKeys: ['total_orders', 'order_count', 'processed_orders', 'unreviewed_order_count']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '流程状态',
|
|
||||||
columnCount: 3,
|
columnCount: 3,
|
||||||
fieldKeys: ['storage_assignment_status', 'express_assignment_status', 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', 'update_time']
|
fieldKeys: ['storage_assignment_status', 'express_assignment_status', 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', 'unreviewed_order_count']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结构与订单信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['create_time', 'update_time']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
api: {
|
api: {
|
||||||
|
|||||||
@ -20,12 +20,7 @@
|
|||||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||||
<!-- <el-button size="small" @click="handleCreateEntry">新建入库单</el-button> -->
|
<!-- <el-button size="small" @click="handleCreateEntry">新建入库单</el-button> -->
|
||||||
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
|
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
|
||||||
<ExportModeDropdown
|
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
|
||||||
:loading="exportLoading"
|
|
||||||
:items="exportDropdownItems"
|
|
||||||
:default-action="'handleExportSelected'"
|
|
||||||
@action="handleExportAction"
|
|
||||||
/>
|
|
||||||
<el-button size="small" @click="handleImport">导入</el-button>
|
<el-button size="small" @click="handleImport">导入</el-button>
|
||||||
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
|
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
|
||||||
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
|
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
|
||||||
@ -140,19 +135,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AsyncExportProgressDialog
|
|
||||||
v-model:visible="exportDialogVisible"
|
|
||||||
title="库存导出进度"
|
|
||||||
:loading="exportLoading"
|
|
||||||
:progress-percent="exportProgressPercent"
|
|
||||||
:progress-status="exportProgressStatus"
|
|
||||||
:status-label="exportStatusLabel"
|
|
||||||
:task-id="exportTaskProgress.taskId"
|
|
||||||
:message="exportTaskProgress.message"
|
|
||||||
:error="exportTaskProgress.error"
|
|
||||||
:update-time="exportTaskProgress.updateTime"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<InventoryStockPickerDialog
|
<InventoryStockPickerDialog
|
||||||
v-model="stockPickerVisible"
|
v-model="stockPickerVisible"
|
||||||
:store-id="stockPickerStoreId"
|
:store-id="stockPickerStoreId"
|
||||||
@ -167,8 +149,6 @@ import { ref, reactive, onMounted, computed, nextTick } from 'vue'
|
|||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
|
||||||
import { useAsyncExportTask, type AsyncExportPayload } from '@/composables/useAsyncExportTask'
|
|
||||||
import * as indexApi from '@/api/index/index'
|
import * as indexApi from '@/api/index/index'
|
||||||
// import * as entryApi from '@/api/storage.entry/entry'
|
// import * as entryApi from '@/api/storage.entry/entry'
|
||||||
import * as inventoryApi from '@/api/storage.inventory/inventory'
|
import * as inventoryApi from '@/api/storage.inventory/inventory'
|
||||||
@ -178,15 +158,17 @@ import {
|
|||||||
formatInventoryBarcodes,
|
formatInventoryBarcodes,
|
||||||
formatInventoryFlagLabel,
|
formatInventoryFlagLabel,
|
||||||
formatInventoryOptionalText,
|
formatInventoryOptionalText,
|
||||||
|
inventoryExportColumns,
|
||||||
isInventoryFlagEnabled,
|
isInventoryFlagEnabled,
|
||||||
productstockColums,
|
productstockColums,
|
||||||
} from './inventory-config'
|
} from './inventory-config'
|
||||||
|
import { exportUpperTableRows } from '@/views/order/orderManagement/utils/export'
|
||||||
|
|
||||||
import entrydetail from './component/panelstockdetail.vue'
|
import entrydetail from './component/panelstockdetail.vue'
|
||||||
import log from './component/log.vue'
|
import log from './component/log.vue'
|
||||||
import InventoryStockPickerDialog from './component/InventoryStockPickerDialog.vue'
|
import InventoryStockPickerDialog from './component/InventoryStockPickerDialog.vue'
|
||||||
import type { InventoryStockPickerItem } from './component/InventoryStockPickerDialog.vue'
|
import type { InventoryStockPickerItem } from './component/InventoryStockPickerDialog.vue'
|
||||||
import ExportModeDropdown, { type ExportDropdownItem } from '@/components/ExportModeDropdown.vue'
|
import ExportModeDropdown from '@/components/ExportModeDropdown.vue'
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
|
|
||||||
@ -232,30 +214,9 @@ const activeTab = ref('details')
|
|||||||
|
|
||||||
const list = ref<any[]>([])
|
const list = ref<any[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const exportLoading = ref(false)
|
||||||
const queryTime = ref(0)
|
const queryTime = ref(0)
|
||||||
|
|
||||||
// --- 异步导出 ---
|
|
||||||
const {
|
|
||||||
exportLoading,
|
|
||||||
exportDialogVisible,
|
|
||||||
exportTaskProgress,
|
|
||||||
exportProgressPercent,
|
|
||||||
exportProgressStatus,
|
|
||||||
exportStatusLabel,
|
|
||||||
submitExportTask,
|
|
||||||
resumeExportTaskFromStorage,
|
|
||||||
hasPendingExportTask
|
|
||||||
} = useAsyncExportTask({
|
|
||||||
storageKey: 'storage.inventory.export.taskId',
|
|
||||||
submitExport: (payload) => inventoryApi.exportInventory(payload as any),
|
|
||||||
queryProgress: (params) => inventoryApi.exportTaskProgress(params)
|
|
||||||
})
|
|
||||||
|
|
||||||
const exportDropdownItems: ExportDropdownItem[] = [
|
|
||||||
{ label: '导出选中', action: 'handleExportSelected' },
|
|
||||||
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
|
||||||
]
|
|
||||||
|
|
||||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||||
const tableSize = ref('small')
|
const tableSize = ref('small')
|
||||||
const groupByBatch = ref(false)
|
const groupByBatch = ref(false)
|
||||||
@ -320,7 +281,6 @@ const selectedRow = computed(() => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadData()
|
loadData()
|
||||||
loadFilterData()
|
loadFilterData()
|
||||||
resumeExportTaskFromStorage()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
@ -557,56 +517,101 @@ async function confirmBatchCancel() {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildExportPayload(): AsyncExportPayload {
|
async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
|
||||||
const rawWhere = scanBox.value?.getConditions?.() || {}
|
exportLoading.value = true
|
||||||
return {
|
try {
|
||||||
where: { ...rawWhere },
|
if (mode === 'waybill') {
|
||||||
group_by_batch: groupByBatch.value
|
const sourceRows = selectionRows.value.length ? selectionRows.value : list.value
|
||||||
}
|
if (!sourceRows.length) {
|
||||||
}
|
|
||||||
|
|
||||||
async function handleExportSelected() {
|
|
||||||
if (!selectionRows.value.length) {
|
|
||||||
ElMessage.warning('请先选择要导出的库存记录')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (hasPendingExportTask()) {
|
|
||||||
ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试')
|
|
||||||
resumeExportTaskFromStorage()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const stockIds = selectionRows.value
|
|
||||||
.map((row: any) => Number(row.stock_id))
|
|
||||||
.filter((id: number) => Number.isFinite(id) && id > 0)
|
|
||||||
if (!stockIds.length) {
|
|
||||||
ElMessage.warning('选中的记录无有效 stock_id')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
await submitExportTask({
|
|
||||||
where: { stock_id: stockIds.length === 1 ? stockIds[0] : stockIds },
|
|
||||||
group_by_batch: groupByBatch.value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleExportAll() {
|
|
||||||
if (!list.value.length) {
|
|
||||||
ElMessage.warning('当前无数据可导出')
|
ElMessage.warning('当前无数据可导出')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (hasPendingExportTask()) {
|
exportUpperTableRows({
|
||||||
ElMessage.warning('检测到未完成导出任务,请等待当前任务完成后再试')
|
rows: sourceRows,
|
||||||
resumeExportTaskFromStorage()
|
columns: inventoryExportColumns,
|
||||||
|
fileName: `库存列表-${Date.now()}.xlsx`,
|
||||||
|
transformCell: (prop, value) => {
|
||||||
|
if (prop === 'is_shelf_life_mgmt') return formatInventoryFlagLabel(value)
|
||||||
|
if (prop === 'remaining_threshold_days') return formatInventoryOptionalText(value)
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ElMessage.success('导出成功')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await submitExportTask(buildExportPayload())
|
|
||||||
|
const params: any = {
|
||||||
|
pagination: { page: 1, pageSize: 10000 },
|
||||||
|
where: scanBox.value?.getConditions?.() || {},
|
||||||
|
group_by_batch: true
|
||||||
|
}
|
||||||
|
const res: any = await inventoryApi.getInventoryList(params)
|
||||||
|
if (!(res && (res.code === 200 || res.code === 1 || res.flag === 'success'))) {
|
||||||
|
ElMessage.error('获取库存明细失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = res.data || res
|
||||||
|
const rawRows = Array.isArray(data.list) ? data.list : []
|
||||||
|
let exportRows = rawRows.map((item: any) => {
|
||||||
|
return {
|
||||||
|
store_name: item.store_name || item.stock?.store_name || '',
|
||||||
|
item_code: item.stock?.item_code || '',
|
||||||
|
item_name: item.stock?.item_name || '',
|
||||||
|
barcodes: formatInventoryBarcodes(item.stock?.barcodes),
|
||||||
|
sku_property: formatInventoryOptionalText(item.stock?.sku_property),
|
||||||
|
stock_unit: formatInventoryOptionalText(item.stock?.stock_unit),
|
||||||
|
production_date: item.production_date || '',
|
||||||
|
expiry_date: item.expiry_date || '',
|
||||||
|
quantity: item.quantity,
|
||||||
|
available_quantity: item.available_quantity,
|
||||||
|
locked_quantity: item.locked_quantity,
|
||||||
|
first_inbound_time: item.first_inbound_time || '',
|
||||||
|
last_inbound_time: item.last_inbound_time,
|
||||||
|
batch_count: Number(item.batch_count || 0),
|
||||||
|
is_shelf_life_mgmt: item.stock?.is_shelf_life_mgmt ?? '',
|
||||||
|
remaining_threshold_days: item.stock?.remaining_threshold_days ?? '',
|
||||||
|
is_batch_mgmt_enabled: item.stock?.is_batch_mgmt_enabled
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (selectionRows.value.length) {
|
||||||
|
const selectedKeys = new Set(
|
||||||
|
selectionRows.value.map((row: any) => row.stock_id)
|
||||||
|
)
|
||||||
|
exportRows = exportRows.filter((row: any) =>
|
||||||
|
selectedKeys.has(row.stock_id)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exportRows.length) {
|
||||||
|
ElMessage.warning('未获取到可导出的库存明细')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
exportUpperTableRows({
|
||||||
|
rows: exportRows,
|
||||||
|
columns: productstockColums,
|
||||||
|
fileName: `库存明细-${Date.now()}.xlsx`,
|
||||||
|
transformCell: (prop, value) => {
|
||||||
|
if (prop === 'is_shelf_life_mgmt' || prop === 'is_batch_mgmt_enabled') {
|
||||||
|
return formatInventoryFlagLabel(value)
|
||||||
|
}
|
||||||
|
if (prop === 'remaining_threshold_days') return formatInventoryOptionalText(value)
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ElMessage.success('导出成功')
|
||||||
|
} catch (e) {
|
||||||
|
console.error('导出 Excel 失败:', e)
|
||||||
|
ElMessage.error('导出失败')
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleExportAction(action: string) {
|
function handleExportAction(action: string) {
|
||||||
if (action === 'handleExportAll') {
|
void handleExport(action === 'handleExportItem' ? 'item' : 'waybill')
|
||||||
void handleExportAll()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
void handleExportSelected()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleImport() {
|
function handleImport() {
|
||||||
|
|||||||
@ -149,16 +149,14 @@
|
|||||||
<el-button type="primary" plain :loading="authLinkLoading" @click="handleOpenAuthorizeLink">
|
<el-button type="primary" plain :loading="authLinkLoading" @click="handleOpenAuthorizeLink">
|
||||||
去授权
|
去授权
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- <el-text v-if="authNeedCallbackUrl" type="info" size="small" class="auth-tip">
|
||||||
|
请先在平台完成授权,再将回调地址粘贴到上方输入框后点击「确认授权」。
|
||||||
|
</el-text>
|
||||||
|
<el-text v-else type="info" size="small" class="auth-tip">
|
||||||
|
请先在平台完成授权,再点击「确认授权」完成绑定。
|
||||||
|
</el-text> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="isWechatChannel">
|
<el-form-item v-if="authNeedCallbackUrl" label="回调地址" prop="callbackurl">
|
||||||
<el-form-item label="appId" prop="appId">
|
|
||||||
<el-input v-model="authForm.appId" placeholder="请输入视频号 appId" clearable />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="toUserName" prop="toUserName">
|
|
||||||
<el-input v-model="authForm.toUserName" placeholder="请输入视频号 toUserName" clearable />
|
|
||||||
</el-form-item>
|
|
||||||
</template>
|
|
||||||
<el-form-item v-else-if="authNeedCallbackUrl" label="回调地址" prop="callbackurl">
|
|
||||||
<el-input
|
<el-input
|
||||||
v-model="authForm.callbackurl"
|
v-model="authForm.callbackurl"
|
||||||
placeholder="请输入授权完成后的回调 URL"
|
placeholder="请输入授权完成后的回调 URL"
|
||||||
@ -263,33 +261,17 @@ const authForm = reactive({
|
|||||||
shopLabel: '',
|
shopLabel: '',
|
||||||
platform_name: '',
|
platform_name: '',
|
||||||
platformCode: '',
|
platformCode: '',
|
||||||
callbackurl: '',
|
callbackurl: ''
|
||||||
appId: '',
|
|
||||||
toUserName: ''
|
|
||||||
})
|
|
||||||
|
|
||||||
/** 视频号平台需要 appId + toUserName,callbackUrl 固定为 "-" */
|
|
||||||
const isWechatChannel = computed(() => {
|
|
||||||
const code = String(authForm.platformCode || '').trim().toLowerCase()
|
|
||||||
return code === 'shipinhao' || code === '视频号'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const authNeedCallbackUrl = computed(() => {
|
const authNeedCallbackUrl = computed(() => {
|
||||||
const code = String(authForm.platformCode || '').trim()
|
const code = String(authForm.platformCode || '').trim()
|
||||||
if (!code) return false
|
if (!code) return false
|
||||||
// 视频号不需要显示 callbackurl
|
|
||||||
if (isWechatChannel.value) return false
|
|
||||||
const platform = platformOptions.value.find((item) => item.code === code)
|
const platform = platformOptions.value.find((item) => item.code === code)
|
||||||
return isNeedCallbackUrl(platform?.need_callback_url)
|
return isNeedCallbackUrl(platform?.need_callback_url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const authRules = computed<FormRules>(() => {
|
const authRules = computed<FormRules>(() => {
|
||||||
if (isWechatChannel.value) {
|
|
||||||
return {
|
|
||||||
appId: [{ required: true, message: '请输入 appId', trigger: 'blur' }],
|
|
||||||
toUserName: [{ required: true, message: '请输入 toUserName', trigger: 'blur' }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!authNeedCallbackUrl.value) return {}
|
if (!authNeedCallbackUrl.value) return {}
|
||||||
return {
|
return {
|
||||||
callbackurl: [{ required: true, message: '请输入回调地址', trigger: 'blur' }]
|
callbackurl: [{ required: true, message: '请输入回调地址', trigger: 'blur' }]
|
||||||
@ -575,8 +557,6 @@ function resetAuthForm() {
|
|||||||
authForm.platform_name = ''
|
authForm.platform_name = ''
|
||||||
authForm.platformCode = ''
|
authForm.platformCode = ''
|
||||||
authForm.callbackurl = ''
|
authForm.callbackurl = ''
|
||||||
authForm.appId = ''
|
|
||||||
authForm.toUserName = ''
|
|
||||||
authFormRef.value?.clearValidate()
|
authFormRef.value?.clearValidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,14 +615,8 @@ async function submitConfirmAuthorize() {
|
|||||||
|
|
||||||
authConfirmLoading.value = true
|
authConfirmLoading.value = true
|
||||||
try {
|
try {
|
||||||
const payload: { id: number; callbackurl?: string; appId?: string; toUserName?: string } = {
|
const payload: { id: number; callbackurl?: string } = { id: authForm.shopId }
|
||||||
id: authForm.shopId
|
if (authNeedCallbackUrl.value) {
|
||||||
}
|
|
||||||
if (isWechatChannel.value) {
|
|
||||||
payload.appId = authForm.appId.trim()
|
|
||||||
payload.toUserName = authForm.toUserName.trim()
|
|
||||||
payload.callbackurl = '-'
|
|
||||||
} else if (authNeedCallbackUrl.value) {
|
|
||||||
payload.callbackurl = String(authForm.callbackurl || '').trim()
|
payload.callbackurl = String(authForm.callbackurl || '').trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,6 @@
|
|||||||
<template #column-actions="{ row }">
|
<template #column-actions="{ row }">
|
||||||
<el-button link type="primary" size="small" @click.stop="openEdit(row)">编辑</el-button>
|
<el-button link type="primary" size="small" @click.stop="openEdit(row)">编辑</el-button>
|
||||||
<el-button link type="danger" size="small" @click.stop="handleDelete(row)">删除</el-button>
|
<el-button link type="danger" size="small" @click.stop="handleDelete(row)">删除</el-button>
|
||||||
<el-button link type="warning" size="small" @click.stop="openOsd(row)">OSD</el-button>
|
|
||||||
<el-button link type="success" size="small" @click.stop="openPreview(row)">预览</el-button>
|
<el-button link type="success" size="small" @click.stop="openPreview(row)">预览</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -158,77 +157,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- OSD 文字叠加设置弹窗 -->
|
|
||||||
<el-dialog
|
|
||||||
v-model="osdVisible"
|
|
||||||
title="设置 OSD 文字叠加"
|
|
||||||
width="520px"
|
|
||||||
align-center
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
@close="resetOsdForm"
|
|
||||||
>
|
|
||||||
<div class="osd-camera-info">
|
|
||||||
<span class="osd-label">摄像头:</span>
|
|
||||||
<span>{{ osdCameraName }}</span>
|
|
||||||
</div>
|
|
||||||
<el-form ref="osdFormRef" :model="osdForm" :rules="osdRules" label-width="100px" class="osd-form">
|
|
||||||
<el-form-item label="叠加文字" prop="text">
|
|
||||||
<el-input
|
|
||||||
v-model="osdForm.text"
|
|
||||||
placeholder="请输入要在画面中叠加的文字"
|
|
||||||
maxlength="64"
|
|
||||||
show-word-limit
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="X 坐标">
|
|
||||||
<div class="osd-coord-row">
|
|
||||||
<el-slider
|
|
||||||
v-model="osdForm.x"
|
|
||||||
:min="-1"
|
|
||||||
:max="1"
|
|
||||||
:step="0.1"
|
|
||||||
:marks="osdCoordMarks"
|
|
||||||
show-input
|
|
||||||
style="flex:1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="osd-coord-hint">范围 -1(左)~ 1(右),默认 -0.9</div>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Y 坐标">
|
|
||||||
<div class="osd-coord-row">
|
|
||||||
<el-slider
|
|
||||||
v-model="osdForm.y"
|
|
||||||
:min="-1"
|
|
||||||
:max="1"
|
|
||||||
:step="0.1"
|
|
||||||
:marks="osdCoordMarks"
|
|
||||||
show-input
|
|
||||||
style="flex:1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="osd-coord-hint">范围 -1(上)~ 1(下),默认 0.8</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div class="osd-preview-box">
|
|
||||||
<div class="osd-preview-label">位置预览</div>
|
|
||||||
<div class="osd-preview-canvas">
|
|
||||||
<span
|
|
||||||
class="osd-preview-dot"
|
|
||||||
:style="osdDotStyle"
|
|
||||||
title="OSD 文字参考位置"
|
|
||||||
>●</span>
|
|
||||||
</div>
|
|
||||||
<div class="osd-preview-pos">当前坐标:({{ osdForm.x.toFixed(1) }}, {{ osdForm.y.toFixed(1) }})</div>
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="osdVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" :loading="osdSaving" @click="submitOsd">
|
|
||||||
应用 OSD
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 预览弹窗 -->
|
<!-- 预览弹窗 -->
|
||||||
<CameraPreviewDialog v-model="previewVisible" :camera-row="previewCameraRow" />
|
<CameraPreviewDialog v-model="previewVisible" :camera-row="previewCameraRow" />
|
||||||
</div>
|
</div>
|
||||||
@ -241,7 +169,7 @@ import type { FormInstance, FormRules } from 'element-plus'
|
|||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
import CameraPreviewDialog from './component/CameraPreviewDialog.vue'
|
import CameraPreviewDialog from './component/CameraPreviewDialog.vue'
|
||||||
import { list, create, update, del, setOsd } from '@/api/camera/camera'
|
import { list, create, update, del } from '@/api/camera/camera'
|
||||||
import { list as serverList, detail as serverDetail } from '@/api/camera_server/camera_server'
|
import { list as serverList, detail as serverDetail } from '@/api/camera_server/camera_server'
|
||||||
import { getHikvisionChannels } from '@/api/camera_server/localServerApi'
|
import { getHikvisionChannels } from '@/api/camera_server/localServerApi'
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
@ -299,7 +227,7 @@ const columns = [
|
|||||||
{ prop: 'custom_name', label: '自定义名称', minWidth: '160', showOverflowTooltip: true },
|
{ prop: 'custom_name', label: '自定义名称', minWidth: '160', showOverflowTooltip: true },
|
||||||
{ prop: 'status', label: '状态', width: '90' },
|
{ prop: 'status', label: '状态', width: '90' },
|
||||||
{ prop: 'remark', label: '备注', minWidth: '160', showOverflowTooltip: true },
|
{ prop: 'remark', label: '备注', minWidth: '160', showOverflowTooltip: true },
|
||||||
{ prop: 'actions', label: '操作', width: '220', fixed: 'right' }
|
{ prop: 'actions', label: '操作', width: '150', fixed: 'right' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const availableFields = [
|
const availableFields = [
|
||||||
@ -353,29 +281,6 @@ const serverPassword = ref('')
|
|||||||
const selectedServerNeedsPassword = ref(false)
|
const selectedServerNeedsPassword = ref(false)
|
||||||
const previewVisible = ref(false)
|
const previewVisible = ref(false)
|
||||||
const previewCameraRow = ref<CameraRecord | null>(null)
|
const previewCameraRow = ref<CameraRecord | null>(null)
|
||||||
|
|
||||||
// --- OSD 文字叠加 ---
|
|
||||||
const osdVisible = ref(false)
|
|
||||||
const osdSaving = ref(false)
|
|
||||||
const osdCameraRow = ref<CameraRecord | null>(null)
|
|
||||||
const osdFormRef = ref<FormInstance>()
|
|
||||||
const osdForm = reactive({ text: '', x: -0.9, y: 0.8 })
|
|
||||||
const osdRules: FormRules = {
|
|
||||||
text: [{ required: true, message: '请输入叠加文字', trigger: 'blur' }]
|
|
||||||
}
|
|
||||||
const osdCoordMarks = { '-1': '-1', '0': '0', '1': '1' }
|
|
||||||
|
|
||||||
const osdCameraName = computed(() => {
|
|
||||||
const row = osdCameraRow.value
|
|
||||||
if (!row) return '--'
|
|
||||||
return row.custom_name || row.channel_name || `摄像头 #${row.id}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const osdDotStyle = computed(() => {
|
|
||||||
const left = ((osdForm.x + 1) / 2) * 100
|
|
||||||
const top = ((1 - osdForm.y) / 2) * 100
|
|
||||||
return { left: `${left}%`, top: `${top}%` }
|
|
||||||
})
|
|
||||||
const queryTime = ref(0)
|
const queryTime = ref(0)
|
||||||
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
||||||
const currentConditionRaw = ref<any>(null)
|
const currentConditionRaw = ref<any>(null)
|
||||||
@ -813,53 +718,6 @@ function openPreview(row: CameraRecord) {
|
|||||||
previewVisible.value = true
|
previewVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 打开 OSD 设置弹窗 */
|
|
||||||
function openOsd(row: CameraRecord) {
|
|
||||||
osdCameraRow.value = row
|
|
||||||
resetOsdForm()
|
|
||||||
osdVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetOsdForm() {
|
|
||||||
osdForm.text = ''
|
|
||||||
osdForm.x = -0.9
|
|
||||||
osdForm.y = 0.8
|
|
||||||
osdFormRef.value?.clearValidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交 OSD 文字叠加 */
|
|
||||||
async function submitOsd() {
|
|
||||||
if (!osdFormRef.value || osdSaving.value) return
|
|
||||||
const valid = await osdFormRef.value.validate().catch(() => false)
|
|
||||||
if (!valid) return
|
|
||||||
|
|
||||||
const row = osdCameraRow.value
|
|
||||||
if (!row?.id) {
|
|
||||||
ElMessage.error('未找到摄像头信息')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
osdSaving.value = true
|
|
||||||
try {
|
|
||||||
const res: any = await setOsd({
|
|
||||||
id: row.id,
|
|
||||||
text: osdForm.text.trim(),
|
|
||||||
x: osdForm.x,
|
|
||||||
y: osdForm.y
|
|
||||||
})
|
|
||||||
if (isSuccess(res)) {
|
|
||||||
ElMessage.success(`已为「${osdCameraName.value}」设置 OSD 文字`)
|
|
||||||
osdVisible.value = false
|
|
||||||
} else {
|
|
||||||
ElMessage.error(res?.message || 'OSD 设置失败')
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
ElMessage.error('OSD 设置失败,请检查网络连接')
|
|
||||||
} finally {
|
|
||||||
osdSaving.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadList()
|
loadList()
|
||||||
loadServerOptions()
|
loadServerOptions()
|
||||||
@ -902,71 +760,4 @@ onMounted(() => {
|
|||||||
color: #909399;
|
color: #909399;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- OSD 弹窗样式 --- */
|
|
||||||
.osd-camera-info {
|
|
||||||
padding: 8px 12px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
background: #f5f7fa;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
.osd-label {
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-form {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-coord-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-coord-hint {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-preview-box {
|
|
||||||
margin-top: 16px;
|
|
||||||
border: 1px solid #e4e7ed;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-preview-label {
|
|
||||||
font-size: 13px;
|
|
||||||
color: #606266;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-preview-canvas {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 120px;
|
|
||||||
background: #1a1a2e;
|
|
||||||
border-radius: 4px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-preview-dot {
|
|
||||||
position: absolute;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #67c23a;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
text-shadow: 0 0 4px rgba(103, 194, 58, 0.6);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osd-preview-pos {
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -247,7 +247,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
key: 'operation',
|
key: 'operation',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { width: 220, fixed: 'right', align: 'center' },
|
table: { width: 180, fixed: 'right', align: 'center' },
|
||||||
slot: { type: 'operation' }
|
slot: { type: 'operation' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -689,12 +689,6 @@ export const tabPages: TabPageRawConfig[] = [
|
|||||||
confirmType: 'warning',
|
confirmType: 'warning',
|
||||||
confirmButtonText: '确认删除'
|
confirmButtonText: '确认删除'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'osd',
|
|
||||||
label: 'OSD',
|
|
||||||
actionType: 'action',
|
|
||||||
type: 'warning'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'preview',
|
key: 'preview',
|
||||||
label: '预览',
|
label: '预览',
|
||||||
|
|||||||
@ -114,7 +114,6 @@
|
|||||||
<div class="operation-cell">
|
<div class="operation-cell">
|
||||||
<el-button link type="primary" size="small" @click.stop="openCameraForm('edit', getRowById(row['id']))">编辑</el-button>
|
<el-button link type="primary" size="small" @click.stop="openCameraForm('edit', getRowById(row['id']))">编辑</el-button>
|
||||||
<el-button link type="danger" size="small" @click.stop="handleDeleteCamera(getRowById(row['id'])!)">删除</el-button>
|
<el-button link type="danger" size="small" @click.stop="handleDeleteCamera(getRowById(row['id'])!)">删除</el-button>
|
||||||
<el-button link type="warning" size="small" @click.stop="openOsdDialog(getRowById(row['id'])!)">OSD</el-button>
|
|
||||||
<el-button link type="success" size="small" @click.stop="handlePreview(getRowById(row['id'])!)">预览</el-button>
|
<el-button link type="success" size="small" @click.stop="handlePreview(getRowById(row['id'])!)">预览</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -208,7 +207,6 @@
|
|||||||
<div class="operation-cell">
|
<div class="operation-cell">
|
||||||
<el-button link type="primary" size="small" @click.stop="openCameraForm('edit', getRowById(row['id']))">编辑</el-button>
|
<el-button link type="primary" size="small" @click.stop="openCameraForm('edit', getRowById(row['id']))">编辑</el-button>
|
||||||
<el-button link type="danger" size="small" @click.stop="handleDeleteCamera(getRowById(row['id'])!)">删除</el-button>
|
<el-button link type="danger" size="small" @click.stop="handleDeleteCamera(getRowById(row['id'])!)">删除</el-button>
|
||||||
<el-button link type="warning" size="small" @click.stop="openOsdDialog(getRowById(row['id'])!)">OSD</el-button>
|
|
||||||
<el-button link type="success" size="small" @click.stop="handlePreview(getRowById(row['id'])!)">预览</el-button>
|
<el-button link type="success" size="small" @click.stop="handlePreview(getRowById(row['id'])!)">预览</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -241,77 +239,6 @@
|
|||||||
|
|
||||||
<!-- ===== 预览弹窗 ===== -->
|
<!-- ===== 预览弹窗 ===== -->
|
||||||
<CameraPreviewDialog v-model="previewVisible" :camera-row="previewCameraRow" />
|
<CameraPreviewDialog v-model="previewVisible" :camera-row="previewCameraRow" />
|
||||||
|
|
||||||
<!-- ===== OSD 文字叠加设置弹窗 ===== -->
|
|
||||||
<el-dialog
|
|
||||||
v-model="osdVisible"
|
|
||||||
title="设置 OSD 文字叠加"
|
|
||||||
width="520px"
|
|
||||||
align-center
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
@close="resetOsdForm"
|
|
||||||
>
|
|
||||||
<div class="osd-camera-info">
|
|
||||||
<span class="osd-label">摄像头:</span>
|
|
||||||
<span>{{ osdCameraName }}</span>
|
|
||||||
</div>
|
|
||||||
<el-form ref="osdFormRef" :model="osdForm" :rules="osdRules" label-width="100px" class="osd-form">
|
|
||||||
<el-form-item label="叠加文字" prop="text">
|
|
||||||
<el-input
|
|
||||||
v-model="osdForm.text"
|
|
||||||
placeholder="请输入要在画面中叠加的文字"
|
|
||||||
maxlength="64"
|
|
||||||
show-word-limit
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="X 坐标">
|
|
||||||
<div class="osd-coord-row">
|
|
||||||
<el-slider
|
|
||||||
v-model="osdForm.x"
|
|
||||||
:min="-1"
|
|
||||||
:max="1"
|
|
||||||
:step="0.1"
|
|
||||||
:marks="osdCoordMarks"
|
|
||||||
show-input
|
|
||||||
style="flex:1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="osd-coord-hint">范围 -1(左)~ 1(右),默认 -0.9</div>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="Y 坐标">
|
|
||||||
<div class="osd-coord-row">
|
|
||||||
<el-slider
|
|
||||||
v-model="osdForm.y"
|
|
||||||
:min="-1"
|
|
||||||
:max="1"
|
|
||||||
:step="0.1"
|
|
||||||
:marks="osdCoordMarks"
|
|
||||||
show-input
|
|
||||||
style="flex:1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="osd-coord-hint">范围 -1(上)~ 1(下),默认 0.8</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div class="osd-preview-box">
|
|
||||||
<div class="osd-preview-label">位置预览</div>
|
|
||||||
<div class="osd-preview-canvas">
|
|
||||||
<span
|
|
||||||
class="osd-preview-dot"
|
|
||||||
:style="osdDotStyle"
|
|
||||||
title="OSD 文字参考位置"
|
|
||||||
>●</span>
|
|
||||||
</div>
|
|
||||||
<div class="osd-preview-pos">当前坐标:({{ osdForm.x.toFixed(1) }}, {{ osdForm.y.toFixed(1) }})</div>
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="osdVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" :loading="osdSaving" @click="submitOsd">
|
|
||||||
应用 OSD
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -323,7 +250,6 @@ defineOptions({ name: 'NewCamera' })
|
|||||||
|
|
||||||
import { ref, computed, onMounted, reactive } from 'vue'
|
import { ref, computed, onMounted, reactive } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
@ -335,7 +261,7 @@ import CameraFormDialog from './pages/CameraFormDialog.vue'
|
|||||||
import CameraPreviewDialog from './components/CameraPreviewDialog.vue'
|
import CameraPreviewDialog from './components/CameraPreviewDialog.vue'
|
||||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
import { del, setOsd } from '@/api/camera/camera'
|
import { del } from '@/api/camera/camera'
|
||||||
import {
|
import {
|
||||||
PAGE_CONFIG,
|
PAGE_CONFIG,
|
||||||
tabPages,
|
tabPages,
|
||||||
@ -539,76 +465,6 @@ function handleFormSuccess() {
|
|||||||
const previewVisible = ref(false)
|
const previewVisible = ref(false)
|
||||||
const previewCameraRow = ref<Record<string, any> | null>(null)
|
const previewCameraRow = ref<Record<string, any> | null>(null)
|
||||||
|
|
||||||
// ============================================================
|
|
||||||
// OSD 文字叠加
|
|
||||||
// ============================================================
|
|
||||||
const osdVisible = ref(false)
|
|
||||||
const osdSaving = ref(false)
|
|
||||||
const osdCameraRow = ref<Record<string, any> | null>(null)
|
|
||||||
const osdFormRef = ref<FormInstance>()
|
|
||||||
const osdForm = reactive({ text: '', x: -0.9, y: 0.8 })
|
|
||||||
const osdRules: FormRules = {
|
|
||||||
text: [{ required: true, message: '请输入叠加文字', trigger: 'blur' }]
|
|
||||||
}
|
|
||||||
const osdCoordMarks = { '-1': '-1', '0': '0', '1': '1' }
|
|
||||||
|
|
||||||
const osdCameraName = computed(() => {
|
|
||||||
const row = osdCameraRow.value
|
|
||||||
if (!row) return '--'
|
|
||||||
return row.custom_name || row.channel_name || `摄像头 #${row.id}`
|
|
||||||
})
|
|
||||||
|
|
||||||
const osdDotStyle = computed(() => {
|
|
||||||
const left = ((osdForm.x + 1) / 2) * 100
|
|
||||||
const top = ((1 - osdForm.y) / 2) * 100
|
|
||||||
return { left: `${left}%`, top: `${top}%` }
|
|
||||||
})
|
|
||||||
|
|
||||||
function openOsdDialog(row: Record<string, any>) {
|
|
||||||
osdCameraRow.value = row
|
|
||||||
resetOsdForm()
|
|
||||||
osdVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetOsdForm() {
|
|
||||||
osdForm.text = ''
|
|
||||||
osdForm.x = -0.9
|
|
||||||
osdForm.y = 0.8
|
|
||||||
osdFormRef.value?.clearValidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submitOsd() {
|
|
||||||
if (!osdFormRef.value || osdSaving.value) return
|
|
||||||
const valid = await osdFormRef.value.validate().catch(() => false)
|
|
||||||
if (!valid) return
|
|
||||||
|
|
||||||
const row = osdCameraRow.value
|
|
||||||
if (!row?.id) {
|
|
||||||
ElMessage.error('未找到摄像头信息')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
osdSaving.value = true
|
|
||||||
try {
|
|
||||||
const res: any = await setOsd({
|
|
||||||
id: row.id,
|
|
||||||
text: osdForm.text.trim(),
|
|
||||||
x: osdForm.x,
|
|
||||||
y: osdForm.y
|
|
||||||
})
|
|
||||||
if (res && [0, 1, 200].includes(res.code)) {
|
|
||||||
ElMessage.success(`已为「${osdCameraName.value}」设置 OSD 文字`)
|
|
||||||
osdVisible.value = false
|
|
||||||
} else {
|
|
||||||
ElMessage.error(res?.message || 'OSD 设置失败')
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
ElMessage.error('OSD 设置失败,请检查网络连接')
|
|
||||||
} finally {
|
|
||||||
osdSaving.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 操作列按钮事件处理
|
// 操作列按钮事件处理
|
||||||
// ============================================================
|
// ============================================================
|
||||||
@ -623,9 +479,6 @@ async function handleOperationAction(key: string, row: Record<string, any>) {
|
|||||||
case 'preview':
|
case 'preview':
|
||||||
handlePreview(row)
|
handlePreview(row)
|
||||||
break
|
break
|
||||||
case 'osd':
|
|
||||||
openOsdDialog(row)
|
|
||||||
break
|
|
||||||
default:
|
default:
|
||||||
console.warn('[NewCamera] 未处理的操作按钮:', key)
|
console.warn('[NewCamera] 未处理的操作按钮:', key)
|
||||||
}
|
}
|
||||||
@ -962,65 +815,4 @@ onMounted(() => {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================
|
|
||||||
6. OSD 弹窗样式
|
|
||||||
================================================================ */
|
|
||||||
.osd-camera-info {
|
|
||||||
padding: 8px 12px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
background: #f5f7fa;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
.osd-label {
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
.osd-form {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.osd-coord-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.osd-coord-hint {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
margin-top: 4px;
|
|
||||||
}
|
|
||||||
.osd-preview-box {
|
|
||||||
margin-top: 16px;
|
|
||||||
border: 1px solid #e4e7ed;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
.osd-preview-label {
|
|
||||||
font-size: 13px;
|
|
||||||
color: #606266;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
.osd-preview-canvas {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 120px;
|
|
||||||
background: #1a1a2e;
|
|
||||||
border-radius: 4px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.osd-preview-dot {
|
|
||||||
position: absolute;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #67c23a;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
text-shadow: 0 0 4px rgba(103, 194, 58, 0.6);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
.osd-preview-pos {
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user