Compare commits

..

No commits in common. "2054018ddac60b49cd4c191f3162b8197578bfdb" and "e1cbf289eda84a429a878302392366168e6ebeec" have entirely different histories.

44 changed files with 1643 additions and 8220 deletions

View File

@ -1,28 +0,0 @@
import request from '@/utils/request'
const v = "1.0"
export function getdeliveryOrderlist(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'order.deliveryOrder.getdeliveryOrderlist',
v,
timestamp: new Date().getTime()
},
data: data
})
}
// export const getdeliveryOrderDetail = (data: any): Promise<any> => {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'order.deliveryOrder.getdeliveryOrderDetail',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }

View File

@ -1,28 +0,0 @@
import request from '@/utils/request'
const v = "1.0"
export function getEntryList(data:any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.entry.getEntryList',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function getEntryDetail(data:any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.entry.getEntryDetail',
v,
timestamp: new Date().getTime()
},
data: data
})
}

View File

@ -14,7 +14,6 @@ export function getReceivingList(data: any): Promise<any> {
}) })
} }
export function getReceivingDetail(data: any): Promise<any> { export function getReceivingDetail(data: any): Promise<any> {
return request({ return request({
url: '/system', url: '/system',
@ -28,20 +27,6 @@ export function getReceivingDetail(data: any): Promise<any> {
}) })
} }
// 未使用,保留
export function getReceivingProduct(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.getReceivingProduct',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function batchCancelReceiving(data: any): Promise<any> { export function batchCancelReceiving(data: any): Promise<any> {
return request({ return request({
url: '/system', url: '/system',

View File

@ -30,7 +30,6 @@ export function getWarehouseTree(warehouseId:any) {
} as any) } as any)
} }
// 获取子区域,未使用
export function getChildren(zoneId:any) { export function getChildren(zoneId:any) {
return request({ return request({
url: '/system', url: '/system',
@ -101,7 +100,6 @@ export function detail(id:any) {
} as any) } as any)
} }
// 切换激活状态,未使用
export function toggleActive(id:any, isActive:any) { export function toggleActive(id:any, isActive:any) {
return request({ return request({
url: '/system', url: '/system',
@ -116,7 +114,6 @@ export function toggleActive(id:any, isActive:any) {
} as any) } as any)
} }
// 切换激活状态,未使用
export function getPath(id:any) { export function getPath(id:any) {
return request({ return request({
url: '/system', url: '/system',

View File

@ -11,7 +11,6 @@
:current-row-key="currentRowKey" :current-row-key="currentRowKey"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
@row-click="handleRowClick" @row-click="handleRowClick"
@row-contextmenu="handleRowContextMenu"
@sort-change="handleSortChange" @sort-change="handleSortChange"
style="width: 100%" style="width: 100%"
:size="tableSize" :size="tableSize"
@ -275,7 +274,6 @@ const emit = defineEmits([
'current-change', 'current-change',
'selection-change', 'selection-change',
'row-click', 'row-click',
'row-contextmenu',
'sort-change', 'sort-change',
'page-size-change', 'page-size-change',
'page-change', 'page-change',
@ -495,10 +493,6 @@ function handleRowClick(row: any, column: any, event: any) {
} }
} }
function handleRowContextMenu(row: any, column: any, event: any) {
emit('row-contextmenu', row, column, event)
}
function handleSortChange({ column, prop, order }: any) { function handleSortChange({ column, prop, order }: any) {
emit('sort-change', { column, prop, order }) emit('sort-change', { column, prop, order })
} }

View File

@ -36,23 +36,12 @@ router.beforeEach(async (to, from) => {
const permissionStore = usePermissionStore() const permissionStore = usePermissionStore()
// generate accessible routes based on menus // generate accessible routes based on menus
const accessRoutes = await permissionStore.generateRoutes(user.menus || []) const accessRoutes = await permissionStore.generateRoutes(user.menus || [])
// console.log("生成的路由表",accessRoutes);
console.log('从后端获取并转换后的动态路由:', accessRoutes)
console.log('合并后的前端完整路由表 (添加前):', router.getRoutes())
// dynamically add accessible routes // dynamically add accessible routes
accessRoutes.forEach(route => { accessRoutes.forEach(route => {
router.addRoute(route) router.addRoute(route)
}) })
// 打印已添加的动态路由信息与添加后的完整路由表,便于调试
try {
console.log('已添加的动态路由 paths:', accessRoutes.map(r => r.path))
} catch (e) {
console.log('已添加的动态路由 (无法列出 paths):', accessRoutes)
}
console.log('合并后的前端完整路由表 (添加后):', router.getRoutes())
// hack method to ensure that addRoutes is complete // hack method to ensure that addRoutes is complete
// set the replace: true, so the navigation will not leave a history record // set the replace: true, so the navigation will not leave a history record
return { ...to, replace: true } return { ...to, replace: true }

View File

@ -191,23 +191,14 @@ export const transformMenusToRoutes = (menus: any[]) => {
if (menu.component) { if (menu.component) {
if (menu.component === 'Layout') { if (menu.component === 'Layout') {
route.component = Layout route.component = Layout
} else if (typeof menu.component === 'string') { } else if (menu.component.startsWith('@/views/')) {
// 正常情况:字符串类型
if (menu.component.startsWith('@/views/')) {
const componentPath = menu.component.replace('@/views/', '') const componentPath = menu.component.replace('@/views/', '')
route.component = resolveComponent(componentPath) route.component = resolveComponent(componentPath)
} else if (menu.component.startsWith('@/')) { } else if (menu.component.startsWith('@/')) {
const componentPath = menu.component.replace('@/', '') const componentPath = menu.component.replace('@/', '')
route.component = () => import(`@/${componentPath}.vue`) route.component = () => import(`@/${componentPath}.vue`)
} else { } else {
route.component = resolveComponent(menu.component) route.component = () => import(`@/views/${menu.component}.vue`)
}
} else {
// 如果后端传回的 component 是一个带有 __file 等不该出现的打包后的对象
// 通过父子路径拼接去 map 里面找,或者直接截取 path
const fallbackPath = parentName ? `${parentName.toLowerCase()}/${menu.path}` : menu.path;
console.warn(`Invalid component format for path [${menu.path}]. Falling back to use componentMap key: ${fallbackPath}`);
route.component = resolveComponent(fallbackPath);
} }
} else { } else {
if (!menu.children || menu.children.length === 0) { if (!menu.children || menu.children.length === 0) {

View File

@ -11,10 +11,6 @@ export const componentMap: Record<string, any> = {
'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'), 'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'),
'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'), 'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'),
'storage/receiving': () => import('@/views/storage/receiving/index.vue'), 'storage/receiving': () => import('@/views/storage/receiving/index.vue'),
'storage/entry': () => import('@/views/storage/entry/index.vue'),
'storage/entry/index': () => import('@/views/storage/entry/index.vue'),
'storage/stock': () => import('@/views/storage/stock/index.vue'),
//'storage/stock/index': () => import('@/views/storage/stock/index.vue'),
'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'), 'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'),
// 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'), // 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'),
'system/print/station': () => import('@/views/system/setting/printStation/index.vue'), 'system/print/station': () => import('@/views/system/setting/printStation/index.vue'),

View File

@ -79,22 +79,12 @@ service.interceptors.request.use(
// response interceptor // response interceptor
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
// 强制转换为小写键以进行不区分大小写的查找
const headers = response.headers const headers = response.headers
const res = response.data const res = response.data
const authHeader = headers['authorization'] || headers['Authorization'];
// axios 的 headers 对象通常已经处理过大小写,但为了保险起见,检查多种可能的键名 if (authHeader && authHeader.startsWith('Bearer ')) {
const newToken = headers['new-token'] || headers['new-authorization'] || headers['authorization'] || headers['Authorization']; const newToken = authHeader.substring(7)
setToken(newToken)
if (newToken) {
// 提取 Bearer 之后的 token 字符串
const tokenValue = newToken.startsWith('Bearer ') ? newToken.substring(7) : newToken
if (tokenValue && tokenValue !== getToken()) {
console.log('检测到新 Token,正在更新存储...');
setToken(tokenValue)
// 同步更新当前实例的默认请求头,确保后续请求立即生效
service.defaults.headers.common['Authorization'] = `Bearer ${tokenValue}`
}
} }
// 检查业务状态码 // 检查业务状态码

View File

@ -1,235 +0,0 @@
<template>
<div class="order-sub-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
<div class="toolbar-right">
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="归档订单列表"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateField('order_status', row.order_status) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无归档订单</div>
</template>
</upper-table>
</div>
<div class="lower-level" v-if="selectedOrderId" :class="tableSize">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="订单详情" name="details" />
<el-tab-pane label="履约记录" name="fulfillment" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<div v-if="activeTab === 'details'">
<detail :data="selectedRow" :config="archiveOrderDetail" :column="3" />
</div>
<div v-else-if="activeTab === 'fulfillment'">
<p>履约历程加载中...</p>
</div>
<div v-else>
<log :data="selectedRow" />
</div>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else>
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import {
archiveAvailableFields,
orderColumns,
archiveOrderDetail
} from './config/order-common-config'
import detail from './component/detail.vue'
import log from './component/log.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(archiveAvailableFields)))
const activeTab = ref('details')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(orderColumns)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedOrderId = ref<number | string | null>(null)
const quickSearch = ref('')
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
return 'info'
}
onMounted(() => {
loadData()
loadFilterData()
})
async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
try {
const mockData = [
{ id: 401, order_code: 'SO20260321A01', store_name: '总仓', order_status: 'ARCHIVED', complete_time: '2026-03-20 18:00:00', create_time: '2026-03-20 10:00:00' },
]
list.value = mockData
pagination.total = mockData.length
} catch (e) {
ElMessage.error('加载订单失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
async function loadFilterData() {
try {
const [storesRes]: any = await Promise.all([
indexApi.loadStores({ type: 'order' })
])
if (storesRes?.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
} catch (e) {}
}
function handleConditionChange() {
pagination.currentPage = 1
loadData()
}
function handleConditionClear() {
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
pagination.currentPage = 1
scanBox.value?.reset?.()
loadData()
}
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
}
function handleRowClick(row: any) {
selectedOrderId.value = row?.id || null
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
async function handleExport() {
exportLoading.value = true
setTimeout(() => {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
</script>
<style scoped lang="scss">
@import "./styles/order-sub.scss";
</style>

View File

@ -1,43 +0,0 @@
<template>
<div class="order-detail-view">
<el-descriptions :column="column || 3" border>
<el-descriptions-item
v-for="item in config"
:key="item.prop"
:label="item.label"
:span="item.span || 1"
>
<template v-if="item.prop === 'items'">
<!-- 商品清单特殊处理 -->
<div v-if="data?.[item.prop]">
{{ data[item.prop] }}
</div>
<span v-else>-</span>
</template>
<template v-else>
{{ data ? data[item.prop] : '-' }}
</template>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script setup lang="ts">
interface ConfigItem {
label: string
prop: string
span?: number
}
defineProps<{
data: any
config: ConfigItem[]
column?: number
}>()
</script>
<style lang="scss" scoped>
.order-detail-view {
padding: 10px;
}
</style>

View File

@ -1,7 +0,0 @@
<template>
<div class="">日志</div>
</template>
<script setup lang="ts"></script>
<style lang="css" scoped></style>

View File

@ -1,203 +0,0 @@
export const commonFields = [
{ label: '货主', value: 'store_id', type: 'select', options: [] },
{ label: '订单号', value: 'order_code', type: 'input' },
{ label: '创建时间', value: 'create_time', type: 'daterange' },
]
export const orderColumns = [
{ prop: 'id', label: 'ID', width: '80' },
{ prop: 'order_code', label: '订单号', width: '180' },
{ prop: 'store_name', label: '货主', width: '140' },
{ prop: 'order_type', label: '订单类型', width: '120' },
{ prop: 'order_status', label: '状态', width: '120' },
{ prop: 'receiver_name', label: '收货人', width: '120' },
{ prop: 'create_time', label: '创建时间', width: '180' },
]
// deliveryOrder相关配置
export const deliveryAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', options: [] },
{ label: '紧急订单', value: 'is_urgency', type: 'select', options: [
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' },
]},
{ label: '快递', value: '', type: 'input' },
{ label: '来源平台', value: '', type: 'input' },
{ label: '同步状态', value: '', type: 'input' },
{ label: '出库单号', value: '', type: 'text' },
{ label: '前置单号', value: '', type: 'input' },
{ label: '物流单号', value: '', type: 'text' },
{ label: '移动电话', value: '', type: 'text' },
{ label: '固定电话', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
// { label: '', value: '', type: 'text' },
{ label: '审核时间', value: '', type: 'daterange' },
{ label: '系统创建时间', value: '', type: 'daterange' },
{ label: '下单时间', value: '', type: 'daterange' },
{ label: '支付时间', value: '', type: 'daterange' },
// { label: '', value: '', type: 'daterange' },
// { label: '', value: '', type: 'daterange' },
// { label: '', value: '', type: 'daterange' },
// { label: '', value: '', type: 'daterange' },
]
export const deliveryColumns = [
{ prop: 'shop_nick', label: '店铺名称', width: '120' },
{ prop: 'name', label: '收件人姓名', width: '100' },
{ prop: 'express_code', label: '快递运单号', width: '160' },
{ prop: 'mobile', label: '收件人手机', width: '120' },
{ prop: 'province', label: '省份', width: '100' },
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'source_platform_name', label: '来源平台名称', width: '120' },
{ prop: 'logistics_name', label: '物流公司名称', width: '120' },
{ prop:'invoice_flag',label: '是否需要发票',width:'120' },
{ prop:'intercept_status',label: '拦截状态',width:'120' },
{ prop: 'create_at', label: '创建时间', width: '160' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
]
export const deliverydetail = [
{ label: '订单编号', prop: 'id' },
{ label: '发货单号', prop: 'delivery_order_code' },
{ label: '预发货单号', prop: 'pre_delivery_order_code' },
{ label: '运单号', prop: 'express_code' },
{ label: '物流公司名称', prop: 'logistics_name' },
{ label: '配送方式', prop: 'delivery_type' },
{ label: '省/市/区', prop: 'province_city_area' },
{ label: '城镇/街道', prop: 'town' },
{ label: '详细地址', prop: 'detail_address' },
{ label: '邮编', prop: 'zip_code' },
{ label: '隐私号 ID', prop: 'oaid' },
{ label: '商品种类数', prop: 'items_count' },
{ label: '商品总件数', prop: 'items_total' },
{ label: '总重量', prop: 'items_weight' },
{ label: '订单总金额', prop: 'total_amount' },
{ label: '商品总价', prop: 'item_amount' },
{ label: '优惠金额', prop: 'discount_amount' },
{ label: '快递费用', prop: 'freight' },
{ label: '应收金额', prop: 'ar_amount' },
{ label: '实付金额', prop: 'got_amount' },
{ label: '服务费', prop: 'service_fee' },
{ label: '创建时间', prop: 'create_at' },
{ label: '更新时间', prop: 'updated_at' },
{ label: '删除时间', prop: 'delete_at' },
{ label: '下单时间', prop: 'place_order_time' },
{ label: '支付时间', prop: 'pay_time' },
{ label: 'ERP 审核时间', prop: 'operate_time' },
]
// revieworder相关配置
export const reviewAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
{ label: '出库单号', value: 'delivery_order_code', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
{ label: '来源平台', value: 'source_platform_name', type: 'text' },
{ label: '物流公司', value: 'logistics_name', type: 'text' },
{ label: '物流单号', value: 'express_code', type: 'text' },
{ label: '收货人', value: 'name', type: 'text' },
{ label: '手机号', value: 'mobile', type: 'text' },
{ label: '省/市/区', value: 'province_city_area', type: 'text' },
{ label: '是否紧急', value: 'is_urgency', type: 'select', options: [ { label: '是', value: 'Y' }, { label: '否', value: 'N' } ] },
{ label: '同步状态', value: 'sync_status', type: 'select', options: [ { label: '待同步', value: 'padding' }, { label: '已同步', value: 'fin' }, { label: '错误', value: 'error' } ] },
{ label: '下单时间', value: 'place_order_time', type: 'daterange' },
{ label: '创建时间', value: 'create_at', type: 'daterange' },
]
export const reviewColums = [
{ prop: 'store_id', label: '货主id', width: '100' },
{ prop: 'source_platform_name', label: '来源平台名称', width: '120' },
{ prop: 'name', label: '收件人姓名', width: '120' },
{ prop: 'mobile', label: '收件人手机', width: '120' },
{ prop: 'create_at', label: '创建时间', width: '160' },
]
export const reviewOrderDetail = [
// 基础信息
{ prop: 'store_id', label: '货主id' },
{ prop: 'source_platform_name', label: '来源平台名称' },
{ prop: 'name', label: '收件人姓名' },
{ prop: 'mobile', label: '收件人手机' },
{ prop: 'create_at', label: '创建时间' },
// 明细
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'item_name', label: '商品名称(预留)' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
]
// pendingOrder相关配置
export const pendingAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', options: [] },
{ label: '订单号', value: 'order_code', type: 'text' },
{ label: '出库单号', value: 'delivery_order_code', type: 'text' },
{ label: '店铺名称', value: 'shop_nick', type: 'text' },
{ label: '来源平台', value: 'source_platform_name', type: 'text' },
{ label: '物流公司', value: 'logistics_name', type: 'text' },
{ label: '物流单号', value: 'express_code', type: 'text' },
{ label: '收货人', value: 'name', type: 'text' },
{ label: '手机号', value: 'mobile', type: 'text' },
{ label: '省/市/区', value: 'province_city_area', type: 'text' },
{ label: '是否紧急', value: 'is_urgency', type: 'select', options: [ { label: '是', value: 'Y' }, { label: '否', value: 'N' } ] },
{ label: '同步状态', value: 'sync_status', type: 'select', options: [ { label: '待同步', value: 'padding' }, { label: '已同步', value: 'fin' }, { label: '错误', value: 'error' } ] },
{ label: '下单时间', value: 'place_order_time', type: 'daterange' },
{ label: '创建时间', value: 'create_at', type: 'daterange' },
]
export const pendingCloums = [
{ prop: 'id', label: 'ID', width: '80' },
{ prop: 'shop_nick', label: '店铺昵称', width: '160' },
{ prop: 'order_code', label: '订单号', width: '180' },
{ prop: 'delivery_order_code', label: '出库单号', width: '160' },
{ prop: 'name', label: '收货人', width: '160' },
{ prop: 'seller_nick', label: '卖家昵称', width: '160' },
{ prop: 'source_platform_name', label: '来源平台', width: '160' },
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'logistics_name', label: '物流公司', width: '160' },
{ prop: 'status', label: '系统状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'province', label: '送达省份', width: '120' },
{ prop: 'create_at', label: '创建时间', width: '160' },
]
// archiveOrder相关配置
export const archiveAvailableFields = [
{ label: '货主', value: 'store_id', type: 'select', options: [] },
{ label: '订单号', value: 'order_code', type: 'input' },
{ label: '状态', value: 'order_status', type: 'select', options: [
{ label: '已完成', value: 'FINISHED' },
{ label: '已作废', value: 'CANCELLED' },
{ label: '已归档', value: 'ARCHIVED' },
]},
{ label: '创建时间', value: 'create_time', type: 'daterange' },
]
export const archiveOrderDetail = [
{ prop: 'order_code', label: '订单号' },
{ prop: 'store_name', label: '货主' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_status', label: '状态' },
{ prop: 'receiver_name', label: '收货人' },
{ prop: 'complete_time', label: '完成时间' },
{ prop: 'create_time', label: '创建时间' },
]

View File

@ -1,463 +0,0 @@
<template>
<div class="delivery-order-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" @click="handleCreate">新建配送单</el-button>
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
<div class="toolbar-right">
<el-input size="small" placeholder="搜索配送单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="配送订单列表"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateField('order_status', row.order_status) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无订单</div>
</template>
</upper-table>
</div>
<div class="lower-level" v-if="selectedOrderId" :class="tableSize">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="订单明细" name="details" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<div v-if="activeTab === 'details'">
<detail :data="selectedRow" :config="deliverydetail" :column="3" />
</div>
<div v-else>
<log :data="selectedRow" />
</div>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else>
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import * as orderApi from '@/api/order/order'
import {
deliveryAvailableFields,
deliveryColumns,
deliverydetail
} from './config/order-common-config'
import detail from './component/detail.vue'
import log from './component/log.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(deliveryAvailableFields)))
const activeTab = ref('details')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(deliveryColumns)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedOrderId = ref<number | string | null>(null)
const quickSearch = ref('')
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
const map: Record<string, string> = {
'PENDING': 'info',
'SYNCING': 'primary',
'SUCCESS': 'success',
'FAIL': 'danger'
}
return map[status] || ''
}
onMounted(() => {
loadData()
loadFilterData()
})
async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
try {
const params = {
page: pagination.currentPage,
pageSize: pagination.pageSize,
quickSearch: quickSearch.value,
condition: scanBox.value?.getCondition ? scanBox.value.getCondition() : {}
}
const res: any = await orderApi.getdeliveryOrderlist(params)
if (res && res.code === 200 && res.list) {
list.value = res.list
pagination.total = res.total || 0
} else {
throw new Error('Fallback to mock data')
}
} catch (e) {
// 模拟基于数据库结构扩展后的数据
const mockData = [
{
id: 14,
delivery_order_code: '2885-831',
pre_delivery_order_code: '',
express_code: '',
logistics_name: '',
delivery_type: 'NORMAL',
province: '广东省',
city: '广州市',
area: '白云区',
province_city_area: '广东省 / 广州市 / 白云区',
town: '',
detail_address: '钟落潭良沙二路32号',
zip_code: '',
oaid: '',
items_count: 1,
items_total: 5,
items_weight: 0.00,
total_amount: 0.00,
item_amount: 0.00,
discount_amount: 0.00,
freight: 0.00,
ar_amount: 0.00,
got_amount: 0.00,
service_fee: 0.00,
create_at: '2026-01-13 14:17:35',
updated_at: '2026-01-13 14:17:35',
delete_at: null,
place_order_time: '2026-01-13 13:37:42',
pay_time: '2026-01-13 13:37:42',
operate_time: '2026-01-13 13:38:05',
order_type: 'JYCK',
shop_nick: '线下店铺',
mobile: '18022440198',
is_urgency: 'N',
sync_status: 'padding'
},
{
id: 21,
delivery_order_code: 'JY2026011327233',
pre_delivery_order_code: '',
express_code: '',
logistics_name: '顺丰空运',
delivery_type: 'EXPRESS',
province: '广东省',
city: '广州市',
area: '白云区',
province_city_area: '广东省 / 广州市 / 白云区',
town: '太和镇',
detail_address: '广东省 广州市 白云区 太和镇 二路32号',
zip_code: '',
oaid: '',
items_count: 1,
items_total: 10,
items_weight: 0.00,
total_amount: 10.00,
item_amount: 10.00,
discount_amount: 0.00,
freight: 0.00,
ar_amount: 0.00,
got_amount: 0.00,
service_fee: 0.00,
create_at: '2026-01-13 15:26:07',
updated_at: '2026-01-13 15:26:07',
delete_at: null,
place_order_time: '2026-01-13 15:22:03',
pay_time: '2026-01-13 15:22:03',
operate_time: '2026-01-13 15:26:07',
order_type: 'JYCK',
shop_nick: '火火家de小店',
mobile: '18022440198',
is_urgency: 'N',
sync_status: 'padding'
},
{
id: 29,
delivery_order_code: 'CK26012000894',
pre_delivery_order_code: '',
express_code: '',
logistics_name: '',
delivery_type: 'NORMAL',
province: '北京',
city: '北京市',
area: '西城区',
province_city_area: '北京 / 北京市 / 西城区',
town: '',
detail_address: '湖北省襄阳市宏泰越秀星汇城',
zip_code: '',
oaid: '',
items_count: 2,
items_total: 101,
items_weight: 2.00,
total_amount: 12990.00,
item_amount: 0.00,
discount_amount: 0.00,
freight: 5.00,
ar_amount: 0.00,
got_amount: 12990.00,
service_fee: 0.00,
create_at: '2026-01-20 13:02:59',
updated_at: '2026-01-20 13:11:33',
delete_at: null,
place_order_time: '2026-01-20 13:02:59',
pay_time: '2026-01-20 13:02:59',
operate_time: '2026-01-20 13:11:33',
order_type: 'JYCK',
shop_nick: 'af69a68',
mobile: '18727038559',
is_urgency: 'N',
sync_status: 'padding'
}
]
list.value = mockData
pagination.total = mockData.length
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
async function loadFilterData() {
try {
const [storesRes, presetRes]: any = await Promise.all([
indexApi.loadStores({ type: 'delivery' }),
indexApi.fastWhereTree('delivery')
])
if (storesRes && storesRes.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
if (presetRes && presetRes.code === 200) {
presetTree.value = presetRes.presetTree || []
}
} catch (e) {}
}
function handleConditionChange(condition: any) {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
pagination.currentPage = 1
if (scanBox.value?.reset) {
scanBox.value.reset()
}
loadData()
}
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
}
function handleRowClick(row: any) {
selectedOrderId.value = row?.id || null
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function handleCreate() {
ElMessage.info('新建配送单')
}
async function confirmBatchCancel() {
try {
await ElMessageBox.confirm(`确定要批量作废选中的配送单吗?`, '确认', { type: 'warning' })
ElMessage.success('操作成功')
loadData()
} catch (e) {}
}
async function handleExport() {
exportLoading.value = true
setTimeout(() => {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
</script>
<style scoped lang="scss">
.delivery-order-container {
display: flex;
height: 100%;
width: 100%;
background-color: #f0f2f5;
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
.toolbar {
padding: 10px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.toolbar-right {
display: flex;
gap: 15px;
align-items: center;
}
.upper-wrapper {
flex: 1;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.table-container) {
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
}
.lower-level {
flex: 1;
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
.detail-tab { margin-bottom: -1px; }
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip { text-align: center; }
}
}
}
</style>

View File

@ -1,240 +0,0 @@
<template>
<div class="order-sub-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" type="warning" :disabled="!hasSelection" @click="handleBatchFix">批量重置状态</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
<div class="toolbar-right">
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="异常订单列表"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateField('order_status', row.order_status) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无异常订单</div>
</template>
</upper-table>
</div>
<div class="lower-level" v-if="selectedOrderId" :class="tableSize">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="订单详情" name="details" />
<el-tab-pane label="异常记录" name="exceptions" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<div v-if="activeTab === 'details'">
<el-descriptions :column="3" border>
<el-descriptions-item label="订单号">{{ selectedRow?.order_code }}</el-descriptions-item>
<el-descriptions-item label="原始单号">{{ selectedRow?.source_code }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-else-if="activeTab === 'exceptions'">
<el-alert title="系统异常" type="error" :closable="false" description="库存不足或物流接口调用失败。" />
</div>
<div v-else>
<p>操作日志暂无</p>
</div>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else>
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import {
commonFields,
orderColumns,
} from './config/order-common-config'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(commonFields)))
const activeTab = ref('details')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(orderColumns)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedOrderId = ref<number | string | null>(null)
const quickSearch = ref('')
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
return 'danger'
}
onMounted(() => {
loadData()
loadFilterData()
})
async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
try {
const mockData = [
{ id: 301, order_code: 'SO20260321E01', store_name: '分仓B', order_type: 'B2C订单', order_status: 'EXCEPTION', create_time: '2026-03-21 14:00:00', source_code: 'EX999' },
]
list.value = mockData
pagination.total = mockData.length
} catch (e) {
ElMessage.error('加载订单失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
async function loadFilterData() {
try {
const [storesRes]: any = await Promise.all([
indexApi.loadStores({ type: 'order' })
])
if (storesRes?.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
} catch (e) {}
}
function handleConditionChange() {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
pagination.currentPage = 1
scanBox.value?.reset?.()
loadData()
}
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
}
function handleRowClick(row: any) {
selectedOrderId.value = row?.id || null
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function handleBatchFix() {
ElMessage.warning(`正在修复 ${selectionRows.value.length} 个订单的状态`)
}
async function handleExport() {
exportLoading.value = true
setTimeout(() => {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
</script>
<style scoped lang="scss">
@use "./styles/order-sub.scss";
</style>

View File

@ -1,210 +1,8 @@
<template> <template>
<div style="width:100%;padding:10px;height: 100%;"> <div class="order-container">
<!-- 使用 keep-alive 强制保留所有标签 --> <h1>订单管理</h1>
<el-tabs
v-model="activeTab"
@tab-click="handleTabClick"
tab-position="top"
type="border-card"
class="tab-container"
>
<!-- 使用 v-for 动态生成,确保每个标签都被创建 -->
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">
{{ tab.label }}
<el-badge
:value="tab.count"
:max="99"
:hidden="tab.count === 0"
class="tab-badge"
/>
</span>
</template>
<!-- Vue 3 keep-alive 内部必须是单一根元素或动态组件 -->
<router-view v-if="activeTab === tab.name" v-slot="{ Component }">
<keep-alive>
<component :is="tab.component" v-if="activeTab === tab.name || forceRenderAll" />
</keep-alive>
</router-view>
<div v-else-if="forceRenderAll">
<component :is="tab.component" />
</div>
</el-tab-pane>
</el-tabs>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import ReviewOrder from './reviewOrder.vue'
import PendingOrder from './pendingOrder.vue'
import ExceptionOrder from './exceptionOrder.vue'
import DeliveryOrder from './deliveryOrder.vue'
import ArchiveOrder from './archiveOrder.vue'
const route = useRoute()
const router = useRouter()
const activeTab = ref('reviewOrder')
const forceRenderAll = ref(true) // 强制渲染所有组件
const tabs = ref([
{
name: 'reviewOrder',
label: '待审核订单',
count: 5,
component: ReviewOrder
},
{
name: 'pendingOrder',
label: '待处理订单',
count: 10,
component: PendingOrder
},
{
name: 'exceptionOrder',
label: '异常订单',
count: 3,
component: ExceptionOrder
},
{
name: 'deliveryOrder',
label: '配送订单',
count: 0,
component: DeliveryOrder
},
{
name: 'archiveOrder',
label: '归档订单',
count: 0,
component: ArchiveOrder
}
])
// 初始化:从URL参数获取激活的标签
const initFromRoute = () => {
const tabFromUrl = route.query.tab as string
const validTabs = tabs.value.map(tab => tab.name)
if (tabFromUrl && validTabs.includes(tabFromUrl)) {
activeTab.value = tabFromUrl
} else {
// 如果没有tab参数或参数无效,设置默认值
activeTab.value = 'reviewOrder'
// 更新URL参数
if (!route.query.tab) {
router.replace({
query: {
...route.query,
tab: 'reviewOrder'
}
})
}
}
}
// 监听URL参数变化
watch(
() => route.query.tab,
(newTab) => {
const validTabs = tabs.value.map(tab => tab.name)
if (newTab && validTabs.includes(newTab as string)) {
activeTab.value = newTab as string
} else {
activeTab.value = 'reviewOrder'
if (!newTab) {
router.replace({
query: {
...route.query,
tab: 'reviewOrder'
}
})
}
}
},
{ immediate: true }
)
onMounted(() => {
initFromRoute()
// 确保所有标签都被渲染
setTimeout(() => {
forceRenderAll.value = false
}, 100)
})
// 点击标签时处理
const handleTabClick = (tab: any) => {
const tabName = tab.paneName // Element Plus 中 tabs 的 tab-click 事件对象有 paneName
// 如果已经是当前激活的标签,不重复跳转
if (activeTab.value === tabName && route.query.tab === tabName) {
return
}
// 更新URL参数(使用replace避免历史记录过多)
router.replace({
query: {
...route.query,
tab: tabName
}
})
}
</script> </script>
<style lang="scss" scoped>
.tab-container {
display: flex;
flex-direction: column;
height: 100%;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__content) {
flex: 1;
overflow: auto;
position: relative;
.el-tab-pane {
height: 100%;
}
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
.tab-badge {
:deep(.el-badge__content) {
font-size: 12px;
height: 18px;
line-height: 18px;
padding: 0 6px;
&.is-fixed {
top: -2px;
right: -8px;
}
}
}
// 当数量很大时显示为红色
:deep(.el-badge__content) {
&.is-danger {
background-color: #f56c6c;
}
}
</style>

View File

@ -1,275 +0,0 @@
<template>
<div class="order-sub-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" type="primary" :disabled="!hasSelection" @click="handleBatchProcess">批量下发</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
<div class="toolbar-right">
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="待处理订单列表"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateField('order_status', row.order_status) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无待处理订单</div>
</template>
</upper-table>
</div>
<div class="lower-level" v-if="selectedOrderId" :class="tableSize">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="订单详情" name="details" />
<el-tab-pane label="配货信息" name="picking" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<div v-if="activeTab === 'details'">
<el-descriptions :column="3" border>
<el-descriptions-item label="订单号">{{ selectedRow?.order_code }}</el-descriptions-item>
<el-descriptions-item label="货主">{{ selectedRow?.store_name }}</el-descriptions-item>
<el-descriptions-item label="处理优先级">{{ selectedRow?.priority || '普通' }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-else-if="activeTab === 'picking'">
<p>配货明细加载中...</p>
</div>
<div v-else>
<p>操作日志暂无</p>
</div>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else>
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import {
commonFields,
orderColumns,
pendingCloums,
pendingAvailableFields,
} from './config/order-common-config'
import detail from './component/detail.vue'
import log from './component/log.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(pendingAvailableFields)))
const activeTab = ref('details')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(pendingCloums)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedOrderId = ref<number | string | null>(null)
const quickSearch = ref('')
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
return 'primary'
}
onMounted(() => {
loadData()
loadFilterData()
})
async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
try {
const mockData = [
{
id: 201,
order_code: 'SO20260321P01',
delivery_order_code: 'DO20260321P01',
shop_nick: '待处理店铺A',
name: '王五',
seller_nick: '卖家001',
source_platform_name: '拼多多',
is_urgency: 'N',
logistics_name: '顺丰快递',
status: 'WAIT_PROCESS',
sync_status: 'padding',
province: '浙江省',
create_at: '2026-03-21 11:00:00'
},
{
id: 202,
order_code: 'SO20260321P02',
delivery_order_code: 'DO20260321P02',
shop_nick: '待处理店铺B',
name: '赵六',
seller_nick: '卖家002',
source_platform_name: '抖音',
is_urgency: 'Y',
logistics_name: '中通快递',
status: 'WAIT_PROCESS',
sync_status: 'error',
province: '广东省',
create_at: '2026-03-21 12:30:00'
},
]
list.value = mockData
pagination.total = mockData.length
} catch (e) {
ElMessage.error('加载订单失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
async function loadFilterData() {
try {
const [storesRes, presetRes]: any = await Promise.all([
indexApi.loadStores({ type: 'order' }),
indexApi.fastWhereTree('order')
])
if (storesRes?.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
} catch (e) {}
}
function handleConditionChange() {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
pagination.currentPage = 1
scanBox.value?.reset?.()
loadData()
}
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
}
function handleRowClick(row: any) {
selectedOrderId.value = row?.id || null
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function handleBatchProcess() {
ElMessage.success(`成功并发下发 ${selectionRows.value.length} 个订单`)
}
async function handleExport() {
exportLoading.value = true
setTimeout(() => {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
</script>
<style scoped lang="scss">
@use "./styles/order-sub.scss";
</style>

View File

@ -1,283 +0,0 @@
<template>
<div class="order-sub-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" type="success" :disabled="!hasSelection" @click="handleBatchAudit">批量审核</el-button>
<el-button size="small" type="danger" :disabled="!hasSelection" @click="confirmBatchCancel">批量拦截</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
</div>
<div class="toolbar-right">
<el-input size="small" placeholder="搜索订单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="待审核订单列表"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateField('order_status', row.order_status) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无待审核订单</div>
</template>
</upper-table>
</div>
<div class="lower-level" v-if="selectedOrderId" :class="tableSize">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="订单详情" name="details" />
<el-tab-pane label="收货信息" name="receiver" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<div v-if="activeTab === 'details'">
<detail :data="selectedRow" :config="reviewOrderDetail" :column="3" />
</div>
<div v-else-if="activeTab === 'receiver'">
<el-descriptions :column="2" border>
<el-descriptions-item label="收货人">{{ selectedRow?.name }}</el-descriptions-item>
<el-descriptions-item label="手机">{{ selectedRow?.mobile }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-else>
<log :data="selectedRow" />
</div>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else>
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import {
orderColumns,
reviewAvailableFields,
reviewColums,
reviewOrderDetail
} from './config/order-common-config'
import detail from './component/detail.vue'
import log from './component/log.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(reviewAvailableFields)))
const activeTab = ref('details')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(reviewColums)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedOrderId = ref<number | string | null>(null)
const quickSearch = ref('')
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
return status === 'AUDITED' ? 'success' : 'warning'
}
onMounted(() => {
loadData()
loadFilterData()
})
async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
try {
const mockData = [
{
id: 101,
store_id: '1000016',
source_platform_name: '线下',
name: '刘付明仁',
mobile: '18022440198',
create_at: '2026-01-13 14:17:35',
shop_nick: '线下店铺',
item_name: '商品A(预留)',
order_type: 'JYCK',
order_flag: '普通订单',
order_status: 'WAIT_AUDIT'
},
{
id: 102,
store_id: '1000016',
source_platform_name: '拼多多',
name: '刘付明仁',
mobile: '18022440198',
create_at: '2026-01-13 15:26:07',
shop_nick: '火火家de小店',
item_name: '商品B(预留)',
order_type: 'JYCK',
order_flag: '急单',
order_status: 'WAIT_AUDIT'
}
]
list.value = mockData
pagination.total = mockData.length
} catch (e) {
ElMessage.error('加载订单失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
async function loadFilterData() {
try {
const [storesRes, presetRes]: any = await Promise.all([
indexApi.loadStores({ type: 'order' }),
indexApi.fastWhereTree('order')
])
if (storesRes?.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
if (presetRes?.code === 200) {
presetTree.value = presetRes.presetTree || []
}
} catch (e) {}
}
function handleConditionChange() {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
pagination.currentPage = 1
scanBox.value?.reset?.()
loadData()
}
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
}
function handleRowClick(row: any) {
selectedOrderId.value = row?.id || null
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function handleBatchAudit() {
ElMessage.success(`成功审核 ${selectionRows.value.length} 个订单`)
loadData()
}
async function confirmBatchCancel() {
try {
await ElMessageBox.confirm(`确定要拦截选中的订单吗?`, '警告', { type: 'error' })
ElMessage.success('操作成功')
loadData()
} catch (e) {}
}
async function handleExport() {
exportLoading.value = true
setTimeout(() => {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
</script>
<style scoped lang="scss">
@use "./styles/order-sub.scss";
</style>

View File

@ -1,83 +0,0 @@
.order-sub-container {
display: flex;
height: 100%;
width: 100%;
background-color: #f0f2f5;
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
.toolbar {
padding: 10px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.toolbar-right {
display: flex;
gap: 15px;
align-items: center;
}
.upper-wrapper {
flex: 1;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.table-container) {
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
}
.lower-level {
flex: 1;
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
.detail-tab { margin-bottom: -1px; }
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip { text-align: center; }
}
}
}

View File

@ -1,183 +0,0 @@
<template>
<div class="entry-details">
<div class="header-actions">
<div class="left-actions">
<el-button size="small" @click="loadEntryDetail">刷新</el-button>
<el-button disabled>入库</el-button>
<el-button size="small" type="primary" disabled>批量入库</el-button>
<el-button size="small" disabled>EXCEL导出</el-button>
<el-button size="small" disabled>导出</el-button>
</div>
<div class="right-actions">
<!-- 搜索或额外操作 -->
</div>
</div>
<div class="table-content">
<UpperTable
:data="tableData"
:columns="detailColumns"
:show-selection="true"
:pagination="pagination"
:loading="loading"
@selection-change="handleSelectionChange"
@page-size-change="handlePageSizeChange"
@page-change="handlePageChange"
>
<template #column-images="{ row }">
<div class="image-slot">
<el-image
v-if="row.images"
style="width: 40px; height: 40px"
:src="row.images"
:preview-src-list="[row.images]"
fit="cover"
/>
<span v-else>--</span>
</div>
</template>
</UpperTable>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, watch, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import UpperTable from '@/components/UpperTable/index.vue'
import * as entryApi from '@/api/storage/entry'
import {entrydetail} from '../entry-config'
const props = defineProps<{
id?: string | number,
row?: any
}>()
const tableData = ref<any[]>([])
const loading = ref(false)
const multipleSelection = ref<any[]>([])
// 分页相关
const pagination = reactive({
currentPage: 1,
pageSize: 20,
total: 0
})
// 列定义
const detailColumns = ref(entrydetail)
const emit = defineEmits(['refresh'])
// 监听 ID 变化加载数据
watch(() => props.id, (newVal) => {
if (newVal) {
loadEntryDetail()
}
}, { immediate: true })
async function loadEntryDetail() {
if (!props.id) return
loading.value = true
try {
console.log('加载入库单详情, ID:', props.id)
let useMock = false
try {
const res = await entryApi.getEntryDetail({
id: props.id,
page: pagination.currentPage,
page_size: pagination.pageSize
})
if (res && res.code === 200 && res.data) {
tableData.value = Array.isArray(res.data) ? res.data : [res.data]
pagination.total = res.total || tableData.value.length
} else {
useMock = true
}
} catch (apiError) {
console.warn('详情API调用失败,改用模拟数据', apiError)
useMock = true
}
if (useMock) {
// 模拟数据源
const allMockDetails: Record<number | string, any[]> = {
90: [
{ id: 91, order_id: 90, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 0, count: 5000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 5000, confirm_quantity: 5000 }
],
93: [
{ id: 94, order_id: 93, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '6977520597331', item_id: 1000689, count: 1000, inventory_type: 'ZP', stock_id: 101845, received_quantity: 1000, confirm_quantity: 1000 }
],
95: [
{ id: 95, order_id: 95, out_biz_code: '', order_line_no: 2786714391389667366, owner_code: 'wdt02060120001', item_code: '三层钢蒸锅+屉26cm', item_id: 1000690, count: 1000, inventory_type: 'ZP', stock_id: 101874, received_quantity: 1000, confirm_quantity: 1000 }
],
96: [
{ id: 96, order_id: 96, out_biz_code: '', order_line_no: 2786720123363262666, owner_code: 'wdt02060120001', item_code: 'rrxm202502', item_id: 1000691, count: 1000, inventory_type: 'ZP', stock_id: 101875, received_quantity: 1000, confirm_quantity: 1000 }
],
97: [
{ id: 97, order_id: 97, out_biz_code: '', order_line_no: 1, owner_code: 'khgj2025100901', item_code: '20251023-18', item_id: 1000686, count: 1000, inventory_type: 'ZP', stock_id: 101842, received_quantity: 0, confirm_quantity: 0 }
]
}
const mockDetails = allMockDetails[props.id] || []
tableData.value = mockDetails
pagination.total = mockDetails.length
}
} catch (error) {
ElMessage.error('获取明细失败')
} finally {
loading.value = false
}
}
const handleSelectionChange = (val: any[]) => {
multipleSelection.value = val
}
const handlePageSizeChange = (val: number) => {
pagination.pageSize = val
loadEntryDetail()
}
const handlePageChange = (val: number) => {
pagination.currentPage = val
loadEntryDetail()
}
onMounted(() => {
if (props.id) {
loadEntryDetail()
}
})
</script>
<style scoped lang="scss">
.entry-details {
display: flex;
flex-direction: column;
height: 100%;
background: #fff;
.header-actions {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 10px;
border-bottom: 1px solid #ebeef5;
margin-bottom: 10px;
}
.table-content {
flex: 1;
overflow: hidden;
}
.image-slot {
display: flex;
align-items: center;
justify-content: center;
}
}
</style>

View File

@ -1,167 +0,0 @@
<template>
<div class="entry-operate">
<div class="left-col">
<div class="col-left">
<el-form :model="form" label-width="120px" size="small">
<!-- 动态渲染可用字段,此处可根据 entry-config 调整 -->
<el-form-item
v-for="field in entryColums"
:key="field.prop"
:label="field.label"
:prop="field.prop"
>
<el-input
v-model="(form as any)[field.prop]"
:placeholder="'请输入' + field.label"
/>
</el-form-item>
</el-form>
</div>
<div class="col-right">
<!-- 预留扩展区域 -->
</div>
</div>
<aside class="right-col">
<div class="right-panel">
<div class="panel-actions">
<el-button size="small" @click="handleReset">重置</el-button>
<el-button type="primary" size="small" @click="handleSave" :loading="saveLoading">保存</el-button>
</div>
<div class="panel-info" v-if="row">
<div class="info-item">
<span class="info-label">创建时间:</span>
<span class="info-value">{{ row.order_create_time }}</span>
</div>
<div class="info-item">
<span class="info-label">当前状态:</span>
<el-tag size="small">{{ row.status }}</el-tag>
</div>
</div>
</div>
</aside>
</div>
</template>
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { entryColums } from '../entry-config'
import { ElMessage } from 'element-plus'
const props = defineProps<{
id: string | number,
row?: any
}>()
const form = ref<any>({})
const saveLoading = ref(false)
// 监听行数据变化同步表单
watch(() => props.row, (newRow) => {
if (newRow) {
form.value = { ...newRow }
}
}, { immediate: true })
const handleReset = () => {
if (props.row) {
form.value = { ...props.row }
} else {
form.value = {}
}
}
const handleSave = async () => {
try {
saveLoading.value = true
// 模拟接口调用
await new Promise(resolve => setTimeout(resolve, 500))
ElMessage.success('保存成功')
} catch (error) {
ElMessage.error('保存失败')
} finally {
saveLoading.value = false
}
}
onMounted(() => {
if (props.row) {
form.value = { ...props.row }
}
})
</script>
<style scoped lang="scss">
.entry-operate {
padding: 12px;
display: grid;
grid-template-columns: 1fr 320px;
gap: 0 16px;
align-items: start;
height: 100%;
overflow: hidden;
background: #fff;
}
.left-col {
grid-column: 1 / 2;
height: 100%;
overflow-y: auto;
padding-right: 12px;
display: flex;
gap: 24px;
}
.col-left {
flex: 1;
}
.col-right {
flex: 1;
border-left: 1px solid #f0f0f0;
padding-left: 12px;
}
.right-col {
grid-column: 2 / 3;
height: 100%;
overflow-y: auto;
}
.right-panel {
position: sticky;
top: 0;
background: #fff;
border-radius: 4px;
padding: 16px;
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
border: 1px solid #ebeef5;
.panel-actions {
text-align: right;
margin-bottom: 20px;
}
.panel-info {
border-top: 1px dashed #ebeef5;
padding-top: 15px;
.info-item {
margin-bottom: 10px;
font-size: 13px;
display: flex;
justify-content: space-between;
align-items: center;
.info-label {
color: #909399;
}
.info-value {
color: #303133;
font-weight: 500;
}
}
}
}
</style>

View File

@ -1,9 +0,0 @@
<template>
<div class="">
<h1>操作日志</h1>
</div>
</template>
<script setup lang="ts"></script>
<style lang="css" scoped></style>

View File

@ -1,96 +0,0 @@
export const availableFields = [
{ label:'', value: '', type: 'input' },
{ label: '货主', value: 'store_id', type: 'select', options: [] },
{ label: '状态', value: 'order_status', type: 'select', options: [
{ label: '已创建', value: 'CREATED' },
{ label: '待入库', value: 'PENDING' },
{ label: '入库中', value: 'PARTIAL' },
{ label: '已完成', value: 'COMPLETED' },
{ label: '已取消', value: 'CANCELLED' },
]},
{ label: '入库单类型', value: 'order_type', type: 'select', options: [
{ label: '采购入库', value: 'CGRK' },
{ label: '退货入库', value: 'THRK' },
{ label: '其他入库', value: 'QTRK' },
{ label: '盘点入库', value: 'PDRK' },
]},
{ label: '同步状态', value: 'sync_status', type: 'select', options: [
{ label: '待推送', value: 'PENDING' },
{ label: '推送中', value: 'SYNCING' },
{ label: '成功', value: 'SUCCESS' },
{ label: '失败', value: 'FAIL' },
]},
{ label: '费用是否记录',value: 'expense_record', type: 'select', options: [
{ label: '是', value: true },
{ label: '否', value: false },
]},
{ label: '批次',value: 'batch',type: 'text' },
{ label: '编号',value: 'number',type: 'text' },
{ label: '备注',value: 'remark',type: 'text' },
{ label: 'ERP备注',value: 'erp_remark',type: 'text' },
{ label: '操作员ID',value: 'operator_id',type: 'text' },
{ label: '申请起始日期',value: 'start_date',type: 'daterange' },
{ label: '申请结束日期',value: 'end_date',type: 'daterange' },
{ label: '',value: ''},
{ label: '',value: ''},
{ label: '',value: ''},
{ label: '',value: ''},
]
export const entryColums = [
{ prop: 'id',label:'ID',width:'50' },
{ prop: 'entry_order_code',label:'入库单号',width:'160',},
{ prop: 'store_name',label:'货主',width:'140', },
{ prop: 'order_type',label:'类型',width:'160' },
{ prop: 'purchase_order_code',label:'单据编号 ',width:'160' },
{ prop: 'total_order_lines',label:'商品数',width:'160' },
{ prop: 'order_status',label:'订单状态',width:'160' },
{ prop: 'sync_status',label:'同步状态',width:'160' },
{ prop: 'supplier_code',label:'供应商编码',width:'160' },
{ prop: 'supplier_name',label:'供应商名称',width:'160' },
{ prop: '',label:'',width:'160' },
{ prop: 'express_code',label:'运单号',width:'160' },
{ prop: 'logistics_code',label:'物流公司编码',width:'160' },
{ prop: 'logistics_name',label:'物流公司名称',width:'160' },
{ prop: '',label:'',width:'160',fixed: 'left' },
{ prop: '',label:'',width:'160',fixed: 'left' },
{ prop: 'order_create_time',label:'单据创建时间',width:'160' },
{ prop: 'expect_start_time',label:'预计开始时间',width:'160' },
{ prop: 'expect_end_time',label:'预计结束时间',width:'160' },
{ prop: '',label:'',width:'160',fixed: 'left' },
{ prop: 'source_type',label:'数据来源',width:'160' },
{ prop: '',label:'',width:'160',fixed: 'left' },
{ prop: '',label:'',width:'160',fixed: 'left' },
]
export const entrydetail = [
{ prop: 'id', label: 'ID', width: '160' },
{ prop: 'out_biz_code', label: '外部业务编码', width: '160' },
{ prop: 'order_line_no', label: '订单行号', width: '160' },
{ prop: 'owner_code', label: '货主编码', width: '160' },
{ prop: 'item_code', label: '商品编码', width: '160' },
{ prop: 'item_id', label: '商品 ID', width: '160' },
{ prop: 'count', label: '应收数量', width: '160' },
{ prop: 'inventory_type', label: '库存类型', width: '160' },
{ prop: 'stock_id', label: '库存记录 ID', width: '160' },
{ prop: 'received_quantity', label: '实收数量', width: '160' },
{ prop: 'confirm_quantity', label: '确认数量', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
{ prop: '', label: '', width: '160' },
]

View File

@ -1,500 +0,0 @@
<template>
<div class="storage-entry-container">
<scan-box
ref="scanBox"
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" @click="handleCreateEntry">新建入库单</el-button>
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
<el-button size="small" @click="handleImport">导入</el-button>
</div>
<div class="toolbar-right">
<el-input size="small" placeholder="搜索入库单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
</div>
</div>
<div class="upper-wrapper">
<upper-table
ref="upperTable"
title="入库单列表"
:data="list"
:columns="columns"
:table-size="tableSize"
:pagination="pagination"
:show-index="true"
:show-actions="true"
:show-selection="true"
:loading="loading"
:queryTime="queryTime"
@current-change="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getStatusType(row.order_status)" size="small">
{{ translateField('order_status', row.order_status) }}
</el-tag>
</template>
<template #column-order_type="{ row }">
<span>{{ translateField('order_type', row.order_type) }}</span>
</template>
<template #column-sync_status="{ row }">
<el-tag :type="getSyncStatusType(row.sync_status)" size="small">
{{ translateField('sync_status', row.sync_status) }}
</el-tag>
</template>
<template #empty>
<div class="empty-tip">暂无入库单</div>
</template>
</upper-table>
</div>
<div class="lower-level" v-if="selectedEntryId" :class="tableSize">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tabs></el-tabs>
<el-tab-pane label="表单操作" name="operate" />
<el-tab-pane label="入库明细" name="details" />
<el-tab-pane label="操作日志" name="logs" />
</el-tabs>
</div>
<div class="detail-container">
<KeepAlive>
<component
:is="activeComponent"
:id="selectedEntryId"
:row="selectedRow"
@refresh="loadData"
/>
</KeepAlive>
</div>
</div>
<div class="no-selection" v-else>
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index'
import * as entryApi from '@/api/storage/entry'
import {
availableFields,
entryColums,
} from './entry-config'
import entrydetail from './component/entrydetail.vue'
import log from './component/log.vue'
import entryoperate from './component/entryoperate.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
const activeTab = ref('details')
const list = ref<any[]>([])
const loading = ref(false)
const exportLoading = ref(false)
const queryTime = ref(0)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const tableSize = ref('small')
const columns = ref(entryColums)
const selectionRows = ref<any[]>([])
const hasSelection = ref(false)
const selectedEntryId = ref<number | string | null>(null)
const quickSearch = ref('')
const componentMap: Record<string, any> = {
details: entrydetail,
logs: log,
operate: entryoperate
}
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.details)
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedEntryId.value) || null
})
function translateField(fieldValue: string, value: any) {
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
if (field && field.options) {
const option = field.options.find((opt: any) => opt.value === value)
return option ? option.label : value
}
return value
}
function getStatusType(status: string) {
const map: Record<string, string> = {
'CREATED': 'info',
'PENDING': 'warning',
'PARTIAL': 'primary',
'COMPLETED': 'success',
'CANCELLED': 'danger'
}
return map[status] || ''
}
function getSyncStatusType(status: string) {
const map: Record<string, string> = {
'PENDING': 'info',
'SYNCING': 'primary',
'SUCCESS': 'success',
'FAIL': 'danger'
}
return map[status] || ''
}
onMounted(() => {
loadData()
loadFilterData()
})
async function loadData() {
if (loading.value) return
loading.value = true
const start = Date.now()
try {
const params = {
page: pagination.currentPage,
page_size: pagination.pageSize,
quick_search: quickSearch.value,
...(scanBox.value?.getConditions() || {})
}
let useMock = false
try {
const res = await entryApi.getEntryList(params)
if (res && res.code === 200 && res.data && res.data.length > 0) {
list.value = res.data
pagination.total = res.total || res.data.length
} else {
useMock = true
console.log('API未返回数据,准备使用模拟数据')
}
} catch (apiError) {
console.warn('API调用失败,改用模拟数据', apiError)
useMock = true
}
if (useMock) {
const mockData = [
{
id: 90,
entry_order_code: '2885-2011062548597596161',
order_type: 'CGRK',
purchase_order_code: '',
total_order_lines: 1,
order_create_time: '2026-01-13 13:07:36',
expect_start_time: '2026-01-13 13:07:36',
expect_end_time: '2026-01-13 13:07:36',
logistics_code: '',
logistics_name: '',
express_code: '',
supplier_code: '',
supplier_name: '',
source_type: 'QM',
order_status: 'COMPLETED',
sync_status: 'SUCCESS',
warehouse_id: 100000,
store_id: 1000016,
store_name: '花颜物语',
warehouse_name: '天豹2',
status: '已完成'
},
{
id: 93,
entry_order_code: '2885-2011043642256453634',
order_type: 'CGRK',
purchase_order_code: '',
total_order_lines: 1,
order_create_time: '2026-01-13 13:17:13',
expect_start_time: '2026-01-13 13:17:13',
expect_end_time: '2026-01-13 13:17:13',
logistics_code: '',
logistics_name: '',
express_code: '',
supplier_code: '',
supplier_name: '',
source_type: 'QM',
order_status: 'COMPLETED',
sync_status: 'SUCCESS',
warehouse_id: 100000,
store_id: 1000016,
store_name: '花颜物语',
warehouse_name: '天豹2',
status: '已完成'
},
{
id: 95,
entry_order_code: 'CGW2601201120',
order_type: 'CGRK',
purchase_order_code: '',
total_order_lines: 1,
order_create_time: '2026-01-20 12:48:05',
expect_start_time: '2026-01-20 12:52:34',
expect_end_time: '2026-01-20 12:52:34',
logistics_code: '',
logistics_name: '',
express_code: '',
supplier_code: '0004',
supplier_name: 'NBBT30',
source_type: 'QM',
order_status: 'COMPLETED',
sync_status: 'SUCCESS',
warehouse_id: 100000,
store_id: 1000016,
store_name: '花颜物语',
warehouse_name: '天豹2',
status: '已完成'
},
{
id: 97,
entry_order_code: '2885-2021923981203890178',
order_type: 'CGRK',
purchase_order_code: '',
total_order_lines: 1,
order_create_time: '2026-02-12 12:27:01',
expect_start_time: '2026-02-12 12:27:01',
expect_end_time: '2026-02-12 12:27:01',
logistics_code: '',
logistics_name: '',
express_code: '',
supplier_code: '',
supplier_name: '',
source_type: 'QM',
order_status: 'CREATED',
sync_status: 'PENDING',
warehouse_id: 100000,
store_id: 1000016,
store_name: '花颜物语',
warehouse_name: '天豹2',
status: '待入库'
}
]
list.value = mockData
pagination.total = mockData.length
}
} catch (e) {
console.error('加载逻辑发生严重错误', e)
ElMessage.error('加载入库单失败')
} finally {
loading.value = false
queryTime.value = Date.now() - start
}
}
async function loadFilterData() {
try {
const [storesRes, presetRes]: any = await Promise.all([
indexApi.loadStores({ type: 'entry' }),
indexApi.fastWhereTree('entry')
])
if (storesRes && storesRes.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
if (f) f.options = storesRes.stores || []
}
if (presetRes && presetRes.code === 200) {
presetTree.value = presetRes.presetTree || []
}
} catch (e) {
console.error('加载筛选配置失败', e)
}
}
function handleConditionChange(condition: any) {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
pagination.currentPage = 1
if (scanBox.value?.reset) {
scanBox.value.reset()
}
loadData()
}
function onSelectionChange(rows: any[]) {
selectionRows.value = rows || []
hasSelection.value = selectionRows.value.length > 0
}
async function handleRowClick(row: any) {
selectedEntryId.value = row?.id || null
}
function handlePageChange(page: number) {
pagination.currentPage = page
loadData()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
function onQuickSearch() {
pagination.currentPage = 1
loadData()
}
function handleCreateEntry() {
ElMessage.info('新建入库单')
}
async function confirmBatchCancel() {
if (!selectionRows.value.length) {
ElMessage.warning('请先选择要作废的入库单')
return
}
try {
await ElMessageBox.confirm(`确定要批量作废 ${selectionRows.value.length} 个入库单吗?`, '确认', { type: 'warning' })
// 调用作废 API
ElMessage.success('操作成功')
loadData()
} catch (e) {}
}
async function handleExport() {
exportLoading.value = true
setTimeout(() => {
exportLoading.value = false
ElMessage.success('导出成功')
}, 1000)
}
function handleImport() {
ElMessage.info('导入功能')
}
</script>
<style scoped lang="scss">
.storage-entry-container {
display: flex;
height: calc(100vh - 130px);
width: 100%;
background-color: #f0f2f5;
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
.toolbar {
padding: 10px;
border-bottom: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
.toolbar-right {
display: flex;
gap: 15px;
align-items: center;
}
.upper-wrapper {
flex: 1;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.upper-table-container) {
height: 100%;
display: flex;
flex-direction: column;
}
.upper-wrapper :deep(.table-container) {
height: auto !important;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.upper-wrapper :deep(.el-table__body-wrapper) {
overflow: auto;
}
.lower-level {
flex: 1;
display: flex;
flex-direction: column;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
.detail-header {
padding: 0 10px;
border-bottom: 1px solid #ebeef5;
.detail-tab { margin-bottom: -1px; }
}
.detail-container {
flex: 1;
overflow: auto;
padding: 10px;
}
}
.no-selection {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
background-color: #fff;
.empty-tip { text-align: center; }
}
}
}
</style>

View File

@ -2,9 +2,8 @@
<div class="product-details"> <div class="product-details">
<div class="header-actions"> <div class="header-actions">
<div class="left-actions"> <div class="left-actions">
<el-button @click="loadProductData">刷新</el-button> <el-button type="primary">批量操作</el-button>
<el-button type="primary" disabled>批量操作</el-button> <el-button>导出</el-button>
<el-button disabled>导出</el-button>
</div> </div>
<div class="right-actions"> <div class="right-actions">
<!-- 可以在这里添加搜索框或其他操作 --> <!-- 可以在这里添加搜索框或其他操作 -->
@ -75,8 +74,8 @@
</KeepAlive> </KeepAlive>
</div> </div>
<div class="window-body-bottom"> <div class="window-body-bottom">
<el-button @click="resetForm" disabled>重置</el-button> <el-button @click="resetForm">重置</el-button>
<el-button type="primary" @click="saveProductDetail" disabled>保存</el-button> <el-button type="primary" @click="saveProductDetail">保存</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -84,8 +83,8 @@
<!-- <aside class="right-col"> <!-- <aside class="right-col">
<div class="right-panel"> <div class="right-panel">
<div class="panel-actions"> <div class="panel-actions">
<el-button disabled>重置</el-button> <el-button>重置</el-button>
<el-button type="primary" @click="handleSave" :loading="saveLoading" disabled> <el-button type="primary" @click="handleSave" :loading="saveLoading">
保存 保存
</el-button> </el-button>
</div> </div>
@ -95,7 +94,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, onUnmounted, computed, reactive, watch } from 'vue' import { ref, onMounted, onUnmounted, computed, reactive } from 'vue'
import { productdetail,productquick,productsnapshop,windowtopbar } from '../receiving-config' import { productdetail,productquick,productsnapshop,windowtopbar } from '../receiving-config'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { FullScreen, Close, CopyDocument } from '@element-plus/icons-vue' import { FullScreen, Close, CopyDocument } from '@element-plus/icons-vue'
@ -105,128 +104,7 @@ import basic from '../window/basic.vue'
import log from '../window/log.vue' import log from '../window/log.vue'
import product from '../window/product.vue' import product from '../window/product.vue'
const props = defineProps<{ const props = defineProps<{ id?: string | number }>()
id?: string | number,
productData?: any[],
loading?: boolean,
productTotal?: number
}>()
// 模拟数据
// const mockProductData = [
// {
// id: 1,
// receiving_number: 'RCV202601180001',
// item_name: '商品A - 测试商品',
// barcodes: '6901234567890',
// product_snapshot: '{"id": null, "name": "商品A - 测试商品", "barcode": "6901234567890", "spec": "500g/袋"}',
// system_product_id: null,
// actual_quantity: 20,
// box_quantity: 2,
// boxes_per_pallet: 10,
// pallet_quantity: 0,
// receiving_time: '2026-01-18 22:43:42',
// receiving_status_display: '已完成',
// storage_status: '未入库',
// stored_quantity: 0,
// batch_number: 'BATCH20231215A',
// production_date: '2023-12-01',
// expiry_date: '2024-12-01',
// remark: '商品A测试明细 - 未匹配',
// box_length: 40,
// box_width: 30,
// box_height: 25,
// weight: 10.5,
// space_id: 'A-01-01',
// creator_id: 'EMP001',
// updated_at_display: '2026-01-18 22:43:42',
// created_at_display: '2026-01-18 22:43:42'
// },
// {
// id: 2,
// receiving_number: 'RCV202601180001',
// item_name: '商品B - 进口商品',
// barcodes: '8801234567890',
// product_snapshot: '{"id": null, "name": "商品B - 进口商品", "barcode": "8801234567890", "origin": "日本", "spec": "1kg/盒"}',
// system_product_id: null,
// actual_quantity: 15,
// box_quantity: 1,
// boxes_per_pallet: 15,
// pallet_quantity: 1,
// receiving_time: '2026-01-18 22:43:42',
// receiving_status_display: '已完成',
// storage_status: '未入库',
// stored_quantity: 0,
// batch_number: 'BATCH20231215B',
// production_date: '2023-11-15',
// expiry_date: '2024-11-15',
// remark: '商品B测试明细 - 未匹配',
// box_length: 50,
// box_width: 40,
// box_height: 30,
// weight: 15.0,
// space_id: 'B-02-05',
// creator_id: 'EMP001',
// updated_at_display: '2026-01-18 22:43:42',
// created_at_display: '2026-01-18 22:43:42'
// },
// {
// id: 3,
// receiving_number: 'RCV202601180001',
// item_name: '商品C - 电子商品',
// barcodes: '4901234567890',
// product_snapshot: '{"id": null, "name": "商品C - 电子商品", "barcode": "4901234567890", "brand": "索尼", "model": "X-100"}',
// system_product_id: 152656,
// actual_quantity: 15,
// box_quantity: 2,
// boxes_per_pallet: 8,
// pallet_quantity: 1,
// receiving_time: '2026-01-18 21:43:42',
// receiving_status_display: '已完成',
// storage_status: '部分入库',
// stored_quantity: 5,
// batch_number: 'BATCH20231215C',
// production_date: '2023-10-01',
// expiry_date: '2025-10-01',
// remark: '商品C测试明细 - 未匹配',
// box_length: 30,
// box_width: 20,
// box_height: 15,
// weight: 5.2,
// space_id: 'C-01-12',
// creator_id: 'EMP001',
// updated_at_display: '2026-01-18 22:43:42',
// created_at_display: '2026-01-18 22:43:42'
// },
// {
// id: 48,
// receiving_number: 'RCV2026020100002',
// item_name: 'MOODAMOR绮梦茉莉香型香水',
// barcodes: '6942233906190',
// product_snapshot: '{"store_id":1000166,"store_name":"花颜物语","updated_at":"2026-02-02T08:37:06.691Z"}',
// system_product_id: null,
// actual_quantity: 1000,
// box_quantity: 10,
// boxes_per_pallet: 100,
// pallet_quantity: 20,
// receiving_time: '2026-02-02 07:10:26',
// receiving_status_display: '收货中',
// storage_status: '未入库',
// stored_quantity: 0,
// batch_number: '20260202',
// production_date: '2025-12-01',
// expiry_date: '2028-12-01',
// remark: '1561534',
// box_length: 45,
// box_width: 35,
// box_height: 30,
// weight: 12.8,
// space_id: 'D-05-01',
// creator_id: 'EMP030',
// updated_at_display: '2026-02-02 13:24:43',
// created_at_display: '2026-02-02 07:10:26'
// }
// ]
const tableData = ref<any[]>([]) const tableData = ref<any[]>([])
const multipleSelection = ref<any[]>([]) const multipleSelection = ref<any[]>([])
@ -241,53 +119,16 @@ const pagination = reactive({
const queryTime = ref(0) const queryTime = ref(0)
// 监听外部数据变化
watch(() => props.productData, (newVal) => {
if (newVal && newVal.length > 0) {
tableData.value = [...newVal]
pagination.total = props.productTotal || newVal.length
} else if (!props.loading) {
// 只有在非加载状态下且没有数据时才使用模拟数据
// tableData.value = [...mockProductData]
// pagination.total = mockProductData.length
}
}, { immediate: true })
const emit = defineEmits(['page-change', 'page-size-change', 'refresh-product'])
const handlePageSizeChange = (val: number) => { const handlePageSizeChange = (val: number) => {
pagination.pageSize = val pagination.pageSize = val
emit('page-size-change', val) // 这里可以重新请求接口获取数据
} }
const handlePageChange = (val: number) => { const handlePageChange = (val: number) => {
pagination.currentPage = val pagination.currentPage = val
emit('page-change', val) // 这里可以重新请求接口获取数据
} }
const loadProductData = () => {
// 请求父组件刷新商品数据
emit('refresh-product')
}
// 监听 props.loading
watch(() => props.loading, (val) => {
if (!val && (!props.productData || props.productData.length === 0)) {
// tableData.value = [...mockProductData]
// pagination.total = mockProductData.length
}
})
// 监听 props.productTotal
watch(() => props.productTotal, (val) => {
if (val !== undefined) {
pagination.total = val
}
})
const handleRowClick = (row: any) => { const handleRowClick = (row: any) => {
currentRow.value = row currentRow.value = row
} }
@ -402,6 +243,122 @@ const saveProductDetail = async () => {
} }
} }
// 模拟数据
const mockProductData = [
{
id: 1,
receiving_number: 'RCV202601180001',
item_name: '商品A - 测试商品',
barcodes: '6901234567890',
product_snapshot: '{"id": null, "name": "商品A - 测试商品", "barcode": "6901234567890", "spec": "500g/袋"}',
system_product_id: null,
actual_quantity: 20,
box_quantity: 2,
boxes_per_pallet: 10,
pallet_quantity: 0,
receiving_time: '2026-01-18 22:43:42',
receiving_status_display: '已完成',
storage_status: '未入库',
stored_quantity: 0,
batch_number: 'BATCH20231215A',
production_date: '2023-12-01',
expiry_date: '2024-12-01',
remark: '商品A测试明细 - 未匹配',
box_length: 40,
box_width: 30,
box_height: 25,
weight: 10.5,
space_id: 'A-01-01',
creator_id: 'EMP001',
updated_at_display: '2026-01-18 22:43:42',
created_at_display: '2026-01-18 22:43:42'
},
{
id: 2,
receiving_number: 'RCV202601180001',
item_name: '商品B - 进口商品',
barcodes: '8801234567890',
product_snapshot: '{"id": null, "name": "商品B - 进口商品", "barcode": "8801234567890", "origin": "日本", "spec": "1kg/盒"}',
system_product_id: null,
actual_quantity: 15,
box_quantity: 1,
boxes_per_pallet: 15,
pallet_quantity: 1,
receiving_time: '2026-01-18 22:43:42',
receiving_status_display: '已完成',
storage_status: '未入库',
stored_quantity: 0,
batch_number: 'BATCH20231215B',
production_date: '2023-11-15',
expiry_date: '2024-11-15',
remark: '商品B测试明细 - 未匹配',
box_length: 50,
box_width: 40,
box_height: 30,
weight: 15.0,
space_id: 'B-02-05',
creator_id: 'EMP001',
updated_at_display: '2026-01-18 22:43:42',
created_at_display: '2026-01-18 22:43:42'
},
{
id: 3,
receiving_number: 'RCV202601180001',
item_name: '商品C - 电子商品',
barcodes: '4901234567890',
product_snapshot: '{"id": null, "name": "商品C - 电子商品", "barcode": "4901234567890", "brand": "索尼", "model": "X-100"}',
system_product_id: 152656,
actual_quantity: 15,
box_quantity: 2,
boxes_per_pallet: 8,
pallet_quantity: 1,
receiving_time: '2026-01-18 21:43:42',
receiving_status_display: '已完成',
storage_status: '部分入库',
stored_quantity: 5,
batch_number: 'BATCH20231215C',
production_date: '2023-10-01',
expiry_date: '2025-10-01',
remark: '商品C测试明细 - 未匹配',
box_length: 30,
box_width: 20,
box_height: 15,
weight: 5.2,
space_id: 'C-01-12',
creator_id: 'EMP001',
updated_at_display: '2026-01-18 22:43:42',
created_at_display: '2026-01-18 22:43:42'
},
{
id: 48,
receiving_number: 'RCV2026020100002',
item_name: 'MOODAMOR绮梦茉莉香型香水',
barcodes: '6942233906190',
product_snapshot: '{"store_id":1000166,"store_name":"花颜物语","updated_at":"2026-02-02T08:37:06.691Z"}',
system_product_id: null,
actual_quantity: 1000,
box_quantity: 10,
boxes_per_pallet: 100,
pallet_quantity: 20,
receiving_time: '2026-02-02 07:10:26',
receiving_status_display: '收货中',
storage_status: '未入库',
stored_quantity: 0,
batch_number: '20260202',
production_date: '2025-12-01',
expiry_date: '2028-12-01',
remark: '1561534',
box_length: 45,
box_width: 35,
box_height: 30,
weight: 12.8,
space_id: 'D-05-01',
creator_id: 'EMP030',
updated_at_display: '2026-02-02 13:24:43',
created_at_display: '2026-02-02 07:10:26'
}
]
const handleSave = async () => { const handleSave = async () => {
try { try {
saveLoading.value = true saveLoading.value = true
@ -416,13 +373,8 @@ const handleSave = async () => {
} }
onMounted(() => { onMounted(() => {
if (props.productData && props.productData.length > 0) { tableData.value = [...mockProductData]
tableData.value = [...props.productData] pagination.total = mockProductData.length
pagination.total = props.productData.length
} else if (!props.loading) {
// tableData.value = [...mockProductData]
// pagination.total = mockProductData.length
}
window.addEventListener('click', closeMenu) window.addEventListener('click', closeMenu)
}) })
@ -546,8 +498,8 @@ onUnmounted(() => {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
height: 40px; height: 35px;
background-color: rgb(235, 235, 235); background-color: antiquewhite;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }

View File

@ -105,17 +105,7 @@
<div class="detail-container"> <div class="detail-container">
<KeepAlive> <KeepAlive>
<component <component :is="activeComponent" :id="selectedReceivingId" :row="selectedRow" @refresh="loadData" />
:is="activeComponent"
:id="selectedReceivingId"
:row="selectedRow"
:product-data="productData"
:product-total="productTotal"
:loading="productLoading"
@refresh-product="loadProductData"
@page-change="handleProductPageChange"
@page-size-change="handleProductSizeChange"
/>
</KeepAlive> </KeepAlive>
</div> </div>
</div> </div>
@ -265,69 +255,8 @@ function onSelectionChange(rows: any[]) {
hasSelection.value = selectionRows.value.length > 0 hasSelection.value = selectionRows.value.length > 0
} }
const productData = ref<any[]>([]) function handleRowClick(row: any) {
const productLoading = ref(false)
const productTotal = ref(0)
const productPagination = reactive({ currentPage: 1, pageSize: 20 })
async function handleRowClick(row: any) {
selectedReceivingId.value = row?.id || null selectedReceivingId.value = row?.id || null
if (!selectedReceivingId.value) {
productData.value = []
productTotal.value = 0
return
}
// 重置分页
productPagination.currentPage = 1
loadProductData()
}
async function loadProductData() {
productLoading.value = true
const start = Date.now()
try {
const params = {
id: selectedReceivingId.value,
pagination: {
page: productPagination.currentPage,
pageSize: productPagination.pageSize
}
}
const res: any = await receivingApi.getReceivingDetail(params)
if (res && res.code === 200 && res.data) {
// 这里的路径需要匹配实际返回的数据结构 res.data.receiving.details
const receivingData = res.data.receiving || {}
if (Array.isArray(receivingData.details)) {
productData.value = receivingData.details
productTotal.value = receivingData.pagination?.total || receivingData.details.length || 0
} else {
// 兼容处理
productData.value = []
productTotal.value = 0
}
} else {
productData.value = []
productTotal.value = 0
}
} catch (e) {
console.error('获取收货单详情失败', e)
productData.value = []
productTotal.value = 0
} finally {
productLoading.value = false
// queryTime.value = Date.now() - start // 这里queryTime是给主表的,子表可能需要单独传
}
}
function handleProductPageChange(page: number) {
productPagination.currentPage = page
loadProductData()
}
function handleProductSizeChange(size: number) {
productPagination.pageSize = size
productPagination.currentPage = 1
loadProductData()
} }
function handlePageChange(page: number) { function handlePageChange(page: number) {

View File

@ -175,12 +175,6 @@ export const availableFields = [
} }
] ]
export const addReceving = [
{ prop: 'receiving_number', label: '收货单号', type: 'input' },
]
// 详情面板表单配置 // 详情面板表单配置
export const detailpanel = [ export const detailpanel = [
{ prop: 'receiving_number', label: '收货单号', type: 'input', disabled: true }, { prop: 'receiving_number', label: '收货单号', type: 'input', disabled: true },
@ -209,17 +203,17 @@ export const productsnapshop = [
] ]
export const productdetail = [ export const productdetail = [
{ prop: 'id', label: 'ID', width: '100' }, { prop: 'receiving_number', label: '收货单号', width: '160', fixed: 'left' },
{ prop: 'product_name', label: '商品名称', width: '160', fixed: 'left' }, { prop: 'item_name', label: '商品名称', width: '160', fixed: 'left' },
{ prop: 'barcode', label: '商品条码', width: '160' }, { prop:'barcodes',label: '商品条码',width:'160' },
{ prop: 'product_snapshot', label: '商品信息快照', width: '160' }, { prop: 'product_snapshot', label: '商品信息快照', width: '160' },
{ prop: 'system_product_id', label: '关联系统商品ID', width: '160' }, { prop: 'system_product_id', label: '关联系统商品ID', width: '160' },
{ prop: 'actual_quantity', label: '实际收货数量', width: '160' }, { prop:'actual_quantity',label: '实际收货数量',width:'160' },
{ prop: 'box_quantity', label: '箱数', width: '160' }, { prop: 'box_quantity', label: '箱数', width: '160' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '160' }, { prop:'boxes_per_pallet',label: '箱规',width:'160' },
{ prop: 'pallet_quantity', label: '托盘数', width: '160' }, { prop: 'pallet_quantity', label: '托盘数', width: '160' },
{ prop: 'receiving_time', label: '收货时间', width: '160' }, { prop: 'receiving_time', label: '收货时间', width: '160' },
{ prop: 'receiving_status', label: '收货状态', width: '160' }, { prop: 'receiving_status_display', label: '收货状态', width: '160' },
{ prop: 'storage_status', label: '入库状态', width: '160' }, { prop: 'storage_status', label: '入库状态', width: '160' },
{ prop: 'stored_quantity', label: '已入库数量', width: '160' }, { prop: 'stored_quantity', label: '已入库数量', width: '160' },
{ prop: 'batch_number', label: '批次号', width: '160' }, { prop: 'batch_number', label: '批次号', width: '160' },
@ -232,15 +226,14 @@ export const productdetail = [
{ prop: 'weight', label: '重量', width: '160' }, { prop: 'weight', label: '重量', width: '160' },
{ prop: 'space_id', label: '存放位置', width: '160' }, { prop: 'space_id', label: '存放位置', width: '160' },
{ prop: 'creator_id', label: '创建人ID', width: '160' }, { prop: 'creator_id', label: '创建人ID', width: '160' },
{ prop: 'updated_at', label: '更新时间', width: '160' }, { prop: 'updated_at_display', label: '更新时间', width: '160' },
{ prop: 'created_at', label: '创建时间', width: '160' }, { prop: 'created_at_display', label: '创建时间', width: '160' },
] ]
export const productquick = [ export const productquick = [
{ prop: 'id', label: 'ID', width: '100' }, { prop: 'receiving_number', label: '收货单号', width: '160', fixed: 'left' },
{ prop: 'product_name', label: '商品名称', width: '160', fixed: 'left' }, { prop: 'item_name', label: '商品名称', width: '160', fixed: 'left' },
{ prop: 'barcode', label: '条码', width: '160' }, { prop:'actual_quantity',label: '实际收货数量',width:'160' },
{ prop: 'actual_quantity', label: '实际收货数量', width: '160' },
{ prop: 'box_quantity', label: '箱数', width: '160' }, { prop: 'box_quantity', label: '箱数', width: '160' },
{ prop: 'storage_status', label: '入库状态', width: '160' }, { prop: 'storage_status', label: '入库状态', width: '160' },
{ prop: 'remark', label: '备注', width: '160' }, { prop: 'remark', label: '备注', width: '160' },

View File

@ -1,9 +0,0 @@
<template>
<div class="">
<h1>库存管理</h1>
</div>
</template>
<script setup lang="ts"></script>
<style lang="css" scoped></style>

View File

@ -1,505 +0,0 @@
<template>
<div class="property-form">
<div class="form-header">
<h3>{{ title }}</h3>
<el-button
v-if="showAddButton"
type="primary"
size="small"
icon="el-icon-plus"
@click="handleAddProperty"
>
添加属性
</el-button>
</div>
<!-- 属性列表 -->
<el-table
v-if="propertyList.length > 0"
:data="propertyList"
style="width: 100%; margin-bottom: 20px;"
border
stripe
size="small"
>
<el-table-column
prop="name"
label="属性名称"
min-width="150"
>
<template #default="{ row }">
<el-input
v-if="row.editing"
v-model="row.name"
size="small"
/>
<span v-else>{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column
prop="type"
label="属性类型"
min-width="120"
>
<template #default="{ row }">
<el-select
v-if="row.editing"
v-model="row.type"
size="small"
style="width: 100%;"
>
<el-option label="文本" value="text" />
<el-option label="数字" value="number" />
<el-option label="日期" value="date" />
<el-option label="选项" value="select" />
<el-option label="布尔" value="boolean" />
</el-select>
<span v-else>{{ getTypeLabel(row.type) }}</span>
</template>
</el-table-column>
<el-table-column
prop="description"
label="描述"
min-width="200"
>
<template #default="{ row }">
<el-input
v-if="row.editing"
v-model="row.description"
type="textarea"
:rows="1"
size="small"
/>
<span v-else>{{ row.description || '--' }}</span>
</template>
</el-table-column>
<el-table-column
prop="required"
label="必填"
min-width="80"
align="center"
>
<template #default="{ row }">
<el-checkbox
v-if="row.editing"
v-model="row.required"
:disabled="row.system"
/>
<span v-else>
<el-tag
v-if="row.required"
type="danger"
size="small"
>是</el-tag>
<el-tag
v-else
type="info"
size="small"
>否</el-tag>
</span>
</template>
</el-table-column>
<el-table-column
prop="system"
label="系统属性"
min-width="100"
align="center"
>
<template #default="{ row }">
<el-tag
v-if="row.system"
type="warning"
size="small"
>是</el-tag>
<span v-else>--</span>
</template>
</el-table-column>
<el-table-column
label="操作"
width="180"
align="center"
fixed="right"
>
<template #default="{ row }">
<template v-if="!row.system">
<el-button
v-if="row.editing"
type="success"
size="mini"
@click="saveProperty(row)"
>保存</el-button>
<el-button
v-else
type="primary"
size="mini"
@click="editProperty(row)"
>编辑</el-button>
<el-button
v-if="!row.editing"
type="danger"
size="mini"
@click="deleteProperty(row)"
>删除</el-button>
<el-button
v-else
type="warning"
size="mini"
@click="cancelEdit(row)"
>取消</el-button>
</template>
<span v-else>--</span>
</template>
</el-table-column>
</el-table>
<!-- 空状态 -->
<el-empty
v-else
:description="emptyText"
:image-size="100"
/>
<!-- 添加属性对话框 -->
<el-dialog
title="添加属性"
v-model:visible="addDialogVisible"
width="500px"
@close="resetAddForm"
>
<el-form
ref="addFormRef"
:model="addForm"
:rules="addFormRules"
label-width="100px"
>
<el-form-item label="属性名称" prop="name">
<el-input
v-model="addForm.name"
placeholder="请输入属性名称"
/>
</el-form-item>
<el-form-item label="属性类型" prop="type">
<el-select
v-model="addForm.type"
placeholder="请选择属性类型"
style="width: 100%;"
>
<el-option label="文本" value="text" />
<el-option label="数字" value="number" />
<el-option label="日期" value="date" />
<el-option label="选项" value="select" />
<el-option label="布尔" value="boolean" />
</el-select>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input
v-model="addForm.description"
type="textarea"
:rows="3"
placeholder="请输入属性描述"
/>
</el-form-item>
<el-form-item label="是否必填" prop="required">
<el-switch
v-model="addForm.required"
active-text="是"
inactive-text="否"
/>
</el-form-item>
<!-- 如果是选项类型,显示选项设置 -->
<el-form-item
v-if="addForm.type === 'select'"
label="选项值"
prop="options"
>
<div
v-for="(option, index) in addForm.options"
:key="index"
style="display: flex; align-items: center; margin-bottom: 10px;"
>
<el-input
v-model="option.label"
placeholder="选项标签"
style="margin-right: 10px; flex: 1;"
/>
<el-input
v-model="option.value"
placeholder="选项值"
style="flex: 1;"
/>
<el-button
v-if="addForm.options.length > 1"
type="text"
icon="el-icon-delete"
@click="removeOption(Number(index))"
/>
</div>
<el-button
type="text"
icon="el-icon-plus"
@click="addOption"
>
添加选项
</el-button>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitAddForm">确 定</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
const props = defineProps({
title: { type: String, default: '属性管理' },
spaceId: { type: [String, Number], default: null },
showAddButton: { type: Boolean, default: true }
})
// 数据
const propertyList = ref<any[]>([
{
id: 1,
name: '名称',
type: 'text',
description: '空间名称',
required: true,
system: true,
editing: false
},
{
id: 2,
name: '编号',
type: 'text',
description: '空间编号',
required: true,
system: true,
editing: false
}
])
const addDialogVisible = ref(false)
const addForm = reactive<any>({
name: '',
type: 'text',
description: '',
required: false,
options: [{ label: '', value: '' }]
})
const addFormRules = reactive({
name: [
{ required: true, message: '请输入属性名称', trigger: 'blur' },
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择属性类型', trigger: 'change' }
]
})
const addFormRef = ref(null)
const emptyText = computed(() => '暂无属性数据,点击"添加属性"按钮创建')
// 监听 spaceId
watch(() => props.spaceId, (newVal) => {
if (newVal) {
loadProperties()
}
}, { immediate: true })
// 方法
async function loadProperties() {
try {
if (props.spaceId) {
propertyList.value.push({
id: Date.now(),
name: '自定义属性',
type: 'text',
description: '用户自定义属性',
required: false,
system: false,
editing: false
})
}
} catch (error) {
ElMessage.error('加载属性数据失败')
console.error('加载属性数据失败:', error)
}
}
function handleAddProperty() {
addDialogVisible.value = true
}
function submitAddForm() {
if (!addFormRef.value) return
;(addFormRef.value as any).validate().then(async () => {
try {
const newProperty = {
id: Date.now(),
name: addForm.name,
type: addForm.type,
description: addForm.description,
required: addForm.required,
system: false,
editing: false,
options: addForm.type === 'select' ? [...addForm.options] : null
}
propertyList.value.push(newProperty)
ElMessage.success('添加属性成功')
addDialogVisible.value = false
} catch (error) {
ElMessage.error('添加属性失败')
console.error('添加属性失败:', error)
}
}).catch(() => {})
}
function editProperty(property: any) {
property.editing = true
property.originalData = { ...property }
}
async function saveProperty(property: any) {
try {
property.editing = false
delete property.originalData
ElMessage.success('保存成功')
} catch (error) {
ElMessage.error('保存失败')
console.error('保存失败:', error)
}
}
function cancelEdit(property: any) {
if (property.originalData) {
Object.assign(property, property.originalData)
delete property.originalData
}
property.editing = false
}
function deleteProperty(property: any) {
ElMessageBox.confirm('确定删除该属性吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
try {
const index = propertyList.value.findIndex(item => item.id === property.id)
if (index > -1) {
propertyList.value.splice(index, 1)
}
ElMessage.success('删除成功')
} catch (error) {
ElMessage.error('删除失败')
console.error('删除失败:', error)
}
}).catch(() => {})
}
function getTypeLabel(type: string) {
const typeMap: any = {
text: '文本',
number: '数字',
date: '日期',
select: '选项',
boolean: '布尔'
}
return typeMap[type] || type
}
function addOption() {
addForm.options.push({ label: '', value: '' })
}
function removeOption(index: number) {
addForm.options.splice(index, 1)
}
function resetAddForm() {
if (addFormRef.value) {
;(addFormRef.value as any).resetFields()
}
addForm.options = [{ label: '', value: '' }]
}
function getProperties() {
return propertyList.value.map(item => ({
id: item.id,
name: item.name,
type: item.type,
description: item.description,
required: item.required,
system: item.system,
options: item.options
}))
}
defineExpose({ getProperties })
</script>
<style scoped lang="scss">
.property-form {
height: 100%;
display: flex;
flex-direction: column;
.form-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #ebeef5;
h3 {
margin: 0;
font-size: 16px;
font-weight: 600;
color: #303133;
}
}
.el-table {
flex: 1;
overflow: auto;
::v-deep .el-table__body-wrapper {
overflow: auto;
}
}
.el-empty {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
}
// 对话框样式调整
::v-deep .el-dialog__body {
padding: 20px;
max-height: 60vh;
overflow-y: auto;
}
</style>

View File

@ -1,519 +0,0 @@
<template>
<div class="property-form">
<!-- 标题栏 -->
<div class="form-header">
<div class="space-info">
<el-tag type="success" size="small">
仓位编码: {{ formData.space_code }}
</el-tag>
<el-tag :type="getStatusTagType(formData.space_status)" size="small">
{{ getStatusText(formData.space_status) }}
</el-tag>
<el-tag v-if="formData.is_enabled === 0" type="danger" size="small">
已禁用
</el-tag>
</div>
<el-button-group>
<el-button type="primary" size="small" icon="el-icon-edit" @click="handleEdit" :disabled="!props.spaceId || loading">
{{ isEditing ? '保存修改' : '编辑属性' }}
</el-button>
<el-button v-if="isEditing" type="warning" size="small" icon="el-icon-refresh" @click="handleCancel">
取消编辑
</el-button>
</el-button-group>
</div>
<!-- 表单内容 -->
<el-form v-if="props.spaceId" ref="propertyFormRef" :model="formData" :rules="formRules" label-width="100px"
:disabled="!isEditing" size="small" class="property-form-content">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="自定义名称" prop="custom_name">
<el-input v-model="formData.custom_name" placeholder="请输入自定义名称" :maxlength="100" show-word-limit />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="自定义条码" prop="custom_barcode">
<el-input v-model="formData.custom_barcode" placeholder="请输入自定义条码" :maxlength="100" show-word-limit
@blur="handleBarcodeBlur" @input="handleBarcodeInput" clearable />
<div class="form-tip">
<span v-if="barcodeLoading">
<i class="el-icon-loading"></i> 正在检测条码...
</span>
<span v-else-if="barcodeError" class="error">
<i class="el-icon-error"></i> {{ barcodeError }}
</span>
<span v-else-if="barcodeValid" class="success">
<i class="el-icon-success"></i> 条码可用
</span>
<span v-else>可用于扫码识别</span>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓位类型" prop="location_type_id">
<el-select v-model="formData.location_type_id" placeholder="请选择仓位类型" style="width: 100%;"
:loading="typeLoading">
<el-option v-for="type in locationTypes" :key="type.id" :label="type.type_name" :value="type.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="拣货顺序" prop="pick_sequence">
<el-input-number v-model="formData.pick_sequence" placeholder="拣货顺序" :step="1" :min="0" :max="9999"
style="width: 100%;" controls-position="right" />
<div class="form-tip">数值越小越优先</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="启用状态" prop="is_enabled">
<el-switch v-model="formData.is_enabled" :active-value="1" :inactive-value="0" active-text="启用"
inactive-text="禁用" :disabled="!isEditing || formData.space_status === 'OCCUPIED'" />
<div v-if="formData.space_status === 'OCCUPIED'" class="form-tip error">
仓位被占用时不可禁用
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 空状态 -->
<div v-if="!loading && !props.spaceId" class="empty-state">
<el-empty description="请先选择仓位" :image-size="100" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, watch, onMounted, onBeforeUnmount, getCurrentInstance, } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import * as warehouseApi from '@/api/warehouse'
const props = defineProps({
title: { type: String, default: '仓位属性管理' },
spaceId: { type: [String, Number], default: null }
})
const emit = defineEmits(['spaceSave'])
// 表单相关
function getDefaultFormData() {
return {
id: null,
space_code: '',
custom_name: '',
custom_barcode: '',
location_type_id: null,
pick_sequence: 0,
is_enabled: 1,
space_status: 'AVAILABLE'
}
}
const formData = reactive<any>(getDefaultFormData())
let originalData: any = null
const isEditing = ref(false)
const loading = ref(false)
const saving = ref(false)
// 条码检测
const barcodeLoading = ref(false)
const barcodeValid = ref(false)
const barcodeError = ref('')
let barcodeCheckTimer: any = null
// 下拉
const locationTypes = ref<any[]>([])
const typeLoading = ref(false)
// 表单 ref & rules
const propertyFormRef = ref(null)
const formRules = {
custom_name: [{ max: 100, message: '长度不能超过100个字符', trigger: 'blur' }],
custom_barcode: [
{ max: 100, message: '长度不能超过100个字符', trigger: 'blur' },
{ validator: (rule:any, value:any, callback:any) => validateBarcode(rule, value, callback), trigger: 'blur' }
],
location_type_id: [{ required: true, message: '请选择仓位类型', trigger: 'change' }],
pick_sequence: [{ type: 'number', min: 0, max: 9999, message: '拣货顺序必须在0-9999之间', trigger: 'blur' }]
}
// 监听 props.spaceId
watch(() => props.spaceId, (newId) => {
if (newId) {
loadSpaceData(newId)
} else {
resetForm()
}
}, { immediate: true })
// 监听 is_enabled 和 space_status 的变化
watch(() => formData.is_enabled, (newValue) => {
if (isEditing.value) {
if (newValue === 1) {
formData.space_status = 'AVAILABLE'
} else if (newValue === 0) {
formData.space_status = 'DISABLED'
}
}
})
watch(() => formData.space_status, (newValue) => {
if (isEditing.value && newValue === 'OCCUPIED') {
formData.is_enabled = 1
}
})
onMounted(() => {
loadLocationTypes()
})
onBeforeUnmount(() => {
if (barcodeCheckTimer) clearTimeout(barcodeCheckTimer)
})
// 获取状态标签样式与文字
function getStatusTagType(status: string) {
const map: any = {
'AVAILABLE': 'success',
'OCCUPIED': 'info',
'RESERVED': 'warning',
'MAINTENANCE': 'warning',
'DISABLED': 'danger'
}
return map[status] || 'info'
}
function getStatusText(status: string) {
const map: any = {
'AVAILABLE': '可用',
'OCCUPIED': '占用',
'RESERVED': '预留',
'MAINTENANCE': '维护中',
'DISABLED': '禁用'
}
return map[status] || status
}
// 加载仓位数据
async function loadSpaceData(spaceId: any) {
loading.value = true
isEditing.value = false
resetBarcodeStatus()
try {
const response: any = await warehouseApi.getSpaceInfo(spaceId)
if (response.code == 200) {
const data = response.data
const fd = {
id: data.id,
space_code: data.space_code || '',
custom_name: data.custom_name || '',
custom_barcode: data.custom_barcode || '',
location_type_id: data.location_type_id || null,
pick_sequence: data.pick_sequence || 0,
is_enabled: data.is_enabled === undefined ? 1 : data.is_enabled,
space_status: data.space_status || 'AVAILABLE'
}
if (fd.is_enabled === 0) {
fd.space_status = 'DISABLED'
} else if (fd.space_status === 'DISABLED') {
fd.is_enabled = 0
}
originalData = { ...fd }
Object.assign(formData, fd)
} else {
ElMessage.error(response.message || '加载仓位数据失败')
}
} catch (error) {
console.error('加载仓位数据失败:', error)
ElMessage.error('加载仓位数据失败')
} finally {
loading.value = false
}
}
// 加载仓位类型
async function loadLocationTypes() {
typeLoading.value = true
try {
locationTypes.value = [
{ id: 1, type_name: '普通仓位' },
{ id: 2, type_name: '拣货仓位' },
{ id: 3, type_name: '存储仓位' }
]
} catch (error) {
console.error('加载仓位类型失败:', error)
} finally {
typeLoading.value = false
}
}
// 条码输入/失去焦点/检测
function handleBarcodeInput() {
barcodeValid.value = false
barcodeError.value = ''
if (barcodeCheckTimer) clearTimeout(barcodeCheckTimer)
const barcode = formData.custom_barcode
if (barcode && barcode.length > 0) {
barcodeCheckTimer = setTimeout(() => { checkBarcodeUnique(barcode) }, 500)
}
}
function handleBarcodeBlur() {
const barcode = formData.custom_barcode
if (barcode && barcode.length > 0) {
checkBarcodeUnique(barcode)
}
}
async function checkBarcodeUnique(barcode: string) {
if (originalData && originalData.custom_barcode === barcode) {
barcodeValid.value = true
barcodeError.value = ''
return
}
if (!barcode || barcode.trim() === '') {
resetBarcodeStatus()
return
}
barcodeLoading.value = true
barcodeValid.value = false
barcodeError.value = ''
try {
const response: any = await warehouseApi.checkBarcodeUnique({ id: props.spaceId, barcode: barcode.trim() })
if (response.code == 200) {
const data = response.data
if (data.isUnique) {
barcodeValid.value = true
barcodeError.value = ''
} else {
barcodeValid.value = false
barcodeError.value = data.message || '该条码已被其他仓位使用'
}
} else {
barcodeValid.value = false
barcodeError.value = response.message || '条码检测失败'
}
} catch (error) {
console.error('条码检测失败:', error)
barcodeValid.value = false
barcodeError.value = '条码检测失败,请稍后重试'
} finally {
barcodeLoading.value = false
}
}
function resetBarcodeStatus() {
barcodeLoading.value = false
barcodeValid.value = false
barcodeError.value = ''
}
function validateBarcode(rule: any, value: any, callback: any) {
if (!value || value.trim() === '') { callback(); return }
const pattern = /^[A-Za-z0-9_-]+$/
if (!pattern.test(value)) { callback(new Error('条码只能包含字母、数字、下划线和短横线')); return }
if (value.length > 100) { callback(new Error('条码长度不能超过100个字符')); return }
if (barcodeLoading.value) { callback(new Error('正在检测条码唯一性...')); return }
if (!barcodeValid.value && barcodeError.value) { callback(new Error(barcodeError.value)); return }
callback()
}
// 编辑/保存/取消
function handleEdit() {
if (!isEditing.value) {
isEditing.value = true
originalData = { ...formData }
resetBarcodeStatus()
} else {
handleSave()
}
}
async function handleSave() {
let valid = true
try {
await (propertyFormRef.value as any).validate()
} catch (e) { valid = false }
if (!valid) {
ElMessage.warning('请检查表单填写是否正确')
return
}
const barcode = formData.custom_barcode
if (barcode && barcode.trim() !== '') {
if (originalData && originalData.custom_barcode !== barcode && !barcodeValid.value) {
if (!barcodeError.value) {
await checkBarcodeUnique(barcode)
if (!barcodeValid.value) { ElMessage.warning('请先完成条码检测'); return }
} else { ElMessage.warning(barcodeError.value); return }
}
}
if (formData.space_status === 'OCCUPIED' && formData.is_enabled === 0) {
ElMessage.warning('占用状态的仓位不可禁用')
return
}
saving.value = true
try {
const instance = getCurrentInstance()
const globalStore: any = instance?.appContext.config.globalProperties.$store
const userId = (globalStore && globalStore.state && globalStore.state.user && globalStore.state.user.userId) || 1
const submitData: any = {
id: formData.id,
custom_name: formData.custom_name,
custom_barcode: formData.custom_barcode,
location_type_id: formData.location_type_id,
pick_sequence: formData.pick_sequence,
is_enabled: formData.is_enabled,
space_status: formData.space_status,
updated_by: userId
}
const response: any = await warehouseApi.updateSpaceInfo(submitData)
if (response.code == 200) {
ElMessage.success('仓位属性保存成功')
isEditing.value = false
originalData = { ...formData }
emit('spaceSave', { ...formData })
} else {
ElMessage.error(response.message || '保存失败')
}
} catch (error) {
console.error('保存失败:', error)
ElMessage.error('保存失败')
} finally {
saving.value = false
}
}
function handleCancel() {
if (originalData) {
Object.assign(formData, originalData)
}
isEditing.value = false
resetBarcodeStatus()
ElMessage.info('已取消编辑')
}
function resetForm() {
Object.assign(formData, getDefaultFormData())
originalData = null
isEditing.value = false
resetBarcodeStatus()
if (propertyFormRef.value) (propertyFormRef.value as any).clearValidate()
}
async function refreshData() {
if (props.spaceId) {
await loadSpaceData(props.spaceId)
ElMessage.success('数据已刷新')
}
}
function getFormData() { return { ...formData } }
function reload() { if (props.spaceId) loadSpaceData(props.spaceId) }
function toggleEnabled(enabled: boolean) {
if (formData.space_status === 'OCCUPIED' && !enabled) {
ElMessage.warning('占用状态的仓位不可禁用')
return false
}
formData.is_enabled = enabled ? 1 : 0
formData.space_status = enabled ? 'AVAILABLE' : 'DISABLED'
return true
}
defineExpose({ getFormData, reload, refreshData, toggleEnabled })
</script>
<style scoped lang="scss">
.property-form {
height: 100%;
display: flex;
flex-direction: column;
.form-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding: 15px 0;
border-bottom: 1px solid #ebeef5;
.space-info {
flex: 1;
display: flex;
align-items: center;
gap: 8px;
}
}
.property-form-content {
flex: 1;
.el-form-item {
margin-bottom: 20px;
}
}
.loading-container {
flex: 1;
display: flex;
flex-direction: column;
padding: 20px;
}
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #909399;
}
.form-tip {
font-size: 12px;
margin-top: 4px;
line-height: 1.4;
display: flex;
align-items: center;
gap: 4px;
&.error {
color: #f56c6c;
}
.error {
color: #f56c6c;
}
.success {
color: #67c23a;
}
.el-icon-loading,
.el-icon-error,
.el-icon-success {
font-size: 14px;
}
}
}
</style>

View File

@ -1,280 +0,0 @@
<template>
<div class="rack-space-management">
<!-- 货架管理部分 -->
<div v-if="props.rack && props.rack.type === 'rack'" class="rack-management">
<!-- 仓位管理部分 -->
<el-card class="space-management-card">
<template #header>
<div class="card-header">
<span>仓位管理(货架{{ props.rack.name }})</span>
<span>
<el-button type="text" size="small" @click="handleAddSpace">
一键排列拣货路径
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
打印
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
修复货架
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
导出
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
导入批量修改
</el-button>
</span>
</div>
</template>
<!-- 仓位列表 -->
<el-table :data="rackSpaces" height="100%" style="width: 100%" @row-click="handleSpaceClick"
highlight-current-row :row-style="rowStyle" :cell-style="cellStyle">
<el-table-column type="selection"></el-table-column>
<el-table-column sortable prop="space_code" label="仓位编码" width="120" fixed="left"/>
<el-table-column prop="custom_name" label="自定义名称" width="120" />
<el-table-column prop="custom_barcode" label="自定义条码" width="150" />
<el-table-column prop="column_no" label="组" width="80" />
<el-table-column prop="row_no" label="层" width="80" />
<el-table-column prop="level_no" label="格" width="80" />
<el-table-column label="状态">
<template #default="{ row }">
<el-tag :type="spaceStatusStatus(row.space_status)" size="small">
{{ spaceStatusText(row.space_status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column sortable prop="pick_sequence" label="拣货顺序" width="100" fixed="right" />
</el-table>
<div class="info">
<span>货架/实际/可用/禁用:{{ calculateRackTotal() }}/{{ rackSpaces.length }}/{{ canUseSpacecCount }}/{{ canNotUseSpace }}</span>
<span>有存货的仓位数:{{ useSpaceCount }}</span>
</div>
</el-card>
</div>
<div v-else class="empty-rack-container">
<el-empty description="选择货架后查看信息" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch, computed, } from 'vue'
import * as warehouseApi from '@/api/warehouse'
import { ElMessage } from 'element-plus'
const props = defineProps({
rack: { type: Object, default: null },
warehouse: { type: Object, default: null },
zone: { type: Object, default: null }
})
const emit = defineEmits(['edit-warehouse','edit-zone','edit-rack','edit-space','space-click','refresh'])
const rackSpaces = ref<any[]>([])
const loading = ref(false)
const useSpaceCount = ref(0)
const canUseSpacecCount = ref(0)
const canNotUseSpace = ref(0)
watch(() => props.rack, (newVal) => {
console.log('货架信息', newVal)
if (newVal && newVal.type === 'rack') {
loadRackSpaces()
}
}, { immediate: true })
watch(() => props.warehouse, (newVal) => {
console.log('仓库信息', newVal)
}, { immediate: true })
function spaceStatusText(status: string) {
let text = ''
switch (status) {
case 'AVAILABLE': text = '可用'; break
case 'OCCUPIED': text = '可用/存货'; break
case 'DISABLED': text = '禁用'; break
}
return text
}
function spaceStatusStatus(status: string) {
let text = ''
switch (status) {
case 'AVAILABLE':
case 'OCCUPIED': text = 'success'; break
default: text = 'warning'; break
}
return text
}
function rowStyle() {
return { height: '30px' }
}
function cellStyle() {
return { padding: '0', textAlign: 'center' }
}
function calculateRackTotal() {
if (!props.rack) return 0
const { rackColumns = 1, rackRows = 1, rackLevels = 1 } = props.rack.data || {}
return rackColumns * rackRows * rackLevels
}
async function loadRackSpaces() {
if (!props.rack || props.rack.type !== 'rack') return
loading.value = true
try {
const response: any = await warehouseApi.getSpacesByRack(props.rack.id)
if (response.code === 200) {
rackSpaces.value = response.spaces || []
useSpaceCount.value = 0
canUseSpacecCount.value = 0
canNotUseSpace.value = 0
rackSpaces.value.forEach(item => {
switch (item.space_status) {
case 'AVAILABLE':
canUseSpacecCount.value++
break
case 'OCCUPIED':
canUseSpacecCount.value++
useSpaceCount.value++
break
default:
canNotUseSpace.value++
}
})
}
} catch (error) {
console.error('加载仓位失败:', error)
rackSpaces.value = []
} finally {
loading.value = false
}
}
function handleEditWarehouse() { emit('edit-warehouse', props.warehouse) }
function handleEditZone() { emit('edit-zone', props.zone) }
function handleEditRack() { emit('edit-rack', props.rack) }
async function handleAddSpace() {
if (!props.rack || props.rack.type !== 'rack') return
loading.value = true
try {
const response: any = await warehouseApi.createRackWithSpaces(props.rack.id)
if (response.code === 200) {
ElMessage.success('货架生成成功')
await loadRackSpaces()
}
} catch (error) {
console.error('加载仓位失败:', error)
rackSpaces.value = []
} finally {
loading.value = false
}
}
function handleEditSpace(space: any) { emit('edit-space', space) }
function handleSpaceClick(space: any) { emit('space-click', space) }
function refresh() {
if (props.rack && props.rack.type === 'rack') loadRackSpaces()
emit('refresh')
}
defineExpose({ loadRackSpaces, refresh })
</script>
<style scoped>
.rack-space-management {
display: flex;
flex-direction: column;
gap: 16px;
height: 425px;
width: 600px;
overflow: hidden;
.space-management-card {
display: flex;
flex-direction: column;
height: 100%;
:deep(.el-card__body) {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 10px;
}
}
.el-card__header {
flex-shrink: 0;
height: 40px;
line-height: 40px;
padding: 0 20px;
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
color: #303133;
}
}
.rack-management {
height: 100%;
display: flex;
flex-direction: column;
}
.el-table {
flex: 1;
width: 100%;
::v-deep .el-table__inner-wrapper {
height: 100% !important;
}
::v-deep .el-table__row {
cursor: pointer;
&:hover {
background-color: #f5f7fa;
}
}
}
.el-table td {
padding: 0;
}
.info {
flex-shrink: 0;
width: 100%;
height: 30px;
line-height: 30px;
font-size: 13px;
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 10px;
border-top: 1px solid #f0f0f0;
padding-top: 5px;
}
.empty-rack-container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 4px;
border: 1px solid #ebeef5;
}
}
</style>

View File

@ -1,171 +0,0 @@
<template>
<el-dialog
title="编辑仓位"
:visible="props.visible"
width="500px"
@close="handleClose"
>
<el-form
ref="formRef"
:model="formData"
:rules="rules"
label-width="100px"
size="small"
>
<el-form-item label="仓位编码">
<el-input v-model="formData.space_code" disabled />
</el-form-item>
<el-form-item label="位置">
<div class="position-display">
列{{ props.space.column_no }} 层{{ props.space.row_no }} 格{{ props.space.level_no }}
</div>
</el-form-item>
<el-form-item label="尺寸">
<div class="dimension-display">
<div>长: {{ props.space.length || '未设置' }}cm</div>
<div>宽: {{ props.space.width || '未设置' }}cm</div>
<div>高: {{ props.space.height || '未设置' }}cm</div>
</div>
</el-form-item>
<el-form-item label="承重限制" prop="max_weight">
<el-input-number
v-model="formData.max_weight"
:min="0"
:step="0.1"
style="width: 100%"
placeholder="最大承重(kg)"
/>
</el-form-item>
<el-form-item label="仓位状态" prop="space_status">
<el-select
v-model="formData.space_status"
placeholder="请选择状态"
style="width: 100%"
>
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否启用" prop="is_enabled">
<el-switch
v-model="formData.is_enabled"
:active-value="1"
:inactive-value="0"
/>
</el-form-item>
<el-form-item label="自定义名称">
<el-input
v-model="formData.custom_name"
placeholder="可选"
maxlength="100"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="saving">保存</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, watch } from 'vue'
import * as spaceApi from '@/api/warehouse'
import { ElMessage } from 'element-plus'
const props = defineProps({
visible: { type: Boolean, default: false },
space: { type: Object, required: true }
})
const emit = defineEmits(['close', 'saved'])
const formRef = ref(null)
const saving = ref(false)
const formData = reactive<any>({
id: null,
space_code: '',
custom_name: '',
custom_barcode: '',
max_weight: null,
space_status: 'AVAILABLE',
is_enabled: 1
})
const rules = {
space_status: [
{ required: true, message: '请选择状态', trigger: 'change' }
]
}
const statusOptions = [
{ value: 'AVAILABLE', label: '可用' },
{ value: 'OCCUPIED', label: '已占用' },
{ value: 'RESERVED', label: '已预留' },
{ value: 'MAINTENANCE', label: '维护中' },
{ value: 'DISABLED', label: '已禁用' }
]
watch(() => props.space, (newSpace) => {
if (newSpace) {
formData.id = newSpace.id
formData.space_code = newSpace.space_code
formData.custom_name = newSpace.custom_name || ''
formData.custom_barcode = newSpace.custom_barcode || ''
formData.max_weight = newSpace.max_weight
formData.space_status = newSpace.space_status
formData.is_enabled = newSpace.is_enabled ? 1 : 0
}
}, { immediate: true })
function handleClose() { emit('close') }
async function handleSubmit() {
try {
const valid = await (formRef.value as any).validate().catch(() => false)
if (!valid) return
saving.value = true
const response: any = await spaceApi.update(formData, formData.id)
if (response.code === 200) {
ElMessage.success('保存成功')
emit('saved')
} else {
ElMessage.error(response.message || '保存失败')
}
} catch (error) {
ElMessage.error('保存失败')
} finally {
saving.value = false
}
}
</script>
<style lang="scss" scoped>
.position-display {
display: flex;
gap: 16px;
font-size: 14px;
color: #606266;
}
.dimension-display {
display: flex;
flex-direction: column;
gap: 4px;
font-size: 14px;
color: #606266;
}
</style>

View File

@ -1,286 +0,0 @@
<template>
<div class="space-list">
<div class="section-header">
<span>仓位格子管理</span>
<div class="header-actions">
<el-button
type="primary"
size="mini"
@click="loadSpaces"
:loading="loading"
>
<i class="el-icon-refresh"></i>
</el-button>
<el-button
type="success"
size="mini"
@click="generateSpaces"
:loading="generating"
v-if="!spaces.length"
>
生成仓位
</el-button>
</div>
</div>
<!-- 仓位列表 -->
<div class="space-grid" v-if="spaces.length > 0">
<div class="grid-header">
<div class="grid-cell">列</div>
<div class="grid-cell">层</div>
<div class="grid-cell">格</div>
<div class="grid-cell">编码</div>
<div class="grid-cell">状态</div>
<div class="grid-cell">操作</div>
</div>
<div class="grid-body">
<div
v-for="space in sortedSpaces"
:key="space.id"
class="space-row"
:class="{
'selected': selectedSpaceId === space.id,
'occupied': space.space_status === 'OCCUPIED'
}"
@click="selectSpace(space)"
>
<div class="grid-cell">{{ space.column_no }}</div>
<div class="grid-cell">{{ space.row_no }}</div>
<div class="grid-cell">{{ space.level_no }}</div>
<div class="grid-cell">{{ space.space_code }}</div>
<div class="grid-cell">
<el-tag
size="mini"
:type="getStatusTag(space.space_status)"
>
{{ getStatusText(space.space_status) }}
</el-tag>
</div>
<div class="grid-cell">
<el-button
type="text"
size="mini"
@click.stop="editSpace(space)"
>
<i class="el-icon-edit"></i>
</el-button>
</div>
</div>
</div>
<!-- 分页 -->
<div class="pagination" v-if="spaces.length > pageSize">
<el-pagination
small
:current-page="currentPage"
:page-size="pageSize"
:total="spaces.length"
layout="prev, pager, next"
@current-change="handlePageChange"
/>
</div>
</div>
<!-- 空状态 -->
<div v-else class="empty-state">
<p>暂无仓位数据</p>
</div>
<!-- 仓位表单 -->
<space-form
v-if="showForm"
:space="currentSpace"
@close="closeForm"
@saved="handleSpaceSaved"
/>
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue'
import * as warehouseApi from '@/api/warehouse'
import SpaceForm from './SpaceForm.vue'
import { ElMessage } from 'element-plus'
const props = defineProps({ rackId: { type: [Number, String], required: true } })
const emit = defineEmits(['refresh'])
const spaces = ref<any[]>([])
const loading = ref(false)
const generating = ref(false)
const currentPage = ref(1)
const pageSize = ref(10)
const selectedSpaceId = ref<any>(null)
const showForm = ref(false)
const currentSpace = ref<any>(null)
const statusMap: any = {
'AVAILABLE': { tag: 'success', text: '可用' },
'OCCUPIED': { tag: 'warning', text: '占用' },
'RESERVED': { tag: 'info', text: '预留' },
'MAINTENANCE': { tag: 'danger', text: '维护' },
'DISABLED': { tag: 'info', text: '禁用' }
}
const sortedSpaces = computed(() => {
return [...spaces.value].sort((a, b) => {
const colA = parseInt(a.column_no) || 0
const colB = parseInt(b.column_no) || 0
if (colA !== colB) return colA - colB
const rowA = parseInt(a.row_no) || 0
const rowB = parseInt(b.row_no) || 0
if (rowA !== rowB) return rowA - rowB
const levelA = parseInt(a.level_no) || 0
const levelB = parseInt(b.level_no) || 0
return levelA - levelB
})
})
const paginatedSpaces = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
const end = start + pageSize.value
return sortedSpaces.value.slice(start, end)
})
async function loadSpaces() {
loading.value = true
try {
const response: any = await warehouseApi.getSpacesByRack(props.rackId)
if (response.code === 200) {
spaces.value = response.spaces || []
ElMessage.success(`加载了 ${spaces.value.length} 个仓位`)
}
} catch (error) {
ElMessage.error('加载仓位失败')
} finally {
loading.value = false
}
}
async function generateSpaces() {
generating.value = true
try {
const response: any = await warehouseApi.createRackWithSpaces(props.rackId)
if (response.code === 200) {
ElMessage.success('仓位生成成功')
await loadSpaces()
}
} catch (error) {
ElMessage.error('生成仓位失败')
} finally {
generating.value = false
}
}
function selectSpace(space: any) { selectedSpaceId.value = space.id }
function editSpace(space: any) {
currentSpace.value = space
showForm.value = true
}
function closeForm() {
showForm.value = false
currentSpace.value = null
}
function handleSpaceSaved() {
closeForm()
loadSpaces()
emit('refresh')
}
function getStatusTag(status: string) { return statusMap[status]?.tag || 'info' }
function getStatusText(status: string) { return statusMap[status]?.text || status }
function handlePageChange(page: number) { currentPage.value = page }
onMounted(() => { loadSpaces() })
</script>
<style lang="scss" scoped>
.space-list {
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
padding-bottom: 8px;
border-bottom: 1px solid #ebeef5;
span {
font-weight: 500;
color: #303133;
}
}
.space-grid {
.grid-header {
display: grid;
grid-template-columns: 1fr 1fr 1fr 2fr 2fr 1fr;
gap: 8px;
padding: 8px;
background: #f8f9fa;
border-radius: 4px;
margin-bottom: 8px;
.grid-cell {
font-size: 12px;
font-weight: 500;
color: #606266;
text-align: center;
}
}
.grid-body {
max-height: 300px;
overflow-y: auto;
.space-row {
display: grid;
grid-template-columns: 1fr 1fr 1fr 2fr 2fr 1fr;
gap: 8px;
padding: 8px;
border-bottom: 1px solid #ebeef5;
cursor: pointer;
transition: background-color 0.2s;
&:hover {
background-color: #f5f7fa;
}
&.selected {
background-color: #ecf5ff;
}
&.occupied {
opacity: 0.7;
}
.grid-cell {
font-size: 12px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.pagination {
margin-top: 12px;
display: flex;
justify-content: center;
}
}
.empty-state {
text-align: center;
padding: 32px;
color: #c0c4cc;
}
}
</style>

View File

@ -1,155 +0,0 @@
<template>
<el-dialog
title="添加仓库"
v-model="internalVisible"
width="600px"
@close="handleClose"
>
<el-form
ref="formRef"
:model="formData"
:rules="rules"
label-width="100px"
>
<el-form-item label="仓库名称" prop="zone_name">
<el-input v-model="formData.zone_name" placeholder="请输入仓库名称" />
</el-form-item>
<el-form-item label="仓库编码" prop="zone_code">
<el-input
v-model="formData.zone_code"
placeholder="请输入仓库编码"
maxlength="5"
/>
</el-form-item>
<el-form-item label="仓库长度" prop="length">
<el-input-number
v-model="formData.length"
:min="1000"
:step="1000"
style="width: 100%"
placeholder="长度(mm)"
/>
</el-form-item>
<el-form-item label="仓库宽度" prop="width">
<el-input-number
v-model="formData.width"
:min="1000"
:step="1000"
style="width: 100%"
placeholder="宽度(mm)"
/>
</el-form-item>
<el-form-item label="仓库高度" prop="height">
<el-input-number
v-model="formData.height"
:min="1000"
:step="1000"
style="width: 100%"
placeholder="高度(mm)"
/>
</el-form-item>
<el-form-item label="显示颜色">
<el-color-picker v-model="formData.color" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="submitting">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, watch } from 'vue'
import * as warehouseApi from '@/api/warehouse'
import { ElMessage } from 'element-plus'
// import { defineProps, defineEmits } from 'vue'
const props = defineProps({ visible: { type: Boolean, default: false } })
const emit = defineEmits(['close', 'success'])
const internalVisible = ref(props.visible)
watch(() => props.visible, (newVal) => {
internalVisible.value = newVal
})
const formRef = ref(null)
const submitting = ref(false)
const formData = reactive<any>({
zone_type: 'warehouse',
zone_name: '',
zone_code: '',
parent_id: 0,
x: 0,
y: 0,
z: 0,
length: 10000,
width: 10000,
height: 5000,
color: '#96ceb4',
is_active: 1
})
const rules = {
zone_name: [ { required: true, message: '请输入仓库名称', trigger: 'blur' } ],
zone_code: [ { required: true, message: '请输入仓库编码', trigger: 'blur' } ],
length: [ { required: true, message: '请输入长度', trigger: 'blur' } ],
width: [ { required: true, message: '请输入宽度', trigger: 'blur' } ],
height: [ { required: true, message: '请输入高度', trigger: 'blur' } ]
}
function handleClose() { emit('close') }
async function handleSubmit() {
try {
const valid = await (formRef.value as any).validate().catch(() => false)
if (!valid) return
submitting.value = true
if (!formData.zone_code) {
const timestamp = Date.now().toString().slice(-4)
formData.zone_code = `WH${timestamp}`
}
const response: any = await warehouseApi.create(formData)
if (response.code === 200) {
ElMessage.success('仓库添加成功')
emit('success')
resetForm()
} else {
ElMessage.error(response.message || '添加失败')
}
} catch (error) {
ElMessage.error('添加失败')
} finally {
submitting.value = false
}
}
function resetForm() {
formData.zone_type = 'warehouse'
formData.zone_name = ''
formData.zone_code = ''
formData.parent_id = 0
formData.x = 0
formData.y = 0
formData.z = 0
formData.length = 10000
formData.width = 10000
formData.height = 5000
formData.color = '#96ceb4'
formData.is_active = 1
if (formRef.value) (formRef.value as any).resetFields()
}
</script>
<style scoped>
</style>

View File

@ -1,97 +0,0 @@
<template>
<el-card class="warehouse-tree-card">
<template #header>
<div class="clearfix">
<span>仓库列表</span>
<el-button type="text" @click="emit('add')">添加仓库</el-button>
</div>
</template>
<div class="tree-container">
<el-tree
ref="treeRef"
:data="props.warehouseList"
node-key="id"
:props="treeProps"
:expand-on-click-node="false"
:highlight-current="true"
@node-click="handleNodeClick"
>
<template #default="{ node, data }">
<span class="tree-node">
<el-icon><office-building /></el-icon>
<span class="node-label">{{ data.label }}</span>
</span>
</template>
</el-tree>
</div>
</el-card>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { OfficeBuilding } from '@element-plus/icons-vue'
const props = defineProps({
warehouseList: { type: Array, default: () => [] }
})
const emit = defineEmits(['add', 'select'])
const treeRef = ref(null)
const treeProps = {
children: 'children',
label: 'name'
}
onMounted(() => {
console.log(props.warehouseList)
})
function handleNodeClick(data: any) {
emit('select', data)
}
</script>
<style scoped>
.warehouse-tree-card {
height: 220px;
display:flex;
flex-direction: column;
.el-card__header {
padding: 0;
height:40px;
line-height: 40px;
padding-left: 20px;
.clearfix{
display:flex;
flex-direction: row;
justify-content: space-between;
}
}
.el-card__body{
flex:1;
height: 10px;
}
.tree-container {
height: 100%;
overflow-y: auto;
.tree-node {
display: flex;
align-items: center;
font-size: 14px;
i {
margin-right: 6px;
color: #409EFF;
}
.node-label {
flex: 1;
}
}
}
}
</style>

View File

@ -1,585 +0,0 @@
<template>
<el-card shadow="never" class="warehouse-plan-card">
<!-- 工具栏 -->
<template #header>
<div class="card-header">
<span class="card-title">{{ props.warehouseData.name }} - 平面图</span>
<div class="toolbar">
<el-button-group>
<el-button size="small" @click="zoomIn">放大</el-button>
<el-button size="small" @click="zoomOut">缩小</el-button>
<el-button size="small" @click="resetZoom">重置</el-button>
<el-button size="small" @click="centerView">居中</el-button>
</el-button-group>
<span class="scale-info ml-3">
缩放: {{ (scale * 100).toFixed(0) }}%
</span>
</div>
</div>
</template>
<!-- 平面图容器 -->
<div class="warehouse-container" ref="containerRef">
<div ref="svgContainerRef" class="svg-container" @wheel="handleWheel" @mousedown="handleMouseDown"
@mousemove="handleMouseMove" @mouseup="handleMouseUp" @mouseleave="handleMouseLeave">
<svg ref="svgRef" :width="svgWidth" :height="svgHeight" :viewBox="viewBox" preserveAspectRatio="xMidYMid meet">
<!-- 仓库边界 -->
<rect :x="0" :y="0" :width="warehouseLength" :height="warehouseWidth" fill="#fafafa" stroke="#000"
stroke-width="20" rx="4" />
<!-- 绘制所有区域 -->
<g v-for="area in (props.warehouseData.children || [])" :key="area.id" v-show="area.type === 'area'" class="area-group">
<!-- 区域背景 -->
<rect :x="area.data.x" :y="area.data.y" :width="area.data.length" :height="area.data.width"
:fill="getAreaColor(area)" :stroke="area.data.isActive ? '#67c23a' : '#909399'" stroke-width="1.5"
:stroke-dasharray:number="area.data.isActive ? null : '4,3'" rx="3" />
<!-- 区域名称 -->
<g>
<rect :x="area.data.x + area.data.length/2 - 40" :y="area.data.y + area.data.width/2 - 15" width="80"
height="30" fill="rgba(255,255,255,0.9)" stroke="#dcdfe6" stroke-width="1" rx="4" />
<text :x="area.data.x + area.data.length/2" :y="area.data.y + area.data.width/2" text-anchor="middle"
dominant-baseline="middle" fill="#303133" font-size="84" font-weight="bold">
{{ area.name }}
</text>
</g>
<!-- 区域内的货架 -->
<g v-for="rack in (area.children || [])" :key="rack.id">
<!-- U型货架 -->
<g v-if="rack.type === 'rack'">
<!-- 货架背景 -->
<rect :x="getRackX(rack, area)" :y="getRackY(rack, area)" :width="getRackDisplayWidth(rack)"
:height="getRackDisplayHeight(rack)" fill="url(#rackPattern)" stroke="#409EFF" stroke-width="1"
:stroke-dasharray:numbers="rack.data.isActive ? null : '3,2'" class="rack-background" />
<!-- U型槽位 -->
<g v-for="col in rack.data.rackColumns" :key="col">
<!-- 单个U型槽 -->
<path :d="getUSlotPath(rack, area, col)" :fill="getSlotColor(col)" stroke="#333" stroke-width="0.5"
:filter="isHoveredSlot(rack.id, col) ? 'url(#highlight)' : ''" @mouseenter="() => hoverSlot(rack.id, col)"
@mouseleave="clearHover" class="u-slot" />
<!-- 槽位编号 -->
<text :x="getSlotTextX(rack, area, col)" :y="getSlotTextY(rack, area, col)" text-anchor="middle"
dominant-baseline="middle" fill="#303133" font-size="50" font-weight="bold">
{{ col }}
</text>
</g>
<!-- 货架名称标签 -->
<g v-if="rack.code">
<rect :x="getRackLabelX(rack, area)" :y="getRackLabelY(rack, area)" width="120" height="64"
fill="rgba(255,255,255,0.9)" stroke="#409EFF" stroke-width="1" rx="3" />
<text :x="getRackLabelX(rack, area) + 60" :y="getRackLabelY(rack, area) + 32" text-anchor="middle"
dominant-baseline="middle" fill="#409EFF" font-size="42" font-weight="500">
{{ rack.code }}
</text>
</g>
</g>
<!-- 拣货起点 -->
<g v-else-if="rack.type === 'pick_start'">
<circle :cx="getPickStartX(rack, area)" :cy="getPickStartY(rack, area)"
:r="Math.max(rack.data.length, rack.data.width) / 2" fill="#67c23a" stroke="#5daf34" stroke-width="2"
class="pick-start" />
<text :x="getPickStartX(rack, area)" :y="getPickStartY(rack, area)" text-anchor="middle"
dominant-baseline="middle" fill="white" font-size="10" font-weight="bold">
起点
</text>
</g>
</g>
</g>
<!-- 图案定义 -->
<defs>
<!-- 货架背景图案 -->
<pattern id="rackPattern" patternUnits="userSpaceOnUse" width="20" height="20">
<rect width="20" height="20" fill="#f0f9ff" />
<path d="M0,0 L20,20 M20,0 L0,20" stroke="#e6f7ff" stroke-width="1" />
</pattern>
<!-- 高亮效果 -->
<filter id="highlight" x="-20%" y="-20%" width="140%" height="140%">
<feGaussianBlur in="SourceAlpha" stdDeviation="2" result="blur" />
<feOffset in="blur" dx="0" dy="0" result="offsetBlur" />
<feFlood flood-color="#409EFF" flood-opacity="0.2" result="offsetColor" />
<feComposite in="offsetColor" in2="offsetBlur" operator="in" result="offsetBlur" />
<feMerge>
<feMergeNode in="offsetBlur" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<!-- 朝向指示箭头 -->
<marker id="directionArrow" markerWidth="6" markerHeight="4" refX="5" refY="2" orient="auto">
<polygon points="0,0 6,2 0,4" fill="#e6a23c" />
</marker>
</defs>
</svg>
</div>
</div>
</el-card>
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted, watch } from 'vue'
const props = defineProps({ warehouseData: { type: Object, required: true } })
const containerRef = ref<HTMLElement | null>(null)
const svgContainerRef = ref<HTMLElement | null>(null)
const svgRef = ref<SVGElement | null>(null)
const state = reactive({
scale: 0.1,
minScale: 0.01,
maxScale: 1,
svgWidth: 1200,
svgHeight: 800,
viewBoxX: 0,
viewBoxY: 0,
isDragging: false,
dragStart: { x: 0, y: 0, viewBoxX: 0, viewBoxY: 0 },
hoveredElement: null as any,
hoveredSlot: null as any
})
const scale = computed({ get: () => state.scale, set: (v: number) => (state.scale = v) })
const minScale = computed(() => state.minScale)
const maxScale = computed(() => state.maxScale)
const svgWidth = computed({ get: () => state.svgWidth, set: (v: number) => (state.svgWidth = v) })
const svgHeight = computed({ get: () => state.svgHeight, set: (v: number) => (state.svgHeight = v) })
const viewBox = computed(() => {
const width = svgWidth.value / state.scale
const height = svgHeight.value / state.scale
return `${state.viewBoxX} ${state.viewBoxY} ${width} ${height}`
})
const warehouseLength = computed(() => props.warehouseData.data.length)
const warehouseWidth = computed(() => props.warehouseData.data.width)
onMounted(() => {
updateSvgSize()
centerView()
if (svgContainerRef.value) svgContainerRef.value.style.cursor = 'grab'
})
watch(() => props.warehouseData, () => {
updateSvgSize()
centerView()
})
function updateSvgSize() {
if (!containerRef.value) return
const containerRect = containerRef.value.getBoundingClientRect()
const containerWidth = containerRect.width
const containerHeight = containerRect.height
svgWidth.value = Math.max(containerWidth, 100)
svgHeight.value = Math.max(containerHeight, 100)
const size = svgWidth.value / warehouseLength.value > svgHeight.value / warehouseWidth.value ?
parseInt(((svgHeight.value / warehouseWidth.value) * 100).toString()) : parseInt(((svgWidth.value / warehouseLength.value) * 100).toString())
state.scale = size / 100
state.minScale = size / 100
}
function getAreaColor(area: any) {
if (area.data.color && area.data.color !== '#3B82F6') return area.data.color
const colors = [
'rgba(64, 158, 255, 0.1)',
'rgba(103, 194, 58, 0.1)',
'rgba(230, 162, 60, 0.1)',
'rgba(245, 108, 108, 0.1)',
'rgba(144, 147, 153, 0.1)'
]
const index = (area.id % colors.length)
return colors[index]
}
function getSlotColor(column: number) {
return column % 2 === 0 ? '#a5d8ff' : '#74c0fc'
}
function getRackDisplayWidth(rack: any) {
const direction = rack.data.direction
if (direction === 'east' || direction === 'west') return rack.data.width
return rack.data.length
}
function getRackDisplayHeight(rack: any) {
const direction = rack.data.direction
if (direction === 'east' || direction === 'west') return rack.data.length
return rack.data.width
}
function getRackX(rack: any, area: any) {
const baseX = area.data.x + (rack.data.x || 0)
return baseX
}
function getRackY(rack: any, area: any) {
const baseY = area.data.y + (rack.data.y || 0)
return baseY
}
function getUSlotPath(rack: any, area: any, column: number) {
const direction = rack.data.direction
const rackX = getRackX(rack, area)
const rackY = getRackY(rack, area)
const displayWidth = getRackDisplayWidth(rack)
const displayHeight = getRackDisplayHeight(rack)
const columnCount = rack.data.rackColumns
let slotWidth: number, slotHeight: number, slotX: number, slotY: number
if (direction === 'east' || direction === 'west') {
slotWidth = displayWidth
slotHeight = displayHeight / columnCount
slotX = rackX
slotY = rackY + (column - 1) * slotHeight
} else {
slotWidth = displayWidth / columnCount
slotHeight = displayHeight
slotX = rackX + (column - 1) * slotWidth
slotY = rackY
}
const uDepth = (direction === 'east' || direction === 'west') ? slotWidth * 0.6 : slotHeight * 0.6
const uWidth = (direction === 'east' || direction === 'west') ? slotHeight * 0.8 : slotWidth * 0.8
switch (direction) {
case 'north':
return `M ${slotX + slotWidth/2 - uWidth/2},${slotY} L ${slotX + slotWidth/2 - uWidth/2},${slotY + slotHeight - uDepth} Q ${slotX + slotWidth/2 - uWidth/2},${slotY + slotHeight} ${slotX + slotWidth/2},${slotY + slotHeight} Q ${slotX + slotWidth/2 + uWidth/2},${slotY + slotHeight} ${slotX + slotWidth/2 + uWidth/2},${slotY + slotHeight - uDepth} L ${slotX + slotWidth/2 + uWidth/2},${slotY} Z`
case 'south':
return `M ${slotX + slotWidth/2 - uWidth/2},${slotY + slotHeight} L ${slotX + slotWidth/2 - uWidth/2},${slotY + uDepth} Q ${slotX + slotWidth/2 - uWidth/2},${slotY} ${slotX + slotWidth/2},${slotY} Q ${slotX + slotWidth/2 + uWidth/2},${slotY} ${slotX + slotWidth/2 + uWidth/2},${slotY + uDepth} L ${slotX + slotWidth/2 + uWidth/2},${slotY + slotHeight} Z`
case 'west':
return `M ${slotX},${slotY + slotHeight/2 - uWidth/2} L ${slotX + slotWidth - uDepth},${slotY + slotHeight/2 - uWidth/2} Q ${slotX + slotWidth},${slotY + slotHeight/2 - uWidth/2} ${slotX + slotWidth},${slotY + slotHeight/2} Q ${slotX + slotWidth},${slotY + slotHeight/2 + uWidth/2} ${slotX + slotWidth - uDepth},${slotY + slotHeight/2 + uWidth/2} L ${slotX},${slotY + slotHeight/2 + uWidth/2} Z`
case 'east':
return `M ${slotX + slotWidth},${slotY + slotHeight/2 - uWidth/2} L ${slotX + uDepth},${slotY + slotHeight/2 - uWidth/2} Q ${slotX},${slotY + slotHeight/2 - uWidth/2} ${slotX},${slotY + slotHeight/2} Q ${slotX},${slotY + slotHeight/2 + uWidth/2} ${slotX + uDepth},${slotY + slotHeight/2 + uWidth/2} L ${slotX + slotWidth},${slotY + slotHeight/2 + uWidth/2} Z`
default:
return ''
}
}
function getSlotTextX(rack: any, area: any, column: number) {
const direction = rack.data.direction
const rackX = getRackX(rack, area)
const displayWidth = getRackDisplayWidth(rack)
const columnCount = rack.data.rackColumns
if (direction === 'east' || direction === 'west') {
const slotWidth = displayWidth
return rackX + slotWidth / 2
} else {
const slotWidth = displayWidth / columnCount
return rackX + (column - 0.5) * slotWidth
}
}
function getSlotTextY(rack: any, area: any, column: number) {
const direction = rack.data.direction
const rackY = getRackY(rack, area)
const displayHeight = getRackDisplayHeight(rack)
const columnCount = rack.data.rackColumns
if (direction === 'east' || direction === 'west') {
const slotHeight = displayHeight / columnCount
return rackY + (column - 0.5) * slotHeight
} else {
const slotHeight = displayHeight
return rackY + slotHeight / 2
}
}
function getRackLabelX(rack: any, area: any) {
const direction = rack.data.direction
const rackX = getRackX(rack, area)
const displayWidth = getRackDisplayWidth(rack)
if (direction === 'east' || direction === 'west') return rackX + displayWidth + 5
return rackX + displayWidth / 2 - 40
}
function getRackLabelY(rack: any, area: any) {
const direction = rack.data.direction
const rackY = getRackY(rack, area)
const displayHeight = getRackDisplayHeight(rack)
if (direction === 'north') return rackY - 30
if (direction === 'south') return rackY + displayHeight + 5
return rackY + displayHeight / 2 - 12
}
function getPickStartX(pickStart: any, area: any) {
return area.data.x + (pickStart.data.x || 0) + (pickStart.data.length || 0) / 2
}
function getPickStartY(pickStart: any, area: any) {
return area.data.y + (pickStart.data.y || 0) + (pickStart.data.width || 0) / 2
}
function hoverSlot(rackId: number, column: number) {
const rack = findRackById(rackId)
if (rack) {
state.hoveredElement = rack
state.hoveredSlot = { rackId, column }
}
}
function isHoveredSlot(rackId: number, column: number) {
return state.hoveredSlot && state.hoveredSlot.rackId === rackId && state.hoveredSlot.column === column
}
function clearHover() { state.hoveredSlot = null }
function findRackById(rackId: number) {
for (const area of (props.warehouseData.children || [])) {
for (const child of (area.children || [])) {
if (child.id === rackId) return child
}
}
return null
}
function getDirectionText(direction: string) {
const map: any = { north: '北', south: '南', east: '东', west: '西' }
return map[direction] || direction
}
function getElementTypeText(type: string) {
const map: any = { warehouse: '仓库', area: '区域', rack: '货架', pick_start: '拣货点' }
return map[type] || type
}
function getElementTagType(element: any) {
const map: any = { warehouse: 'primary', area: 'success', rack: 'warning', pick_start: 'info' }
return map[element.type] || 'info'
}
function zoomIn() {
if (state.scale < state.maxScale) state.scale = Math.min(state.maxScale, state.scale * 1.2)
centerView()
}
function zoomOut() {
if (state.scale > state.minScale) state.scale = Math.max(state.minScale, state.scale / 1.2)
centerView()
}
function resetZoom() { updateSvgSize(); centerView() }
function centerView() {
const width = svgWidth.value / state.scale
const height = svgHeight.value / state.scale
state.viewBoxX = -(width - warehouseLength.value) / 2
state.viewBoxY = -(height - warehouseWidth.value) / 2
}
function handleWheel(event: WheelEvent) {
event.preventDefault()
const delta = event.deltaY > 0 ? -1 : 1
if (event.ctrlKey || (event as any).metaKey) {
const zoomFactor = 1.1
const newScale = delta > 0 ? state.scale * zoomFactor : state.scale / zoomFactor
state.scale = Math.max(state.minScale, Math.min(state.maxScale, newScale))
}
}
function handleMouseDown(event: MouseEvent) {
if (event.button !== 0) return
state.isDragging = true
state.dragStart = { x: event.clientX, y: event.clientY, viewBoxX: state.viewBoxX, viewBoxY: state.viewBoxY }
if (svgContainerRef.value) svgContainerRef.value.style.cursor = 'grabbing'
}
function handleMouseMove(event: MouseEvent) {
if (!state.isDragging) return
const dx = event.clientX - state.dragStart.x
const dy = event.clientY - state.dragStart.y
state.viewBoxX = state.dragStart.viewBoxX - dx / state.scale
state.viewBoxY = state.dragStart.viewBoxY - dy / state.scale
}
function handleMouseUp() {
state.isDragging = false
if (svgContainerRef.value) svgContainerRef.value.style.cursor = 'grab'
}
function handleMouseLeave() { state.isDragging = false }
defineExpose({ updateSvgSize, centerView })
</script>
<style scoped>
.warehouse-plan-card {
height: 100%;
display: flex;
flex-direction: column;
.el-card__body {
flex: 1;
height: 100px;
}
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.card-title {
font-size: 16px;
font-weight: 600;
color: var(--el-text-color-primary);
}
.toolbar {
display: flex;
align-items: center;
}
.scale-info {
color: var(--el-text-color-secondary);
font-size: 14px;
margin-left: 16px;
}
.warehouse-container {
flex: 1;
display: flex;
position: relative;
min-height: 600px;
height: 100%;
background: var(--el-fill-color-light);
border-radius: var(--el-border-radius-base);
overflow: hidden;
}
.svg-container {
flex: 1;
overflow: hidden;
position: relative;
}
svg {
display: block;
background: white;
}
.u-slot {
cursor: pointer;
transition: filter 0.2s;
}
.u-slot:hover {
filter: url(#highlight);
}
.rack-background {
pointer-events: none;
}
.pick-start {
cursor: pointer;
transition: transform 0.2s;
}
.pick-start:hover {
transform: scale(1.1);
}
.info-panel {
position: absolute;
top: 16px;
right: 16px;
width: 280px;
background: white;
border-radius: var(--el-border-radius-base);
box-shadow: var(--el-box-shadow-light);
border: 1px solid var(--el-border-color-lighter);
z-index: 10;
}
.info-header {
padding: 16px;
border-bottom: 1px solid var(--el-border-color-lighter);
display: flex;
justify-content: space-between;
align-items: center;
}
.info-header h4 {
margin: 0;
font-size: 14px;
font-weight: 600;
color: var(--el-text-color-primary);
}
.info-content {
padding: 16px;
}
.info-section {
margin-bottom: 16px;
}
.info-section:last-child {
margin-bottom: 0;
}
.info-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
font-size: 13px;
}
.info-row:last-child {
margin-bottom: 0;
}
.info-row .label {
color: var(--el-text-color-secondary);
}
.info-row .value {
color: var(--el-text-color-primary);
font-weight: 500;
text-align: right;
}
.grid-layer text {
user-select: none;
pointer-events: none;
}
/* 响应式调整 */
@media (max-width: 992px) {
.warehouse-container {
flex-direction: column;
}
.info-panel {
position: static;
width: 100%;
margin-top: 16px;
}
.svg-container {
min-height: 500px;
}
}
@media (max-width: 768px) {
.card-header {
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
.toolbar {
flex-wrap: wrap;
gap: 8px;
}
.scale-info {
margin-left: 0;
flex-basis: 100%;
}
}
</style>

View File

@ -1,522 +0,0 @@
<template>
<el-dialog :title="dialogTitle" v-model="props.visible" width="900px" :before-close="handleClose" :close-on-click-modal="false">
<el-form ref="zoneFormRef" :model="formData" :rules="formRules" label-width="100px" label-position="left">
<!-- 分区类型改为下拉选择 -->
<el-form-item label="分区类型" prop="zone_type">
<el-select v-model="formData.zone_type" placeholder="请选择分区类型" style="width: 100%" @change="handleTypeChange"
:disabled="mode === 'edit' || submitting">
<el-option v-for="type in availableZoneTypes" :key="type.value" :label="type.label" :value="type.value" />
</el-select>
</el-form-item>
<el-form-item label="分区编码" prop="zone_code">
<el-input v-model="formData.zone_code" placeholder="请输入分区编码" maxlength="5" show-word-limit />
</el-form-item>
<el-form-item label="分区名称" prop="zone_name">
<el-input v-model="formData.zone_name" placeholder="请输入分区名称" maxlength="100" show-word-limit />
</el-form-item>
<!-- 父分区信息显示 -->
<el-form-item v-if="showParentInfo" label="父分区">
<el-input v-model="parentDisplayName" :disabled="true" style="width: 100%" />
</el-form-item>
<!-- 尺寸信息 - 所有类型都显示 -->
<el-card class="size-card">
<template #header>
<span>尺寸信息</span>
<el-tooltip v-if="formData.zone_type === 'area'" content="区域通常用于规划仓库内的功能区划分" placement="top">
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
</el-tooltip>
<el-tooltip v-if="formData.zone_type === 'warehouse'" content="仓库的整体尺寸" placement="top">
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
</el-tooltip>
</template>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="总长度" prop="length">
<el-input-number v-if="formData.direction=='north'||formData.direction=='south'" v-model="formData.length" placeholder="长度" :min="10" :step="10" style="width: 100%" />
<el-input-number v-else v-model="formData.width" placeholder="长度" :min="10" :step="10" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="总宽度" prop="width">
<el-input-number v-if="formData.direction=='west'||formData.direction=='east'" v-model="formData.length" placeholder="宽度" :min="10" :step="10" style="width: 100%" />
<el-input-number v-else v-model="formData.width" placeholder="宽度" :min="10" :step="10" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="高度" prop="height">
<el-input-number v-model="formData.height" placeholder="高度" :min="10" :step="10" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
</el-row>
<!-- 面积/体积信息显示 -->
<div class="calculation-info">
<span v-if="formData.zone_type === 'area'">面积:{{ calculateArea() }} m²</span>
<span v-if="formData.zone_type === 'rack'">体积:{{ calculateVolume() }} m³</span>
<span v-if="formData.zone_type === 'warehouse'">面积:{{ calculateArea() }} m²</span>
<span v-if="formData.zone_type === 'pick_start'">面积:{{ calculateArea() }} m²</span>
</div>
</el-card>
<!-- 坐标信息 - 用于定位 -->
<el-card class="coordinate-card" v-if="formData.zone_type !== 'warehouse'">
<template #header>
<span>坐标信息</span>
<el-tooltip content="设置分区在三维空间中的位置坐标" placement="top">
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
</el-tooltip>
</template>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="X坐标" prop="x">
<el-input-number v-model="formData.x" placeholder="X坐标" :min="0" :step="10" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="Y坐标" prop="y">
<el-input-number v-model="formData.y" placeholder="Y坐标" :min="0" :step="10" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="Z坐标" prop="z">
<el-input-number v-model="formData.z" placeholder="Z坐标" :min="0" :step="10" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
</el-row>
<!-- 坐标说明 -->
<div class="coordinate-note">
<small>说明:X(左右), Y(前后), Z(上下),用于三维空间定位</small>
</div>
</el-card>
<!-- 货架配置 -->
<el-card class="rack-card" v-if="formData.zone_type === 'rack'">
<template #header>
<span>货架配置</span>
<el-tooltip content="货架尺寸指单个货架的尺寸,用于计算仓位布局" placement="top">
<i class="el-icon-info" style="margin-left: 8px; color: #909399;"></i>
</el-tooltip>
</template>
<!-- 货架单元格尺寸 -->
<div class="rack-grid-size">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="货架长度" prop="cell_length">
<el-input-number v-model="formData.cell_length" placeholder="货架长度" :min="10" :step="5" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="货架深度" prop="cell_width">
<el-input-number v-model="formData.cell_width" placeholder="货架深度" :min="10" :step="5" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="货架高度" prop="cell_height">
<el-input-number v-model="formData.cell_height" placeholder="货架高度" :min="10" :step="5" style="width: 100%" />
<span class="unit-hint">cm</span>
</el-form-item>
</el-col>
</el-row>
</div>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="列数" prop="rack_columns">
<el-input-number v-model="formData.rack_columns" placeholder="列数" :min="1" :max="255" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="层数" prop="rack_rows">
<el-input-number v-model="formData.rack_rows" placeholder="层数" :min="1" :max="255" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="分格数" prop="rack_levels">
<el-input-number v-model="formData.rack_levels" placeholder="分格数" :min="1" :max="255" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="朝向" prop="direction">
<el-radio-group v-model="formData.direction">
<el-radio label="north">北</el-radio>
<el-radio label="south">南</el-radio>
<el-radio label="east">东</el-radio>
<el-radio label="west">西</el-radio>
</el-radio-group>
</el-form-item>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="自定义通道" prop="z">
<el-input v-model="aislesInput" placeholder="通道所在的列数,多个使用英文,分割,不能超出总列数" style="width: 100%" />
<span class="unit-hint">通道所在的列数,多个使用英文逗号分割</span>
</el-form-item>
</el-col>
</el-row>
<!-- 货架仓位总数 -->
<div class="rack-total-info">
<span>仓位总数:{{ calculateRackTotal() }}</span>
</div>
</el-card>
<!-- 显示颜色和启用状态 -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="是否启用" prop="is_active">
<el-switch v-model="formData.is_active" :active-value="1" :inactive-value="0" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="submitting">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, watch, computed } from 'vue'
import * as warehouseApi from '@/api/warehouse'
import { ElMessage, ElMessageBox } from 'element-plus'
const props = defineProps({
visible: { type: Boolean, required: true },
mode: { type: String, default: 'add' },
zoneData: { type: Object, default: null },
parentId: { type: [Number, String], default: null },
parentType: { type: String, default: null },
parentInfo: { type: Object, default: null },
warehouseId: { type: [Number, String], default: null }
})
const emit = defineEmits(['close', 'success'])
const zoneFormRef = ref<any>(null)
const aislesInput = ref('')
const submitting = ref(false)
type ZoneForm = {
zone_type: string
zone_code: string
zone_name: string
parent_id: string | number | null
warehouse_id: string | number | null
x: number
y: number
z: number
length: number
width: number
height: number
rack_columns: number | null
rack_rows: number | null
rack_levels: number | null
cell_length: number | null
cell_width: number | null
cell_height: number | null
direction: string | null
color: string
is_active: number
aisles: (string | number)[]
}
const formData = reactive<ZoneForm>(getDefaultFormData())
function getDefaultFormData(): ZoneForm {
return {
zone_type: 'area',
zone_code: '',
zone_name: '',
parent_id: null,
warehouse_id: null,
x: 0,
y: 0,
z: 0,
length: 500,
width: 500,
height: 300,
rack_columns: 5,
rack_rows: 5,
rack_levels: 2,
cell_length: 220,
cell_width: 100,
cell_height: 500,
direction: 'north',
color: '#3B82F6',
is_active: 1,
aisles: []
}
}
const allZoneTypes = [ { value: 'area', label: '库区' }, { value: 'rack', label: '货架' }, { value: 'pick_start', label: '拣货点' } ]
const predefineColors = [ '#3B82F6','#10B981','#F59E0B','#EF4444','#8B5CF6','#EC4899','#6B7280','#14B8A6','#F97316','#84CC16' ]
const formRules = reactive({
zone_type: [ { required: true, message: '请选择分区类型', trigger: 'change' } ],
zone_code: [ { required: true, message: '请输入分区编码', trigger: 'blur' }, { pattern: /^[A-Z0-9]{1,5}$/, message: '编码只能是1-5位字母或数字', trigger: 'blur' } ],
zone_name: [ { required: true, message: '请输入分区名称', trigger: 'blur' }, { max: 100, message: '名称最多100个字符', trigger: 'blur' } ],
length: [ { required: true, message: '请输入长度', trigger: 'blur' } ],
width: [ { required: true, message: '请输入宽度', trigger: 'blur' } ],
height: [ { required: true, message: '请输入高度', trigger: 'blur' } ],
rack_columns: [ { type: 'number', min:1, max:255, message: '列数范围1-255', trigger: 'blur' } ],
rack_rows: [ { type: 'number', min:1, max:10, message: '层数范围1-10', trigger: 'blur' } ],
rack_levels: [ { type: 'number', min:1, max:8, message: '分格数范围1-8', trigger: 'blur' } ],
cell_length: [ { required: true, message: '请输入单元格长度', trigger: 'blur' } ],
cell_width: [ { required: true, message: '请输入单元格宽度', trigger: 'blur' } ],
cell_height: [ { required: true, message: '请输入单元格高度', trigger: 'blur' } ]
})
const availableZoneTypes = computed(() => {
if (props.mode === 'edit') {
const currentType = formData.zone_type
const t = allZoneTypes.find(x => x.value === currentType)
return t ? [t] : []
}
if (props.mode === 'add' && props.parentType) {
if (props.parentType === 'warehouse') return allZoneTypes.filter(t => t.value === 'area')
if (props.parentType === 'area') return allZoneTypes.filter(t => t.value === 'rack' || t.value === 'pick_start')
return []
}
return allZoneTypes
})
const dialogTitle = computed(() => {
const map: any = { 'warehouse': '仓库','area':'库区','rack':'货架','pick_start':'拣货点' }
const typeName = map[formData.zone_type] || '分区'
return props.mode === 'add' ? `添加${typeName}` : `编辑${typeName}`
})
const showParentInfo = computed(() => {
if (props.mode === 'edit' && formData.zone_type !== 'warehouse') return true
if (props.mode === 'add' && props.parentInfo) return true
return false
})
const parentDisplayName = computed(() => {
if (props.mode === 'edit' && formData.zone_type !== 'warehouse') {
if (props.zoneData && (props.zoneData.parentInfo || props.zoneData.parentWarehouseName)) {
const p = props.zoneData.parentInfo || { code: '未知编码', name: '未知名称' }
return `${p.code || '未知编码'} - ${p.name || '未知名称'}`
}
return '未知父分区'
}
if (props.mode === 'add' && props.parentInfo) {
const map: any = { 'warehouse': '仓库','area':'库区','rack':'货架' }
const typeName = map[props.parentInfo.type] || props.parentInfo.type || '未知'
return `${props.parentInfo.code || '未知编码'} - ${props.parentInfo.name || '未知名称'} (${typeName})`
}
return ''
})
watch(() => props.visible, (newVal) => { if (newVal) initFormData(); else resetForm() }, { immediate: true })
watch(() => props.zoneData, () => initFormData(), { deep: true })
watch(() => props.parentType, (nv) => { if (nv && props.mode === 'add') autoSetZoneType(nv) }, { immediate: true })
watch(() => formData.length, () => autoCalculateCellSize())
watch(() => formData.width, () => autoCalculateCellSize())
watch(() => formData.height, () => autoCalculateCellSize())
watch(aislesInput, (newVal) => {
if (!newVal) { formData.aisles = []; return }
formData.aisles = newVal.split(',').map(s => { const t = s.trim(); const n = parseInt(t,10); return isNaN(n)? t: n }).filter(x => x !== '')
})
function initFormData() {
if (props.mode === 'edit' && props.zoneData) {
const d = props.zoneData.data || {}
Object.assign(formData, {
zone_type: props.zoneData.type || props.zoneData.zone_type,
zone_code: props.zoneData.code || props.zoneData.zone_code,
zone_name: props.zoneData.name || props.zoneData.zone_name,
parent_id: props.zoneData.parentId || props.zoneData.parent_id,
warehouse_id: props.warehouseId,
x: props.zoneData.x || 0,
y: props.zoneData.y || 0,
z: props.zoneData.z || 0,
length: props.zoneData.length || getDefaultFormData().length,
width: props.zoneData.width || getDefaultFormData().width,
height: props.zoneData.height || getDefaultFormData().height,
rack_columns: props.zoneData.rackColumns || props.zoneData.rack_columns || 5,
rack_rows: props.zoneData.rackRows || props.zoneData.rack_rows || 5,
rack_levels: props.zoneData.rackLevels || props.zoneData.rack_levels || 2,
cell_length: props.zoneData.cellLength || props.zoneData.cell_length || 220,
cell_width: props.zoneData.cellWidth || props.zoneData.cell_width || 100,
cell_height: props.zoneData.cellHeight || props.zoneData.cell_height || 500,
direction: props.zoneData.direction || 'north',
color: props.zoneData.color || '#3B82F6',
is_active: props.zoneData.isActive !== undefined ? props.zoneData.isActive : 1,
aisles: props.zoneData.aisles || []
})
aislesInput.value = (formData.aisles || []).map((it:any)=>String(it)).join(',')
} else {
Object.assign(formData, getDefaultFormData())
formData.warehouse_id = props.warehouseId
formData.parent_id = props.parentId
generateZoneCode()
setDefaultSizeByType()
}
}
function autoSetZoneType(parentTypeVal:any) {
if (props.mode === 'add' && parentTypeVal) {
if (parentTypeVal === 'warehouse') formData.zone_type = 'area'
else if (parentTypeVal === 'area') formData.zone_type = 'rack'
else { ElMessage.warning('当前位置不能添加子分区'); handleClose() }
}
}
function handleTypeChange(value:any) {
if (!formData.zone_code) generateZoneCode()
if (value !== 'rack') { formData.rack_columns = null; formData.rack_rows = null; formData.rack_levels = null; formData.cell_length = null; formData.cell_width = null; formData.cell_height = null; formData.direction = null }
setDefaultSizeByType()
}
function getDefaultSizeByType(type:any) {
const defs:any = { warehouse:{ length:3000,width:2000,height:800 }, area:{ length:500,width:500,height:300 }, rack:{ length:200,width:100,height:200 }, pick_start:{ length:100,width:100,height:100 } }
return defs[type] || defs.area
}
function setDefaultSizeByType() { Object.assign(formData, getDefaultSizeByType(formData.zone_type)) }
function generateZoneCode() {
if (!formData.zone_code) {
const prefixMap:any = { warehouse:'WH', area:'A', rack:'R', pick_start:'PS' }
const prefix = prefixMap[formData.zone_type] || 'Z'
const timestamp = Date.now().toString().slice(-4)
const random = Math.floor(Math.random()*90+10)
formData.zone_code = `${prefix}${random}${timestamp.slice(0,2)}`
}
}
function autoCalculateCellSize() {
if (formData.zone_type === 'rack') {
const { length=200, width=100, height=200, rack_columns=5, rack_rows=5 } = formData as any
const suggestedLength = Math.floor((length - 20) / rack_columns)
const suggestedWidth = Math.floor((width - 20) / 1)
const suggestedHeight = Math.floor((height - 20) / rack_rows)
if (!formData.cell_length || formData.cell_length <= 0) formData.cell_length = suggestedLength > 10 ? suggestedLength : 50
if (!formData.cell_width || formData.cell_width <= 0) formData.cell_width = suggestedWidth > 10 ? suggestedWidth : 50
if (!formData.cell_height || formData.cell_height <= 0) formData.cell_height = suggestedHeight > 10 ? suggestedHeight : 50
}
}
function calculateArea() { const { length=0, width=0 } = formData as any; return ((length*width)/10000).toFixed(2) }
function calculateVolume() { const { length=0,width=0,height=0 } = formData as any; return ((length*width*height)/1000000).toFixed(2) }
function calculateRackTotal() { const { rack_columns=1,rack_rows=1,rack_levels=1 } = formData as any; return rack_columns * rack_rows * rack_levels }
function resetForm() { if (zoneFormRef.value && zoneFormRef.value.resetFields) zoneFormRef.value.resetFields(); Object.assign(formData, getDefaultFormData()); submitting.value = false }
function handleClose() { if (!submitting.value) emit('close') }
async function handleSubmit() {
try {
if (zoneFormRef.value && zoneFormRef.value.validate) await zoneFormRef.value.validate()
submitting.value = true
const submitData = { ...formData, warehouse_id: props.warehouseId }
if (!validateHierarchy()) { submitting.value = false; return }
if (!validateSize()) { submitting.value = false; return }
let response:any
if (props.mode === 'add') response = await warehouseApi.create(submitData)
else response = await warehouseApi.update(submitData, props.zoneData?.id)
if (response && (response.code == 200 || (response.data && response.data.success))) {
ElMessage.success(props.mode === 'add' ? '添加成功' : '更新成功')
emit('success')
handleClose()
} else {
throw new Error(response.message || '操作失败')
}
} catch (error:any) {
console.error('提交失败:', error)
ElMessage.error(error.message || '操作失败')
} finally { submitting.value = false }
}
function validateHierarchy() {
if (props.mode === 'add') {
if (props.parentType === 'warehouse' && formData.zone_type !== 'area') { ElMessage.error('仓库下只能添加库区'); return false }
if (props.parentType === 'area' && !['rack','pick_start'].includes(formData.zone_type)) { ElMessage.error('库区下只能添加货架或拣货点'); return false }
if (props.parentType === 'rack') { ElMessage.error('货架下不能添加子分区'); return false }
}
return true
}
function validateSize() {
const { length=0,width=0,height=0 } = formData as any
if (length <=0 || width<=0 || height<=0) { ElMessage.error('长度、宽度、高度必须大于0'); return false }
if (formData.zone_type === 'rack') {
const { cell_length=0, cell_width=0, cell_height=0, rack_columns=1, rack_rows=1 } = formData as any
if (cell_length<=0 || cell_width<=0 || cell_height<=0) { ElMessage.error('货架单元格尺寸必须大于0'); return false }
if (cell_length * rack_columns > length) ElMessage.warning('货架单元格总长度超过货架总长度')
if (cell_height * rack_rows > height) ElMessage.warning('货架单元格总高度超过货架总高度')
}
return true
}
</script>
<style lang="scss" scoped>
.size-card,
.coordinate-card,
.rack-card {
margin-bottom: 20px;
.el-card__header {
padding: 12px 20px;
background: #f8f9fa;
display: flex;
align-items: center;
}
.unit-hint {
margin-left: 8px;
color: #909399;
font-size: 12px;
}
.calculation-info,
.rack-total-info {
margin-top: 16px;
padding: 8px 12px;
background: #f0f9ff;
border-radius: 4px;
color: #0369a1;
font-size: 14px;
font-weight: 500;
}
.rack-grid-size {
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #ebeef5;
}
}
.dialog-footer { text-align: right; }
.el-form-item { margin-bottom: 20px; &:last-child { margin-bottom: 0; } }
.el-input-number, .el-input { width: 100%; }
.el-color-picker { vertical-align: middle; margin-right: 8px; }
.color-preview { display: inline-block; width: 20px; height: 20px; border-radius: 4px; border: 1px solid #dcdfe6; vertical-align: middle; margin-left: 8px; }
.el-tag { font-size: 14px; padding: 0 10px; height: 32px; line-height: 32px; }
</style>

View File

@ -1,146 +0,0 @@
<template>
<el-card class="zone-management-card">
<template #header>仓库结构</template>
<div class="zone-tree-container">
<el-tree
v-if="treeData.length > 0"
ref="zoneTreeRef"
:data="treeData"
node-key="id"
:props="treeProps"
:expand-on-click-node="false"
:highlight-current="true"
@node-click="handleNodeClick"
>
<template v-slot="{ node, data }">
<span class="tree-node">
<span class="node-content">
<el-tag size="mini" :type="getZoneTypeTag(data.type)">
{{ getZoneTypeText(data.type) }}
</el-tag>
<span class="node-label">{{ data.name }}</span>
</span>
<span class="node-actions">
<el-button v-if="canAddChild(data.type)" type="primary" link @click.stop="handleAdd(data)">
<el-icon><Plus /></el-icon>
</el-button>
<el-button type="primary" link @click.stop="handleEdit(data)">
<el-icon><Edit /></el-icon>
</el-button>
<el-button type="danger" link @click.stop="handleDelete(data)">
<el-icon><Delete /></el-icon>
</el-button>
</span>
</span>
</template>
</el-tree>
</div>
</el-card>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { Plus, Edit, Delete } from '@element-plus/icons-vue'
const props = defineProps({
warehouseId: { type: [Number, String], required: true },
warehouseData: { type: Object, default: null }
})
const emit = defineEmits(['select', 'add', 'edit', 'delete'])
const treeData = ref<any[]>([])
const treeProps = { children: 'children', label: 'name' }
const zoneTypeMap: Record<string, { tag: string; text: string }> = {
warehouse: { tag: 'primary', text: '仓库' },
area: { tag: 'success', text: '库区' },
rack: { tag: 'warning', text: '货架' },
pick_start: { tag: 'info', text: '拣货点' }
}
const allowedParents: any = {
warehouse: ['area'],
area: ['rack', 'pick_start'],
rack: [],
pick_start: []
}
watch(() => props.warehouseData, (newData) => {
if (newData) treeData.value = [newData]
else treeData.value = []
}, { immediate: true })
function handleNodeClick(data: any) { emit('select', data) }
function handleAdd(data: any) { emit('add', data) }
function handleEdit(data: any) { emit('edit', data) }
function handleDelete(data: any) { emit('delete', data) }
function canAddChild(zoneType: string) { return (allowedParents[zoneType] || []).length > 0 }
function getZoneTypeTag(type: string) { return zoneTypeMap[type]?.tag || 'info' }
function getZoneTypeText(type: string) { return zoneTypeMap[type]?.text || type }
</script>
<style scoped>
.zone-management-card {
flex: 1;
display: flex;
flex-direction: column;
.el-card__header {
padding:0;
height:40px;
line-height:40px;
padding-left: 20px;
}
.el-card__body{
height: 100px;
flex:1;
}
.zone-tree-container {
height: 100%;
overflow-y: auto;
.tree-node {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
font-size: 14px;
.node-content {
display: flex;
align-items: center;
gap: 8px;
.node-label {
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.node-actions {
opacity: 0;
transition: opacity 0.3s;
display: flex;
align-items: center;
.el-button {
padding: 0 4px;
margin-left: 0;
}
.el-icon {
font-size: 16px;
}
}
&:hover .node-actions {
opacity: 1;
}
}
}
}
</style>

View File

@ -1,356 +1,8 @@
<template> <template>
<div class="warehouse-management-container"> <div class="warehouse-container">
<div class="main-layout"> <h1>仓库管理</h1>
<!-- 左侧边栏 -->
<div class="sidebar left-sidebar">
<warehouse-tree
:warehouse-list="warehouseList"
@select="handleWarehouseSelect"
@add="showAddWarehouseDialog"
/>
<zone-management
v-if="selectedWarehouse.id"
:warehouse-id="selectedWarehouse.id"
:warehouse-data="warehouseData"
@select="handleZoneSelect"
@add="handleAddZone"
@edit="handleEditZone"
@delete="handleDeleteZone"
/>
<zone-info
v-if="selectedWarehouse.id"
:rack="selectedRack"
:warehouse="selectedWarehouse"
:zone="selectedZone"
/>
</div>
<!-- 右侧边栏 -->
<div class="sidebar right-sidebar">
<!-- 修改这里,传入更多信息 -->
<rack-space-management
:rack="selectedRack"
ref="rackSpaceManagement"
@refresh="refreshRackSpaces"
@space-click="spaceClick"
/>
<space-card
v-if="selectedRack"
:spaceId="currentSpaceId"
@spaceSave="handleSpaceSave"
/>
</div>
<!-- 中间主内容区 -->
<div class="main-content">
<warehouse-viewer
v-if="warehouseData"
ref="warehouseViewer"
:warehouse-data="zoneData"
:scale="scale"
@shelf-click="onShelfClick"
/>
<div v-else class="empty-viewer">
<el-icon><OfficeBuilding /></el-icon>
<p>请选择一个仓库</p>
</div>
</div>
</div>
<!-- 弹窗组件 -->
<zone-dialog
:visible="zoneDialogVisible"
:mode="zoneDialogMode"
:zone-data="currentZone"
:parent-id="currentParentId"
:parent-type="currentParentType"
:parent-info="currentParentInfo"
:warehouse-id="selectedWarehouse.id"
@close="handleZoneDialogClose"
@success="handleZoneDialogSuccess"
/>
<warehouse-dialog
:visible="warehouseDialogVisible"
@close="handleWarehouseDialogClose"
@success="handleWarehouseDialogSuccess"
/>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { OfficeBuilding } from '@element-plus/icons-vue'
import WarehouseTree from './WarehouseTree.vue'
import ZoneManagement from './ZoneManagement.vue'
import WarehouseViewer from './WarehouseViewer.vue'
import RackSpaceManagement from './RackSpaceManagement.vue'
import ZoneDialog from './ZoneDialog.vue'
import WarehouseDialog from './WarehouseDialog.vue'
import zoneInfo from './zoneInfo.vue'
import spaceCard from './spaceCard.vue'
import * as warehouseApi from '@/api/warehouse'
// 仓库数据
const warehouseList = ref<any[]>([])
const selectedWarehouse = ref<any>({ id: null })
const selectedZone = ref<any>({})
const warehouseData = ref<any>(null)
const zoneData = ref<any>(null)
// 货架数据
const selectedRack = ref<any>(null)
// 缩放控制
const scale = ref(1)
// 弹窗控制
const zoneDialogVisible = ref(false)
const zoneDialogMode = ref<'add' | 'edit'>('add')
const currentZone = ref<any>(null)
const currentParentId = ref<any>(null)
const currentParentType = ref<any>(null)
const currentParentInfo = ref<any>(null)
const currentSpaceId = ref<any>(null)
const warehouseDialogVisible = ref(false)
// 组件引用
const rackSpaceManagement = ref<any>(null)
const warehouseViewer = ref<any>(null)
const spaceClick = async (data: any) => {
console.log("仓位行点击", data)
currentSpaceId.value = data.id
console.log(data.id, currentSpaceId.value)
}
// 加载仓库列表
const loadWarehouseList = async () => {
try {
const response: any = await warehouseApi.getWarehouseZones({})
if (response.code === 200) {
warehouseList.value = response.zones || []
}
} catch (error) {
ElMessage.error('加载仓库列表失败')
console.error(error)
}
}
const handleSpaceSave = async () => {
if (rackSpaceManagement.value) {
await rackSpaceManagement.value.loadRackSpaces()
}
}
// 选择仓库
const handleWarehouseSelect = async (warehouse: any) => {
selectedWarehouse.value = warehouse
selectedRack.value = null
try {
const response: any = await warehouseApi.getWarehouseTree(warehouse.id)
if (response.code === 200) {
zoneData.value = warehouseData.value = response.warehouseRoot
}
} catch (error) {
ElMessage.error('加载仓库数据失败')
console.error(error)
}
}
// 选择仓库元素
const handleZoneSelect = (zone: any) => {
if (zone.type === 'rack') {
selectedRack.value = zone
} else {
selectedRack.value = null // 更新平面图显示
if (zone.type !== 'pick_start') {
zoneData.value = zone
}
}
currentSpaceId.value = null
nextTick(() => {
if (warehouseViewer.value) {
warehouseViewer.value.updateSvgSize()
warehouseViewer.value.centerView()
}
})
}
// 添加元素
const handleAddZone = (parentData: any) => {
zoneDialogMode.value = 'add'
currentZone.value = null
currentParentId.value = parentData.id
currentParentType.value = parentData.type
currentParentInfo.value = {
code: parentData.code,
name: parentData.name
}
zoneDialogVisible.value = true
}
// 编辑元素
const handleEditZone = async (zoneDataObj: any) => {
try {
const response: any = await warehouseApi.detail(zoneDataObj.id)
if (response.code === 200) {
zoneDialogMode.value = 'edit'
currentZone.value = response.zone
zoneDialogVisible.value = true
}
} catch (error) {
ElMessage.error('加载元素详情失败')
}
}
// 删除元素
const handleDeleteZone = async (zoneDataObj: any) => {
ElMessageBox.confirm('确定删除该元素吗?此操作不可恢复。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
try {
const response: any = await warehouseApi.deleteZone(zoneDataObj.id)
if (response.code === 200) {
ElMessage.success('删除成功')
await refreshCurrentWarehouse()
} else {
ElMessage.error(response.message || '删除失败')
}
} catch (error: any) {
ElMessage.error(error.message || '删除失败')
}
}).catch(() => {})
}
// 刷新当前仓库数据
const refreshCurrentWarehouse = async () => {
if (selectedWarehouse.value.id) {
await handleWarehouseSelect(selectedWarehouse.value)
}
}
// 刷新货架格子数据
const refreshRackSpaces = async () => {
if (selectedRack.value && rackSpaceManagement.value) {
await rackSpaceManagement.value.loadSpaces()
}
}
// 货架点击事件
const onShelfClick = (shelfData: any) => {
selectedRack.value = shelfData
}
// 弹窗关闭
const handleZoneDialogClose = () => {
zoneDialogVisible.value = false
}
// 弹窗成功
const handleZoneDialogSuccess = async () => {
zoneDialogVisible.value = false
await refreshCurrentWarehouse()
}
// 显示添加仓库弹窗
const showAddWarehouseDialog = () => {
warehouseDialogVisible.value = true
}
// 仓库弹窗关闭
const handleWarehouseDialogClose = () => {
warehouseDialogVisible.value = false
}
// 仓库弹窗成功
const handleWarehouseDialogSuccess = async () => {
warehouseDialogVisible.value = false
await loadWarehouseList()
}
onMounted(() => {
loadWarehouseList()
})
</script> </script>
<style lang="scss" scoped>
.warehouse-management-container {
width: 100%;
height: 100%;
overflow: hidden;
.main-layout {
display: flex;
height: 100%;
padding: 16px;
gap: 16px;
.sidebar {
width: 300px;
display: flex;
flex-direction: column;
gap: 16px;
&.left-sidebar {
flex-shrink: 0;
}
&.right-sidebar {
flex-shrink: 0;
width: 600px;
}
}
.main-content {
flex: 1;
min-width: 0;
.empty-viewer {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 4px;
color: #c0c4cc;
i {
font-size: 48px;
margin-bottom: 16px;
}
p {
font-size: 14px;
}
}
}
.empty-rack {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #c0c4cc;
i {
font-size: 48px;
margin-bottom: 16px;
}
p {
font-size: 14px;
}
}
}
}
</style>

View File

@ -1,125 +0,0 @@
<template>
<div class="space-card">
<el-card class="space-management-card">
<el-tabs v-model="activeTab" class="space-tabs">
<el-tab-pane label="属性" name="property">
<property-form
ref="propertyFormRef"
:title="'属性管理'"
:space-id="currentSpaceId"
:key="propertyFormKey"
@spaceSave="handleSpaceSave"
class="tab-content"
/>
</el-tab-pane>
<el-tab-pane label="库存" name="inventory">
<inventory-form
ref="inventoryFormRef"
:title="'库存管理'"
:space-id="currentSpaceId"
:key="inventoryFormKey"
class="tab-content"
/>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script setup lang="ts">
import { ref, watch, nextTick,} from 'vue'
import PropertyForm from './PropertyForm.vue'
import InventoryForm from './InventoryForm.vue'
const props = defineProps({ spaceId: { type: [String, Number], default: null } })
const emit = defineEmits(['spaceSave'])
const activeTab = ref('property')
const currentSpaceId = ref(props.spaceId)
const propertyFormKey = ref(0)
const inventoryFormKey = ref(0)
const propertyFormRef = ref<any>(null)
const inventoryFormRef = ref<any>(null)
watch(() => props.spaceId, (newId) => {
console.log('空间ID变化:', newId)
currentSpaceId.value = newId
propertyFormKey.value += 1
inventoryFormKey.value += 1
nextTick(() => {
if (activeTab.value === 'property' && propertyFormRef.value && propertyFormRef.value.loadProperties) {
propertyFormRef.value.loadProperties()
} else if (activeTab.value === 'inventory' && inventoryFormRef.value && inventoryFormRef.value.loadInventory) {
inventoryFormRef.value.loadInventory()
}
})
}, { immediate: true })
function updateSpaceId(spaceId: any) { currentSpaceId.value = spaceId }
function handleSpaceSave() {
emit('spaceSave')
console.log('修改仓位')
}
function reloadCurrentTab() {
if (activeTab.value === 'property') {
if (propertyFormRef.value && propertyFormRef.value.loadProperties) propertyFormRef.value.loadProperties()
} else if (activeTab.value === 'inventory') {
if (inventoryFormRef.value && inventoryFormRef.value.loadInventory) inventoryFormRef.value.loadInventory()
}
}
function getFormData() {
const data: any = { spaceId: currentSpaceId.value, properties: null, inventory: null }
if (propertyFormRef.value) {
if (propertyFormRef.value.getProperties) data.properties = propertyFormRef.value.getProperties()
else if (propertyFormRef.value.getFormData) data.properties = propertyFormRef.value.getFormData()
}
if (inventoryFormRef.value) {
if (inventoryFormRef.value.getInventory) data.inventory = inventoryFormRef.value.getInventory()
else if (inventoryFormRef.value.getProperties) data.inventory = inventoryFormRef.value.getProperties()
else if (inventoryFormRef.value.getFormData) data.inventory = inventoryFormRef.value.getFormData()
}
return data
}
defineExpose({ updateSpaceId, getFormData, reloadCurrentTab })
</script>
<style>
.space-card{
flex:1;
.space-management-card{
height:100%;
display:flex;
.el-card__body{
flex:1;
.space-tabs{
display:flex;
flex-direction: column;
height: 100%;
overflow-y: auto;
.el-tabs__header{
padding:0;
margin:0;
}
.el-tabs__content{
flex:1;
.el-tab-pane{
height: 100%;
overflow-y: auto;
overflow-x: hidden;
}
}
}
}
}
}
</style>

View File

@ -1,768 +0,0 @@
<template>
<div class="zone-management">
<!-- 左侧边栏 -->
<div class="sidebar">
<!-- 仓库列表卡片 -->
<el-card class="warehouse-card">
<template #header>
<span>仓库列表</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="showAddWarehouseDialog">
添加仓库
</el-button>
</template>
<div class="warehouse-list">
<el-tree ref="warehouseTreeRef" :data="warehouseList" node-key="id" :props="warehouseTreeProps"
:expand-on-click-node="false" :highlight-current="true" @node-click="handleWarehouseSelect">
<template v-slot="{ node, data }">
<span class="custom-tree-node">
<span>
<span>{{ data.name }}</span>
</span>
</span>
</template>
</el-tree>
</div>
</el-card>
<!-- 仓库元素树状图 -->
<el-card class="zone-card">
<template #header>
<span>仓库元素</span>
</template>
<div class="zone-tree">
<el-tree v-if="selectedWarehouse.id" ref="zoneTreeRef" :data="zoneTreeData" node-key="id" :props="zoneTreeProps"
:expand-on-click-node="false" :highlight-current="true" @node-click="handleZoneSelect">
<template v-slot="{ node, data }">
<span class="custom-tree-node">
<span class="tree-node-content">
<span>{{ data.name }}</span>
</span>
<span class="tree-node-actions">
<el-button type="text" size="mini" @click.stop="addChildElement(data)">添加</el-button>
<el-button type="text" size="mini" @click.stop="editElement(data)">编辑</el-button>
<el-button type="text" size="mini" @click.stop="deleteElement(data)">删除</el-button>
</span>
</span>
</template>
</el-tree>
<div v-else class="empty-state">
<i class="el-icon-office-building" style="font-size: 48px; color: #c0c4cc;"></i>
<p>请先选择一个仓库</p>
</div>
</div>
</el-card>
</div>
<!-- 主内容区 - 仓库平面图 -->
<el-card class="main-content" :body-style="'flex:1'">
<template #header>
<span>仓库平面图</span>
<div class="view-controls">
<el-button-group>
<el-button size="mini" @click="zoomOut" :disabled="scale <= minScale">
<i class="el-icon-zoom-out"></i>
</el-button>
<el-button size="mini" @click="zoomIn" :disabled="scale >= maxScale">
<i class="el-icon-zoom-in"></i>
</el-button>
<el-button size="mini" @click="resetView">
<i class="el-icon-refresh"></i> 重置
</el-button>
</el-button-group>
<span class="scale-display">
缩放: {{ (scale * 100).toFixed(0) }}%
</span>
</div>
</template>
<div class="viewer-container">
<WarehouseViewer v-if="warehouseData" ref="warehouseViewerRef" :warehouse-data="warehouseData" :scale="scale"
@shelf-cell-click="onShelfCellClick" @area-click="onAreaClick" @mode-change="onModeChange" />
</div>
</el-card>
<!-- 右侧边栏 - 连通性检测 -->
<div class="sidebar">
<el-card class="connectivity-card">
<template #header>
<span>连通性检测</span>
</template>
<div class="connectivity-content">
<div class="zone-selectors">
<div class="zone-selector">
<label>起点位置:</label>
<el-select v-model="startZone" placeholder="请选择起点" @change="onZoneSelect('start')">
<el-option v-for="z in allZones" :key="z.id" :label="z.label" :value="z.id" />
</el-select>
</div>
<div class="zone-selector">
<label>终点位置:</label>
<el-select v-model="endZone" placeholder="请选择终点" @change="onZoneSelect('end')">
<el-option v-for="z in allZones" :key="z.id" :label="z.label" :value="z.id" />
</el-select>
</div>
</div>
<div class="selected-zones">
<div v-if="selectedStartZone" class="selected-zone">
<div class="zone-info">
<strong>{{ selectedStartZone.name }}</strong>
</div>
</div>
<div v-if="selectedEndZone" class="selected-zone">
<div class="zone-info">
<strong>{{ selectedEndZone.name }}</strong>
</div>
</div>
</div>
<div class="detection-actions">
<el-button type="primary" size="small" @click="checkConnectivity" :disabled="!selectedStartZone || !selectedEndZone">
<i class="el-icon-connection"></i> 检测连通性
</el-button>
<el-button type="info" size="small" @click="clearSelection">
清空选择
</el-button>
</div>
<div v-if="connectivityResult !== null" class="result-container">
<div :class="['result-card', connectivityResult.success ? 'success' : 'error']">
<div class="result-header">
<strong>{{ connectivityResult.success ? '连通' : '不连通' }}</strong>
</div>
<div class="result-content">
<div v-if="connectivityResult.success">距离: {{ connectivityResult.distance }}</div>
<div v-else>原因: {{ connectivityResult.reason }}</div>
</div>
<div v-if="connectivityResult.success" class="result-actions">
<el-button size="mini" @click="visualizePath">可视化路径</el-button>
<el-button size="mini" @click="showPathDetails">查看详情</el-button>
</div>
</div>
</div>
<div v-if="detectionHistory.length > 0" class="history-container">
<div class="history-header">
<span>检测历史</span>
<el-button type="text" size="mini" @click="clearHistory">清空</el-button>
</div>
<div class="history-list">
<div v-for="record in detectionHistory" :key="record.id" class="history-item" @click="showHistoryRecord(record)">
<div>{{ record.time }} - {{ record.startName }} → {{ record.endName }} - {{ record.success ? '成功' : '失败' }}</div>
</div>
</div>
</div>
</div>
</el-card>
</div>
<!-- 添加/编辑元素弹窗 -->
<ZoneDialog :visible="dialogVisible" :mode="dialogMode" :zone-data="currentZone" :parent-id:string="selectedParentId" :parentType="parentType"
:warehouse-id:string="selectedWarehouse.id" @close="() => dialogVisible = false" @success="handleDialogSuccess" />
<!-- 添加仓库弹窗 -->
<el-dialog title="添加仓库" :visible.sync="warehouseDialogVisible" width="800px" :before-close="handleWarehouseDialogClose">
<el-form ref="warehouseFormRef" :model="warehouseForm" :rules="warehouseRules" label-width="100px">
<el-form-item label="仓库名称" prop="zone_name">
<el-input v-model="warehouseForm.zone_name" placeholder="请输入仓库名称" />
</el-form-item>
<el-form-item label="仓库编码" prop="zone_code">
<el-input v-model="warehouseForm.zone_code" placeholder="请输入仓库编码" maxlength="5" show-word-limit />
</el-form-item>
<el-card class="coordinate-section">
<template #header>
<span>仓库尺寸(单位:毫米)</span>
</template>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="长度" prop="length">
<el-input-number v-model="warehouseForm.length" :min="1000" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="宽度" prop="width">
<el-input-number v-model="warehouseForm.width" :min="1000" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="高度" prop="height">
<el-input-number v-model="warehouseForm.height" :min="1000" />
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-form-item label="显示颜色" prop="color">
<el-color-picker v-model="warehouseForm.color" />
</el-form-item>
<el-form-item label="是否启用" prop="is_active">
<el-switch v-model="warehouseForm.is_active" :active-value="1" :inactive-value="0" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="warehouseDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitWarehouse" :loading="submittingWarehouse">确定</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
import WarehouseViewer from './WarehouseViewer.vue'
import ZoneDialog from './ZoneDialog.vue'
import * as warehouseApi from '@/api/warehouse'
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
const warehouseTreeRef = ref(null)
const zoneTreeRef = ref(null)
const warehouseViewerRef = ref<any>(null)
const warehouseFormRef = ref<any>(null)
const warehouseList = ref<any[]>([])
const selectedWarehouse = reactive({ id: null })
const zoneTreeData = ref<any[]>([])
const zoneTreeProps = { children: 'children', label: 'label' }
const warehouseTreeProps = { children: 'children', label: 'name' }
const warehouseData = ref<any>(null)
const scale = ref(1)
const minScale = ref(0.5)
const maxScale = ref(3)
const allZones = ref<any[]>([])
const startZone = ref<number | null>(null)
const endZone = ref<number | null>(null)
const selectedStartZone = ref<any>(null)
const selectedEndZone = ref<any>(null)
const connectivityResult = ref<any | null>(null)
const detectionHistory = ref<any[]>([])
const currentDetectionId = ref<number | null>(null)
const dialogVisible = ref(false)
const dialogMode = ref<'add' | 'edit'>('add')
const currentZone = ref<any>(null)
const parentType = ref<any>(null)
const selectedParentId = ref<number | null>(null)
const warehouseDialogVisible = ref(false)
const warehouseForm = reactive({
zone_type: 'warehouse',
zone_name: '',
zone_code: '',
parent_id: 0,
x: 0,
y: 0,
z: 0,
length: 10000,
width: 10000,
height: 5000,
color: '#96ceb4',
is_active: 1
})
const warehouseRules = reactive({
zone_name: [ { required: true, message: '请输入仓库名称', trigger: 'blur' }, { min:1, max:100, message: '长度在 1 到 100 个字符', trigger: 'blur' } ],
zone_code: [ { required: true, message: '请输入仓库编码', trigger: 'blur' }, { pattern: /^[A-Z0-9]{1,5}$/, message: '编码必须是1-5位大写字母或数字', trigger: 'blur' } ],
length: [ { required: true, message: '请输入长度', trigger: 'blur' }, { type: 'number', min: 1000, message: '长度不能小于1000mm', trigger: 'blur' } ],
width: [ { required: true, message: '请输入宽度', trigger: 'blur' }, { type: 'number', min: 1000, message: '宽度不能小于1000mm', trigger: 'blur' } ],
height: [ { required: true, message: '请输入高度', trigger: 'blur' }, { type: 'number', min: 1000, message: '高度不能小于1000mm', trigger: 'blur' } ]
})
let handleWheelListener: any = null
onMounted(() => {
initWarehouse()
initEventListeners()
})
onBeforeUnmount(() => {
removeEventListeners()
})
watch(zoneTreeData, (newVal) => {
if (newVal && newVal.length > 0) {
extractAllZones(newVal[0])
}
}, { deep: true })
async function initWarehouse() {
try {
const response: any = await warehouseApi.getWarehouseZones({})
if (response.code == 200) {
warehouseList.value = formatWarehouseList(response.zones || [])
}
} catch (error) {
ElMessage.error('加载仓库列表失败')
console.error(error)
}
}
function formatWarehouseList(data: any[]) {
return data.map(warehouse => ({
id: warehouse.id,
name: warehouse.label || warehouse.zone_name,
code: warehouse.code || warehouse.zone_code,
type: warehouse.type || 'warehouse',
children: warehouse.children || [],
data: warehouse.data || {}
}))
}
async function handleWarehouseSelect(data: any) {
selectedWarehouse.id = data.id
try {
const treeResponse: any = await warehouseApi.getWarehouseTree(data.id)
if (treeResponse.code == 200) {
zoneTreeData.value = [treeResponse.warehouseRoot]
calculateInitialScale(treeResponse.warehouseRoot)
warehouseData.value = treeResponse.warehouseRoot
}
} catch (error) {
ElMessage.error('加载仓库数据失败')
console.error(error)
}
}
function handleZoneSelect(data: any) {
warehouseData.value = data
}
function extractAllZones(node: any, result: any[] = []) {
if (!node) return result
if (node.type !== 'warehouse_root' && node.id) {
result.push({ id: node.id, label: `${node.code || ''} - ${node.name}`, type: node.type, name: node.name, code: node.code, data: node.data || {} })
}
if (node.children && node.children.length > 0) node.children.forEach((child: any) => extractAllZones(child, result))
allZones.value = result
}
function calculateInitialScale(warehouseRoot: any) {
if (!warehouseRoot || !warehouseRoot.children || warehouseRoot.children.length === 0) {
scale.value = 1
return
}
let maxX = 0, maxY = 0
const traverse = (node: any) => {
if (node.data) {
const x = (node.data.x || 0) + (node.data.length || 0)
const y = (node.data.y || 0) + (node.data.width || 0)
maxX = Math.max(maxX, x)
maxY = Math.max(maxY, y)
}
if (node.children) node.children.forEach((c: any) => traverse(c))
}
traverse(warehouseRoot)
nextTick(() => {
const containerWidth = warehouseViewerRef.value && warehouseViewerRef.value.$el ? warehouseViewerRef.value.$el.offsetWidth : 800
const containerHeight = warehouseViewerRef.value && warehouseViewerRef.value.$el ? warehouseViewerRef.value.$el.offsetHeight : 600
const scaleX = containerWidth / (maxX + 100)
const scaleY = containerHeight / (maxY + 100)
const targetScale = Math.min(scaleX, scaleY, 1)
scale.value = targetScale || 1
})
}
function canAddChild(zoneType: string) {
const allowedParents: any = { warehouse: ['area'], area: ['aisle'], aisle: ['rack'], rack: [], obstacle: [], gate: [], pick_start: [] }
return allowedParents[zoneType] && allowedParents[zoneType].length > 0
}
function getAddableChildTypes(parentTypeVal: string) {
const typeMap: any = { warehouse: ['area'], area: ['aisle'], aisle: ['rack', 'obstacle', 'gate', 'pick_start'] }
return typeMap[parentTypeVal] || []
}
function addRootElement() {
if (!selectedWarehouse.id) { ElMessage.warning('请先选择仓库'); return }
dialogMode.value = 'add'
currentZone.value = null
selectedParentId.value = selectedWarehouse.id
dialogVisible.value = true
}
function addChildElement(parentData: any) {
dialogMode.value = 'add'
currentZone.value = null
parentType.value = parentData.type
selectedParentId.value = parentData.id
dialogVisible.value = true
}
async function editElement(zoneData: any) {
try {
const response: any = await warehouseApi.detail(zoneData.id)
if (response.code == 200) {
dialogMode.value = 'edit'
currentZone.value = response.zone
selectedParentId.value = null
dialogVisible.value = true
}
} catch (error) {
ElMessage.error('加载元素详情失败')
console.error(error)
}
}
function deleteElement(zoneData: any) {
ElMessageBox.confirm('确定删除该元素吗?此操作不可恢复。', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
.then(async () => {
try {
const response: any = await warehouseApi.deleteZone(zoneData.id)
if (response.data && response.data.success) {
ElMessage.success('删除成功')
refreshZoneTree()
}
} catch (error) { ElMessage.error('删除失败'); console.error(error) }
}).catch(() => {})
}
async function handleDialogSuccess() { dialogVisible.value = false; await refreshZoneTree() }
async function refreshZoneTree() {
if (!selectedWarehouse.id) return
try {
const response: any = await warehouseApi.getWarehouseTree(selectedWarehouse.id)
if (response.data && response.data.success) {
zoneTreeData.value = [response.data.data]
warehouseData.value = response.data.data
}
} catch (error) { console.error('刷新树状图失败:', error) }
}
function showAddWarehouseDialog() {
warehouseForm.zone_type = 'warehouse'
warehouseForm.zone_name = ''
warehouseForm.zone_code = ''
warehouseForm.parent_id = 0
warehouseForm.x = 0
warehouseForm.y = 0
warehouseForm.z = 0
warehouseForm.length = 10000
warehouseForm.width = 10000
warehouseForm.height = 5000
warehouseForm.color = '#96ceb4'
warehouseForm.is_active = 1
if (warehouseFormRef.value && warehouseFormRef.value.clearValidate) warehouseFormRef.value.clearValidate()
warehouseDialogVisible.value = true
}
async function submitWarehouse() {
try {
if (warehouseFormRef.value && warehouseFormRef.value.validate) await warehouseFormRef.value.validate()
warehouseDialogVisible.value = false
submittingWarehouse.value = false
const response: any = await warehouseApi.create(warehouseForm)
if (response.data && response.data.success) { ElMessage.success('仓库添加成功'); initWarehouse() }
} catch (err: unknown) {
let msg = '添加仓库失败'
if (err instanceof Error) msg = err.message
else if (typeof err === 'string') msg = err
ElMessage.error(msg)
console.error(err)
}
}
function handleWarehouseDialogClose(done: any) {
if (submittingWarehouse.value) { ElMessage.warning('正在提交,请稍候'); return }
done()
}
function onZoneSelect(type: 'start' | 'end') {
const zoneId = type === 'start' ? startZone.value : endZone.value
const zone = allZones.value.find(z => z.id === zoneId)
if (zone) { if (type === 'start') selectedStartZone.value = zone; else selectedEndZone.value = zone }
}
async function checkConnectivity() {
if (!selectedStartZone.value || !selectedEndZone.value) { ElMessage.warning('请选择起点和终点'); return }
if (selectedStartZone.value.id === selectedEndZone.value.id) { ElMessage.warning('起点和终点不能相同'); return }
try {
const response: any = await warehouseApi.checkConnectivity({ startZoneId: selectedStartZone.value.id, endZoneId: selectedEndZone.value.id, warehouseId: selectedWarehouse.id })
if (response.data && response.data.success) {
connectivityResult.value = response.data.data
addToHistory(connectivityResult.value)
ElMessage.success('连通性检测完成')
}
} catch (error) {
const result = simulateConnectivity()
connectivityResult.value = result
addToHistory(result)
if (result.success) ElMessage.success('路径可达')
else ElMessage.warning('路径不可达')
}
}
function simulateConnectivity() {
const start = selectedStartZone.value; const end = selectedEndZone.value
const obstacles = allZones.value.filter((z: any) => z.type === 'obstacle' || (z.type === 'rack' && !canPassThroughRack(z)))
if (obstacles.some((obs: any) => obs.id === start.id || obs.id === end.id)) return { success: false, reason: '起点或终点是障碍物', distance:0, path: [] }
const distance = calculateDistance(start, end)
const path = [start, end]
const isConnected = Math.random() > 0.3
return isConnected ? { success: true, distance, path, reason: '' } : { success: false, distance:0, path: [], reason: '路径被障碍物阻挡' }
}
function calculateDistance(zone1: any, zone2: any) {
const center1 = { x: zone1.data.x + zone1.data.length / 2, y: zone1.data.y + zone1.data.width / 2, z: zone1.data.z + zone1.data.height / 2 }
const center2 = { x: zone2.data.x + zone2.data.length / 2, y: zone2.data.y + zone2.data.width / 2, z: zone2.data.z + zone2.data.height / 2 }
const dx = center1.x - center2.x, dy = center1.y - center2.y, dz = center1.z - center2.z
return Math.sqrt(dx*dx + dy*dy + dz*dz)
}
function canPassThroughRack(rackZone: any) { return rackZone.data.direction !== 'north' }
function addToHistory(result: any) {
const record = { id: Date.now(), startZoneId: selectedStartZone.value.id, startName: selectedStartZone.value.name, endZoneId: selectedEndZone.value.id, endName: selectedEndZone.value.name, success: result.success, distance: result.distance, time: new Date().toLocaleTimeString(), data: result }
detectionHistory.value.unshift(record)
currentDetectionId.value = record.id
if (detectionHistory.value.length > 10) detectionHistory.value = detectionHistory.value.slice(0,10)
}
function showHistoryRecord(record: any) {
startZone.value = record.startZoneId
endZone.value = record.endZoneId
selectedStartZone.value = allZones.value.find(z => z.id === record.startZoneId)
selectedEndZone.value = allZones.value.find(z => z.id === record.endZoneId)
connectivityResult.value = record.data
currentDetectionId.value = record.id
}
function clearSelection() { startZone.value = null; endZone.value = null; selectedStartZone.value = null; selectedEndZone.value = null; connectivityResult.value = null; currentDetectionId.value = null }
function clearHistory() { detectionHistory.value = []; currentDetectionId.value = null }
function showPathDetails() {
if (!connectivityResult.value || !connectivityResult.value.success) return
const pathDetails = connectivityResult.value.path.map((zone: any, index: number) => `${index+1}. ${zone.name} (${zone.type})`).join('\n')
ElMessageBox.alert(pathDetails, '路径详情', { confirmButtonText: '确定', customClass: 'path-details-dialog' })
}
function visualizePath() { if (warehouseViewerRef.value && warehouseViewerRef.value.showPath) warehouseViewerRef.value.showPath(connectivityResult.value.path) }
function zoomIn() { if (scale.value < maxScale.value) scale.value = Math.min(scale.value + 0.1, maxScale.value) }
function zoomOut() { if (scale.value > minScale.value) scale.value = Math.max(scale.value - 0.1, minScale.value) }
function resetView() { calculateInitialScale(warehouseData.value) }
function initEventListeners() {
handleWheelListener = (event: WheelEvent) => {
if (event.ctrlKey) { event.preventDefault(); const delta = event.deltaY > 0 ? -0.1 : 0.1; scale.value = Math.max(minScale.value, Math.min(maxScale.value, scale.value + delta)) }
}
window.addEventListener('wheel', handleWheelListener, { passive: false })
}
function removeEventListeners() { if (handleWheelListener) window.removeEventListener('wheel', handleWheelListener) }
function onShelfCellClick(data: any) { console.log('货架单元格点击:', data) }
function onAreaClick(data: any) { console.log('区域点击:', data) }
function onModeChange(mode: any) { console.log('模式变更:', mode) }
const submittingWarehouse = ref(false)
</script>
<style lang="scss" scoped>
.zone-management {
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
flex-direction: row;
padding: 16px;
box-sizing: border-box;
background: #f5f7fa;
.el-card__header {
height: 40px;
line-height: 40px;
padding: 0 20px;
}
.sidebar {
width: 320px;
height: 100%;
display: flex;
flex-direction: column;
.warehouse-card {
height: 300px;
margin-bottom: 16px;
display: flex;
flex-direction: column;
.warehouse-list {
flex: 1;
overflow: auto;
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
}
}
.zone-card {
flex: 1;
display: flex;
flex-direction: column;
.zone-tree {
flex: 1;
overflow: auto;
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
.tree-node-content {}
.tree-node-actions {}
&:hover .tree-node-actions {}
}
.empty-state {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #909399;
p {}
}
}
}
.connectivity-card {
flex: 1;
display: flex;
flex-direction: column;
.connectivity-content {
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
.zone-selectors {
display: flex;
flex-direction: column;
gap: 12px;
.zone-selector {}
}
.selected-zones {
display: flex;
flex-direction: column;
gap: 12px;
.selected-zone {}
}
.detection-actions {
display: flex;
gap: 8px;
justify-content: center;
}
.result-container {
.result-card {}
}
.history-container {
.history-header {}
.history-list {}
}
}
}
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
margin: 0 16px;
.el-card__header {
display: flex;
justify-content: space-between;
align-items: center;
.view-controls {
display: flex;
align-items: center;
gap: 16px;
.scale-display {
font-size: 14px;
color: #666;
}
}
}
.el-card__body{
flex:1;
.viewer-container {
height:100%;
flex: 1;
min-height: 0;
position: relative;
background: #fff;
border-radius: 4px;
overflow: hidden;
}
}
}
}
.el-tree {
.el-tree-node__content {
height: 36px;
&:hover {
background-color: #f5f7fa;
}
}
.el-tree-node.is-current>.el-tree-node__content {
background-color: #ecf5ff;
.el-tree-node__label {
color: #409eff;
font-weight: 500;
}
}
}
.el-card {
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
border: 1px solid #ebeef5;
&:hover {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
}
.coordinate-section { margin-bottom: 20px; .el-card__header { padding: 12px 20px; background: #f8f9fa; } }
.path-details-dialog { .el-message-box__content { max-height: 400px; overflow-y: auto; white-space: pre-line; } }
</style>

View File

@ -1,304 +0,0 @@
<template>
<div class="rack-space-management">
<!-- 货架管理部分 -->
<div v-if="props.rack && props.rack.type === 'rack'" class="rack-management">
<el-card class="rack-info-card">
<template #header>
<span>货架信息</span>
</template>
<div class="rack-info-content">
<div class="info-item">
<span class="label">编码:</span>
<span class="value">{{ props.rack.code || props.rack.zone_code }}</span>
</div>
<div class="info-item">
<span class="label">名称:</span>
<span class="value">{{ props.rack.name || props.rack.zone_name }}</span>
</div>
<div class="info-item">
<span class="label">尺寸:</span>
<span class="value">{{ props.rack.data.length || 0 }} × {{ props.rack.data.width || 0 }} × {{ props.rack.data.height || 0 }} cm</span>
</div>
<div class="info-item">
<span class="label">仓位数量:</span>
<span class="value">{{ calculateRackTotal() }}</span>
</div>
</div>
</el-card>
</div>
<!-- 仓库/库区信息卡片 -->
<div v-else-if="props.warehouse || props.zone" class="info-display">
<!-- 仓库信息卡片 -->
<el-card v-if="props.warehouse && props.warehouse.id" class="warehouse-info-card">
<template #header>
<span>仓库信息</span>
<el-button type="text" size="small" @click="handleEditWarehouse" v-if="props.warehouse.editable">编辑</el-button>
</template>
<div class="warehouse-info-content">
<div class="info-item">
<span class="label">仓库编码:</span>
<span class="value">{{ props.warehouse.code || props.warehouse.zone_code }}</span>
</div>
<div class="info-item">
<span class="label">仓库名称:</span>
<span class="value">{{ props.warehouse.label }}</span>
</div>
<div class="info-item">
<span class="label">仓库尺寸:</span>
<span class="value">{{ props.warehouse.length || 0 }} × {{ props.warehouse.width || 0 }} × {{ props.warehouse.height || 0 }} cm</span>
</div>
<div class="info-item">
<span class="label">总面积:</span>
<span class="value">{{ calculateArea(props.warehouse) }} m²</span>
</div>
<!-- 仓库统计信息 -->
<div class="statistics-section">
<h4>统计信息</h4>
<el-row :gutter="20">
<el-col :span="12">
<div class="stat-item">
<div class="stat-label">库区数量</div>
<div class="stat-value">{{ props.warehouse.areaCount || 0 }}</div>
</div>
</el-col>
<el-col :span="12">
<div class="stat-item">
<div class="stat-label">货架数量</div>
<div class="stat-value">{{ props.warehouse.rackCount || 0 }}</div>
</div>
</el-col>
<el-col :span="12">
<div class="stat-item">
<div class="stat-label">总仓位</div>
<div class="stat-value">{{ props.warehouse.totalSpaces || 0 }}</div>
</div>
</el-col>
</el-row>
</div>
</div>
</el-card>
<!-- 库区信息卡片 -->
<el-card v-else-if="props.zone && props.zone.type === 'area'" class="zone-info-card">
<template #header>
<span>库区信息</span>
<el-button type="text" size="small" @click="handleEditZone" v-if="props.zone.editable">编辑</el-button>
</template>
<div class="zone-info-content">
<div class="info-item">
<span class="label">库区编码:</span>
<span class="value">{{ props.zone.code || props.zone.zone_code }}</span>
</div>
<div class="info-item">
<span class="label">库区名称:</span>
<span class="value">{{ props.zone.name || props.zone.zone_name }}</span>
</div>
<div class="info-item">
<span class="label">所属仓库:</span>
<span class="value">{{ props.zone.warehouseName || '未知' }}</span>
</div>
<div class="info-item">
<span class="label">库区尺寸:</span>
<span class="value">{{ props.zone.length || 0 }} × {{ props.zone.width || 0 }} × {{ props.zone.height || 0 }} cm</span>
</div>
<div class="info-item">
<span class="label">占地面积:</span>
<span class="value">{{ calculateArea(props.zone) }} m²</span>
</div>
<div class="info-item">
<span class="label">显示颜色:</span>
<span class="value color-preview" :style="{ backgroundColor: props.zone.color || '#3B82F6' }"></span>
</div>
<div class="info-item">
<span class="label">状态:</span>
<span class="value">
<el-tag :type="props.zone.is_active === 1 ? 'success' : 'info'" size="small">{{ props.zone.is_active === 1 ? '启用' : '停用' }}</el-tag>
</span>
</div>
<!-- 库区统计信息 -->
<div class="statistics-section">
<h4>库区统计</h4>
<el-row :gutter="20">
<el-col :span="12">
<div class="stat-item">
<div class="stat-label">货架数量</div>
<div class="stat-value">{{ props.zone.rackCount || 0 }}</div>
</div>
</el-col>
<el-col :span="12">
<div class="stat-item">
<div class="stat-label">拣货点数量</div>
<div class="stat-value">{{ props.zone.pickPointCount || 0 }}</div>
</div>
</el-col>
<el-col :span="24">
<div class="stat-item">
<div class="stat-label">总仓位数量</div>
<div class="stat-value">{{ props.zone.totalSpaces || 0 }}</div>
</div>
</el-col>
</el-row>
</div>
</div>
</el-card>
</div>
<!-- 空状态 -->
<div v-else class="empty-info">
<div class="empty-content">
<i class="el-icon-s-grid"></i>
<p>请选择仓库、库区或货架</p>
<p class="empty-hint">在左侧选择项目查看详细信息</p>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import * as warehouseApi from '@/api/warehouse'
const props = defineProps({
rack: { type: Object, default: null },
warehouse: { type: Object, default: null },
zone: { type: Object, default: null }
})
const emit = defineEmits([ 'edit-warehouse', 'edit-zone', 'edit-rack', 'edit-space', 'space-click', 'refresh' ])
const rackSpaces = ref<any[]>([])
const loading = ref(false)
watch(() => props.rack, (newVal) => {
if (newVal && newVal.type === 'rack') {
loadRackSpaces()
}
}, { immediate: true })
watch(() => props.warehouse, (newVal) => {
// 保持原行为
}, { immediate: true })
function rowStyle() { return { height: '40px' } }
function calculateRackTotal() {
if (!props.rack) return 0
const { rackColumns = 1, rackRows = 1, rackLevels = 1 } = props.rack.data || {}
return rackColumns * rackRows * rackLevels
}
function calculateVolume(item: any) {
const { length = 0, width = 0, height = 0 } = item || {}
const volume = (length * width * height) / 1000000
return volume.toFixed(2)
}
function calculateArea(item: any) {
const { length = 0, width = 0 } = item || {}
const area = (length * width) / 10000
return area.toFixed(2)
}
async function loadRackSpaces() {
if (!props.rack || props.rack.type !== 'rack') return
loading.value = true
try {
const response: any = await warehouseApi.getSpacesByRack(props.rack.id)
if (response.code === 200) {
rackSpaces.value = response.spaces || []
}
} catch (error) {
console.error('加载仓位失败:', error)
rackSpaces.value = []
} finally {
loading.value = false
}
}
function handleEditWarehouse() { emit('edit-warehouse', props.warehouse) }
function handleEditZone() { emit('edit-zone', props.zone) }
function handleEditRack() { emit('edit-rack', props.rack) }
async function handleAddSpace() {
if (!props.rack || props.rack.type !== 'rack') return
loading.value = true
try {
const response: any = await warehouseApi.createRackWithSpaces(props.rack.id)
if (response.code === 200) {
await loadRackSpaces()
}
} catch (error) {
console.error('创建仓位失败:', error)
} finally {
loading.value = false
}
}
function handleEditSpace(space: any) { emit('edit-space', space) }
function handleSpaceClick(space: any) { emit('space-click', space) }
function refresh() {
if (props.rack && props.rack.type === 'rack') loadRackSpaces()
emit('refresh')
}
</script>
<style scoped>
.rack-space-management {
display: flex;
flex-direction: column;
gap: 16px;
overflow-y: auto;
.el-card__header {
padding: 0;
height: 40px;
line-height: 40px;
padding-left: 20px;
font-weight: 400;
}
.el-card__body{
font-size: 14px;
}
.rack-management,
.info-display {
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
color: #303133;
}
.zone-image-placeholder {
margin-top: 20px;
padding: 40px 20px;
text-align: center;
border: 1px dashed #dcdfe6;
border-radius: 4px;
background: #f5f7fa;
i {
font-size: 40px;
color: #c0c4cc;
margin-bottom: 12px;
}
p {
margin: 0;
color: #909399;
font-size: 14px;
}
}
}
</style>

1482
src/windows.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (14, '2885-831', '', '', 'JYCK', 'khgj2025100902', '', 'OFFLINE', '线下', '2026-01-13 14:17:35', NULL, '2026-01-13 14:17:35', '2026-01-13 13:37:42', '2026-01-13 13:37:42', '', NULL, NULL, '2026-01-13 13:38:05', '线下店铺', NULL, NULL, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, NULL, 'SF', NULL, '', '', NULL, 'N', 'N', 'pedding', '刘付明仁', '', '', '18022440198', '', '', '广东省', '广州市', '白云区', '', '钟落潭良沙二路32号', NULL, NULL, NULL, 'padding', 1000016, 100000, 34597803, '101845+5', 1, 5, 0.00, 'cbb47c0389ebc6c930a4671a4ea5d3a3', 403, 0, 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none');
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (17, '2885-832', '', '', 'JYCK', 'khgj2025100902', '', 'OFFLINE', '线下', '2026-01-13 14:46:22', NULL, '2026-01-13 14:46:22', '2026-01-13 14:36:37', '2026-01-13 14:36:37', '', NULL, NULL, '2026-01-13 14:40:48', '线下店铺', NULL, NULL, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, NULL, 'SF', NULL, '', '', NULL, 'N', 'N', 'pedding', '刘付明仁', '', '', '18022440198', '', '', '广东省', '广州市', '白云区', '', '钟落潭良沙二路32号', NULL, NULL, NULL, 'padding', 1000016, 100000, 34597803, '101842+1|101845+1', 2, 2, 0.00, '78ebc40a9cfca92e44e69e4cc3828c3e', 919, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (19, '935496', '', '', 'JYCK', '100000', '', 'OFFLINE', '线下', '2026-01-13 15:05:38', NULL, '2026-01-13 15:05:40', '2026-01-13 14:49:50', '2026-01-13 14:51:36', 'S20260113225136223', NULL, NULL, '2026-01-13 15:05:38', '{线下}', NULL, '刘付明仁', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, NULL, 'SF', '顺丰', '', '', NULL, 'N', 'N', 'pedding', '刘付明仁', '', '', '18022440198', '', '', '广东省', '广州市', '白云区', '', '钟落潭良沙二路32号', NULL, NULL, NULL, 'padding', 1000000, 100000, 23060081, '101391+5', 1, 5, 0.00, '26939f46b9fb7d216a485c89b6bda980', 399, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (20, '935502', '', '', 'JYCK', '100000', '', 'OFFLINE', '线下', '2026-01-13 15:09:37', NULL, '2026-01-13 15:09:40', '2026-01-13 14:49:50', '2026-01-13 14:51:36', 'S20260113225136223', NULL, NULL, '2026-01-13 15:09:37', '{线下}', NULL, '刘付明仁', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, NULL, 'SF', '顺丰', '', '', NULL, 'N', 'N', 'pedding', '刘付明仁', '', '', '18022440198', '', '', '广东省', '广州市', '白云区', '', '钟落潭良沙二路32号', NULL, NULL, NULL, 'padding', 1000000, 100000, 23060081, '101391+5', 1, 5, 0.00, '26939f46b9fb7d216a485c89b6bda980', 399, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (21, 'JY2026011327233', '', '', 'JYCK', '100000', '', 'PDD', '拼多多', '2026-01-13 15:26:07', NULL, '2026-01-13 15:26:07', '2026-01-13 15:22:03', '2026-01-13 15:22:03', '', NULL, '1', '2026-01-13 15:26:07', '火火家de小店', '1', '刘付明仁18022440198', 10.00, 10.00, 0.00, 0.00, 0.00, 0.00, NULL, 'SFKY', '顺丰空运', '', '', NULL, 'N', 'N', 'pedding', '刘付明仁', '', '', '18022440198', '', 'CN', '广东省', '广州市', '白云区', '太和镇', '广东省 广州市 白云区 太和镇 二路32号', NULL, NULL, NULL, 'padding', 1000000, 100000, 24869601, '101384+10', 1, 10, 0.00, '0043ebfd4f730160a5e9db969f1b856c', 445, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (22, '935520', '', '', 'JYCK', '100000', '', 'OFFLINE', '线下', '2026-01-13 15:27:36', NULL, '2026-01-13 15:27:38', '2026-01-13 14:49:50', '2026-01-13 14:51:36', 'S20260113225136223', NULL, NULL, '2026-01-13 15:27:36', '{线下}', NULL, '刘付明仁', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, NULL, 'SFKY', '顺丰速运_空运', '', '', NULL, 'N', 'N', 'pedding', '刘付明仁', '', '', '18022440198', '', '', '广东省', '广州市', '白云区', '', '钟落潭良沙二路32号', NULL, NULL, NULL, 'padding', 1000000, 100000, 23060081, '101391+5', 1, 5, 0.00, '26939f46b9fb7d216a485c89b6bda980', 399, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (29, 'CK26012000894', '', '', 'JYCK', 'wdt02060120001', '', 'OFFLINE', '线下', '2026-01-20 13:02:59', NULL, '2026-01-20 13:11:33', '2026-01-20 13:02:59', '2026-01-20 13:02:59', '', NULL, NULL, '2026-01-20 13:11:33', 'af69a68', NULL, '肖宇玄', 12990.00, 0.00, 0.00, 5.00, 0.00, 12990.00, NULL, 'YTO', NULL, '', '', NULL, 'N', 'N', 'pedding', '肖宇玄', '', '18727038559', '18727038559', '', '', '北京', '北京市', '西城区', '', '湖北省襄阳市宏泰越秀星汇城', NULL, NULL, NULL, 'padding', 1000016, 100000, 21363512, '101874+100|101875+1@2', 2, 101, 2.00, '4dc8eceb86a6dfeb730321a6779bc360', 1137, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (30, 'CK26012000895', '', '', 'JYCK', 'wdt02060120001', '', 'OFFLINE', '线下', '2026-01-20 13:00:40', NULL, '2026-01-20 13:11:37', '2026-01-20 13:00:41', '2026-01-20 13:00:41', '', NULL, NULL, '2026-01-20 13:11:37', 'af69a68', NULL, '测试', 6495.00, 0.00, 0.00, 5.00, 0.00, 6495.00, NULL, 'YTO', NULL, '', '', NULL, 'N', 'N', 'pedding', '测试', '', '11111111111', '11111111111', '', '', '北京', '北京市', '东城区', '', '测试', NULL, NULL, NULL, 'padding', 1000016, 100000, 21363512, '101874+50|101875+1@2', 2, 51, 2.00, 'e87473418ea8a893825a3b13c2663c10', 1093, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (31, 'CK26012800003', '', '', 'JYCK', 'wdt02060120001', '', 'OFFLINE', '线下', '2026-01-20 13:02:59', NULL, '2026-01-28 02:33:35', '2026-01-20 13:02:59', '2026-01-20 13:02:59', '', NULL, NULL, '2026-01-28 02:33:35', 'af69a68', NULL, '肖宇玄', 12990.00, 0.00, 0.00, 5.00, 0.00, 12990.00, NULL, 'YTO', NULL, '', '', NULL, 'N', 'N', 'pedding', '肖宇玄', '', '18727038559', '18727038559', '', '', '北京', '北京市', '西城区', '', '湖北省襄阳市宏泰越秀星汇城', NULL, NULL, NULL, 'padding', 1000016, 100000, 21363512, '101874+100|101875+1@2', 2, 101, 2.00, '4dc8eceb86a6dfeb730321a6779bc360', 1137, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);
INSERT INTO `wms_order_delivery_100000`(`id`, `delivery_order_code`, `pre_delivery_order_code`, `pre_delivery_order_id`, `order_type`, `warehouse_code`, `order_flag`, `source_platform_code`, `source_platform_name`, `create_at`, `delete_at`, `updated_at`, `place_order_time`, `pay_time`, `pay_no`, `service_code`, `operator_name`, `operate_time`, `shop_nick`, `seller_nick`, `buyer_nick`, `total_amount`, `item_amount`, `discount_amount`, `freight`, `ar_amount`, `got_amount`, `service_fee`, `logistics_code`, `logistics_name`, `express_code`, `logistics_area_code`, `delivery_type`, `is_urgency`, `invoice_flag`, `status`, `name`, `zip_code`, `tel`, `mobile`, `email`, `country_code`, `province`, `city`, `area`, `town`, `detail_address`, `id_type`, `id_number`, `oaid`, `sync_status`, `store_id`, `warehouse_id`, `from_key`, `items`, `items_count`, `items_total`, `items_weight`, `items_hash`, `items_crc`, `wave_id`, `post_status`, `storage_status`, `pick_status`, `pack_status`, `inspection_status`, `print_status`, `claim_status`, `outbound_status`, `lock_status`, `intercept_status`) VALUES (32, 'CK26013001179', '', '', 'JYCK', 'wdt02060120001', '', 'OFFLINE', '线下', '2026-01-20 13:02:59', NULL, '2026-01-30 02:42:45', '2026-01-20 13:02:59', '2026-01-20 13:02:59', '', NULL, NULL, '2026-01-30 02:42:44', 'af69a68', NULL, '肖宇玄', 12990.00, 0.00, 0.00, 5.00, 0.00, 12990.00, NULL, 'YTO', NULL, '', '', NULL, 'N', 'N', 'pedding', '肖宇玄', '', '18727038559', '18727038559', '', '', '北京', '北京市', '西城区', '', '湖北省襄阳市宏泰越秀星汇城', NULL, NULL, NULL, 'padding', 1000016, 100000, 21363512, '101874+100|101875+1@2', 2, 101, 2.00, '4dc8eceb86a6dfeb730321a6779bc360', 1137, 0, 'none', 'none', 'none', 'none', 'none', NULL, 'none', 'none', NULL, NULL);