Compare commits
No commits in common. "292e69a6d18af4ec9cc30e55a441a0ed1fbcc008" and "19ac3babad3b5ce41da34ba8eb790ab1da38bc2c" have entirely different histories.
292e69a6d1
...
19ac3babad
@ -1,118 +0,0 @@
|
|||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
const v = '1.0'
|
|
||||||
|
|
||||||
/** 打包任务列表查询参数 */
|
|
||||||
export type PackingListParams = {
|
|
||||||
/** 仓库ID(按仓库维度查询,必填) */
|
|
||||||
warehouse_id?: number | string
|
|
||||||
pagination?: {
|
|
||||||
page?: number
|
|
||||||
pageSize?: number
|
|
||||||
}
|
|
||||||
where?: PackingListWhere
|
|
||||||
sort?: PackingListSort
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打包任务列表 where 条件 */
|
|
||||||
export type PackingListWhere = {
|
|
||||||
/** 任务状态:0=待处理 1=打包中 2=已完成 3=异常 */
|
|
||||||
status?: number | string
|
|
||||||
/** 打包模式:1=散单 2=团购 */
|
|
||||||
pack_mode?: number | string
|
|
||||||
/** 运单号(模糊匹配) */
|
|
||||||
waybill_code?: string
|
|
||||||
/** 波次号(模糊匹配) */
|
|
||||||
wave_no?: string
|
|
||||||
/** 订单ID(精确匹配) */
|
|
||||||
order_id?: number | string
|
|
||||||
/** 工作台ID(精确匹配) */
|
|
||||||
workbench_id?: number | string
|
|
||||||
/** 快捷搜索:运单号/波次号模糊匹配 */
|
|
||||||
quickWhere?: string
|
|
||||||
/** 开始打包时间范围-起始 */
|
|
||||||
start_time_start?: string
|
|
||||||
/** 开始打包时间范围-结束 */
|
|
||||||
start_time_end?: string
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打包任务列表排序 */
|
|
||||||
export type PackingListSort = {
|
|
||||||
sortField?: string
|
|
||||||
sortOrder?: 'ASC' | 'DESC' | 'asc' | 'desc'
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打包任务列表项 */
|
|
||||||
export type PackingTaskItem = {
|
|
||||||
id?: number
|
|
||||||
order_id?: number | string
|
|
||||||
warehouse_id?: number | string
|
|
||||||
workbench_id?: number | string
|
|
||||||
wave_id?: number | string
|
|
||||||
wave_no?: string
|
|
||||||
waybill_code?: string
|
|
||||||
pack_quantity?: number
|
|
||||||
pack_mode?: number | string
|
|
||||||
status?: number | string
|
|
||||||
start_time?: string
|
|
||||||
end_time?: string
|
|
||||||
create_time?: string
|
|
||||||
update_time?: string
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打包任务列表响应 */
|
|
||||||
export type PackingListResponse = {
|
|
||||||
list: PackingTaskItem[]
|
|
||||||
pagination: {
|
|
||||||
page?: number
|
|
||||||
pageSize?: number
|
|
||||||
total?: number
|
|
||||||
totalPages?: number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打包任务列表查询(仓库侧)
|
|
||||||
* 按仓库维度查询 wms_pack_task 表,支持分页、筛选、排序
|
|
||||||
*/
|
|
||||||
export function packingList(data: PackingListParams = {}): Promise<{
|
|
||||||
code: number
|
|
||||||
message: string
|
|
||||||
data: PackingListResponse
|
|
||||||
}> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'order.packing.list',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打包任务详情查询(仓库侧)
|
|
||||||
* 按打包任务ID + 仓库维度查询单条打包任务记录
|
|
||||||
*/
|
|
||||||
export function packingGet(id: number): Promise<{
|
|
||||||
code: number
|
|
||||||
message: string
|
|
||||||
data: PackingTaskItem
|
|
||||||
}> {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'order.packing.get',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data: { id },
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
@ -215,7 +215,6 @@ export function storeWarehouseQueryPrintQuantityLogs(data: {
|
|||||||
page?: number
|
page?: number
|
||||||
page_size?: number
|
page_size?: number
|
||||||
}
|
}
|
||||||
where?: Record<string, any>
|
|
||||||
}) {
|
}) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
@ -361,39 +360,3 @@ export function storeWarehouseOpenAccount(data: {
|
|||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交面单余额变更日志导出任务 */
|
|
||||||
export function storeWarehouseExportPrintQuantityLogs(data: {
|
|
||||||
store_id: number | string
|
|
||||||
pagination?: { page?: number; page_size?: number }
|
|
||||||
where?: Record<string, any>
|
|
||||||
}) {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'storeWarehouse.store.exportPrintQuantityLogs',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 查询面单余额变更日志导出任务进度 */
|
|
||||||
export function storeWarehouseExportPrintQuantityLogsTaskProgress(data: {
|
|
||||||
task_id: string
|
|
||||||
}) {
|
|
||||||
return request({
|
|
||||||
url: '/system',
|
|
||||||
method: 'post',
|
|
||||||
params: {
|
|
||||||
method: 'storeWarehouse.store.exportPrintQuantityLogsTaskProgress',
|
|
||||||
v,
|
|
||||||
timestamp: new Date().getTime()
|
|
||||||
},
|
|
||||||
data,
|
|
||||||
isSystemApi: true
|
|
||||||
} as any)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -71,7 +71,6 @@ export default {
|
|||||||
'Externalwarehouse':'External Warehouse',
|
'Externalwarehouse':'External Warehouse',
|
||||||
'workbench':'Workbench',
|
'workbench':'Workbench',
|
||||||
// 'OwnerReceiving':'Owner Receiving',
|
// 'OwnerReceiving':'Owner Receiving',
|
||||||
'PackingFlow':'Packing Flow',
|
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "Login",
|
"title": "Login",
|
||||||
|
|||||||
@ -74,7 +74,9 @@ export default {
|
|||||||
'workbench':'工作台',
|
'workbench':'工作台',
|
||||||
// 'OwnerReceiving':'仓库收货单',
|
// 'OwnerReceiving':'仓库收货单',
|
||||||
'WmsCameraServer':'录像服务器',
|
'WmsCameraServer':'录像服务器',
|
||||||
'PackingFlow':'打包流水',
|
'':'',
|
||||||
|
'':'',
|
||||||
|
'':'',
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "登录",
|
"title": "登录",
|
||||||
|
|||||||
@ -65,5 +65,4 @@ export const componentMap: Record<string, any> = {
|
|||||||
'system/setting/pickcart/index':() => import('@/views/system/setting/pickcart/index.vue'),
|
'system/setting/pickcart/index':() => import('@/views/system/setting/pickcart/index.vue'),
|
||||||
'video/cameraServer/index': () => import('@/views/video/cameraServer/index.vue'),
|
'video/cameraServer/index': () => import('@/views/video/cameraServer/index.vue'),
|
||||||
'video/camera/index': () => import('@/views/video/newcamara/index.vue'),
|
'video/camera/index': () => import('@/views/video/newcamara/index.vue'),
|
||||||
'data/packingflow': () => import('@/views/data/packingflow/index.vue'),
|
|
||||||
};
|
};
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-button
|
|
||||||
v-if="videoCount > 0"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
@click.stop="$emit('click')"
|
|
||||||
>
|
|
||||||
<el-icon style="margin-right:2px"><VideoCameraFilled /></el-icon>
|
|
||||||
有视频 ({{ videoCount }})
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue'
|
|
||||||
import { VideoCameraFilled } from '@element-plus/icons-vue'
|
|
||||||
|
|
||||||
export interface VideoItem {
|
|
||||||
id: number
|
|
||||||
video_url: string
|
|
||||||
camera_id?: number
|
|
||||||
camera_name?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
videos: VideoItem[]
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineEmits<{
|
|
||||||
click: []
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const videoCount = computed(() => props.videos?.length ?? 0)
|
|
||||||
</script>
|
|
||||||
@ -1,134 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog
|
|
||||||
:model-value="visible"
|
|
||||||
title="打包录像列表"
|
|
||||||
width="700px"
|
|
||||||
align-center
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
@update:model-value="$emit('update:visible', $event)"
|
|
||||||
>
|
|
||||||
<div v-if="videos.length === 0" class="empty-hint">
|
|
||||||
<el-empty description="暂无录像" :image-size="80" />
|
|
||||||
</div>
|
|
||||||
<div v-else class="video-list">
|
|
||||||
<div
|
|
||||||
v-for="(video, index) in videos"
|
|
||||||
:key="video.id ?? index"
|
|
||||||
class="video-item"
|
|
||||||
@click="$emit('play', video)"
|
|
||||||
>
|
|
||||||
<div class="video-item__thumb">
|
|
||||||
<el-icon size="28"><VideoPlay /></el-icon>
|
|
||||||
</div>
|
|
||||||
<div class="video-item__info">
|
|
||||||
<div class="video-item__name">
|
|
||||||
{{ video.camera_name || '录像 ' + (index + 1) }}
|
|
||||||
</div>
|
|
||||||
<div class="video-item__meta">
|
|
||||||
<span>摄像头ID: {{ video.camera_id ?? '—' }}</span>
|
|
||||||
<span class="meta-divider">|</span>
|
|
||||||
<span>录像ID: {{ video.id }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="video-item__action">
|
|
||||||
<el-button type="primary" size="small" round>播放</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<el-button size="small" @click="$emit('update:visible', false)">关闭</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { VideoPlay } from '@element-plus/icons-vue'
|
|
||||||
import type { VideoItem } from './VideoButton.vue'
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
visible: boolean
|
|
||||||
videos: VideoItem[]
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineEmits<{
|
|
||||||
'update:visible': [value: boolean]
|
|
||||||
play: [video: VideoItem]
|
|
||||||
}>()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.video-list {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
padding: 4px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 16px;
|
|
||||||
padding: 16px 20px;
|
|
||||||
border: 1px solid #ebeef5;
|
|
||||||
border-radius: 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item:hover {
|
|
||||||
border-color: #409eff;
|
|
||||||
background: #ecf5ff;
|
|
||||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.15);
|
|
||||||
transform: translateY(-1px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item__thumb {
|
|
||||||
width: 56px;
|
|
||||||
height: 56px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: linear-gradient(135deg, #ecf5ff 0%, #d9ecff 100%);
|
|
||||||
border-radius: 12px;
|
|
||||||
color: #409eff;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item:hover .video-item__thumb {
|
|
||||||
background: linear-gradient(135deg, #409eff 0%, #66b1ff 100%);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item__info {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item__name {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #303133;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item__meta {
|
|
||||||
font-size: 13px;
|
|
||||||
color: #909399;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.meta-divider {
|
|
||||||
color: #dcdfe6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-item__action {
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-hint {
|
|
||||||
padding: 40px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,173 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-dialog
|
|
||||||
:model-value="visible"
|
|
||||||
:title="video?.camera_name || '录像回放'"
|
|
||||||
width="800px"
|
|
||||||
align-center
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
destroy-on-close
|
|
||||||
@update:model-value="$emit('update:visible', $event)"
|
|
||||||
@closed="handleClosed"
|
|
||||||
>
|
|
||||||
<div class="player-wrapper">
|
|
||||||
<!-- 加载中 -->
|
|
||||||
<div v-if="loading" class="player-overlay">
|
|
||||||
<el-icon class="is-loading" size="32"><Loading /></el-icon>
|
|
||||||
<span>加载中…</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 播放错误 -->
|
|
||||||
<div v-else-if="errorMsg" class="player-overlay">
|
|
||||||
<el-icon size="32"><WarningFilled /></el-icon>
|
|
||||||
<span class="error-text">{{ errorMsg }}</span>
|
|
||||||
<el-button size="small" type="primary" @click="retry">重试</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 视频播放器 -->
|
|
||||||
<video
|
|
||||||
v-show="!loading && !errorMsg"
|
|
||||||
ref="videoRef"
|
|
||||||
class="video-element"
|
|
||||||
:src="video?.video_url"
|
|
||||||
controls
|
|
||||||
autoplay
|
|
||||||
@loadeddata="loading = false"
|
|
||||||
@error="handleVideoError"
|
|
||||||
@ended="handleEnded"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 视频信息 -->
|
|
||||||
<div v-if="video" class="video-info-bar">
|
|
||||||
<span v-if="video.camera_id">摄像头ID: {{ video.camera_id }}</span>
|
|
||||||
<span v-if="video.camera_name && video.camera_id" class="info-divider">|</span>
|
|
||||||
<span v-if="video.camera_name">{{ video.camera_name }}</span>
|
|
||||||
<span class="info-divider">|</span>
|
|
||||||
<span>录像ID: {{ video.id }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<el-button size="small" @click="$emit('update:visible', false)">关闭</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, watch, nextTick } from 'vue'
|
|
||||||
import { Loading, WarningFilled } from '@element-plus/icons-vue'
|
|
||||||
import type { VideoItem } from './VideoButton.vue'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
visible: boolean
|
|
||||||
video: VideoItem | null
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
'update:visible': [value: boolean]
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const videoRef = ref<HTMLVideoElement | null>(null)
|
|
||||||
const loading = ref(true)
|
|
||||||
const errorMsg = ref('')
|
|
||||||
|
|
||||||
// 打开时重置状态
|
|
||||||
watch(() => props.visible, (val) => {
|
|
||||||
if (val) {
|
|
||||||
loading.value = true
|
|
||||||
errorMsg.value = ''
|
|
||||||
nextTick(() => {
|
|
||||||
if (videoRef.value) {
|
|
||||||
videoRef.value.load()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function handleVideoError(e: Event) {
|
|
||||||
loading.value = false
|
|
||||||
const el = e.target as HTMLVideoElement
|
|
||||||
const code = el?.error?.code
|
|
||||||
const msgMap: Record<number, string> = {
|
|
||||||
1: '视频加载被中止',
|
|
||||||
2: '网络错误,无法加载视频',
|
|
||||||
3: '视频解码失败',
|
|
||||||
4: '视频格式不支持或文件不存在'
|
|
||||||
}
|
|
||||||
errorMsg.value = msgMap[code ?? 4] || '视频播放失败'
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleEnded() {
|
|
||||||
// 播放结束
|
|
||||||
}
|
|
||||||
|
|
||||||
function retry() {
|
|
||||||
loading.value = true
|
|
||||||
errorMsg.value = ''
|
|
||||||
nextTick(() => {
|
|
||||||
if (videoRef.value) {
|
|
||||||
videoRef.value.load()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleClosed() {
|
|
||||||
if (videoRef.value) {
|
|
||||||
videoRef.value.pause()
|
|
||||||
videoRef.value.removeAttribute('src')
|
|
||||||
videoRef.value.load()
|
|
||||||
}
|
|
||||||
loading.value = true
|
|
||||||
errorMsg.value = ''
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.player-wrapper {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 360px;
|
|
||||||
background: #000;
|
|
||||||
border-radius: 6px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-element {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
min-height: 360px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.player-overlay {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 8px;
|
|
||||||
color: #909399;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-text {
|
|
||||||
color: #f56c6c;
|
|
||||||
max-width: 300px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-info-bar {
|
|
||||||
margin-top: 10px;
|
|
||||||
padding: 6px 0;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #909399;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-divider {
|
|
||||||
color: #dcdfe6;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,550 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="packingflow-container">
|
|
||||||
<scan-box
|
|
||||||
ref="scanBox"
|
|
||||||
width="250px"
|
|
||||||
title="打包筛选"
|
|
||||||
:available-fields="availableFields"
|
|
||||||
@condition-change="handleConditionChange"
|
|
||||||
@reset="handleReset"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class="main-content">
|
|
||||||
<div class="toolbar">
|
|
||||||
<div class="toolbar-left">
|
|
||||||
<el-button size="small" @click="loadData">
|
|
||||||
<el-icon><Refresh /></el-icon> 刷新
|
|
||||||
</el-button>
|
|
||||||
<el-button size="small" plain @click="tableRef?.openColumnConfig?.()">字段设置</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="toolbar-right">
|
|
||||||
<WarehouseSelect
|
|
||||||
v-model="queryForm.warehouse_id"
|
|
||||||
width="200px"
|
|
||||||
style="margin-right: 8px"
|
|
||||||
@change="handleWarehouseChange"
|
|
||||||
/>
|
|
||||||
<el-input
|
|
||||||
v-model="queryForm.quickWhere"
|
|
||||||
placeholder="搜索运单号/波次号"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 220px"
|
|
||||||
@keyup.enter="handleSearch"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<el-icon><Search /></el-icon>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 上下分栏 -->
|
|
||||||
<div class="split-stack" ref="splitStackRef">
|
|
||||||
<div class="upper-wrapper" :style="upperPaneStyle">
|
|
||||||
<upper-table
|
|
||||||
ref="tableRef"
|
|
||||||
default-align="center"
|
|
||||||
:enable-column-config="true"
|
|
||||||
table-id="packingflow-list"
|
|
||||||
:data="list"
|
|
||||||
:columns="columns"
|
|
||||||
:loading="loading"
|
|
||||||
:pagination="pagination"
|
|
||||||
@current-change="handleRowClick"
|
|
||||||
@page-change="handlePageChange"
|
|
||||||
@page-size-change="handleSizeChange"
|
|
||||||
@sort-change="handleSortChange"
|
|
||||||
>
|
|
||||||
<template #column-id="{ row }">
|
|
||||||
<span>{{ row.id ?? '—' }}</span>
|
|
||||||
</template>
|
|
||||||
<template #column-status="{ row }">
|
|
||||||
<el-tag :type="statusTagType(row.status)" size="small">
|
|
||||||
{{ statusLabel(row.status) }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
<template #column-pack_mode="{ row }">
|
|
||||||
<el-tag :type="row.pack_mode === 2 ? 'warning' : 'info'" size="small">
|
|
||||||
{{ row.pack_mode === 2 ? '团购' : '散单' }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
<template #column-videos="{ row }">
|
|
||||||
<VideoButton :videos="row.videos || []" @click="openVideoList(row)" />
|
|
||||||
</template>
|
|
||||||
<template #column-actions="{ row }">
|
|
||||||
<el-button link type="primary" size="small" @click.stop="openDetail(row)">详情</el-button>
|
|
||||||
</template>
|
|
||||||
<template #empty>
|
|
||||||
<el-empty description="暂无打包任务数据" :image-size="60" />
|
|
||||||
</template>
|
|
||||||
</upper-table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分隔条 -->
|
|
||||||
<div
|
|
||||||
class="pane-resizer"
|
|
||||||
title="拖动调整列表与详情区域高度"
|
|
||||||
@mousedown="beginSplitDrag"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 详情面板 -->
|
|
||||||
<div class="lower-level" v-if="selectedRow" :style="lowerPaneStyle">
|
|
||||||
<div class="detail-header">
|
|
||||||
<span class="detail-title">任务详情 #{{ selectedRow.id }}</span>
|
|
||||||
<el-button link type="primary" size="small" @click="selectedRow = null">收起</el-button>
|
|
||||||
</div>
|
|
||||||
<div class="detail-container" v-loading="detailLoading">
|
|
||||||
<el-descriptions :column="2" border size="small">
|
|
||||||
<el-descriptions-item label="任务ID">{{ detail.id ?? '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="订单ID">{{ detail.order_id ?? '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="波次号">{{ detail.wave_no || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="运单号">
|
|
||||||
<template v-if="detail.expresses && detail.expresses.length">
|
|
||||||
<el-tag v-for="(exp, i) in detail.expresses" :key="i" size="small" style="margin-right:4px;margin-bottom:2px">{{ exp.waybill_code }}</el-tag>
|
|
||||||
</template>
|
|
||||||
<span v-else>—</span>
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="打包员">{{ detail.operator_text || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="工作台">{{ detail.workbench_name || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="打包数量">{{ detail.pack_quantity ?? '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="打包模式">
|
|
||||||
<el-tag :type="detail.pack_mode === 2 ? 'warning' : 'info'" size="small">
|
|
||||||
{{ detail.pack_mode === 2 ? '团购' : '散单' }}
|
|
||||||
</el-tag>
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="任务状态">
|
|
||||||
<el-tag :type="statusTagType(detail.status)" size="small">
|
|
||||||
{{ statusLabel(detail.status) }}
|
|
||||||
</el-tag>
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="快递信息" :span="2">
|
|
||||||
<template v-if="detail.expresses && detail.expresses.length">
|
|
||||||
<div v-for="(exp, i) in detail.expresses" :key="i" class="express-row">
|
|
||||||
<span>运单号:<b>{{ exp.waybill_code }}</b></span>
|
|
||||||
<span v-if="exp.logistics_interface_name">接口:{{ exp.logistics_interface_name }}</span>
|
|
||||||
<span v-if="exp.platform_code">平台:{{ exp.platform_code }}</span>
|
|
||||||
<el-tag size="small" :type="exp.status === 1 ? 'success' : 'info'">
|
|
||||||
{{ exp.status === 1 ? '已发货' : '未发货' }}
|
|
||||||
</el-tag>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<span v-else>—</span>
|
|
||||||
</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="开始时间">{{ detail.start_time || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="结束时间">{{ detail.end_time || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="创建时间">{{ detail.create_time || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="更新时间">{{ detail.update_time || '—' }}</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 未选中时占位 -->
|
|
||||||
<div class="lower-level empty" v-else :style="lowerPaneStyle">
|
|
||||||
<el-empty description="点击表格行查看详情" :image-size="60" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 录像列表弹窗 -->
|
|
||||||
<VideoListDialog
|
|
||||||
v-model:visible="videoListVisible"
|
|
||||||
:videos="currentVideos"
|
|
||||||
@play="handlePlayVideo"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 录像播放弹窗 -->
|
|
||||||
<VideoPlayerDialog
|
|
||||||
v-model:visible="playerVisible"
|
|
||||||
:video="playingVideo"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { packingList, packingGet, type PackingTaskItem, type PackingListSort } from '@/api/order/packing/index'
|
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
|
||||||
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
|
||||||
import VideoButton, { type VideoItem } from './components/VideoButton.vue'
|
|
||||||
import VideoListDialog from './components/VideoListDialog.vue'
|
|
||||||
import VideoPlayerDialog from './components/VideoPlayerDialog.vue'
|
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
|
||||||
|
|
||||||
// ─── 列配置 ─────────────────────────────────────────────────────────────────
|
|
||||||
const columns = [
|
|
||||||
{ prop: 'id', label: '任务ID', width: 90 },
|
|
||||||
{ prop: 'order_id', label: '订单ID', width: 100 },
|
|
||||||
{ prop: 'waybill_code', label: '扫描运单号', minWidth: 160, formatter: (row: any) => getWaybill(row) || '—' },
|
|
||||||
{ prop: 'wave_no', label: '波次号', minWidth: 140 },
|
|
||||||
{ prop: 'operator_text', label: '打包员', width: 100 },
|
|
||||||
{ prop: 'workbench_info', label: '工作台', width: 120, formatter: (row: any) => row.workbench_name || '—' },
|
|
||||||
{ prop: 'pack_quantity', label: '打包数量', width: 100, sortable: true },
|
|
||||||
{ prop: 'pack_mode', label: '打包模式', width: 100 },
|
|
||||||
{ 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: '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: 'videos', label: '录像', width: 110, fixed: 'right' },
|
|
||||||
{ prop: 'actions', label: '操作', width: 80, fixed: 'right' }
|
|
||||||
]
|
|
||||||
|
|
||||||
// ─── 筛选字段配置 ──────────────────────────────────────────────────────────
|
|
||||||
const availableFields = [
|
|
||||||
{
|
|
||||||
label: '任务状态',
|
|
||||||
value: 'status',
|
|
||||||
type: 'select',
|
|
||||||
options: [
|
|
||||||
{ label: '全部', value: undefined },
|
|
||||||
{ label: '待处理', value: 0 },
|
|
||||||
{ label: '打包中', value: 1 },
|
|
||||||
{ label: '已完成', value: 2 },
|
|
||||||
{ label: '异常', value: 3 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '打包模式',
|
|
||||||
value: 'pack_mode',
|
|
||||||
type: 'select',
|
|
||||||
options: [
|
|
||||||
{ label: '全部', value: undefined },
|
|
||||||
{ label: '散单', value: 1 },
|
|
||||||
{ label: '团购', value: 2 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '运单号',
|
|
||||||
value: 'waybill_code',
|
|
||||||
type: 'text'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '波次号',
|
|
||||||
value: 'wave_no',
|
|
||||||
type: 'text'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '订单ID',
|
|
||||||
value: 'order_id',
|
|
||||||
type: 'text'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '工作台ID',
|
|
||||||
value: 'workbench_id',
|
|
||||||
type: 'text'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
// ─── 状态映射 ──────────────────────────────────────────────────────────────
|
|
||||||
const statusMap: Record<number, string> = {
|
|
||||||
0: '待处理',
|
|
||||||
1: '打包中',
|
|
||||||
2: '已完成',
|
|
||||||
3: '异常'
|
|
||||||
}
|
|
||||||
|
|
||||||
function statusLabel(status: any): string {
|
|
||||||
const s = Number(status)
|
|
||||||
return statusMap[s] ?? '—'
|
|
||||||
}
|
|
||||||
|
|
||||||
function statusTagType(status: any): 'info' | 'warning' | 'success' | 'danger' {
|
|
||||||
const s = Number(status)
|
|
||||||
if (s === 0) return 'info'
|
|
||||||
if (s === 1) return 'warning'
|
|
||||||
if (s === 2) return 'success'
|
|
||||||
if (s === 3) return 'danger'
|
|
||||||
return 'info'
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 从 expresses 数组提取运单号,兜底取顶层 waybill_code */
|
|
||||||
function getWaybill(row: any): string {
|
|
||||||
if (row.expresses && row.expresses.length) {
|
|
||||||
return row.expresses.map((e: any) => e.waybill_code).filter(Boolean).join(',')
|
|
||||||
}
|
|
||||||
return row.waybill_code || ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 响应式状态 ────────────────────────────────────────────────────────────
|
|
||||||
const scanBox = ref()
|
|
||||||
const tableRef = ref()
|
|
||||||
const loading = ref(false)
|
|
||||||
const list = ref<PackingTaskItem[]>([])
|
|
||||||
const pagination = reactive({
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
total: 0
|
|
||||||
})
|
|
||||||
|
|
||||||
const queryForm = reactive({
|
|
||||||
warehouse_id: '' as string | number,
|
|
||||||
quickWhere: ''
|
|
||||||
})
|
|
||||||
|
|
||||||
const whereConditions = ref<Record<string, any>>({})
|
|
||||||
|
|
||||||
// ─── 数据加载 ──────────────────────────────────────────────────────────────
|
|
||||||
async function loadData() {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const where: Record<string, any> = { ...whereConditions.value }
|
|
||||||
if (queryForm.quickWhere) {
|
|
||||||
where.quickWhere = queryForm.quickWhere
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await packingList({
|
|
||||||
warehouse_id: queryForm.warehouse_id || undefined,
|
|
||||||
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
|
||||||
where,
|
|
||||||
sort: sortState.value
|
|
||||||
})
|
|
||||||
|
|
||||||
const codeOk = [200, 20000, 1, 0].includes(res.code)
|
|
||||||
if (!codeOk) {
|
|
||||||
ElMessage.error(res.message || '查询失败')
|
|
||||||
list.value = []
|
|
||||||
pagination.total = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
list.value = res.data?.list ?? []
|
|
||||||
pagination.total = res.data?.pagination?.total ?? 0
|
|
||||||
} catch (e: any) {
|
|
||||||
ElMessage.error(e?.message || '查询异常')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 排序状态 ──────────────────────────────────────────────────────────────
|
|
||||||
const sortState = ref<PackingListSort>({
|
|
||||||
sortField: 'create_time',
|
|
||||||
sortOrder: 'DESC'
|
|
||||||
})
|
|
||||||
|
|
||||||
function handleSortChange(sort: { prop: string; order: string }) {
|
|
||||||
if (!sort.order) {
|
|
||||||
sortState.value = { sortField: 'create_time', sortOrder: 'DESC' }
|
|
||||||
} else {
|
|
||||||
sortState.value = {
|
|
||||||
sortField: sort.prop,
|
|
||||||
sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 分页 ──────────────────────────────────────────────────────────────────
|
|
||||||
function handlePageChange(page: number) {
|
|
||||||
pagination.currentPage = page
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSizeChange(size: number) {
|
|
||||||
pagination.pageSize = size
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 筛选 ──────────────────────────────────────────────────────────────────
|
|
||||||
function handleConditionChange(conditions: Record<string, any>) {
|
|
||||||
whereConditions.value = { ...conditions }
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleReset() {
|
|
||||||
whereConditions.value = {}
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleWarehouseChange() {
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSearch() {
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 上下分栏拖动 ──────────────────────────────────────────────────────────
|
|
||||||
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
|
||||||
defaultLowerPercent: 35,
|
|
||||||
minLowerPercent: 15,
|
|
||||||
maxLowerPercent: 70
|
|
||||||
})
|
|
||||||
|
|
||||||
// ─── 详情面板 ──────────────────────────────────────────────────────────────
|
|
||||||
const selectedRow = ref<PackingTaskItem | null>(null)
|
|
||||||
const detailLoading = ref(false)
|
|
||||||
const detail = ref<PackingTaskItem>({})
|
|
||||||
|
|
||||||
function handleRowClick(row: PackingTaskItem) {
|
|
||||||
selectedRow.value = row
|
|
||||||
loadDetail(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function openDetail(row: PackingTaskItem) {
|
|
||||||
selectedRow.value = row
|
|
||||||
loadDetail(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadDetail(row: PackingTaskItem) {
|
|
||||||
detailLoading.value = true
|
|
||||||
try {
|
|
||||||
const res = await packingGet(Number(row.id))
|
|
||||||
const codeOk = [200, 20000, 1, 0].includes(res.code)
|
|
||||||
if (!codeOk) {
|
|
||||||
ElMessage.error(res.message || '获取详情失败')
|
|
||||||
detail.value = row
|
|
||||||
return
|
|
||||||
}
|
|
||||||
detail.value = res.data ?? row
|
|
||||||
} catch (e: any) {
|
|
||||||
ElMessage.error(e?.message || '获取详情异常')
|
|
||||||
detail.value = row
|
|
||||||
} finally {
|
|
||||||
detailLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 录像相关 ──────────────────────────────────────────────────────────────
|
|
||||||
const videoListVisible = ref(false)
|
|
||||||
const playerVisible = ref(false)
|
|
||||||
const currentVideos = ref<VideoItem[]>([])
|
|
||||||
const playingVideo = ref<VideoItem | null>(null)
|
|
||||||
|
|
||||||
function openVideoList(row: PackingTaskItem) {
|
|
||||||
currentVideos.value = (row.videos as VideoItem[]) || []
|
|
||||||
if (currentVideos.value.length === 0) return
|
|
||||||
videoListVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function handlePlayVideo(video: VideoItem) {
|
|
||||||
videoListVisible.value = false
|
|
||||||
playingVideo.value = video
|
|
||||||
playerVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
|
||||||
onMounted(() => {
|
|
||||||
loadData()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.packingflow-container {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 0 12px 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toolbar {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 8px 0;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toolbar-left,
|
|
||||||
.toolbar-right {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ─── 上下分栏 ──────────────────────────────────────────────────────────── */
|
|
||||||
.split-stack {
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upper-wrapper {
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 确保 UpperTable 填满 upper-wrapper */
|
|
||||||
.upper-wrapper :deep(.upper-table-container) {
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pane-resizer {
|
|
||||||
flex: 0 0 6px;
|
|
||||||
min-height: 6px;
|
|
||||||
background: #e4e7ed;
|
|
||||||
cursor: row-resize;
|
|
||||||
flex-shrink: 0;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pane-resizer:hover {
|
|
||||||
background: #dcdfe6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ─── 详情面板 ──────────────────────────────────────────────────────────── */
|
|
||||||
.lower-level {
|
|
||||||
border: 1px solid #ebeef5;
|
|
||||||
border-radius: 4px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lower-level.empty {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: 8px 12px;
|
|
||||||
border-bottom: 1px solid #ebeef5;
|
|
||||||
flex-shrink: 0;
|
|
||||||
background: #fafafa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-title {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-container {
|
|
||||||
padding: 12px;
|
|
||||||
overflow: auto;
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.express-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
padding: 2px 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -183,37 +183,9 @@
|
|||||||
<div class="detail-container">
|
<div class="detail-container">
|
||||||
<div v-if="activeTab === 'balanceLogs'" class="balance-log-panel store-detail-pane">
|
<div v-if="activeTab === 'balanceLogs'" class="balance-log-panel store-detail-pane">
|
||||||
<div class="balance-log-toolbar">
|
<div class="balance-log-toolbar">
|
||||||
<div class="balance-log-toolbar__left">
|
|
||||||
<el-button size="small" @click="loadBalanceLogs">刷新</el-button>
|
<el-button size="small" @click="loadBalanceLogs">刷新</el-button>
|
||||||
<el-select
|
<div class="balance-log-toolbar__meta">
|
||||||
v-model="balanceLogFilter"
|
<span>变动记录:{{ balanceLogPagination.total }}</span>
|
||||||
size="small"
|
|
||||||
placeholder="流水类型"
|
|
||||||
style="width: 130px"
|
|
||||||
clearable
|
|
||||||
@change="handleBalanceLogFilterChange"
|
|
||||||
>
|
|
||||||
<el-option label="充值" value="recharge" />
|
|
||||||
<el-option label="消费" value="consumption" />
|
|
||||||
</el-select>
|
|
||||||
<el-date-picker
|
|
||||||
v-model="balanceLogDateRange"
|
|
||||||
type="datetimerange"
|
|
||||||
size="small"
|
|
||||||
range-separator="至"
|
|
||||||
start-placeholder="开始时间"
|
|
||||||
end-placeholder="结束时间"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
style="width: 380px"
|
|
||||||
@change="handleBalanceLogFilterChange"
|
|
||||||
/>
|
|
||||||
<el-button
|
|
||||||
v-if="hasPermission('storeWarehouse.store.exportPrintQuantityLogs')"
|
|
||||||
size="small"
|
|
||||||
type="primary"
|
|
||||||
:loading="exportLoading"
|
|
||||||
@click="handleExportBalanceLogs"
|
|
||||||
>导出</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
@ -248,12 +220,12 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="变动类型" min-width="120">
|
<el-table-column label="变动类型" min-width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.change_type_label || getBalanceLogChangeType(row) || '—' }}
|
{{ getBalanceLogChangeType(row) || '—' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="业务类型" min-width="120">
|
<el-table-column label="业务类型" min-width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.business_type_label || getBalanceLogBusinessType(row) || '—' }}
|
{{ getBalanceLogBusinessType(row) || '—' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="业务ID" min-width="100" align="right">
|
<el-table-column label="业务ID" min-width="100" align="right">
|
||||||
@ -926,21 +898,6 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 余额变动导出进度弹窗 -->
|
|
||||||
<AsyncExportProgressDialog
|
|
||||||
: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"
|
|
||||||
@update:visible="exportDialogVisible = $event"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -952,9 +909,7 @@ import { storeWarehouseList, storeWarehouseUnbind,
|
|||||||
storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields,
|
storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields,
|
||||||
storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig,
|
storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig,
|
||||||
storeWarehouseAdjustPrintQuantity, storeWarehouseQueryPrintQuantityLogs, listApiConfig,
|
storeWarehouseAdjustPrintQuantity, storeWarehouseQueryPrintQuantityLogs, listApiConfig,
|
||||||
storeWarehouseOpenAccount, storeWarehouseConfirmSign,
|
storeWarehouseOpenAccount, storeWarehouseConfirmSign
|
||||||
storeWarehouseExportPrintQuantityLogs,
|
|
||||||
storeWarehouseExportPrintQuantityLogsTaskProgress
|
|
||||||
} from '@/api/storewarehouse.store/storeWarehouse'
|
} from '@/api/storewarehouse.store/storeWarehouse'
|
||||||
import { listInterfaceTypes, getExpressList, getPlatformList, getQimenAppList } from '@/api/index/index'
|
import { listInterfaceTypes, getExpressList, getPlatformList, getQimenAppList } from '@/api/index/index'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
@ -964,17 +919,12 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
|
|||||||
import Detail from './component/detail.vue'
|
import Detail from './component/detail.vue'
|
||||||
import Log from './component/log.vue'
|
import Log from './component/log.vue'
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
import { useUserStore } from '@/stores/modules/user'
|
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
|
||||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
|
||||||
import { safeInvoke } from '@/utils/safe-invoke'
|
import { safeInvoke } from '@/utils/safe-invoke'
|
||||||
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, qimenFormDefault, qimenFormItems, qimenTableColumns, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems, storeToolbarButtons } from './store-config.ts'
|
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, qimenFormDefault, qimenFormItems, qimenTableColumns, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems, storeToolbarButtons } from './store-config.ts'
|
||||||
|
|
||||||
// ─── 列表 ───────────────────────────────────────────────────────────────────
|
// ─── 列表 ───────────────────────────────────────────────────────────────────
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
const userStore = useUserStore()
|
|
||||||
const hasPermission = (perm: string) => userStore.checkPermission(perm)
|
|
||||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||||||
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
|
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
|
||||||
|
|
||||||
@ -1014,63 +964,6 @@ const balanceLogPagination = reactive({
|
|||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 余额变动筛选:''=无, 'recharge'=充值(增加), 'consumption'=消费(减少) */
|
|
||||||
const balanceLogFilter = ref('')
|
|
||||||
|
|
||||||
/** 余额变动时间范围筛选 */
|
|
||||||
const balanceLogDateRange = ref<string[] | null>(null)
|
|
||||||
|
|
||||||
function handleBalanceLogFilterChange() {
|
|
||||||
balanceLogPagination.currentPage = 1
|
|
||||||
void loadBalanceLogs()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 余额变动导出 ────────────────────────────────────────────────────────────
|
|
||||||
function buildBalanceLogExportPayload() {
|
|
||||||
const storeId = selectedStoreId.value
|
|
||||||
if (storeId === undefined || storeId === null) return null
|
|
||||||
const whereFilter: Record<string, any> = {}
|
|
||||||
if (balanceLogFilter.value === 'recharge') {
|
|
||||||
whereFilter.change_quantity = { operator: 'gt', value: 0 }
|
|
||||||
} else if (balanceLogFilter.value === 'consumption') {
|
|
||||||
whereFilter.change_quantity = { operator: 'lt', value: 0 }
|
|
||||||
}
|
|
||||||
if (balanceLogDateRange.value && balanceLogDateRange.value.length === 2) {
|
|
||||||
whereFilter.created_at = {
|
|
||||||
operator: 'between',
|
|
||||||
value: balanceLogDateRange.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const payload: Record<string, any> = { store_id: storeId }
|
|
||||||
if (Object.keys(whereFilter).length > 0) {
|
|
||||||
payload.where = whereFilter
|
|
||||||
}
|
|
||||||
return payload
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
|
||||||
exportLoading,
|
|
||||||
exportDialogVisible,
|
|
||||||
exportTaskProgress,
|
|
||||||
exportProgressPercent,
|
|
||||||
exportProgressStatus,
|
|
||||||
exportStatusLabel,
|
|
||||||
submitExportTaskWithMode
|
|
||||||
} = useAsyncExportTask({
|
|
||||||
storageKey: 'store:stores:balanceLogExportTaskId',
|
|
||||||
submitExport: (payload) => storeWarehouseExportPrintQuantityLogs(payload as any),
|
|
||||||
queryProgress: (params) => storeWarehouseExportPrintQuantityLogsTaskProgress(params as any)
|
|
||||||
})
|
|
||||||
|
|
||||||
async function handleExportBalanceLogs() {
|
|
||||||
const payload = buildBalanceLogExportPayload()
|
|
||||||
if (!payload) {
|
|
||||||
ElMessage.warning('请先选择一个货主')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
await submitExportTaskWithMode(payload, undefined)
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedStoreId = computed<number | string | undefined>(() => {
|
const selectedStoreId = computed<number | string | undefined>(() => {
|
||||||
return resolveStoreIdFromRow(selectedRow.value)
|
return resolveStoreIdFromRow(selectedRow.value)
|
||||||
})
|
})
|
||||||
@ -1370,39 +1263,13 @@ async function loadBalanceLogs() {
|
|||||||
|
|
||||||
balanceLogLoading.value = true
|
balanceLogLoading.value = true
|
||||||
try {
|
try {
|
||||||
// 构建 where 筛选条件
|
const res = (await storeWarehouseQueryPrintQuantityLogs({
|
||||||
const whereFilter: Record<string, any> = {}
|
|
||||||
if (balanceLogFilter.value === 'recharge') {
|
|
||||||
// 充值:change_quantity > 0
|
|
||||||
whereFilter.change_quantity = { operator: 'gt', value: 0 }
|
|
||||||
} else if (balanceLogFilter.value === 'consumption') {
|
|
||||||
// 消费:change_quantity < 0
|
|
||||||
whereFilter.change_quantity = { operator: 'lt', value: 0 }
|
|
||||||
}
|
|
||||||
// 时间范围筛选
|
|
||||||
if (balanceLogDateRange.value && balanceLogDateRange.value.length === 2) {
|
|
||||||
whereFilter.created_at = {
|
|
||||||
operator: 'between',
|
|
||||||
value: balanceLogDateRange.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const requestData: {
|
|
||||||
store_id: number | string
|
|
||||||
pagination: { page: number; page_size: number }
|
|
||||||
where?: Record<string, any>
|
|
||||||
} = {
|
|
||||||
store_id: storeId,
|
store_id: storeId,
|
||||||
pagination: {
|
pagination: {
|
||||||
page: balanceLogPagination.currentPage,
|
page: balanceLogPagination.currentPage,
|
||||||
page_size: balanceLogPagination.pageSize
|
page_size: balanceLogPagination.pageSize
|
||||||
}
|
}
|
||||||
}
|
})) as any
|
||||||
if (Object.keys(whereFilter).length > 0) {
|
|
||||||
requestData.where = whereFilter
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = (await storeWarehouseQueryPrintQuantityLogs(requestData)) as any
|
|
||||||
|
|
||||||
const payload = res?.data || {}
|
const payload = res?.data || {}
|
||||||
const nested = payload?.data && typeof payload.data === 'object' ? payload.data : null
|
const nested = payload?.data && typeof payload.data === 'object' ? payload.data : null
|
||||||
@ -2433,12 +2300,6 @@ onMounted(loadList)
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
|
||||||
&__left {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__meta {
|
&__meta {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
gap: 14px;
|
gap: 14px;
|
||||||
|
|||||||
@ -65,10 +65,9 @@
|
|||||||
<!-- 新增/编辑弹窗 -->
|
<!-- 新增/编辑弹窗 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="dialogVisible"
|
v-model="dialogVisible"
|
||||||
:title="formData.id ? '编辑摄像头' : '新增摄像头'"
|
:title="dialogMode === 'create' ? '新增摄像头' : '编辑摄像头'"
|
||||||
width="560px"
|
width="560px"
|
||||||
align-center
|
align-center
|
||||||
z-index="2500"
|
|
||||||
@close="resetForm"
|
@close="resetForm"
|
||||||
>
|
>
|
||||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
||||||
@ -270,7 +269,6 @@ const availableFields = [
|
|||||||
const presetTree = ref<any[]>([])
|
const presetTree = ref<any[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
const isEditingMode = ref(false)
|
|
||||||
const tableData = ref<CameraRecord[]>([])
|
const tableData = ref<CameraRecord[]>([])
|
||||||
const serverOptions = ref<ServerOption[]>([])
|
const serverOptions = ref<ServerOption[]>([])
|
||||||
/** 服务器完整信息映射(用于连通通道拉取) */
|
/** 服务器完整信息映射(用于连通通道拉取) */
|
||||||
@ -542,8 +540,6 @@ function handleChannelSelect(value: number) {
|
|||||||
|
|
||||||
watch(() => formData.server_id, (newId, oldId) => {
|
watch(() => formData.server_id, (newId, oldId) => {
|
||||||
if (newId && newId !== oldId) {
|
if (newId && newId !== oldId) {
|
||||||
// 编辑模式下不自动清空字段,由 openEdit 手动填充
|
|
||||||
if (!isEditingMode.value) {
|
|
||||||
formData.channel_id = undefined
|
formData.channel_id = undefined
|
||||||
formData.channel_name = ''
|
formData.channel_name = ''
|
||||||
formData.ip = ''
|
formData.ip = ''
|
||||||
@ -554,7 +550,6 @@ watch(() => formData.server_id, (newId, oldId) => {
|
|||||||
channelOptions.value = []
|
channelOptions.value = []
|
||||||
selectedServerNeedsPassword.value = false
|
selectedServerNeedsPassword.value = false
|
||||||
serverPassword.value = ''
|
serverPassword.value = ''
|
||||||
}
|
|
||||||
fetchChannelList()
|
fetchChannelList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -613,8 +608,6 @@ function openEdit(row: CameraRecord) {
|
|||||||
if (!row.id) return
|
if (!row.id) return
|
||||||
dialogMode.value = 'edit'
|
dialogMode.value = 'edit'
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
// 标记编辑模式,防止 watch 清空已填充的字段
|
|
||||||
isEditingMode.value = true
|
|
||||||
formData.id = row.id
|
formData.id = row.id
|
||||||
formData.server_id = row.server_id
|
formData.server_id = row.server_id
|
||||||
formData.channel_id = row.channel_id
|
formData.channel_id = row.channel_id
|
||||||
@ -630,8 +623,9 @@ function openEdit(row: CameraRecord) {
|
|||||||
serverPassword.value = ''
|
serverPassword.value = ''
|
||||||
selectedServerNeedsPassword.value = false
|
selectedServerNeedsPassword.value = false
|
||||||
formRef.value?.clearValidate()
|
formRef.value?.clearValidate()
|
||||||
// 延迟解除编辑标记,确保 watch 回调(pre-flush)执行完毕
|
if (row.server_id) {
|
||||||
setTimeout(() => { isEditingMode.value = false }, 0)
|
fetchChannelList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitForm() {
|
async function submitForm() {
|
||||||
@ -641,7 +635,7 @@ async function submitForm() {
|
|||||||
|
|
||||||
saving.value = true
|
saving.value = true
|
||||||
try {
|
try {
|
||||||
if (!formData.id) {
|
if (dialogMode.value === 'create') {
|
||||||
const res: any = await create({
|
const res: any = await create({
|
||||||
server_id: formData.server_id!,
|
server_id: formData.server_id!,
|
||||||
channel_id: formData.channel_id!,
|
channel_id: formData.channel_id!,
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, watch, type Component } from 'vue'
|
import { ref, reactive, type Component } from 'vue'
|
||||||
import { ElMessageBox } from 'element-plus'
|
import { ElMessageBox } from 'element-plus'
|
||||||
import { COMPONENT_REGISTRY } from '../config/template-config'
|
import { COMPONENT_REGISTRY } from '../config/template-config'
|
||||||
import type { OperationButtonConfig } from '../config/template-config'
|
import type { OperationButtonConfig } from '../config/template-config'
|
||||||
@ -70,14 +70,6 @@ const props = defineProps<{
|
|||||||
row: Record<string, any>
|
row: Record<string, any>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// 用 watch 捕获行数据的最新值,解决 slot scope 中 row 引用失效的问题
|
|
||||||
const currentRow = ref<Record<string, any>>({})
|
|
||||||
watch(() => props.row, (val) => {
|
|
||||||
if (val && Object.keys(val).length > 0) {
|
|
||||||
currentRow.value = val
|
|
||||||
}
|
|
||||||
}, { immediate: true, deep: true })
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
/** action 按钮点击事件(key: 按钮标识, row: 行数据) */
|
/** action 按钮点击事件(key: 按钮标识, row: 行数据) */
|
||||||
(e: 'operation-action', key: string, row: Record<string, any>): void
|
(e: 'operation-action', key: string, row: Record<string, any>): void
|
||||||
@ -112,7 +104,7 @@ async function handleActionClick(btn: OperationButtonConfig) {
|
|||||||
|
|
||||||
actionLoadingMap[btn.key] = true
|
actionLoadingMap[btn.key] = true
|
||||||
try {
|
try {
|
||||||
emit('operation-action', btn.key, currentRow.value)
|
emit('operation-action', btn.key, props.row)
|
||||||
} finally {
|
} finally {
|
||||||
actionLoadingMap[btn.key] = false
|
actionLoadingMap[btn.key] = false
|
||||||
}
|
}
|
||||||
@ -137,21 +129,25 @@ function openForm(btn: OperationButtonConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildFormProps(btn: OperationButtonConfig): Record<string, any> {
|
function buildFormProps(btn: OperationButtonConfig): Record<string, any> {
|
||||||
const formProps: Record<string, any> = {}
|
const props: Record<string, any> = {}
|
||||||
|
|
||||||
// 使用 watch 捕获的最新行数据
|
// paramMap: { formProp: rowField } → 从行数据取值注入表单
|
||||||
formProps.row = currentRow.value
|
if (btn.paramMap) {
|
||||||
|
for (const [formProp, rowField] of Object.entries(btn.paramMap)) {
|
||||||
|
props[formProp] = props.row[rowField]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// extraParams: 固定参数直接注入
|
// extraParams: 固定参数直接注入
|
||||||
if (btn.extraParams) {
|
if (btn.extraParams) {
|
||||||
Object.assign(formProps, btn.extraParams)
|
Object.assign(props, btn.extraParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
return formProps
|
return props
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFormSuccess(key: string) {
|
function handleFormSuccess(key: string) {
|
||||||
emit('operation-action', key, currentRow.value)
|
emit('operation-action', key, props.row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|||||||
@ -676,7 +676,8 @@ export const tabPages: TabPageRawConfig[] = [
|
|||||||
{
|
{
|
||||||
key: 'edit',
|
key: 'edit',
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
actionType: 'action',
|
actionType: 'form',
|
||||||
|
formKey: 'CameraFormDialog',
|
||||||
type: 'primary'
|
type: 'primary'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -103,21 +103,20 @@
|
|||||||
@sort-change="handleSortChange"
|
@sort-change="handleSortChange"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<!-- 动态列插槽:操作列通过 row['id'] 从 listData 查找完整数据 -->
|
<!-- 动态列插槽:根据 columnSlots 配置自动渲染 -->
|
||||||
<template
|
<template
|
||||||
v-for="(slotConfig, colProp) in currentColumnSlots"
|
v-for="(slotConfig, colProp) in currentColumnSlots"
|
||||||
:key="`columnSlots-${colProp}`"
|
:key="`columnSlots-${colProp}`"
|
||||||
#[`column-${colProp}`]="{ row }"
|
#[`column-${colProp}`]="{ row }"
|
||||||
>
|
>
|
||||||
<!-- 操作列:使用 row['id'](slot scope 内可正常访问单属性)查找数据 -->
|
<!-- 操作列:渲染操作按钮 -->
|
||||||
<template v-if="colProp === 'operation'">
|
<OperationCellRenderer
|
||||||
<div class="operation-cell">
|
v-if="slotConfig.type === 'operation'"
|
||||||
<el-button link type="primary" size="small" @click.stop="openCameraForm('edit', getRowById(row['id']))">编辑</el-button>
|
:buttons="currentTabConfig?.operationButtons"
|
||||||
<el-button link type="danger" size="small" @click.stop="handleDeleteCamera(getRowById(row['id'])!)">删除</el-button>
|
:row="row"
|
||||||
<el-button link type="success" size="small" @click.stop="handlePreview(getRowById(row['id'])!)">预览</el-button>
|
@operation-action="handleOperationAction"
|
||||||
</div>
|
/>
|
||||||
</template>
|
<!-- 其他列:标签/文本渲染 -->
|
||||||
<!-- 其他列 -->
|
|
||||||
<ColumnCellRenderer
|
<ColumnCellRenderer
|
||||||
v-else
|
v-else
|
||||||
:config="slotConfig"
|
:config="slotConfig"
|
||||||
@ -203,13 +202,12 @@
|
|||||||
:key="`columnSlots-${colProp}`"
|
:key="`columnSlots-${colProp}`"
|
||||||
#[`column-${colProp}`]="{ row }"
|
#[`column-${colProp}`]="{ row }"
|
||||||
>
|
>
|
||||||
<template v-if="colProp === 'operation'">
|
<OperationCellRenderer
|
||||||
<div class="operation-cell">
|
v-if="slotConfig.type === 'operation'"
|
||||||
<el-button link type="primary" size="small" @click.stop="openCameraForm('edit', getRowById(row['id']))">编辑</el-button>
|
:buttons="currentTabConfig?.operationButtons"
|
||||||
<el-button link type="danger" size="small" @click.stop="handleDeleteCamera(getRowById(row['id'])!)">删除</el-button>
|
:row="row"
|
||||||
<el-button link type="success" size="small" @click.stop="handlePreview(getRowById(row['id'])!)">预览</el-button>
|
@operation-action="handleOperationAction"
|
||||||
</div>
|
/>
|
||||||
</template>
|
|
||||||
<ColumnCellRenderer
|
<ColumnCellRenderer
|
||||||
v-else
|
v-else
|
||||||
:config="slotConfig"
|
:config="slotConfig"
|
||||||
@ -449,12 +447,6 @@ function openCameraForm(mode: 'create' | 'edit', row?: Record<string, any>) {
|
|||||||
cameraFormVisible.value = true
|
cameraFormVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 通过 ID 从 listData 中查找完整行数据(解决 slot scope 中 row 引用失效问题) */
|
|
||||||
function getRowById(id: any): Record<string, any> | undefined {
|
|
||||||
if (id === undefined || id === null) return undefined
|
|
||||||
return (listData.value as any[]).find((item: any) => item.id === id)
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleFormSuccess() {
|
function handleFormSuccess() {
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
align-center
|
align-center
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
append-to-body
|
|
||||||
@closed="handleClosed"
|
@closed="handleClosed"
|
||||||
>
|
>
|
||||||
<div class="form-body">
|
<div class="form-body">
|
||||||
@ -164,7 +163,6 @@ type ChannelItem = {
|
|||||||
type ServerOption = { id: number; name: string }
|
type ServerOption = { id: number; name: string }
|
||||||
|
|
||||||
const isEdit = ref(false)
|
const isEdit = ref(false)
|
||||||
const isPopulating = ref(false)
|
|
||||||
|
|
||||||
const formRef = ref<FormInstance>()
|
const formRef = ref<FormInstance>()
|
||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
@ -219,11 +217,8 @@ function resetForm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function populateFromRow(row: Record<string, any>) {
|
function populateFromRow(row: Record<string, any>) {
|
||||||
isPopulating.value = true
|
|
||||||
// 服务器 ID 可能在 row.server.id(关联对象)或 row.server_id(平级字段)
|
|
||||||
const sid = Number(row.server?.id ?? row.server_id)
|
|
||||||
form.id = row.id
|
form.id = row.id
|
||||||
form.server_id = Number.isNaN(sid) ? undefined : sid
|
form.server_id = row.server_id
|
||||||
form.channel_id = row.channel_id
|
form.channel_id = row.channel_id
|
||||||
form.channel_name = row.channel_name || ''
|
form.channel_name = row.channel_name || ''
|
||||||
form.ip = row.ip || ''
|
form.ip = row.ip || ''
|
||||||
@ -234,10 +229,6 @@ function populateFromRow(row: Record<string, any>) {
|
|||||||
form.custom_name = row.custom_name || ''
|
form.custom_name = row.custom_name || ''
|
||||||
form.status = row.status ?? 1
|
form.status = row.status ?? 1
|
||||||
form.remark = row.remark || ''
|
form.remark = row.remark || ''
|
||||||
// 预加载服务器选项,使 el-select 展示名称而非 ID
|
|
||||||
loadServerOptions()
|
|
||||||
// 延迟解除标记,确保 watch 回调(pre-flush)执行完毕
|
|
||||||
setTimeout(() => { isPopulating.value = false }, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听 visible + row 变化来初始化
|
// 监听 visible + row 变化来初始化
|
||||||
@ -262,12 +253,12 @@ async function loadServerOptions() {
|
|||||||
if (!isSuccess(res)) return
|
if (!isSuccess(res)) return
|
||||||
const list = res?.list || []
|
const list = res?.list || []
|
||||||
serverOptions.value = list.map((item: any) => ({
|
serverOptions.value = list.map((item: any) => ({
|
||||||
id: Number(item.id),
|
id: item.id,
|
||||||
name: item.name || `服务器-${item.id}`
|
name: item.name || `服务器-${item.id}`
|
||||||
}))
|
}))
|
||||||
list.forEach((item: any) => {
|
list.forEach((item: any) => {
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
serverDetailMap.value[Number(item.id)] = {
|
serverDetailMap.value[item.id] = {
|
||||||
internal_ip: item.internal_ip,
|
internal_ip: item.internal_ip,
|
||||||
public_ip: item.public_ip,
|
public_ip: item.public_ip,
|
||||||
port: item.port,
|
port: item.port,
|
||||||
@ -381,8 +372,6 @@ function handleChannelSelect(value: number) {
|
|||||||
|
|
||||||
watch(() => form.server_id, (newId, oldId) => {
|
watch(() => form.server_id, (newId, oldId) => {
|
||||||
if (newId && newId !== oldId) {
|
if (newId && newId !== oldId) {
|
||||||
// 编辑模式下由 populateFromRow 手动填充字段,不自动清空
|
|
||||||
if (!isPopulating.value) {
|
|
||||||
form.channel_id = undefined
|
form.channel_id = undefined
|
||||||
form.channel_name = ''
|
form.channel_name = ''
|
||||||
form.ip = ''
|
form.ip = ''
|
||||||
@ -393,7 +382,6 @@ watch(() => form.server_id, (newId, oldId) => {
|
|||||||
channelOptions.value = []
|
channelOptions.value = []
|
||||||
selectedServerNeedsPassword.value = false
|
selectedServerNeedsPassword.value = false
|
||||||
serverPassword.value = ''
|
serverPassword.value = ''
|
||||||
}
|
|
||||||
fetchChannelList()
|
fetchChannelList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user