This commit is contained in:
yin 2026-09-03 18:05:47 +08:00
parent 9d5b179059
commit 7f4a4549b6
32 changed files with 1059 additions and 136 deletions

View File

@ -611,8 +611,8 @@ export function orderPendingOrderParseAddress(
},
data,
isSystemApi: true,
// 地址解析可能调用外部服务,延长超时时间至 60 秒
timeout: 60000,
// 地址解析可能调用外部服务,超时时间延长至 10 分钟
timeout: 600000,
} as any);
}

View File

@ -41,6 +41,10 @@ export type ReturnReceivedListWhere = {
store_id?: number
/** 是否原单退回:true=有关联原运单,false=无关联 */
is_original_return?: boolean
/** 登记时间范围 { operator:'between'|'gte'|'lte', value:[start,end] 或单值 } */
created_at?: { operator: 'between' | 'gte' | 'lte'; value: [string, string] | string }
/** 更新时间范围 { operator:'between'|'gte'|'lte', value:[start,end] 或单值 } */
updated_at?: { operator: 'between' | 'gte' | 'lte'; value: [string, string] | string }
}
/** returnReceived.list 排序参数 */

View File

@ -78,6 +78,12 @@ export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & {
auto_allocate_express_exclude_remarks?: string[]
/** 默认库位(库位ID,未配置时为 null) */
default_location_id?: number | null
/** 启用截单(flag:0=关闭,1=开启;默认 1)。启用后订单创建时间早于开始自动分配时间或超过截单时间(开始时间晚于截单时间时截单时间视为次日),不再自动分配快递和储位、不再自动加团 */
cutoff_order_enabled?: number
/** 开始自动分配时间,格式 HH:mm,默认 08:00,范围 00:00-23:59;早于该时间的订单与超过截单时间行为一致(不自动分配快递和储位、不自动加团) */
allocate_start_time?: string
/** 截单时间,格式 HH:mm,默认 18:00,范围 00:00-23:59;作为最后允许自动分配的时间,开始时间晚于截单时间时截单时间视为次日(跨天窗口) */
cutoff_order_time?: string
[key: string]: unknown
}
@ -161,6 +167,23 @@ export function normalizeWarehouseSubjectConfig(
base.default_location_id = Number.isFinite(locId) ? Math.trunc(locId) : null
}
// 启用截单(flag:0=关闭,1=开启;默认 1;兼容 boolean / 数字 / 字符串输入)
const cutoffRaw = base.cutoff_order_enabled
if (cutoffRaw === true || cutoffRaw === 1 || cutoffRaw === '1') {
base.cutoff_order_enabled = 1
} else if (cutoffRaw === false || cutoffRaw === 0 || cutoffRaw === '0') {
base.cutoff_order_enabled = 0
} else {
base.cutoff_order_enabled = 1
}
// 开始自动分配时间 / 截单时间(HH:mm,非法回退默认 08:00 / 18:00)
const HHmmPattern = /^([01]\d|2[0-3]):[0-5]\d$/
const allocTime = String(base.allocate_start_time ?? '')
base.allocate_start_time = HHmmPattern.test(allocTime) ? allocTime : '08:00'
const cutoffTime = String(base.cutoff_order_time ?? '')
base.cutoff_order_time = HHmmPattern.test(cutoffTime) ? cutoffTime : '18:00'
return base as SettingWarehouseSubjectConfig
}

View File

@ -37,7 +37,25 @@ export function getReceivingListStore(data: any): Promise<any> {
}
export function getReceivingDetail(data: any): Promise<any> {
export type ReceivingDetailParams = {
/** 收货单ID */
id: number
/** 收货明细分页参数 */
pagination?: { page?: number; pageSize?: number }
}
/**
* storage.receiving.getReceivingDetail — 收货单详情(含收货明细分页)
* 响应 receiving 主要字段:
* - receiving.store_name: 货主名称(合约表 store_remask 优先,回退 company_name)
* - receiving.details: 收货明细数组,明细项含
* stock_id(= system_product_id,向后兼容保留 system_product_id)
* space_id(库位展示名称 string|null = custom_space_name || space_name,历史为数字ID)
* space_id_raw(原始库位ID number|null)、space_name、custom_space_name
* box_remainder(箱内剩余数量)、box_weight(实测箱重)
* - receiving.pagination: 明细分页信息
*/
export function getReceivingDetail(data: ReceivingDetailParams): Promise<any> {
return request({
url: '/system',
method: 'post',

View File

@ -192,8 +192,77 @@ export function storeWarehouseGetPolicyConfig(data: {
} as any)
}
/** storeWarehouse.store.getPolicyConfigFields 字段元信息项(对齐接口文档) */
export interface StorePolicyConfigFieldMeta {
key: string
name?: string
label?: string
/** flag=0/1 开关 / integer / number / string / enum / select 等 */
type?: string
default?: unknown
required?: boolean
description?: string
min?: number
max?: number
step?: number
precision?: number
maxLength?: number
options?: Array<{ label?: string; value?: unknown; [key: string]: unknown } | string | number | boolean>
}
/** storeWarehouse.store.getPolicyConfigFields 响应 */
export interface StorePolicyConfigFieldsResponse {
code?: number
message?: string
data?: StorePolicyConfigFieldMeta[]
}
/** storeWarehouse.store.savePolicyConfig 请求参数(policy_config 结构与接口文档对齐) */
export interface StoreSavePolicyConfigParams {
/** 签约关系ID(兼容 contract_id) */
id: number
/** 策略配置对象 */
policy_config: StorePolicyConfigPayload
}
/** policy_config 可配置字段(与 storeWarehouse.store.savePolicyConfig 文档一致) */
export interface StorePolicyConfigPayload {
receive_mode?: 'standard' | 'strict' | 'manual' | string
auto_allocate_bin?: number
auto_allocate_express?: number
auto_allocate_storage?: number
allow_mix_batch?: number
allow_temp_storage?: number
storage_separation?: number
/** 面单充值元/单,支持 2 位小数 */
print_recharge_price?: number
max_daily_inbound?: number
remark?: string
/** 面单自定义显示类型:1=隐藏,2=商品名称和数量,3=拣货库位和条码和数量,4=拣货库位和条码后5位和数量,5=拣货库位商品名称条码和数量 */
waybill_custom_display_type?: number
/** 是否启用外部快递编码(flag:0=关闭,1=开启;默认 0) */
enable_external_express_code?: number
/** 启用截单(flag:0=关闭,1=开启;默认 1) */
cutoff_order_enabled?: number
/** 截单时间,格式 HH:mm,默认 18:00,范围 00:00-23:59 */
cutoff_order_time?: string
/** 开始自动分配时间,格式 HH:mm,默认 08:00,范围 00:00-23:59 */
allocate_start_time?: string
[key: string]: unknown
}
/** storeWarehouse.store.savePolicyConfig 响应(返回补齐默认值的 policy_config) */
export interface StoreSavePolicyConfigResponse {
code?: number
message?: string
data?: {
contract_id: number
policy_config: StorePolicyConfigPayload
}
}
/** 获取签约策略可配置字段元信息列表 */
export function storeWarehouseGetPolicyConfigFields() {
export function storeWarehouseGetPolicyConfigFields(): Promise<StorePolicyConfigFieldsResponse> {
return request({
url: '/system',
method: 'post',
@ -207,11 +276,8 @@ export function storeWarehouseGetPolicyConfigFields() {
} as any)
}
/** 保存签约策略配置 */
export function storeWarehouseSavePolicyConfig(data: {
id: number
policy_config: Record<string, any>
}) {
/** 保存签约策略配置(响应含补齐默认值的 policy_config) */
export function storeWarehouseSavePolicyConfig(data: StoreSavePolicyConfigParams): Promise<StoreSavePolicyConfigResponse> {
return request({
url: '/system',
method: 'post',

View File

@ -35,7 +35,7 @@ export function detail(data: { id: number }) {
} as any)
}
/** 新增工作台(仓库隔离,条码仓库内唯一) */
/** 新增工作台(仓库隔离,条码仓库内唯一);创建时自动生成 login_code(前缀 wblc + 随机段共 64 位),不接受外部传入 login_code;响应 data 为新建的工作台对象(含自动生成的 login_code) */
export function create(data: {
name: string
barcode?: string
@ -200,3 +200,59 @@ export function bindCamera(data: {
isSystemApi: true
} as any)
}
/** 工作台绑定(需登录、需权限):入参绑定码 code 与工作台ID id,校验后完成关联;成功后工作台写入随机生成的 64 位 token,供 index.getWorkbenchBindCode 长轮询返回 */
export function bind(data: {
/** 缓存生成的绑定码(6 位大写字母+数字) */
code: string
/** 要绑定的工作台ID */
id: number
}) {
return request({
url: '/system',
method: 'post',
params: {
method: 'workbench.bind',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
/** 使用 token 获取工作台信息(免登录、免鉴权):先查缓存 workbench:token:{token},未命中则按 token 查库并回填缓存后返回;token 不存在或无对应工作台返回失败(flag=failure、code=403);返回不含 token/login_code */
export function getWorkbenchInfo(data: {
/** 工作台 token(64 位) */
token: string
}) {
return request({
url: '/system',
method: 'post',
params: {
method: 'workbench.getWorkbenchInfo',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
/** 重置工作台登录码(需登录、需权限):随机生成新的 login_code(前缀 wblc + 随机段共 64 位)并写入数据库,旧 login_code 随即失效(token 不变) */
export function resetLoginCode(data: {
/** 工作台ID */
id: number
}) {
return request({
url: '/system',
method: 'post',
params: {
method: 'workbench.resetLoginCode',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}

View File

@ -563,7 +563,7 @@ async function loadPrintFormData(index: number) {
try {
const res: any = await receivingApi.getReceivingDetail({
id: mainRow.id,
id: Number(mainRow.id),
pagination: { page: 1, pageSize: 1000 }
})
if (res && res.code === 200) {

View File

@ -450,15 +450,27 @@ function handleSelectionChange(rows: PackingTaskItem[]) {
}
// ─── 导出处理(导出选中 / 导出全部)───────────────────────────────────────
/** 构建导出参数:selected=true 仅按勾选任务运单号(waybill_code)过滤;false 全量导出并透传当前排序;where 格式结构与 order.packing.list 一致 */
/**
* 构建导出参数:where 语义与 order.packing.list 一致(warehouse_id 由服务端注入,禁止传)。
* 筛选条件有设置时(whereConditions 非空)一并转为 where 传入;
* selected=true 在筛选条件基础上叠加勾选任务运单号(waybill_code in)。
*/
function buildPackingExportPayload(selected: boolean): Record<string, any> {
const payload: Record<string, any> = {}
// 当前筛选条件一并传入导出(与列表查询 where 语义一致)
const filterWhere = whereConditions.value || {}
if (Object.keys(filterWhere).length) {
payload.where = { ...filterWhere }
}
if (selected) {
const waybillCodes = selectionRows.value
.map((row) => row?.waybill_code)
.filter((v: any) => v !== undefined && v !== null && String(v).trim() !== '')
if (waybillCodes.length) {
payload.where = { waybill_code: { operator: 'in', value: waybillCodes } }
payload.where = {
...(payload.where || {}),
waybill_code: { operator: 'in', value: waybillCodes }
}
}
}
if (sortState.value?.sortField) {

View File

@ -332,7 +332,7 @@ const upperPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
// ─── 导出处理(导出选中 / 导出全部) ──────────────────────────────────────────
// where/sort 语义与 returnReceived.list 一致:
// - 导出选中:仅传勾选记录运单号 waybill_code({ operator:'in', value: waybillCodes }),不叠加筛选条件
// - 导出全部:不传 where(全量导出,等价于 list 无筛选);sort 按当前排序透传
// - 导出全部:筛选条件有设置时传当前条件 where;无筛选时不传 where(全量导出);sort 按当前排序透传
function buildReturnReceivedExportPayload(selected: boolean): Record<string, any> {
const payload: Record<string, any> = {}
if (selected) {
@ -342,6 +342,12 @@ function buildReturnReceivedExportPayload(selected: boolean): Record<string, any
if (waybillCodes.length) {
payload.where = { waybill_code: { operator: 'in', value: waybillCodes } }
}
} else {
// 当前筛选条件一并传入导出(与列表查询 where 语义一致)
const filterWhere = buildWhereFromConditions(currentConditions.value)
if (Object.keys(filterWhere).length) {
payload.where = { ...filterWhere }
}
}
if (currentSort.value.prop) {
payload.sort = {
@ -432,6 +438,10 @@ function buildWhereFromConditions(conditions: Record<string, any>) {
case 'scan_date':
where.scan_date = { operator: 'between', value }
break
case 'created_at':
case 'updated_at':
where[key] = { operator: 'between', value }
break
case 'scanner_id':
case 'store_id': {
const n = Number(value)

View File

@ -39,6 +39,16 @@ export const returnReceivedAvailableFields = [
type: 'boolean',
placeholder: '请选择是否原单退回',
},
{
value: 'created_at',
label: '登记时间',
type: 'datetimerange',
},
{
value: 'updated_at',
label: '更新时间',
type: 'datetimerange',
},
]
// ============================================================

View File

@ -537,7 +537,7 @@ const currentSort = ref<{ prop: string; order: string }>({ prop: '', order: '' }
// ─── 导出处理(导出选中 / 导出全部) ──────────────────────────────────────────
// where/sort 语义与 returnUnpack.list 一致:
// - 导出选中:仅传勾选拆包单号 unpack_no({ operator:'in', value: unpackNos }),不叠加筛选条件
// - 导出全部:不传 where(全量导出,等价于 list 无筛选);sort 按当前排序透传
// - 导出全部:筛选条件有设置时传当前条件 where(export 默认不过滤 status,需由调用方传 where.status);无筛选时不传 where(全量导出);sort 按当前排序透传
function buildReturnUnpackExportPayload(selected: boolean): Record<string, any> {
const payload: Record<string, any> = {}
if (selected) {
@ -547,6 +547,12 @@ function buildReturnUnpackExportPayload(selected: boolean): Record<string, any>
if (unpackNos.length) {
payload.where = { unpack_no: { operator: 'in', value: unpackNos } }
}
} else {
// 当前筛选条件一并传入导出(与列表查询 where 语义一致)
const filterWhere = buildWhereFromConditions(currentConditions.value)
if (Object.keys(filterWhere).length) {
payload.where = { ...filterWhere }
}
}
if (currentSort.value.prop) {
payload.sort = {

View File

@ -67,9 +67,9 @@
</template>
<template #column-status="{ row }">
<el-tag :type="formatPackageMaterialStatus(row.status).type" size="small">
<span :class="getStatusTextClass(formatPackageMaterialStatus(row.status).type)">
{{ formatPackageMaterialStatus(row.status).text }}
</el-tag>
</span>
</template>
<template #column-actions="{ row }">
@ -203,6 +203,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { safeInvoke } from '@/utils/safe-invoke'
import * as indexApi from '@/api/index/index'
import BatchImportDialog from './component/BatchImportDialog.vue'

View File

@ -55,9 +55,9 @@
<el-table-column prop="nameNotation" label="名称简记" min-width="180" show-overflow-tooltip />
<el-table-column label="状态" width="88" align="center">
<template #default="{ row }">
<el-tag :type="formatComboGoodsStatus(row.status).type" size="small">
<span :class="getStatusTextClass(formatComboGoodsStatus(row.status).type)">
{{ formatComboGoodsStatus(row.status).text }}
</el-tag>
</span>
</template>
</el-table-column>
</el-table>
@ -72,6 +72,7 @@
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { comboGoodsSearch } from '@/api/combogoods/combogoods'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import {
formatComboGoodsStatus,
isComboGoodsApiSuccess,
@ -125,6 +126,8 @@ function handleReset() {
</script>
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
.search-alert {
margin-bottom: 12px;
}

View File

@ -47,9 +47,9 @@
@refresh="loadList"
>
<template #column-status="{ row }">
<el-tag :type="formatComboGoodsStatus(row.status).type" size="small">
<span :class="getStatusTextClass(formatComboGoodsStatus(row.status).type)">
{{ formatComboGoodsStatus(row.status).text }}
</el-tag>
</span>
</template>
<template #column-simpleNotation="{ row }">
@ -98,6 +98,7 @@ import UpperTable from '@/components/UpperTable/index.vue'
import { comboGoodsDelete, comboGoodsList } from '@/api/combogoods/combogoods'
import ComboGoodsFormDialog from './component/ComboGoodsFormDialog.vue'
import ComboGoodsSearchDialog from './component/ComboGoodsSearchDialog.vue'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import {
buildComboGoodsListPayload,
comboGoodsColumns,

View File

@ -88,27 +88,27 @@
>
<!-- 自定义状态列 -->
<template #column-is_sn_mgmt="{ row }">
<el-tag :type="row.is_sn_mgmt === 'Y' ? 'success' : 'info'" size="small">
<span :class="getStatusTextClass(row.is_sn_mgmt === 'Y' ? 'success' : 'info')">
{{ row.is_sn_mgmt === 'Y' ? '是' : '否' }}
</el-tag>
</span>
</template>
<template #column-is_shelf_life_mgmt="{ row }">
<el-tag :type="row.is_shelf_life_mgmt === 'Y' ? 'success' : 'info'" size="small">
<span :class="getStatusTextClass(row.is_shelf_life_mgmt === 'Y' ? 'success' : 'info')">
{{ row.is_shelf_life_mgmt === 'Y' ? '是' : '否' }}
</el-tag>
</span>
</template>
<template #column-is_batch_mgmt="{ row }">
<el-tag :type="row.is_batch_mgmt === 'Y' ? 'success' : 'info'" size="small">
<span :class="getStatusTextClass(row.is_batch_mgmt === 'Y' ? 'success' : 'info')">
{{ row.is_batch_mgmt === 'Y' ? '是' : '否' }}
</el-tag>
</span>
</template>
<template #column-need_recheck="{ row }">
<el-tag :type="row.need_recheck === 'N' ? 'warning' : 'info'" size="small">
<span :class="getStatusTextClass(row.need_recheck === 'N' ? 'warning' : 'info')">
{{ row.need_recheck === 'N' ? '是' : '否' }}
</el-tag>
</span>
</template>
<template #empty>
@ -246,6 +246,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import Info from './component/info.vue'
import Images from '@/components/ImagesUpload/index.vue'
import ErpStock from './component/erpStock.vue'

View File

@ -53,20 +53,18 @@
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag :type="getEntryOrderStatusTagType(row.order_status)" size="small">
<span :class="getStatusTextClass(getEntryOrderStatusTagType(row.order_status))">
{{ formatEntryOrderStatus(row.order_status) }}
</el-tag>
</span>
</template>
<template #column-hasReceiving="{ row }">
<el-tag
size="small"
:type="getEntryHasReceivingTagType(row.hasReceiving, row)"
:class="{ 'clickable-tag': resolveEntryHasReceiving(row) }"
<span
:class="[getStatusTextClass(getEntryHasReceivingTagType(row.hasReceiving, row)), { 'clickable-tag': resolveEntryHasReceiving(row) }]"
@click.stop="openReceivingBindingsDialog(row)"
>
{{ formatEntryHasReceiving(row.hasReceiving, row) }}
</el-tag>
</span>
</template>
<template #column-receivingBindings="{ row }">
@ -84,9 +82,9 @@
</template>
<template #column-sync_status="{ row }">
<el-tag :type="getSyncStatusType(row.sync_status)" size="small">
<span :class="getStatusTextClass(getSyncStatusType(row.sync_status))">
{{ translateEntryField('sync_status', row.sync_status) }}
</el-tag>
</span>
</template>
<template #column-sync_message="{ row }">
@ -122,9 +120,9 @@
</template>
<template #column-source_type="{ row }">
<el-tag size="small" :type="row.source_type === 'WMS' ? '' : row.source_type === 'QM' ? 'warning' : 'success'">
<span :class="getStatusTextClass(row.source_type === 'WMS' ? 'info' : row.source_type === 'QM' ? 'warning' : 'success')">
{{ translateEntryField('source_type', row.source_type) }}
</el-tag>
</span>
</template>
<template #column-row_action="{ row }">
@ -346,6 +344,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { safeInvoke } from '@/utils/safe-invoke'
import * as indexApi from '@/api/index/index'
import * as entryApi from '@/api/storage.entry/entry'

View File

@ -66,17 +66,17 @@
<template #column-is_batch_mgmt_enabled="{ row }">
<div style="text-align:center">
<el-tag :type="isInventoryFlagEnabled(row.is_batch_mgmt_enabled) ? 'success' : 'info'" size="small">
<span :class="getStatusTextClass(isInventoryFlagEnabled(row.is_batch_mgmt_enabled) ? 'success' : 'info')">
{{ formatInventoryFlagLabel(row.is_batch_mgmt_enabled) }}
</el-tag>
</span>
</div>
</template>
<template #column-is_shelf_life_mgmt="{ row }">
<div style="text-align:center">
<el-tag :type="isInventoryFlagEnabled(row.is_shelf_life_mgmt) ? 'success' : 'info'" size="small">
<span :class="getStatusTextClass(isInventoryFlagEnabled(row.is_shelf_life_mgmt) ? 'success' : 'info')">
{{ formatInventoryFlagLabel(row.is_shelf_life_mgmt) }}
</el-tag>
</span>
</div>
</template>
@ -86,9 +86,9 @@
<template #column-is_shelf_life_warning_triggered="{ row }">
<div style="text-align:center">
<el-tag :type="row.is_shelf_life_warning_triggered ? 'danger' : 'success'" size="small">
<span :class="getStatusTextClass(row.is_shelf_life_warning_triggered ? 'danger' : 'success')">
{{ row.is_shelf_life_warning_triggered ? '预警' : '正常' }}
</el-tag>
</span>
</div>
</template>
@ -164,6 +164,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { safeInvoke } from '@/utils/safe-invoke'
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
import { useAsyncExportTask, type AsyncExportPayload } from '@/composables/useAsyncExportTask'

View File

@ -2,12 +2,9 @@
<div class="transaction-detail">
<el-descriptions :column="2" border size="small">
<el-descriptions-item label="交易类型">
<el-tag
:type="row?.transaction_type === 'INBOUND' ? 'success' : 'danger'"
size="small"
>
<span :class="getStatusTextClass(row?.transaction_type === 'INBOUND' ? 'success' : 'danger')">
{{ row?.transaction_type === 'INBOUND' ? '入库' : '出库' }}
</el-tag>
</span>
</el-descriptions-item>
<el-descriptions-item label="商品ID">{{ row?.stock_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="库位ID">{{ row?.space_id ?? '—' }}</el-descriptions-item>
@ -24,6 +21,7 @@
</template>
<script setup lang="ts">
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { formatDateTime, getOrderTypeLabel } from '../log-config'
defineProps<{
@ -32,7 +30,9 @@ defineProps<{
}>()
</script>
<style scoped>
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
.transaction-detail {
padding: 12px;
}

View File

@ -55,12 +55,9 @@
@refresh="loadData"
>
<template #column-transaction_type="{ row }">
<el-tag
:type="row.transaction_type === 'INBOUND' ? 'success' : 'danger'"
size="small"
>
<span :class="getStatusTextClass(row.transaction_type === 'INBOUND' ? 'success' : 'danger')">
{{ row.transaction_type === 'INBOUND' ? '入库' : '出库' }}
</el-tag>
</span>
</template>
<template #column-order_type="{ row }">
@ -117,6 +114,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { safeInvoke } from '@/utils/safe-invoke'
import { getTransactionList } from '@/api/storage.inventory/inventory'
import * as indexApi from '@/api/index/index'

View File

@ -145,27 +145,26 @@
sortable="custom"
>
<template #default="{ row }">
<el-tag :type="Number(row.replenishment_needed) > 0 ? 'warning' : 'success'" size="small">
<span :class="getStatusTextClass(Number(row.replenishment_needed) > 0 ? 'warning' : 'success')">
{{ row.replenishment_needed ?? 0 }}
</el-tag>
</span>
</template>
</el-table-column>
<el-table-column prop="replenishment_status" label="补货状态" min-width="110" align="center">
<template #default="{ row }">
<el-tag :type="statusTagType(row.replenishment_status)" size="small">
<span :class="getStatusTextClass(statusTagType(row.replenishment_status))">
{{ statusLabel(row.replenishment_status) }}
</el-tag>
</span>
</template>
</el-table-column>
<el-table-column label="补货库位" min-width="100" align="center">
<template #default="{ row }">
<el-tag
<span
v-if="row.replenishment_locations?.length"
type="success"
size="small"
:class="getStatusTextClass('success')"
>
{{ row.replenishment_locations.length }}个
</el-tag>
</span>
<span v-else class="no-location-text">-</span>
</template>
</el-table-column>
@ -196,6 +195,7 @@ import { getReplenishmentDemand } from '@/api/storage.management/management'
import { loadStores } from '@/api/index/index'
import {
extractStoreListFromResponse,
getStatusTextClass,
mapStoreListToSelectOptions,
} from '@/views/order/orderManagement/config/order-common-config'
import {
@ -367,6 +367,8 @@ onMounted(() => {
</script>
<style lang="scss" scoped>
@use "../../../order/orderManagement/styles/order-sub.scss";
.replenishment-demand-page {
height: 100%;
padding: 16px;

View File

@ -4,9 +4,9 @@
<el-descriptions-item label="流水ID">{{ row?.id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="流水时间">{{ formatDateTime(row?.created_at) }}</el-descriptions-item>
<el-descriptions-item label="流水类型">
<el-tag size="small" :type="getTransactionTypeTag(row?.transaction_type)" effect="light">
<span :class="getStatusTextClass(getTransactionTypeTag(row?.transaction_type))">
{{ getTransactionTypeLabel(row?.transaction_type) }}
</el-tag>
</span>
</el-descriptions-item>
<el-descriptions-item label="操作人">{{ row?.operator_name || '—' }}</el-descriptions-item>
<el-descriptions-item label="商品ID">{{ row?.stock_id ?? '—' }}</el-descriptions-item>
@ -33,6 +33,7 @@
</template>
<script setup lang="ts">
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import {
formatDateTime,
getTransactionTypeLabel,
@ -48,7 +49,8 @@ defineProps<{
}>()
</script>
<style scoped>
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
.productflow-detail {
padding: 12px;
}

View File

@ -56,9 +56,9 @@
{{ formatDateTime(row.created_at) }}
</template>
<template #column-transaction_type="{ row }">
<el-tag size="small" :type="getTransactionTypeTag(row.transaction_type)" effect="light">
<span :class="getStatusTextClass(getTransactionTypeTag(row.transaction_type))">
{{ getTransactionTypeLabel(row.transaction_type) }}
</el-tag>
</span>
</template>
<template #column-stock_quantity="{ row }">
<span :class="getQuantityClass(row, 'stock')">{{ formatStockQuantity(row) }}</span>
@ -158,6 +158,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { stockTransactionList } from '@/api/stock/stock'
import { transactionExport, transactionExportTaskProgress } from '@/api/stock.transaction/stock.transaction'
import * as indexApi from '@/api/index/index'
@ -522,6 +523,7 @@ onMounted(() => {
</script>
<style lang="scss" scoped>
@use "../../order/orderManagement/styles/order-sub.scss";
/* ================================================================
整体布局(对齐 express/waybill)
================================================================ */

View File

@ -61,9 +61,9 @@
{{ formatDateTime(row.created_at) }}
</template>
<template #column-transaction_type="{ row }">
<el-tag size="small" :type="getTransactionTypeTag(row.transaction_type)" effect="light">
<span :class="getStatusTextClass(getTransactionTypeTag(row.transaction_type))">
{{ getTransactionTypeLabel(row.transaction_type) }}
</el-tag>
</span>
</template>
<template #column-stock_quantity="{ row }">
<span :class="getQuantityClass(row, 'stock')">{{ formatStockQuantity(row) }}</span>
@ -121,9 +121,9 @@
<el-descriptions-item label="流水ID">{{ selectedRowData.id }}</el-descriptions-item>
<el-descriptions-item label="流水时间">{{ formatDateTime(selectedRowData.created_at) }}</el-descriptions-item>
<el-descriptions-item label="流水类型">
<el-tag size="small" :type="getTransactionTypeTag(selectedRowData.transaction_type)" effect="light">
<span :class="getStatusTextClass(getTransactionTypeTag(selectedRowData.transaction_type))">
{{ getTransactionTypeLabel(selectedRowData.transaction_type) }}
</el-tag>
</span>
</el-descriptions-item>
<el-descriptions-item label="操作人">{{ selectedRowData.operator_name || '—' }}</el-descriptions-item>
<el-descriptions-item label="商品ID">{{ selectedRowData.stock_id ?? '—' }}</el-descriptions-item>
@ -182,6 +182,7 @@ import UpperTable from '@/components/UpperTable/index.vue'
import WarehouseSelect from '@/components/WarehouseSelect.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { stockTransactionStoreList } from '@/api/stock/stock'
import { transactionExportStore, transactionExportTaskProgress } from '@/api/stock.transaction/stock.transaction'
import * as indexApi from '@/api/index/index'
@ -575,6 +576,7 @@ onMounted(() => {
</script>
<style lang="scss" scoped>
@use "../../../order/orderManagement/styles/order-sub.scss";
/* ================================================================
整体布局(对齐 express/waybill)
================================================================ */

View File

@ -69,23 +69,17 @@
</template>
<template #column-storage_status="{ row }">
<el-tag
:type="formatProductStorageStatus(row.storage_status).config.tagType"
size="small"
effect="light"
<span
:class="getStatusTextClass(formatProductStorageStatus(row.storage_status).config.tagType)"
>
{{ formatProductStorageStatus(row.storage_status).text }}
</el-tag>
</span>
</template>
<template #column-match_status="{ row }">
<el-tag
:type="row.system_product_id ? 'success' : 'info'"
size="small"
effect="light"
>
<span :class="getStatusTextClass(row.system_product_id ? 'success' : 'info')">
{{ row.system_product_id ? '已匹配' : '未匹配' }}
</el-tag>
</span>
</template>
<template #column-actions="{ row }">
@ -438,6 +432,11 @@
<el-button type="primary" link size="small" @click="openBatchRowSpacePicker(row)">选择库位</el-button>
</div>
</template>
<template #column-import_status="{ row }">
<span :class="getStatusTextClass(row.import_status === '成功' ? 'success' : row.import_status === '失败' ? 'danger' : 'info')">
{{ row.import_status || '--' }}
</span>
</template>
<template #column-retry_action="{ row }">
<el-button v-if="row.import_status === '失败'" type="primary" link size="small" @click="retryBatchImportRow(row)">重试</el-button>
<span v-else>--</span>
@ -533,6 +532,7 @@ import AddProduct from '@/views/stock/stock/component/add.vue'
import * as receivingApi from '@/api/storage_receiving/receiving'
import * as stockApi from '@/api/stock/stock'
import * as indexApi from '@/api/index/index'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import * as warehouseApi from '@/api/warehouse/warehouse'
import { buildStockQuery } from '@/utils/stockQueryBuilder'
import * as XLSX from 'xlsx'
@ -823,7 +823,7 @@ const confirmDeleteDetail = async (row: any) => {
async function fetchReceivingDetail() {
try {
const params = {
id: props.id,
id: Number(props.id),
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize }
}
const res: any = await receivingApi.getReceivingDetail(params)
@ -1256,12 +1256,18 @@ const openEditDialog = (row: any) => {
editForm.box_quantity = row?.box_quantity ?? ''
editForm.boxes_per_pallet = row?.boxes_per_pallet ?? ''
editForm.pallet_quantity = row?.pallet_quantity ?? ''
editForm.space_id = row?.space_id ?? ''
// 库位字段适配 getReceivingDetail 最新设计:
// - receiving.details.*.space_id 现为库位展示名称(string|null,取 custom_space_name || space_name),不再是数字ID
// - 原始库位ID 使用 receiving.details.*.space_id_raw;兼容旧响应(space_id 为数字)场景
const rawSpaceId = row?.space_id_raw ?? (typeof row?.space_id === 'number' ? row?.space_id : '')
editForm.space_id = rawSpaceId ?? ''
editForm.space_display_name =
String(row?.space_custom_name ?? '').trim() ||
String(row?.space_name ?? '').trim() ||
String(row?.space_code ?? '').trim() ||
(row?.space_id ? `ID ${row.space_id}` : '')
(typeof row?.space_id === 'string' && String(row?.space_id ?? '').trim())
? String(row?.space_id).trim()
: (String(row?.custom_space_name ?? row?.space_custom_name ?? '').trim() ||
String(row?.space_name ?? '').trim() ||
String(row?.space_code ?? '').trim() ||
(rawSpaceId ? `ID ${rawSpaceId}` : ''))
editForm.remark = row?.remark ?? ''
editForm.system_product_id = row?.system_product_id ?? ''
editForm.barcode = row?.barcode ?? row?.barcodes ?? ''
@ -1294,11 +1300,17 @@ const openEditDialog = (row: any) => {
row?.system_product?.inbound_min_days ??
''
// 仅当持有数字库位ID 且明细行未携带任何库位名称字段时,才按 ID 反查库位名称
// (新接口 space_id 为 string 展示名时不再反查;旧响应 space_id 为数字且无名称字段时仍保留反查)
const rowSpaceName =
String(row?.custom_space_name ?? row?.space_custom_name ?? '').trim() ||
String(row?.space_name ?? '').trim() ||
String(row?.space_code ?? '').trim()
const shouldResolveSpaceName =
!!String(editForm.space_id ?? '').trim() &&
!String(row?.space_custom_name ?? '').trim() &&
!String(row?.space_name ?? '').trim() &&
!String(row?.space_code ?? '').trim()
Number.isFinite(Number(editForm.space_id)) &&
!rowSpaceName &&
typeof row?.space_id !== 'string'
if (shouldResolveSpaceName) {
void resolveSpaceDisplayNameById(editForm.space_id).then((name) => {
@ -2635,7 +2647,9 @@ onUnmounted(() => {
})
</script>
<style scoped>
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
.product-details {
width: 100%;
padding: 6px 10px 8px;
@ -3009,3 +3023,17 @@ onUnmounted(() => {
}
}
</style>
<style lang="scss">
/* append-to-body 弹窗内状态文字颜色(scoped 对 teleport 内容不生效,需全局类) */
.ut-status-text {
font-size: 12px;
line-height: 18px;
white-space: nowrap;
}
.ut-status-text--primary { color: var(--el-color-primary); }
.ut-status-text--success { color: var(--el-color-success); }
.ut-status-text--warning { color: var(--el-color-warning); }
.ut-status-text--info { color: var(--el-color-info); }
.ut-status-text--danger { color: var(--el-color-danger); }
</style>

View File

@ -37,52 +37,48 @@
@page-size-change="handlePageSizeChange" @sort-change="handleSortChange" @refresh="loadData"
@selection-change="onSelectionChange">
<template #column-status="{ row }">
<el-tag v-if="row.status" :type="statusConfig[row.status as keyof typeof statusConfig]?.tagType || 'info'"
size="small">
<span v-if="row.status"
:class="getStatusTextClass(statusConfig[row.status as keyof typeof statusConfig]?.tagType || 'info')">
{{ statusConfig[row.status as keyof typeof statusConfig]?.text || row.status }}
</el-tag>
</span>
</template>
<template #column-detail_status="{ row }">
<el-tag v-if="row.detail_status"
:type="detailStatusConfig[row.detail_status as keyof typeof detailStatusConfig]?.tagType || 'info'"
size="small">
<span v-if="row.detail_status"
:class="getStatusTextClass(detailStatusConfig[row.detail_status as keyof typeof detailStatusConfig]?.tagType || 'info')">
{{ detailStatusConfig[row.detail_status as keyof typeof detailStatusConfig]?.text || row.detail_status }}
</el-tag>
</span>
</template>
<template #column-storage_status="{ row }">
<el-tag v-if="row.storage_status"
:type="storageStatusConfig[row.storage_status as keyof typeof storageStatusConfig]?.tagType || 'info'"
size="small">
<span v-if="row.storage_status"
:class="getStatusTextClass(storageStatusConfig[row.storage_status as keyof typeof storageStatusConfig]?.tagType || 'info')">
{{ storageStatusConfig[row.storage_status as keyof typeof storageStatusConfig]?.text || row.storage_status
}}
</el-tag>
</span>
</template>
<template #column-is_review="{ row }">
<el-tag :type="row.is_review === 1 || row.is_review === true ? 'success' : 'info'" size="small">
<span :class="getStatusTextClass(row.is_review === 1 || row.is_review === true ? 'success' : 'info')">
{{ row.is_review === 1 || row.is_review === true ? '已审核' : '未审核' }}
</el-tag>
</span>
</template>
<template #column-delivery_method="{ row }">
<el-tag v-if="row.delivery_method"
:type="deliveryMethodConfig[row.delivery_method as keyof typeof deliveryMethodConfig]?.tagType || 'info'"
size="small">
<span v-if="row.delivery_method"
:class="getStatusTextClass(deliveryMethodConfig[row.delivery_method as keyof typeof deliveryMethodConfig]?.tagType || 'info')">
{{ deliveryMethodConfig[row.delivery_method as keyof typeof deliveryMethodConfig]?.text ||
row.delivery_method }}
</el-tag>
</span>
</template>
<template #column-loading_method="{ row }">
<el-tag v-if="row.loading_method"
:type="loadingMethodConfig[row.loading_method as keyof typeof loadingMethodConfig]?.tagType || 'info'"
size="small">
<span v-if="row.loading_method"
:class="getStatusTextClass(loadingMethodConfig[row.loading_method as keyof typeof loadingMethodConfig]?.tagType || 'info')">
{{ loadingMethodConfig[row.loading_method as keyof typeof loadingMethodConfig]?.text || row.loading_method
}}
</el-tag>
</span>
</template>
<template #column-actions="{ row }">
@ -244,9 +240,9 @@
</el-table-column>
<el-table-column label="入库状态" width="90" align="center">
<template #default="{ row: e }">
<el-tag size="small" :type="entryOrderStatusTag(e.order_status)">
<span :class="getStatusTextClass(entryOrderStatusTag(e.order_status))">
{{ entryOrderStatusLabel(e.order_status) }}
</el-tag>
</span>
</template>
</el-table-column>
</el-table>
@ -258,14 +254,13 @@
收货单 {{ matchPutawayReceivingRow?.receiving_number || '—' }}
<template v-if="matchSelectedEntryOrder"> ← → 入库单 {{ matchSelectedEntryOrder.entry_order_code }}</template>
</span>
<el-tag
<span
v-if="matchSelectedEntryOrder && matchComparisonRows.length"
size="small"
:type="matchComparisonSummary.type"
:class="getStatusTextClass(matchComparisonSummary.type)"
style="margin-left:10px"
>
{{ matchComparisonSummary.text }}
</el-tag>
</span>
</div>
<el-table
:data="matchComparisonRows"
@ -292,9 +287,9 @@
</el-table-column>
<el-table-column label="匹配" width="70" align="center">
<template #default="{ row: r }">
<el-tag size="small" :type="r.matched ? 'success' : 'info'">
<span :class="getStatusTextClass(r.matched ? 'success' : 'info')">
{{ r.matched ? '已匹配' : '未匹配' }}
</el-tag>
</span>
</template>
</el-table-column>
</el-table>
@ -329,6 +324,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
import Details from './component/DetailsPanel.vue'
@ -782,7 +778,7 @@ async function loadProductData() {
productLoading.value = true
try {
const params = {
id: selectedReceivingId.value,
id: Number(selectedReceivingId.value),
pagination: {
page: productPagination.currentPage,
pageSize: productPagination.pageSize
@ -1780,4 +1776,18 @@ async function handleExportAll() {
font-size: 12px;
color: #909399;
}
</style>
<style lang="scss">
/* append-to-body 弹窗内状态文字颜色(scoped 对 teleport 内容不生效,需全局类) */
.ut-status-text {
font-size: 12px;
line-height: 18px;
white-space: nowrap;
}
.ut-status-text--primary { color: var(--el-color-primary); }
.ut-status-text--success { color: var(--el-color-success); }
.ut-status-text--warning { color: var(--el-color-warning); }
.ut-status-text--info { color: var(--el-color-info); }
.ut-status-text--danger { color: var(--el-color-danger); }
</style>

View File

@ -449,7 +449,9 @@ export const productdetail = [
{ prop: 'actual_quantity', label: '实际收货数量', width: '160' },
{ prop: 'box_quantity', label: '箱数', width: '160' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '160' },
{ prop: 'box_remainder', label: '剩余不满一箱', width: '160' },
{ prop: 'weight', label: '重量(g)', width: '160' },
{ prop: 'box_weight', label: '实测箱重(g)', width: '160' },
{ prop: 'pallet_quantity', label: '托盘数', width: '160' },
{ prop: 'receiving_time', label: '收货时间', width: '160' },
{ prop: 'receiving_status', label: '收货状态', width: '160' },
@ -490,7 +492,9 @@ export const productquick = [
{ prop: 'actual_quantity', label: '收货数量', width: '100', align: 'right' },
{ prop: 'box_quantity', label: '箱数', width: '100', align: 'right' },
{ prop: 'boxes_per_pallet', label: '箱规', width: '100', align: 'right' },
{ prop: 'box_remainder', label: '不满一箱', width: '90', align: 'right' },
{ prop: 'weight', label: '重量(g)', width: '100', align: 'right' },
{ prop: 'box_weight', label: '箱重(g)', width: '100', align: 'right' },
{ prop: 'batch_number', label: '批次号', width: '120' },
{ prop: 'production_date', label: '生产日期', width: '120' },
{ prop: 'expiry_date', label: '到期日期', width: '120' },

View File

@ -54,15 +54,15 @@
@selection-change="onSelectionChange"
>
<template #column-order_status="{ row }">
<el-tag v-if="row.order_status" :type="statusConfig[row.order_status as keyof typeof statusConfig]?.tagType || 'info'" size="small">
<span v-if="row.order_status" :class="getStatusTextClass(statusConfig[row.order_status as keyof typeof statusConfig]?.tagType || 'info')">
{{ statusConfig[row.order_status as keyof typeof statusConfig]?.text || row.order_status }}
</el-tag>
</span>
</template>
<template #column-sync_status="{ row }">
<el-tag v-if="row.sync_status" :type="syncStatusConfig[row.sync_status as keyof typeof syncStatusConfig]?.tagType || 'info'" size="small">
<span v-if="row.sync_status" :class="getStatusTextClass(syncStatusConfig[row.sync_status as keyof typeof syncStatusConfig]?.tagType || 'info')">
{{ syncStatusConfig[row.sync_status as keyof typeof syncStatusConfig]?.text || row.sync_status }}
</el-tag>
</span>
</template>
<template #column-actions="{ row }">
@ -440,6 +440,7 @@ import UpperTable from '@/components/UpperTable/index.vue'
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { safeInvoke } from '@/utils/safe-invoke'
import * as XLSX from 'xlsx'
import * as indexApi from '@/api/index/index'

View File

@ -285,6 +285,19 @@ const FALLBACK_FIELDS: NormalizedField[] = [
{ key: 'default_platform_code', label: '默认平台编码', type: 'string' },
{ key: 'group_wave_prefix', label: '团购波次号前缀', type: 'string' },
{ key: 'enable_external_express_code', label: '启用外部快递编码', type: 'boolean', description: '开启后允许按外部系统传入的快递编码进行处理(如无匹配仍以业务校验为准);默认关闭。' },
{
key: 'cutoff_order_enabled',
label: '启用截单',
type: 'select',
default: 1,
options: [
{ label: '关闭', value: 0 },
{ label: '开启', value: 1 }
],
description: '启用后订单创建时间早于开始自动分配时间或超过截单时间(开始时间晚于截单时间时截单时间视为次日),不再自动分配快递和储位、不再自动加团;默认开启'
},
{ key: 'allocate_start_time', label: '开始自动分配时间', type: 'string', maxLength: 5, default: '08:00', description: '格式 HH:mm,默认 08:00,范围 00:00-23:59;早于该时间的订单与超过截单时间行为一致,不自动分配快递和储位、不自动加团' },
{ key: 'cutoff_order_time', label: '截单时间', type: 'string', maxLength: 5, default: '18:00', description: '格式 HH:mm,默认 18:00,范围 00:00-23:59;作为最后允许自动分配的时间,开始时间晚于截单时间时截单时间视为次日(跨天窗口)' },
{ key: 'sender_name', label: '默认发件人姓名', type: 'string', maxLength: 50 },
{ key: 'sender_tel', label: '默认发件人联系电话', type: 'string', maxLength: 20 },
{ key: 'province_name', label: '默认发件省份', type: 'string', maxLength: 50 },

View File

@ -70,6 +70,8 @@
<div class="workbench-operation-actions">
<el-button link type="primary" size="small" @click.stop="openDetail(row)">详情</el-button>
<el-button link type="primary" size="small" @click.stop="openEdit(row)">编辑</el-button>
<el-button link type="warning" size="small" @click.stop="openBind(row)">绑定</el-button>
<el-button link type="danger" size="small" @click.stop="openResetLoginCode(row)">重置登录码</el-button>
<el-button link type="success" size="small" @click.stop="openBindCamera(row)">摄像头</el-button>
<el-button link type="danger" size="small" @click.stop="handleDelete(row)">删除</el-button>
</div>
@ -191,11 +193,90 @@
<el-button type="primary" :loading="bindCameraSaving" @click="submitBindCamera">保存</el-button>
</template>
</el-dialog>
<!-- 绑定工作台(workbench.bind):输入设备端显示的绑定码,将工作台与设备关联 -->
<el-dialog
v-model="bindVisible"
title="绑定工作台"
width="460px"
align-center
@close="resetBind"
>
<el-form ref="bindFormRef" :model="bindForm" :rules="bindRules" label-width="96px" size="small">
<el-form-item label="目标工作台">
<el-input :model-value="bindTargetDesc" disabled />
</el-form-item>
<el-form-item label="绑定码" prop="code">
<el-input
v-model="bindForm.code"
placeholder="请输入工作台屏幕上显示的 6 位绑定码"
maxlength="6"
clearable
@input="handleBindCodeInput"
/>
<div class="field-tip">
绑定码由工作台设备端生成并显示(6 位大写字母/数字)。确认绑定后,设备端将自动获取访问令牌,原工作台令牌失效。
</div>
</el-form-item>
</el-form>
<template #footer>
<el-button size="small" @click="bindVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="bindSaving" @click="submitBind">确认绑定</el-button>
</template>
</el-dialog>
<!-- 重置登录码(workbench.resetLoginCode):重新生成 64 位登录码,旧登录码失效 -->
<el-dialog
v-model="resetLoginCodeVisible"
title="重置登录码"
width="480px"
align-center
@close="closeResetLoginCode"
>
<div v-if="!resetResult" class="reset-login-code-body">
<el-alert
type="warning"
:closable="false"
show-icon
title="重置后旧登录码将立即失效"
description="将为本工作台重新生成 64 位登录码(wblc 前缀);访问令牌保持不变,不影响已绑定设备正常使用。"
/>
<div class="reset-target">目标工作台:{{ resetWorkbenchName || '--' }}</div>
</div>
<div v-else class="reset-login-code-result">
<div class="result-head">
<span class="result-title">重置成功,旧登录码已失效</span>
</div>
<div class="login-code-box">
<span class="login-code-text">{{ resetResult.login_code || '--' }}</span>
</div>
<div class="result-tip">请将以上 64 位登录码配置到对应工作台设备(token 保持不变)。</div>
</div>
<template #footer>
<template v-if="!resetResult">
<el-button size="small" @click="resetLoginCodeVisible = false">取消</el-button>
<el-button
size="small"
type="danger"
:loading="resetLoginCodeSaving"
@click="submitResetLoginCode"
>
立即重置
</el-button>
</template>
<template v-else>
<el-button size="small" type="primary" @click="copyLoginCode">复制登录码</el-button>
<el-button size="small" @click="closeResetLoginCode">完成</el-button>
</template>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { computed, nextTick, onMounted, reactive, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Search } from '@element-plus/icons-vue'
import type { FormInstance, FormRules } from 'element-plus'
@ -210,7 +291,9 @@ import {
update as workbenchUpdate,
del as workbenchDelete,
checkBarcode as workbenchCheckBarcode,
bindCamera as workbenchBindCamera
bindCamera as workbenchBindCamera,
bind as workbenchBind,
resetLoginCode as workbenchResetLoginCode
} from '@/api/workbench/workbench'
import { list as cameraList } from '@/api/camera/camera'
import { useSettingsStore } from '@/stores/modules/settings'
@ -568,6 +651,144 @@ async function submitBindCamera() {
}
}
// ─── 绑定工作台(workbench.bind) ────────────────────────────────────────────
const bindVisible = ref(false)
const bindSaving = ref(false)
const bindFormRef = ref<FormInstance>()
const bindWorkbenchId = ref<number | undefined>(undefined)
const bindWorkbenchName = ref('')
const bindForm = reactive({ code: '' })
const bindTargetDesc = computed(() => {
const name = bindWorkbenchName.value || '工作台'
return bindWorkbenchId.value != null ? `${name}(ID: ${bindWorkbenchId.value})` : name
})
const bindRules: FormRules = {
code: [
{ required: true, message: '请输入绑定码', trigger: 'blur' },
{ pattern: /^[A-Z0-9]{6}$/, message: '绑定码为 6 位大写字母或数字', trigger: 'blur' }
]
}
function handleBindCodeInput() {
bindForm.code = String(bindForm.code || '')
.replace(/[^a-zA-Z0-9]/g, '')
.toUpperCase()
.slice(0, 6)
}
function openBind(row: WorkbenchRecord) {
if (!row.id) return
bindWorkbenchId.value = row.id
bindWorkbenchName.value = row.name || `工作台-${row.id}`
bindForm.code = ''
bindVisible.value = true
nextTick(() => bindFormRef.value?.clearValidate())
}
function resetBind() {
bindForm.code = ''
bindWorkbenchId.value = undefined
bindWorkbenchName.value = ''
bindFormRef.value?.clearValidate()
}
async function submitBind() {
if (bindWorkbenchId.value === undefined || bindSaving.value) return
const valid = await bindFormRef.value?.validate().catch(() => false)
if (!valid) return
bindSaving.value = true
try {
const res: any = await workbenchBind({
id: bindWorkbenchId.value,
code: bindForm.code
})
if (isSuccess(res)) {
ElMessage.success('绑定成功,设备端将自动获取访问令牌')
bindVisible.value = false
loadList()
} else {
ElMessage.error(res?.message || '绑定失败,请核对绑定码是否有效')
}
} catch {
ElMessage.error('绑定失败,请稍后重试')
} finally {
bindSaving.value = false
}
}
// ─── 重置登录码(workbench.resetLoginCode) ─────────────────────────────────
const resetLoginCodeVisible = ref(false)
const resetLoginCodeSaving = ref(false)
const resetWorkbenchId = ref<number | undefined>(undefined)
const resetWorkbenchName = ref('')
const resetResult = ref<{ id?: number; login_code?: string } | null>(null)
function openResetLoginCode(row: WorkbenchRecord) {
if (!row.id) return
resetWorkbenchId.value = row.id
resetWorkbenchName.value = row.name || `工作台-${row.id}`
resetResult.value = null
resetLoginCodeVisible.value = true
}
function closeResetLoginCode() {
resetLoginCodeVisible.value = false
resetResult.value = null
}
async function submitResetLoginCode() {
if (resetWorkbenchId.value === undefined || resetLoginCodeSaving.value) return
resetLoginCodeSaving.value = true
resetResult.value = null
try {
const res: any = await workbenchResetLoginCode({ id: resetWorkbenchId.value })
if (isSuccess(res)) {
const data: any = res?.data ?? res ?? {}
const payload = data?.data && typeof data.data === 'object' ? data.data : data
resetResult.value = {
id: payload?.id,
login_code: payload?.login_code ?? ''
}
ElMessage.success('登录码已重置')
} else {
ElMessage.error(res?.message || '重置登录码失败')
}
} catch {
ElMessage.error('重置登录码失败,请稍后重试')
} finally {
resetLoginCodeSaving.value = false
}
}
async function copyLoginCode() {
const code = String(resetResult.value?.login_code || '')
if (!code) return
try {
await navigator.clipboard.writeText(code)
ElMessage.success('登录码已复制')
} catch {
const ta = document.createElement('textarea')
ta.value = code
ta.style.position = 'fixed'
ta.style.opacity = '0'
document.body.appendChild(ta)
ta.select()
try {
document.execCommand('copy')
ElMessage.success('登录码已复制')
} catch {
ElMessage.error('复制失败,请手动复制')
} finally {
document.body.removeChild(ta)
}
}
}
// ─── 删除 ────────────────────────────────────────────────────────────────────
async function handleDelete(row: WorkbenchRecord) {
@ -684,4 +905,58 @@ onMounted(() => {
color: #909399;
}
}
// ─── 绑定工作台 / 重置登录码弹窗 ─────────────────────────────────────────────
.field-tip {
margin-top: 6px;
font-size: 12px;
line-height: 1.6;
color: #909399;
}
.reset-login-code-body {
.reset-target {
margin-top: 16px;
font-size: 13px;
color: #303133;
}
}
.reset-login-code-result {
text-align: center;
.result-head {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 16px;
.result-title {
font-size: 15px;
font-weight: 600;
color: #67c23a;
}
}
.login-code-box {
padding: 12px;
background: #f5f7fa;
border: 1px dashed #dcdfe6;
border-radius: 6px;
margin-bottom: 10px;
word-break: break-all;
.login-code-text {
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
font-size: 14px;
color: #303133;
user-select: text;
}
}
.result-tip {
font-size: 12px;
color: #909399;
}
}
</style>

View File

@ -24,7 +24,7 @@ export const workbenchColumns = [
{ prop: 'device_ids', label: '绑定摄像头', width: '120' },
{ prop: 'created_at', label: '创建时间', minWidth: '160' },
{ prop: 'updated_at', label: '更新时间', minWidth: '160' },
{ prop: 'actions', label: '操作', width: '260', fixed: 'right' }
{ prop: 'actions', label: '操作', width: '400', fixed: 'right' }
]
export const workbenchScanFields = [

View File

@ -235,7 +235,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
key: 'operation',
label: '操作',
scanBox: null,
table: { minWidth: 260, fixed: 'right', align: 'center' },
table: { width: 380, fixed: 'right', align: 'center' },
slot: { type: 'operation' }
}
}
@ -622,6 +622,18 @@ export const tabPages: TabPageRawConfig[] = [
actionType: 'action',
type: 'primary'
},
{
key: 'bind',
label: '绑定',
actionType: 'action',
type: 'warning'
},
{
key: 'resetLoginCode',
label: '重置登录码',
actionType: 'action',
type: 'danger'
},
{
key: 'bindCamera',
label: '摄像头',

View File

@ -253,6 +253,32 @@
</template>
</el-dialog>
<!-- ===== 新增成功弹窗(workbench.create):展示接口自动生成的登录码 ===== -->
<el-dialog
v-model="createResultVisible"
title="新增工作台成功"
width="480px"
align-center
destroy-on-close
:close-on-click-modal="false"
@close="closeCreateResult"
>
<div class="reset-login-code-result">
<div class="result-head">
<span class="result-title">已自动生成登录码</span>
</div>
<div class="create-result-target">工作台:{{ createResultData?.name || '--' }}</div>
<div class="login-code-box">
<span class="login-code-text">{{ createResultData?.login_code || '--' }}</span>
</div>
<div class="result-tip">创建时系统自动生成 64 位登录码(wblc 前缀,不接受外部传入)。请复制并配置到对应工作台设备完成登录。</div>
</div>
<template #footer>
<el-button size="small" type="primary" @click="copyCreateLoginCode">复制登录码</el-button>
<el-button size="small" @click="closeCreateResult">完成</el-button>
</template>
</el-dialog>
<!-- ===== 绑定摄像头弹窗 ===== -->
<el-dialog
v-model="bindCameraVisible"
@ -301,6 +327,89 @@
<el-button type="primary" :loading="bindCameraSaving" @click="submitBindCamera">保存</el-button>
</template>
</el-dialog>
<!-- ===== 绑定工作台弹窗(workbench.bind):输入设备端绑定码完成关联 ===== -->
<el-dialog
v-model="bindVisible"
title="绑定工作台"
width="460px"
align-center
destroy-on-close
:close-on-click-modal="false"
@close="resetBind"
>
<el-form ref="bindFormRef" :model="bindForm" :rules="bindRules" label-width="96px" size="small">
<el-form-item label="目标工作台">
<el-input :model-value="bindTargetDesc" disabled />
</el-form-item>
<el-form-item label="绑定码" prop="code">
<el-input
v-model="bindForm.code"
placeholder="请输入工作台屏幕上显示的 6 位绑定码"
maxlength="6"
clearable
@input="handleBindCodeInput"
/>
<div class="field-tip">
绑定码由工作台设备端生成并显示(6 位大写字母/数字)。确认绑定后,设备端将自动获取访问令牌,原工作台令牌失效。
</div>
</el-form-item>
</el-form>
<template #footer>
<el-button size="small" @click="bindVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="bindSaving" @click="submitBind">确认绑定</el-button>
</template>
</el-dialog>
<!-- ===== 重置登录码弹窗(workbench.resetLoginCode):重新生成 64 位登录码 ===== -->
<el-dialog
v-model="resetLoginCodeVisible"
title="重置登录码"
width="480px"
align-center
destroy-on-close
:close-on-click-modal="false"
@close="closeResetLoginCode"
>
<div v-if="!resetResult" class="reset-login-code-body">
<el-alert
type="warning"
:closable="false"
show-icon
title="重置后旧登录码将立即失效"
description="将为本工作台重新生成 64 位登录码(wblc 前缀);访问令牌保持不变,不影响已绑定设备正常使用。"
/>
<div class="reset-target">目标工作台:{{ resetWorkbenchName || '--' }}</div>
</div>
<div v-else class="reset-login-code-result">
<div class="result-head">
<span class="result-title">重置成功,旧登录码已失效</span>
</div>
<div class="login-code-box">
<span class="login-code-text">{{ resetResult.login_code || '--' }}</span>
</div>
<div class="result-tip">请将以上 64 位登录码配置到对应工作台设备(token 保持不变)。</div>
</div>
<template #footer>
<template v-if="!resetResult">
<el-button size="small" @click="resetLoginCodeVisible = false">取消</el-button>
<el-button
size="small"
type="danger"
:loading="resetLoginCodeSaving"
@click="submitResetLoginCode"
>
立即重置
</el-button>
</template>
<template v-else>
<el-button size="small" type="primary" @click="copyLoginCode">复制登录码</el-button>
<el-button size="small" @click="closeResetLoginCode">完成</el-button>
</template>
</template>
</el-dialog>
</div>
</template>
@ -310,7 +419,7 @@
// ============================================================
defineOptions({ name: 'Workbench2' })
import { ref, computed, onMounted, reactive } from 'vue'
import { ref, computed, nextTick, onMounted, reactive } from 'vue'
import { ElMessage } from 'element-plus'
import { Search } from '@element-plus/icons-vue'
import type { FormInstance, FormRules } from 'element-plus'
@ -330,7 +439,9 @@ import {
update as workbenchUpdate,
del as workbenchDelete,
checkBarcode as workbenchCheckBarcode,
bindCamera as workbenchBindCamera
bindCamera as workbenchBindCamera,
bind as workbenchBind,
resetLoginCode as workbenchResetLoginCode
} from '@/api/workbench/workbench'
import { list as cameraList } from '@/api/camera/camera'
import {
@ -520,6 +631,12 @@ async function handleOperationAction(key: string, row: Record<string, any>) {
case 'edit':
openEdit(row)
break
case 'bind':
openBind(row)
break
case 'resetLoginCode':
openResetLoginCode(row)
break
case 'bindCamera':
openBindCamera(row)
break
@ -635,6 +752,35 @@ const rules: FormRules = {
status: [{ required: true, message: '请选择状态', trigger: 'change' }]
}
// ── 新增成功结果(workbench.create 自动生成 login_code) ─────────
const createResultVisible = ref(false)
const createResultData = ref<{ id?: number; name?: string; login_code?: string } | null>(null)
/** 兼容 create 响应的多种包装:Sequelize dataValues 平铺 / data.dataValues / data.data */
function pickCreateResult(res: any) {
const body =
res && typeof res === 'object' && !res?.dataValues && res?.data && typeof res.data === 'object'
? res.data
: (res || {})
const dv = body?.dataValues && typeof body.dataValues === 'object' ? body.dataValues : {}
const nested = body?.data && typeof body.data === 'object' ? body.data : {}
const src: any = { ...body, ...dv }
return {
id: src.id ?? nested.id,
name: src.name ?? nested.name ?? formData.name,
login_code: String(src.login_code ?? nested.login_code ?? '').trim()
}
}
function closeCreateResult() {
createResultVisible.value = false
createResultData.value = null
}
async function copyCreateLoginCode() {
await copyTextToClipboard(String(createResultData.value?.login_code || ''))
}
function resetFormData() {
formData.id = undefined
formData.name = ''
@ -708,8 +854,19 @@ async function submitForm() {
res = await workbenchUpdate({ id: formData.id!, ...payload })
}
if (isSuccess(res)) {
ElMessage.success(dialogMode.value === 'create' ? '新增成功' : '更新成功')
dialogVisible.value = false
if (dialogMode.value === 'create') {
// create 自动生成 login_code:取出并在结果弹窗展示、供复制配置到设备
const created = pickCreateResult(res)
if (created.login_code) {
createResultData.value = created
createResultVisible.value = true
} else {
ElMessage.success('新增成功')
}
} else {
ElMessage.success('更新成功')
}
loadData()
} else {
ElMessage.error(res?.message || (dialogMode.value === 'create' ? '新增失败' : '更新失败'))
@ -828,6 +985,152 @@ async function submitBindCamera() {
}
}
// ============================================================
// 绑定工作台(workbench.bind)
// ============================================================
const bindVisible = ref(false)
const bindSaving = ref(false)
const bindFormRef = ref<FormInstance>()
const bindWorkbenchId = ref<number | undefined>(undefined)
const bindWorkbenchName = ref('')
const bindForm = reactive({ code: '' })
const bindTargetDesc = computed(() => {
const name = bindWorkbenchName.value || '工作台'
return bindWorkbenchId.value != null ? `${name}(ID: ${bindWorkbenchId.value})` : name
})
const bindRules: FormRules = {
code: [
{ required: true, message: '请输入绑定码', trigger: 'blur' },
{ pattern: /^[A-Z0-9]{6}$/, message: '绑定码为 6 位大写字母或数字', trigger: 'blur' }
]
}
function handleBindCodeInput() {
bindForm.code = String(bindForm.code || '')
.replace(/[^a-zA-Z0-9]/g, '')
.toUpperCase()
.slice(0, 6)
}
function openBind(row: Record<string, any>) {
if (!row.id) return
bindWorkbenchId.value = row.id
bindWorkbenchName.value = row.name || `工作台-${row.id}`
bindForm.code = ''
bindVisible.value = true
nextTick(() => bindFormRef.value?.clearValidate())
}
function resetBind() {
bindForm.code = ''
bindWorkbenchId.value = undefined
bindWorkbenchName.value = ''
bindFormRef.value?.clearValidate()
}
async function submitBind() {
if (bindWorkbenchId.value === undefined || bindSaving.value) return
const valid = await bindFormRef.value?.validate().catch(() => false)
if (!valid) return
bindSaving.value = true
try {
const res: any = await workbenchBind({
id: bindWorkbenchId.value,
code: bindForm.code
})
if (isSuccess(res)) {
ElMessage.success('绑定成功,设备端将自动获取访问令牌')
bindVisible.value = false
loadData()
} else {
ElMessage.error(res?.message || '绑定失败,请核对绑定码是否有效')
}
} catch {
ElMessage.error('绑定失败,请稍后重试')
} finally {
bindSaving.value = false
}
}
// ============================================================
// 重置登录码(workbench.resetLoginCode)
// ============================================================
const resetLoginCodeVisible = ref(false)
const resetLoginCodeSaving = ref(false)
const resetWorkbenchId = ref<number | undefined>(undefined)
const resetWorkbenchName = ref('')
const resetResult = ref<{ id?: number; login_code?: string } | null>(null)
function openResetLoginCode(row: Record<string, any>) {
if (!row.id) return
resetWorkbenchId.value = row.id
resetWorkbenchName.value = row.name || `工作台-${row.id}`
resetResult.value = null
resetLoginCodeVisible.value = true
}
function closeResetLoginCode() {
resetLoginCodeVisible.value = false
resetResult.value = null
}
async function submitResetLoginCode() {
if (resetWorkbenchId.value === undefined || resetLoginCodeSaving.value) return
resetLoginCodeSaving.value = true
resetResult.value = null
try {
const res: any = await workbenchResetLoginCode({ id: resetWorkbenchId.value })
if (isSuccess(res)) {
const data: any = res?.data ?? res ?? {}
const payload = data?.data && typeof data.data === 'object' ? data.data : data
resetResult.value = {
id: payload?.id,
login_code: payload?.login_code ?? ''
}
ElMessage.success('登录码已重置')
} else {
ElMessage.error(res?.message || '重置登录码失败')
}
} catch {
ElMessage.error('重置登录码失败,请稍后重试')
} finally {
resetLoginCodeSaving.value = false
}
}
async function copyTextToClipboard(text: string) {
const code = String(text || '')
if (!code) return
try {
await navigator.clipboard.writeText(code)
ElMessage.success('登录码已复制')
return
} catch {
// fallthrough to legacy copy
}
const ta = document.createElement('textarea')
ta.value = code
ta.style.position = 'fixed'
ta.style.opacity = '0'
document.body.appendChild(ta)
ta.select()
try {
document.execCommand('copy')
ElMessage.success('登录码已复制')
} catch {
ElMessage.error('复制失败,请手动复制')
} finally {
document.body.removeChild(ta)
}
}
async function copyLoginCode() {
await copyTextToClipboard(String(resetResult.value?.login_code || ''))
}
// ============================================================
// UpperTable 事件
// ============================================================
@ -1171,4 +1474,64 @@ onMounted(() => {
font-size: 14px;
color: #909399;
}
// ─── 绑定工作台 / 重置登录码弹窗 ─────────────────────────────────────────────
.field-tip {
margin-top: 6px;
font-size: 12px;
line-height: 1.6;
color: #909399;
}
.reset-login-code-body {
.reset-target {
margin-top: 16px;
font-size: 13px;
color: #303133;
}
}
.reset-login-code-result {
text-align: center;
.result-head {
display: inline-flex;
align-items: center;
gap: 6px;
margin-bottom: 16px;
.result-title {
font-size: 15px;
font-weight: 600;
color: #67c23a;
}
}
.login-code-box {
padding: 12px;
background: #f5f7fa;
border: 1px dashed #dcdfe6;
border-radius: 6px;
margin-bottom: 10px;
word-break: break-all;
.login-code-text {
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
font-size: 14px;
color: #303133;
user-select: text;
}
}
.result-tip {
font-size: 12px;
color: #909399;
}
}
.create-result-target {
margin: 0 0 12px;
font-size: 13px;
color: #606266;
}
</style>