feat: 大包/主单管理打印面单,并优化价格表公式下拉
Some checks failed
Build and Deploy Front / deploy (push) Failing after 8s
Some checks failed
Build and Deploy Front / deploy (push) Failing after 8s
管理页支持选模板批量打印;标签设计增加大包/主单类型;价格表计算公式改为轻量选项菜单。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3bde663e43
commit
f77c478981
@ -688,6 +688,51 @@ const menuData = [
|
||||
hideInMenu: false,
|
||||
parentRoute: '/system',
|
||||
},
|
||||
|
||||
// 一级菜单 - 知识库
|
||||
{
|
||||
level: 1,
|
||||
name: '知识库',
|
||||
permissionCode: 'Knowledge',
|
||||
route: '/kb',
|
||||
component: null,
|
||||
icon: 'icon-book',
|
||||
order: 8,
|
||||
hideInMenu: false,
|
||||
},
|
||||
{
|
||||
level: 2,
|
||||
name: '培训手册',
|
||||
permissionCode: 'Knowledge.Training',
|
||||
route: '/kb/training',
|
||||
component: 'views/kb/training/index',
|
||||
icon: 'icon-book',
|
||||
order: 0,
|
||||
hideInMenu: false,
|
||||
parentRoute: '/kb',
|
||||
},
|
||||
{
|
||||
level: 2,
|
||||
name: '分类管理',
|
||||
permissionCode: 'Knowledge.Category',
|
||||
route: '/kb/category',
|
||||
component: 'views/kb/category/index',
|
||||
icon: null,
|
||||
order: 1,
|
||||
hideInMenu: false,
|
||||
parentRoute: '/kb',
|
||||
},
|
||||
{
|
||||
level: 2,
|
||||
name: '文章管理',
|
||||
permissionCode: 'Knowledge.Article',
|
||||
route: '/kb/article',
|
||||
component: 'views/kb/article/index',
|
||||
icon: null,
|
||||
order: 2,
|
||||
hideInMenu: false,
|
||||
parentRoute: '/kb',
|
||||
},
|
||||
];
|
||||
|
||||
// 生成 CSV 内容(UTF-8 BOM 以便 Excel 正确识别中文)
|
||||
|
||||
204
src/api/operation/shipContainer.ts
Normal file
204
src/api/operation/shipContainer.ts
Normal file
@ -0,0 +1,204 @@
|
||||
import { axiosInstance } from '@/api/rbac'
|
||||
import { assertBusinessOk, omsUrl, unwrapData } from '@/api/oms/common'
|
||||
|
||||
function post<T>(path: string, body?: unknown): Promise<T> {
|
||||
return axiosInstance.post(omsUrl(path), body).then((res) => {
|
||||
assertBusinessOk(res.data)
|
||||
return unwrapData(res.data) as T
|
||||
})
|
||||
}
|
||||
|
||||
function get<T>(path: string, params?: Record<string, unknown>): Promise<T> {
|
||||
return axiosInstance.get(omsUrl(path), { params }).then((res) => {
|
||||
assertBusinessOk(res.data)
|
||||
return unwrapData(res.data) as T
|
||||
})
|
||||
}
|
||||
|
||||
export type ShipBagItem = {
|
||||
id: number
|
||||
orderId: number
|
||||
waybillNo: string
|
||||
orderStatus?: string
|
||||
orderStatusName?: string
|
||||
consigneeCountry?: string
|
||||
}
|
||||
|
||||
export type ShipBag = {
|
||||
id: number
|
||||
bagNo: string
|
||||
bagType: string
|
||||
status: string
|
||||
statusName?: string
|
||||
warehouseId?: number
|
||||
destinationCountry?: string
|
||||
destinationPort?: string
|
||||
channelCode?: string
|
||||
length?: number
|
||||
width?: number
|
||||
height?: number
|
||||
weight?: number
|
||||
parcelCount: number
|
||||
sealTime?: string
|
||||
shipTime?: string
|
||||
masterId?: number
|
||||
remark?: string
|
||||
createTime?: string
|
||||
items?: ShipBagItem[]
|
||||
}
|
||||
|
||||
export type ShipMasterItem = {
|
||||
id: number
|
||||
itemType: string
|
||||
bagId?: number
|
||||
bagNo?: string
|
||||
orderId?: number
|
||||
waybillNo?: string
|
||||
}
|
||||
|
||||
export type ShipMaster = {
|
||||
id: number
|
||||
masterNo: string
|
||||
externalMawb?: string
|
||||
status: string
|
||||
statusName?: string
|
||||
warehouseId?: number
|
||||
destinationCountry?: string
|
||||
destinationPort?: string
|
||||
flightOrVoyage?: string
|
||||
length?: number
|
||||
width?: number
|
||||
height?: number
|
||||
weight?: number
|
||||
bagCount: number
|
||||
parcelCount: number
|
||||
sealTime?: string
|
||||
handTime?: string
|
||||
remark?: string
|
||||
createTime?: string
|
||||
items?: ShipMasterItem[]
|
||||
}
|
||||
|
||||
export type ShipBagMetaInput = {
|
||||
bagNo: string
|
||||
destinationCountry?: string
|
||||
destinationPort?: string
|
||||
channelCode?: string
|
||||
length?: number | null
|
||||
width?: number | null
|
||||
height?: number | null
|
||||
weight?: number | null
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export type ShipMasterMetaInput = {
|
||||
masterNo: string
|
||||
destinationCountry?: string
|
||||
destinationPort?: string
|
||||
flightOrVoyage?: string
|
||||
length?: number | null
|
||||
width?: number | null
|
||||
height?: number | null
|
||||
weight?: number | null
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export type ShipPageResult<T> = { items: T[]; total: number }
|
||||
|
||||
export const createShipBag = (body: {
|
||||
bagType?: string
|
||||
warehouseId?: number
|
||||
destinationCountry?: string
|
||||
channelCode?: string
|
||||
remark?: string
|
||||
}) => post<ShipBag>('/operation/bag/create', body)
|
||||
|
||||
export const addParcelToBag = (bagNo: string, waybillNo: string) =>
|
||||
post<ShipBag>('/operation/bag/add-parcel', { bagNo, waybillNo })
|
||||
|
||||
export const removeParcelFromBag = (bagNo: string, waybillNo: string) =>
|
||||
post<ShipBag>('/operation/bag/remove-parcel', { bagNo, waybillNo })
|
||||
|
||||
export const sealShipBag = (bagNo: string) => post<ShipBag>('/operation/bag/seal', { bagNo })
|
||||
|
||||
export const voidShipBag = (bagNo: string) => post<ShipBag>('/operation/bag/void', { bagNo })
|
||||
|
||||
export const updateShipBagMeta = (body: ShipBagMetaInput) =>
|
||||
post<ShipBag>('/operation/bag/update-meta', body)
|
||||
|
||||
export const getShipBag = (bagNo: string) => get<ShipBag>('/operation/bag/get', { bagNo })
|
||||
|
||||
export const pageShipBags = (body: {
|
||||
pageIndex?: number
|
||||
pageSize?: number
|
||||
keyword?: string
|
||||
status?: string
|
||||
warehouseId?: number
|
||||
}) => post<ShipPageResult<ShipBag>>('/operation/bag/page', body)
|
||||
|
||||
export type ShipPrintLabelItem = {
|
||||
bagNo?: string
|
||||
masterNo?: string
|
||||
printUrl: string
|
||||
}
|
||||
|
||||
export type ShipPrintLabelsResult = {
|
||||
templateName?: string
|
||||
items: ShipPrintLabelItem[]
|
||||
}
|
||||
|
||||
/** POST /operation/bag/print-labels */
|
||||
export const printShipBagLabels = (body: { bagNos: string[]; labelTemplateId?: number }) =>
|
||||
post<ShipPrintLabelsResult>('/operation/bag/print-labels', body)
|
||||
|
||||
export const outboundByBag = (bagNo: string, warehouseId?: number) =>
|
||||
post<{ bagNo: string; successCount: number; waybillNos: string[] }>(
|
||||
'/operation/outbound/bag-create',
|
||||
{ bagNo, warehouseId },
|
||||
)
|
||||
|
||||
export const createShipMaster = (body: {
|
||||
warehouseId?: number
|
||||
destinationCountry?: string
|
||||
flightOrVoyage?: string
|
||||
externalMawb?: string
|
||||
remark?: string
|
||||
}) => post<ShipMaster>('/operation/master/create', body)
|
||||
|
||||
export const addBagToMaster = (masterNo: string, bagNo: string) =>
|
||||
post<ShipMaster>('/operation/master/add-bag', { masterNo, bagNo })
|
||||
|
||||
export const addParcelToMaster = (masterNo: string, waybillNo: string) =>
|
||||
post<ShipMaster>('/operation/master/add-parcel', { masterNo, waybillNo })
|
||||
|
||||
export const removeMasterItem = (masterNo: string, itemId: number) =>
|
||||
post<ShipMaster>('/operation/master/remove-item', { masterNo, itemId })
|
||||
|
||||
export const sealShipMaster = (masterNo: string) =>
|
||||
post<ShipMaster>('/operation/master/seal', { masterNo })
|
||||
|
||||
export const bindMasterMawb = (masterNo: string, externalMawb: string, flightOrVoyage?: string) =>
|
||||
post<ShipMaster>('/operation/master/bind-mawb', { masterNo, externalMawb, flightOrVoyage })
|
||||
|
||||
export const updateShipMasterMeta = (body: ShipMasterMetaInput) =>
|
||||
post<ShipMaster>('/operation/master/update-meta', body)
|
||||
|
||||
export const handOverMaster = (masterNo: string) =>
|
||||
post<ShipMaster>('/operation/master/hand-over', { masterNo })
|
||||
|
||||
export const getShipMaster = (masterNo: string) =>
|
||||
get<ShipMaster>('/operation/master/get', { masterNo })
|
||||
|
||||
export const pageShipMasters = (body: {
|
||||
pageIndex?: number
|
||||
pageSize?: number
|
||||
keyword?: string
|
||||
status?: string
|
||||
warehouseId?: number
|
||||
}) => post<ShipPageResult<ShipMaster>>('/operation/master/page', body)
|
||||
|
||||
/** POST /operation/master/print-labels */
|
||||
export const printShipMasterLabels = (body: {
|
||||
masterNos: string[]
|
||||
labelTemplateId?: number
|
||||
}) => post<ShipPrintLabelsResult>('/operation/master/print-labels', body)
|
||||
@ -465,11 +465,8 @@ const pwdForm = reactive({
|
||||
confirmPassword: '',
|
||||
});
|
||||
|
||||
function validateConfirmPassword(
|
||||
_rule: unknown,
|
||||
value: string,
|
||||
callback: (error?: string) => void
|
||||
) {
|
||||
// Arco Form:validator(value, callback)
|
||||
function validateConfirmPassword(value: string, callback: (error?: string) => void) {
|
||||
if (value !== pwdForm.newPassword) {
|
||||
callback(t('profile.passwordMismatch'));
|
||||
} else {
|
||||
|
||||
@ -1015,6 +1015,9 @@ const pathToRouteNameMap: Record<string, string> = {
|
||||
'/channel/guide': 'ChannelGuide',
|
||||
'/marketing/guide': 'MarketingGuide',
|
||||
'/order/guide': 'OrderGuide',
|
||||
'/kb/training': 'KbTraining',
|
||||
'/kb/category': 'KbCategory',
|
||||
'/kb/article': 'KbArticle',
|
||||
// Track 相关路由
|
||||
'/track/guide': 'TrackGuide',
|
||||
'/track/order': 'TrackOrder',
|
||||
|
||||
@ -310,6 +310,10 @@ export const PAGE_BUTTON_PARENT_ALIASES: Record<string, string> = {
|
||||
'Warehouse.BinLocation.Query': 'Warehouse.BinLocation',
|
||||
'Operation.InboundScan.Query': 'Operation.InboundScan',
|
||||
'Operation.OutboundScan.Query': 'Operation.OutboundScan',
|
||||
'Operation.BagPack.Query': 'Operation.BagPack',
|
||||
'Operation.BagManage.Query': 'Operation.BagManage',
|
||||
'Operation.MasterBoard.Query': 'Operation.MasterBoard',
|
||||
'Operation.MasterBill.Query': 'Operation.MasterBill',
|
||||
'Operation.PrintLabel.Query': 'Operation.PrintLabel',
|
||||
'Operation.FulfillPack.Query': 'Operation.FulfillPack',
|
||||
'Operation.FulfillPack.BatchPrint': 'Operation.FulfillPack',
|
||||
@ -806,6 +810,28 @@ const CORE_GROUPS: PageButtonGroup[] = [
|
||||
{ code: 'Reset', name: '重置' },
|
||||
{ code: 'Outbound', name: '出库' },
|
||||
]),
|
||||
B('Operation.BagPack', [
|
||||
{ code: 'Query', name: '查询' },
|
||||
{ code: 'Create', name: '开袋' },
|
||||
{ code: 'Seal', name: '封袋' },
|
||||
]),
|
||||
B('Operation.BagManage', [
|
||||
{ code: 'Query', name: '查询' },
|
||||
{ code: 'Seal', name: '封袋' },
|
||||
{ code: 'Void', name: '作废' },
|
||||
{ code: 'BatchPrint', name: '批量打印' },
|
||||
]),
|
||||
B('Operation.MasterBoard', [
|
||||
{ code: 'Query', name: '查询' },
|
||||
{ code: 'Create', name: '开主单' },
|
||||
{ code: 'Seal', name: '封板' },
|
||||
]),
|
||||
B('Operation.MasterBill', [
|
||||
{ code: 'Query', name: '查询' },
|
||||
{ code: 'BindMawb', name: '绑MAWB' },
|
||||
{ code: 'HandOver', name: '交运' },
|
||||
{ code: 'BatchPrint', name: '批量打印' },
|
||||
]),
|
||||
B('Operation.PrintLabel', [
|
||||
{ code: 'Query', name: '查询' },
|
||||
{ code: 'Reset', name: '重置' },
|
||||
@ -959,6 +985,7 @@ const CORE_GROUPS: PageButtonGroup[] = [
|
||||
]),
|
||||
|
||||
// ── 知识库 ──
|
||||
B('Knowledge.Training', []),
|
||||
B('Knowledge.Category', [
|
||||
{ code: 'Query', name: '查询' },
|
||||
{ code: 'Knowledge.Category.Edit', name: '编辑' },
|
||||
|
||||
@ -1219,6 +1219,10 @@ export default {
|
||||
'menu.operation': 'Operation',
|
||||
'menu.operation.inboundScan': 'Inbound Scan',
|
||||
'menu.operation.outboundScan': 'Outbound Scan',
|
||||
'menu.operation.bagPack': 'Bag Packing',
|
||||
'menu.operation.bagManage': 'Bag Manage',
|
||||
'menu.operation.masterBoard': 'Master Boarding',
|
||||
'menu.operation.masterBill': 'Master Bill',
|
||||
'menu.operation.printLabel': 'Print Label',
|
||||
'menu.operation.parcelArrival': 'Parcel Arrival',
|
||||
'menu.operation.fulfillPack': 'Fulfill Pack & Outbound',
|
||||
@ -4233,6 +4237,8 @@ export default {
|
||||
'operation.printLabel.labelTemplate.outbound': 'Outbound Label',
|
||||
'operation.printLabel.labelTemplate.sku': 'SKU Label',
|
||||
'operation.printLabel.labelTemplate.box': 'Box Mark Label',
|
||||
'operation.printLabel.labelTemplate.shipBag': 'Ship Bag Label',
|
||||
'operation.printLabel.labelTemplate.shipMaster': 'Ship Master Label',
|
||||
'operation.printLabel.preview.title': 'Label preview',
|
||||
'operation.printLabel.preview.empty': 'Scan a number to show order info; open Preview when needed',
|
||||
'operation.printLabel.preview.product': 'Product',
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
export default {
|
||||
'menu.kb': 'Knowledge Base',
|
||||
'menu.kb.training': 'Training Handbook',
|
||||
'menu.kb.category': 'Categories',
|
||||
'menu.kb.article': 'Articles',
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
export default {
|
||||
'menu.kb': '知识库',
|
||||
'menu.kb.training': '培训手册',
|
||||
'menu.kb.category': '分类管理',
|
||||
'menu.kb.article': '文章管理',
|
||||
|
||||
|
||||
@ -1209,6 +1209,10 @@ export default {
|
||||
'menu.operation': '操作',
|
||||
'menu.operation.inboundScan': '入库扫描',
|
||||
'menu.operation.outboundScan': '出库扫描',
|
||||
'menu.operation.bagPack': '装袋作业',
|
||||
'menu.operation.bagManage': '大包管理',
|
||||
'menu.operation.masterBoard': '打板作业',
|
||||
'menu.operation.masterBill': '主单管理',
|
||||
'menu.operation.printLabel': '打印标签',
|
||||
'menu.operation.parcelArrival': '快递到仓',
|
||||
'menu.operation.fulfillPack': '代发打包出库',
|
||||
@ -4256,6 +4260,8 @@ export default {
|
||||
'operation.printLabel.labelTemplate.outbound': '出库标签',
|
||||
'operation.printLabel.labelTemplate.sku': 'sku标签',
|
||||
'operation.printLabel.labelTemplate.box': '箱唛标签',
|
||||
'operation.printLabel.labelTemplate.shipBag': '大包标签',
|
||||
'operation.printLabel.labelTemplate.shipMaster': '主单标签',
|
||||
'operation.printLabel.preview.title': '面单预览',
|
||||
'operation.printLabel.preview.empty': '扫描单号后显示订单信息,需要时可点预览查看面单',
|
||||
'operation.printLabel.preview.product': '销售产品',
|
||||
|
||||
@ -12,6 +12,20 @@ const KNOWLEDGE: AppRouteRecordRaw = {
|
||||
order: 8,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'training',
|
||||
name: 'KbTraining',
|
||||
component: () => import('@/views/kb/training/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.kb.training',
|
||||
requiresAuth: true,
|
||||
// 供菜单管理「同步子菜单及按钮」写入二级菜单权限码(不走路由守卫)
|
||||
menuPermission: 'Knowledge.Training',
|
||||
order: 0,
|
||||
icon: 'icon-book',
|
||||
adminPortalOnly: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'category',
|
||||
name: 'KbCategory',
|
||||
@ -20,6 +34,7 @@ const KNOWLEDGE: AppRouteRecordRaw = {
|
||||
locale: 'menu.kb.category',
|
||||
requiresAuth: true,
|
||||
permission: 'Knowledge.Category.Query',
|
||||
menuPermission: 'Knowledge.Category',
|
||||
order: 1,
|
||||
},
|
||||
},
|
||||
@ -31,6 +46,7 @@ const KNOWLEDGE: AppRouteRecordRaw = {
|
||||
locale: 'menu.kb.article',
|
||||
requiresAuth: true,
|
||||
permission: 'Knowledge.Article.Query',
|
||||
menuPermission: 'Knowledge.Article',
|
||||
order: 2,
|
||||
},
|
||||
},
|
||||
|
||||
@ -34,6 +34,54 @@ const OPERATION: AppRouteRecordRaw = {
|
||||
order: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'bagPack',
|
||||
name: 'BagPack',
|
||||
component: () => import('@/views/operation/bagPack/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.operation.bagPack',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.BagPack.Query',
|
||||
menuPermission: 'Operation.BagPack',
|
||||
order: 3,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'bagManage',
|
||||
name: 'BagManage',
|
||||
component: () => import('@/views/operation/bagManage/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.operation.bagManage',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.BagManage.Query',
|
||||
menuPermission: 'Operation.BagManage',
|
||||
order: 4,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'masterBoard',
|
||||
name: 'MasterBoard',
|
||||
component: () => import('@/views/operation/masterBoard/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.operation.masterBoard',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.MasterBoard.Query',
|
||||
menuPermission: 'Operation.MasterBoard',
|
||||
order: 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'masterBill',
|
||||
name: 'MasterBill',
|
||||
component: () => import('@/views/operation/masterBill/index.vue'),
|
||||
meta: {
|
||||
locale: 'menu.operation.masterBill',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.MasterBill.Query',
|
||||
menuPermission: 'Operation.MasterBill',
|
||||
order: 6,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'printLabel',
|
||||
name: 'PrintLabel',
|
||||
@ -42,7 +90,7 @@ const OPERATION: AppRouteRecordRaw = {
|
||||
locale: 'menu.operation.printLabel',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.PrintLabel',
|
||||
order: 3,
|
||||
order: 7,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -53,7 +101,7 @@ const OPERATION: AppRouteRecordRaw = {
|
||||
locale: 'menu.operation.parcelArrival',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.ParcelArrival.Query',
|
||||
order: 4,
|
||||
order: 8,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -64,7 +112,7 @@ const OPERATION: AppRouteRecordRaw = {
|
||||
locale: 'menu.operation.fulfillPack',
|
||||
requiresAuth: true,
|
||||
permission: 'Operation.FulfillPack',
|
||||
order: 5,
|
||||
order: 9,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@ -59,6 +59,10 @@ export const MENU_NAME_TO_LOCALE_KEY: Record<string, string> = {
|
||||
操作: 'menu.operation',
|
||||
入库扫描: 'menu.operation.inboundScan',
|
||||
出库扫描: 'menu.operation.outboundScan',
|
||||
装袋作业: 'menu.operation.bagPack',
|
||||
大包管理: 'menu.operation.bagManage',
|
||||
打板作业: 'menu.operation.masterBoard',
|
||||
主单管理: 'menu.operation.masterBill',
|
||||
打印标签: 'menu.operation.printLabel',
|
||||
快递到仓: 'menu.operation.parcelArrival',
|
||||
API: 'menu.api',
|
||||
@ -109,6 +113,7 @@ export const MENU_NAME_TO_LOCALE_KEY: Record<string, string> = {
|
||||
技能卡片: 'menu.xhs.skills',
|
||||
拟人设置: 'menu.xhs.humanSettings',
|
||||
知识库: 'menu.kb',
|
||||
培训手册: 'menu.kb.training',
|
||||
分类管理: 'menu.kb.category',
|
||||
文章管理: 'menu.kb.article',
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ export const TOP_MENU_DEFAULT_ICONS: Record<string, string> = {
|
||||
'menu.operation': 'IconSettings',
|
||||
'menu.api': 'IconComputer',
|
||||
'menu.system': 'IconSettings',
|
||||
'menu.kb': 'IconBook',
|
||||
'menu.xhs': 'IconBook',
|
||||
}
|
||||
|
||||
@ -31,6 +32,7 @@ export const SUB_MENU_DEFAULT_ICONS: Record<string, string> = {
|
||||
'menu.finance.rechargeRecord': 'IconList',
|
||||
'menu.finance.accountFlow': 'IconSwap',
|
||||
'menu.finance.receivablePayable': 'IconFile',
|
||||
'menu.kb.training': 'IconBook',
|
||||
'menu.order.orderGuide': 'IconBook',
|
||||
'menu.order.priceCheck': 'IconSearch',
|
||||
'menu.order.placeOrder': 'IconPlus',
|
||||
@ -127,6 +129,7 @@ export const PATH_TO_LOCALE_KEY: Record<string, string> = {
|
||||
'/order/guide': 'menu.order.orderGuide',
|
||||
'/channel/guide': 'menu.channel.channelGuide',
|
||||
'/marketing/guide': 'menu.marketing.marketingGuide',
|
||||
'/kb/training': 'menu.kb.training',
|
||||
'/agentAdmin/list': 'menu.agentAdmin.list',
|
||||
'/agentAdmin/commission': 'menu.agentAdmin.commission',
|
||||
}
|
||||
|
||||
@ -22,6 +22,14 @@ const routeNameMap: Record<string, string> = {
|
||||
'/order/guide': 'OrderGuide',
|
||||
'order': 'Order',
|
||||
'/order': 'Order',
|
||||
'operation_bag_pack': 'BagPack',
|
||||
'/operation/bagPack': 'BagPack',
|
||||
'operation_bag_manage': 'BagManage',
|
||||
'/operation/bagManage': 'BagManage',
|
||||
'operation_master_board': 'MasterBoard',
|
||||
'/operation/masterBoard': 'MasterBoard',
|
||||
'operation_master_bill': 'MasterBill',
|
||||
'/operation/masterBill': 'MasterBill',
|
||||
|
||||
// 首页相关
|
||||
'home_workplace': 'Workplace',
|
||||
@ -118,6 +126,14 @@ const routeNameMap: Record<string, string> = {
|
||||
'/marketing': 'Marketing',
|
||||
'marketing_guide': 'MarketingGuide',
|
||||
'/marketing/guide': 'MarketingGuide',
|
||||
'kb': 'Knowledge',
|
||||
'/kb': 'Knowledge',
|
||||
'kb_training': 'KbTraining',
|
||||
'/kb/training': 'KbTraining',
|
||||
'kb_category': 'KbCategory',
|
||||
'/kb/category': 'KbCategory',
|
||||
'kb_article': 'KbArticle',
|
||||
'/kb/article': 'KbArticle',
|
||||
'channel_sales_products': 'SalesProducts',
|
||||
'/channel/salesProducts': 'SalesProducts',
|
||||
'channel_service_channels': 'ServiceChannels',
|
||||
|
||||
@ -49,6 +49,7 @@ export function resolveCareRoleTone(hasRole: (code: string) => boolean): CareRol
|
||||
|
||||
/** 员工工作台常用入口:按角色 3~4 个,避免与「今日待办」数字入口重复 */
|
||||
export type AdminQuickLinkKey =
|
||||
| 'training'
|
||||
| 'warning'
|
||||
| 'waybill'
|
||||
| 'track'
|
||||
@ -59,20 +60,28 @@ export function resolveAdminQuickLinkKeys(
|
||||
hasRole: (code: string) => boolean,
|
||||
): AdminQuickLinkKey[] {
|
||||
const tone = resolveCareRoleTone(hasRole)
|
||||
let roleLinks: AdminQuickLinkKey[]
|
||||
switch (tone) {
|
||||
case 'finance':
|
||||
return ['waybill', 'price', 'track']
|
||||
roleLinks = ['waybill', 'price', 'track']
|
||||
break
|
||||
case 'cs':
|
||||
return ['waybill', 'track', 'pickup']
|
||||
roleLinks = ['waybill', 'track', 'pickup']
|
||||
break
|
||||
case 'ops':
|
||||
return ['waybill', 'pickup', 'track']
|
||||
roleLinks = ['waybill', 'pickup', 'track']
|
||||
break
|
||||
case 'track':
|
||||
return ['warning', 'track', 'waybill']
|
||||
roleLinks = ['warning', 'track', 'waybill']
|
||||
break
|
||||
case 'sales':
|
||||
return ['waybill', 'price', 'track']
|
||||
roleLinks = ['waybill', 'price', 'track']
|
||||
break
|
||||
default:
|
||||
return ['waybill', 'track', 'pickup', 'price']
|
||||
roleLinks = ['waybill', 'track', 'pickup', 'price']
|
||||
}
|
||||
// 培训手册置顶,方便新人;总量仍控制在 4 个以内
|
||||
return ['training', ...roleLinks.filter((k) => k !== 'training')].slice(0, 4)
|
||||
}
|
||||
|
||||
/** 待办卡紧急度:有量时问题件 / 理赔优先 */
|
||||
|
||||
@ -462,14 +462,15 @@ export function useKpiAreaPage(areaType: KpiAreaType) {
|
||||
trigger: 'change',
|
||||
},
|
||||
{
|
||||
validator: (_rule: any, value: any, callback: any) => {
|
||||
// Arco Form:validator(value, callback),不要写成 AntD 的 (rule, value, callback)
|
||||
validator: (value: any, callback: (error?: string) => void) => {
|
||||
if (
|
||||
model.matchMode === 'range' &&
|
||||
model.leftPostCode &&
|
||||
value &&
|
||||
isPostcodeRangeInvalid(String(model.leftPostCode).trim(), String(value).trim())
|
||||
) {
|
||||
callback(new Error(t('channel.area.form.rules.postcodeRangeInvalid')));
|
||||
callback(t('channel.area.form.rules.postcodeRangeInvalid'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
|
||||
@ -352,7 +352,8 @@ const formItemList = computed(() => {
|
||||
ifShow: () => formState.handlerType === 'user',
|
||||
rules: [
|
||||
{
|
||||
validator: (_rule: unknown, value: number | undefined, callback: (error?: string) => void) => {
|
||||
// Arco Form:validator(value, callback)
|
||||
validator: (value: number | undefined, callback: (error?: string) => void) => {
|
||||
if (formState.handlerType !== 'user') {
|
||||
callback()
|
||||
return
|
||||
|
||||
@ -201,6 +201,8 @@ const typeOptions = computed(() => [
|
||||
{ value: 'outbound', label: t('operation.printLabel.labelTemplate.outbound') },
|
||||
{ value: 'sku', label: t('operation.printLabel.labelTemplate.sku') },
|
||||
{ value: 'box', label: t('operation.printLabel.labelTemplate.box') },
|
||||
{ value: 'shipBag', label: t('operation.printLabel.labelTemplate.shipBag') },
|
||||
{ value: 'shipMaster', label: t('operation.printLabel.labelTemplate.shipMaster') },
|
||||
])
|
||||
|
||||
function typeLabel(type?: string) {
|
||||
|
||||
@ -6,10 +6,39 @@
|
||||
:class="{ 'is-ready': ready }"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="selectMenu.visible"
|
||||
class="price-select-overlay"
|
||||
@mousedown.prevent="closeSelectMenu"
|
||||
>
|
||||
<div
|
||||
class="price-select-menu"
|
||||
:style="selectMenuStyle"
|
||||
role="listbox"
|
||||
@mousedown.stop
|
||||
>
|
||||
<button
|
||||
v-for="opt in selectMenu.options"
|
||||
:key="opt"
|
||||
type="button"
|
||||
class="price-select-option"
|
||||
:class="{ 'is-active': opt === selectMenu.value }"
|
||||
role="option"
|
||||
:aria-selected="opt === selectMenu.value"
|
||||
@click="pickSelectOption(opt)"
|
||||
>
|
||||
<span class="price-select-option__text">{{ opt }}</span>
|
||||
<span v-if="opt === selectMenu.value" class="price-select-option__check" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
|
||||
import Handsontable from 'handsontable';
|
||||
import { registerAllModules } from 'handsontable/registry';
|
||||
import { registerLanguageDictionary, zhCN } from 'handsontable/i18n';
|
||||
@ -62,6 +91,79 @@
|
||||
let resizeRaf = 0;
|
||||
let mountTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
/** 自定义轻量下拉(替代 Handsontable listbox 面板) */
|
||||
const selectMenu = reactive({
|
||||
visible: false,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 160,
|
||||
maxHeight: 240,
|
||||
options: [] as string[],
|
||||
value: '',
|
||||
row: -1,
|
||||
prop: '',
|
||||
});
|
||||
|
||||
const selectMenuStyle = computed(() => ({
|
||||
top: `${selectMenu.top}px`,
|
||||
left: `${selectMenu.left}px`,
|
||||
minWidth: `${selectMenu.width}px`,
|
||||
maxHeight: `${selectMenu.maxHeight}px`,
|
||||
}));
|
||||
|
||||
function closeSelectMenu() {
|
||||
selectMenu.visible = false;
|
||||
selectMenu.row = -1;
|
||||
selectMenu.prop = '';
|
||||
}
|
||||
|
||||
function openSelectMenu(row: number, col: number, td: HTMLElement) {
|
||||
const meta = props.columns[col - 1];
|
||||
if (!meta || meta.type !== 'dropdown' || meta.readOnly) return;
|
||||
const options = (meta.source || []).filter((x) => String(x ?? '').trim() !== '');
|
||||
if (!options.length) return;
|
||||
|
||||
const rect = td.getBoundingClientRect();
|
||||
const width = Math.max(rect.width, 148);
|
||||
const estimated = Math.min(options.length * 36 + 12, 240);
|
||||
const spaceBelow = window.innerHeight - rect.bottom - 8;
|
||||
const spaceAbove = rect.top - 8;
|
||||
const openUp = spaceBelow < estimated && spaceAbove > spaceBelow;
|
||||
const maxHeight = Math.max(120, Math.min(240, openUp ? spaceAbove : spaceBelow));
|
||||
|
||||
selectMenu.options = options;
|
||||
selectMenu.value = String(props.data?.[row]?.[meta.key] ?? '');
|
||||
selectMenu.row = row;
|
||||
selectMenu.prop = meta.key;
|
||||
selectMenu.width = width;
|
||||
selectMenu.maxHeight = maxHeight;
|
||||
selectMenu.left = Math.min(rect.left, window.innerWidth - width - 8);
|
||||
selectMenu.top = openUp ? Math.max(8, rect.top - maxHeight - 4) : rect.bottom + 4;
|
||||
selectMenu.visible = true;
|
||||
}
|
||||
|
||||
function pickSelectOption(opt: string) {
|
||||
const row = props.data?.[selectMenu.row];
|
||||
const prop = selectMenu.prop;
|
||||
if (row && prop) {
|
||||
row[prop] = opt;
|
||||
try {
|
||||
hot?.setDataAtRowProp?.(selectMenu.row, prop, opt, 'priceSelect');
|
||||
} catch {
|
||||
hot?.render?.();
|
||||
}
|
||||
}
|
||||
closeSelectMenu();
|
||||
}
|
||||
|
||||
function onSelectMenuKeydown(e: KeyboardEvent) {
|
||||
if (!selectMenu.visible) return;
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
closeSelectMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/** 量外层容器宽度(不要量 HOT 根节点,否则会被写死的 px 宽度锁死) */
|
||||
function readWrapWidth() {
|
||||
const el = wrapRef.value;
|
||||
@ -70,6 +172,24 @@
|
||||
return w > 0 ? w : 0;
|
||||
}
|
||||
|
||||
function escapeHtml(s: string): string {
|
||||
return s
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function renderSelectCell(td: HTMLTableCellElement, className: string, value: any) {
|
||||
const text = value == null || String(value).trim() === '' ? '' : String(value);
|
||||
td.className = `${className} ht-select-cell${text ? '' : ' ht-select-cell--empty'}`.trim();
|
||||
td.style.cursor = 'pointer';
|
||||
td.innerHTML =
|
||||
`<span class="ht-select-cell__text">${text ? escapeHtml(text) : '请选择'}</span>` +
|
||||
`<span class="ht-select-cell__caret" aria-hidden="true"></span>`;
|
||||
}
|
||||
|
||||
function buildColumns(): any[] {
|
||||
const cols: any[] = [
|
||||
{
|
||||
@ -91,11 +211,20 @@
|
||||
conf.numericFormat = { pattern: '0.00' };
|
||||
conf.className = 'htRight';
|
||||
} else if (col.type === 'dropdown') {
|
||||
conf.type = 'dropdown';
|
||||
conf.source = col.source || [];
|
||||
conf.strict = true;
|
||||
conf.allowInvalid = false;
|
||||
// 不用 HOT dropdown/listbox:禁编辑器,点击弹出轻量菜单
|
||||
conf.type = 'text';
|
||||
conf.editor = false;
|
||||
conf.className = 'htLeft';
|
||||
conf.renderer = (
|
||||
_instance: Handsontable,
|
||||
td: HTMLTableCellElement,
|
||||
_row: number,
|
||||
_col: number,
|
||||
_prop: any,
|
||||
value: any,
|
||||
) => {
|
||||
renderSelectCell(td, conf.className || 'htLeft', value);
|
||||
};
|
||||
} else {
|
||||
conf.type = 'text';
|
||||
}
|
||||
@ -416,6 +545,35 @@
|
||||
row[prop] = newVal;
|
||||
}
|
||||
},
|
||||
afterOnCellMouseDown(event, coords, td) {
|
||||
if (coords.row < 0 || coords.col < 1) {
|
||||
closeSelectMenu();
|
||||
return;
|
||||
}
|
||||
const meta = props.columns[coords.col - 1];
|
||||
if (meta?.type === 'dropdown' && !meta.readOnly) {
|
||||
event.preventDefault?.();
|
||||
event.stopPropagation?.();
|
||||
openSelectMenu(coords.row, coords.col, td as HTMLElement);
|
||||
return;
|
||||
}
|
||||
closeSelectMenu();
|
||||
},
|
||||
beforeKeyDown(event) {
|
||||
if (!hot) return;
|
||||
const selected = hot.getSelectedLast?.() || hot.getSelected()?.[0];
|
||||
if (!selected) return;
|
||||
const [row, col] = selected;
|
||||
if (row < 0 || col < 1) return;
|
||||
const meta = props.columns[col - 1];
|
||||
if (meta?.type !== 'dropdown' || meta.readOnly) return;
|
||||
if (event.key === 'Enter' || event.key === ' ' || event.key === 'F2') {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation?.();
|
||||
const td = hot.getCell(row, col);
|
||||
if (td) openSelectMenu(row, col, td);
|
||||
}
|
||||
},
|
||||
afterSelectionEnd() {
|
||||
if (selectionLock) return;
|
||||
publishSelection();
|
||||
@ -493,6 +651,7 @@
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', onSelectMenuKeydown, true);
|
||||
// 等弹窗/Tab 布局完成再挂载,效果等同「切走再切回」后的正确首屏
|
||||
void nextTick(async () => {
|
||||
await new Promise<void>((resolve) => {
|
||||
@ -512,6 +671,8 @@
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('keydown', onSelectMenuKeydown, true);
|
||||
closeSelectMenu();
|
||||
if (resizeRaf) cancelAnimationFrame(resizeRaf);
|
||||
if (mountTimer) {
|
||||
clearTimeout(mountTimer);
|
||||
@ -609,6 +770,43 @@
|
||||
background: color-mix(in srgb, var(--app-primary-color) 5%, #fff) !important;
|
||||
}
|
||||
|
||||
:deep(td.ht-select-cell) {
|
||||
position: relative;
|
||||
padding-right: 28px !important;
|
||||
cursor: pointer !important;
|
||||
|
||||
.ht-select-cell__text {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--color-text-1);
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.ht-select-cell__caret {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-top: -5px;
|
||||
pointer-events: none;
|
||||
opacity: 0.45;
|
||||
background-color: currentColor;
|
||||
color: var(--color-text-3);
|
||||
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M2.6 4.2a.75.75 0 0 1 1.06 0L6 6.54l2.34-2.34a.75.75 0 1 1 1.06 1.06L6.53 8.13a.75.75 0 0 1-1.06 0L2.6 5.26a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E")
|
||||
center / contain no-repeat;
|
||||
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M2.6 4.2a.75.75 0 0 1 1.06 0L6 6.54l2.34-2.34a.75.75 0 1 1 1.06 1.06L6.53 8.13a.75.75 0 0 1-1.06 0L2.6 5.26a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E")
|
||||
center / contain no-repeat;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(td.ht-select-cell--empty .ht-select-cell__text) {
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
/* 防止 HOT 写死宽度后外层出现空白 */
|
||||
:deep(.ht-wrapper),
|
||||
:deep(.handsontable) {
|
||||
@ -619,8 +817,69 @@
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.handsontable.listbox,
|
||||
.autocompleteEditor.handsontable.listbox {
|
||||
z-index: 11000 !important;
|
||||
.price-select-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 12000;
|
||||
}
|
||||
|
||||
.price-select-menu {
|
||||
position: fixed;
|
||||
z-index: 12001;
|
||||
box-sizing: border-box;
|
||||
padding: 4px;
|
||||
overflow: auto;
|
||||
border: 1px solid var(--color-border-2, #e5e6eb);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
box-shadow:
|
||||
0 4px 16px rgba(0, 0, 0, 0.08),
|
||||
0 1px 4px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.price-select-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
min-height: 34px;
|
||||
padding: 0 12px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: var(--color-text-1, #1d2129);
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: background 0.12s ease, color 0.12s ease;
|
||||
|
||||
&:hover {
|
||||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 10%, #fff);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.price-select-option__text {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.price-select-option__check {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background-color: currentColor;
|
||||
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M4.7 9.1 1.9 6.3a.75.75 0 0 1 1.06-1.06l1.9 1.9 3.9-3.9A.75.75 0 1 1 9.8 4.3L4.7 9.1Z'/%3E%3C/svg%3E")
|
||||
center / contain no-repeat;
|
||||
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M4.7 9.1 1.9 6.3a.75.75 0 0 1 1.06-1.06l1.9 1.9 3.9-3.9A.75.75 0 1 1 9.8 4.3L4.7 9.1Z'/%3E%3C/svg%3E")
|
||||
center / contain no-repeat;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -396,10 +396,11 @@
|
||||
message: t('channel.weightRules.form.rules.volumetricFactorRequired'),
|
||||
},
|
||||
{
|
||||
validator: (_rule: any, value: any, callback: any) => {
|
||||
// Arco Form:validator(value, callback),不要写成 AntD 的 (rule, value, callback)
|
||||
validator: (value: any, callback: (error?: string) => void) => {
|
||||
const n = Number(String(value ?? '').trim());
|
||||
if (!Number.isFinite(n) || n <= 0) {
|
||||
callback(new Error(t('channel.weightRules.form.rules.volumetricFactorPositive')));
|
||||
callback(t('channel.weightRules.form.rules.volumetricFactorPositive'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
IconBook,
|
||||
IconExclamationCircle,
|
||||
IconList,
|
||||
IconPublic,
|
||||
@ -105,6 +106,13 @@ const LINK_CATALOG: Record<
|
||||
tone: string
|
||||
}
|
||||
> = {
|
||||
training: {
|
||||
labelKey: 'workplace.admin.link.training',
|
||||
hintKey: 'workplace.admin.link.trainingHint',
|
||||
path: '/kb/training',
|
||||
icon: IconBook,
|
||||
tone: 'sand',
|
||||
},
|
||||
warning: {
|
||||
labelKey: 'workplace.admin.link.warning',
|
||||
hintKey: 'workplace.admin.link.warningHint',
|
||||
|
||||
@ -227,6 +227,8 @@ export default {
|
||||
'workplace.admin.ops.problematicHint': 'Open issues to handle',
|
||||
'workplace.admin.ops.claimed': 'Claims',
|
||||
'workplace.admin.ops.claimedHint': 'Claims to follow up',
|
||||
'workplace.admin.link.training': 'Training handbook',
|
||||
'workplace.admin.link.trainingHint': '4-week onboarding & scripts',
|
||||
'workplace.admin.link.warning': 'Track warnings',
|
||||
'workplace.admin.link.warningHint': 'Timeouts and track issues',
|
||||
'workplace.admin.link.waybill': 'Waybills',
|
||||
|
||||
@ -224,6 +224,8 @@ export default {
|
||||
'workplace.admin.ops.problematicHint': '待处理异常',
|
||||
'workplace.admin.ops.claimed': '理赔件',
|
||||
'workplace.admin.ops.claimedHint': '待跟进理赔',
|
||||
'workplace.admin.link.training': '培训手册',
|
||||
'workplace.admin.link.trainingHint': '新人四周课表与话术',
|
||||
'workplace.admin.link.warning': '轨迹预警',
|
||||
'workplace.admin.link.warningHint': '超时与轨迹异常',
|
||||
'workplace.admin.link.waybill': '运单管理',
|
||||
|
||||
146
src/views/kb/training/TrainingChecklist.vue
Normal file
146
src/views/kb/training/TrainingChecklist.vue
Normal file
@ -0,0 +1,146 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { Message, Modal } from '@arco-design/web-vue'
|
||||
import { useTrainingProgress } from './useTrainingProgress'
|
||||
import {
|
||||
itemsForRole,
|
||||
itemsForWeek,
|
||||
type TrainingWeekKey,
|
||||
} from './checklist-items'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
week?: TrainingWeekKey | 'all'
|
||||
showReset?: boolean
|
||||
title?: string
|
||||
}>(),
|
||||
{
|
||||
week: 'all',
|
||||
showReset: false,
|
||||
title: '练习进度(勾选会保存在本机)',
|
||||
},
|
||||
)
|
||||
|
||||
defineOptions({ name: 'TrainingChecklist' })
|
||||
|
||||
const { role, isChecked, setChecked, resetAll, weekProgress } = useTrainingProgress()
|
||||
|
||||
const items = computed(() => {
|
||||
const byRole = itemsForRole(role.value)
|
||||
if (props.week === 'all') return byRole
|
||||
const weekIds = new Set(itemsForWeek(props.week).map((i) => i.id))
|
||||
return byRole.filter((i) => weekIds.has(i.id))
|
||||
})
|
||||
|
||||
const progress = computed(() => {
|
||||
if (props.week === 'all') {
|
||||
const done = items.value.filter((i) => isChecked(i.id)).length
|
||||
return { done, total: items.value.length }
|
||||
}
|
||||
return weekProgress(props.week)
|
||||
})
|
||||
|
||||
function onReset() {
|
||||
Modal.confirm({
|
||||
title: '清空练习勾选?',
|
||||
content: '仅清除本机浏览器中的勾选记录,不影响课表内容。',
|
||||
okText: '清空',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
resetAll()
|
||||
Message.success('已清空勾选')
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="items.length" class="training-checklist">
|
||||
<div class="training-checklist__head">
|
||||
<div class="training-checklist__title">
|
||||
{{ title }}
|
||||
<span class="training-checklist__meta">
|
||||
{{ progress.done }}/{{ progress.total }}
|
||||
</span>
|
||||
</div>
|
||||
<a-button v-if="showReset" size="mini" @click="onReset">清空勾选</a-button>
|
||||
</div>
|
||||
<div class="training-checklist__list">
|
||||
<label
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
class="training-checklist__item"
|
||||
:class="{ 'is-done': isChecked(item.id) }"
|
||||
>
|
||||
<a-checkbox
|
||||
:model-value="isChecked(item.id)"
|
||||
@update:model-value="(v: boolean) => setChecked(item.id, !!v)"
|
||||
/>
|
||||
<span class="training-checklist__label">{{ item.label }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.training-checklist {
|
||||
margin: 16px 0 8px;
|
||||
padding: 14px 16px;
|
||||
background: var(--color-fill-1);
|
||||
border: 1px solid var(--color-border-2);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.training-checklist__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.training-checklist__title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
||||
.training-checklist__meta {
|
||||
margin-left: 8px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
.training-checklist__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.training-checklist__item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 6px 8px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
|
||||
&:hover {
|
||||
background: var(--color-fill-2);
|
||||
}
|
||||
|
||||
&.is-done .training-checklist__label {
|
||||
color: var(--color-text-3);
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
|
||||
.training-checklist__label {
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
color: var(--color-text-1);
|
||||
padding-top: 1px;
|
||||
}
|
||||
</style>
|
||||
103
src/views/kb/training/TrainingRolePicker.vue
Normal file
103
src/views/kb/training/TrainingRolePicker.vue
Normal file
@ -0,0 +1,103 @@
|
||||
<script lang="ts" setup>
|
||||
import { useTrainingProgress } from './useTrainingProgress'
|
||||
import { ROLE_WEEK_FOCUS } from './checklist-items'
|
||||
|
||||
defineOptions({ name: 'TrainingRolePicker' })
|
||||
|
||||
const { role, roles, roleMeta, percent, doneCount, totalCount } = useTrainingProgress()
|
||||
|
||||
const weekLabel: Record<string, string> = {
|
||||
week1: '第1周',
|
||||
week2: '第2周',
|
||||
week3: '第3周',
|
||||
week4: '第4周',
|
||||
practice: '练习包',
|
||||
exam: '验收',
|
||||
}
|
||||
|
||||
const focusLabels = () =>
|
||||
(ROLE_WEEK_FOCUS[role.value] || [])
|
||||
.map((k) => weekLabel[k] || k)
|
||||
.join(' · ')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="role-picker">
|
||||
<div class="role-picker__head">
|
||||
<div>
|
||||
<div class="role-picker__title">我的岗位轨</div>
|
||||
<div class="role-picker__desc">
|
||||
{{ roleMeta.summary }} · 建议学习:{{ focusLabels() }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="role-picker__progress">
|
||||
<a-progress
|
||||
:percent="percent"
|
||||
size="small"
|
||||
:stroke-width="6"
|
||||
style="width: 120px"
|
||||
/>
|
||||
<span class="role-picker__count">{{ doneCount }}/{{ totalCount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<a-radio-group v-model="role" type="button" size="small" class="role-picker__radios">
|
||||
<a-radio v-for="r in roles" :key="r.key" :value="r.key">{{ r.label }}</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.role-picker {
|
||||
margin: 0 0 16px;
|
||||
padding: 14px 16px;
|
||||
background: var(--color-fill-1);
|
||||
border: 1px solid var(--color-border-2);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.role-picker__head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.role-picker__title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
||||
.role-picker__desc {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.role-picker__progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.role-picker__count {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.role-picker__radios {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.role-picker__head {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
111
src/views/kb/training/checklist-items.ts
Normal file
111
src/views/kb/training/checklist-items.ts
Normal file
@ -0,0 +1,111 @@
|
||||
export type TrainingWeekKey = 'week1' | 'week2' | 'week3' | 'week4' | 'practice' | 'exam'
|
||||
export type TrainingRoleKey = 'all' | 'cs' | 'channel' | 'warehouse' | 'implement'
|
||||
|
||||
export interface TrainingChecklistItem {
|
||||
id: string
|
||||
week: TrainingWeekKey
|
||||
label: string
|
||||
/** 为空表示全岗位;否则仅这些岗位强调 */
|
||||
roles?: TrainingRoleKey[]
|
||||
}
|
||||
|
||||
export const TRAINING_ROLES: { key: TrainingRoleKey; label: string; summary: string }[] = [
|
||||
{
|
||||
key: 'all',
|
||||
label: '通才 / 未定岗',
|
||||
summary: '四周全学,约 20 个工作日',
|
||||
},
|
||||
{
|
||||
key: 'cs',
|
||||
label: '客服',
|
||||
summary: '第1+3周为主,第4周轨迹扫一眼;约 12 个工作日',
|
||||
},
|
||||
{
|
||||
key: 'channel',
|
||||
label: '渠道运营',
|
||||
summary: '第2周深挖 + 第3周待排货;第1周快速过;约 12 个工作日',
|
||||
},
|
||||
{
|
||||
key: 'warehouse',
|
||||
label: '仓管 / 操作',
|
||||
summary: '第1周状态 + 第3周入库出库;约 8~10 个工作日',
|
||||
},
|
||||
{
|
||||
key: 'implement',
|
||||
label: '实施 / 对接',
|
||||
summary: '第1周主线 + 第4周轨迹/API;约 10 个工作日',
|
||||
},
|
||||
]
|
||||
|
||||
/** 岗位建议学习的周次(用于课表提示) */
|
||||
export const ROLE_WEEK_FOCUS: Record<TrainingRoleKey, TrainingWeekKey[]> = {
|
||||
all: ['week1', 'week2', 'week3', 'week4', 'practice', 'exam'],
|
||||
cs: ['week1', 'week3', 'week4', 'practice', 'exam'],
|
||||
channel: ['week1', 'week2', 'week3', 'practice', 'exam'],
|
||||
warehouse: ['week1', 'week3', 'practice', 'exam'],
|
||||
implement: ['week1', 'week4', 'practice', 'exam'],
|
||||
}
|
||||
|
||||
export const CHECKLIST_ITEMS: TrainingChecklistItem[] = [
|
||||
// 练习包
|
||||
{ id: 'practice.customer-register', week: 'practice', label: '测服自行注册客户账号(网页端 /login)' },
|
||||
{ id: 'practice.admin-access', week: 'practice', label: '拿到或申请运营端账号(/admin),权限含订单/渠道/轨迹' },
|
||||
{ id: 'practice.pick-product', week: 'practice', label: '选定一条已启用销售产品作为练习线(现有产品即可)' },
|
||||
{ id: 'practice.happy-path', week: 'practice', label: '跑通幸福路径:查价→下单→入库→付款→出库' },
|
||||
{ id: 'practice.pending-alloc', week: 'practice', label: '人为制造一票待排货,再修好变为待支付' },
|
||||
{ id: 'practice.draft-fail', week: 'practice', label: '制造/找到一票预报失败草稿,能读失败原因' },
|
||||
{ id: 'practice.price-vs-order', week: 'practice', label: '复现「查价有价、下单更严」(缺邮编/黑名单等)' },
|
||||
{ id: 'practice.track-refresh', week: 'practice', label: '出库后在轨迹订单刷新,能读时间轴(有则看未映射)' },
|
||||
|
||||
// 第1周
|
||||
{ id: 'w1.map', week: 'week1', label: '画出销售产品 / 服务渠道 / 预报 vs 入库 / 待排货' },
|
||||
{ id: 'w1.pc-order', week: 'week1', label: '网页端完成查价→下单→看到已预报' },
|
||||
{ id: 'w1.h5', week: 'week1', label: 'H5 同账号对照查价与订单列表' },
|
||||
{ id: 'w1.ops-find', week: 'week1', label: '运营端用运单号找到该单并说出状态含义' },
|
||||
{ id: 'w1.explain', week: 'week1', label: '能解释:客户选销售产品,入库后系统选服务渠道' },
|
||||
|
||||
// 第2周
|
||||
{ id: 'w2.zone', week: 'week2', label: '价格分区 / 黑名单 / 偏远各做一组正反例', roles: ['all', 'channel'] },
|
||||
{ id: 'w2.weight', week: 'week2', label: '按计重规则手算一例计费重', roles: ['all', 'channel'] },
|
||||
{ id: 'w2.price', week: 'week2', label: '卖价矩阵故意配错,看到「卖价未匹配」', roles: ['all', 'channel'] },
|
||||
{ id: 'w2.alloc', week: 'week2', label: '理解排货与买价发布;能说明待排货成因', roles: ['all', 'channel', 'cs'] },
|
||||
{ id: 'w2.publish', week: 'week2', label: '规则+价格都点过发布;故意不发布观察旧规则', roles: ['all', 'channel'] },
|
||||
|
||||
// 第3周
|
||||
{ id: 'w3.full', week: 'week3', label: '完整跑通:下单→入库→付款→出库' },
|
||||
{ id: 'w3.pending', week: 'week3', label: '待排货→重算应付→待支付' },
|
||||
{ id: 'w3.fee-talk', week: 'week3', label: '用预报/入库件重尺差演练费用解释', roles: ['all', 'cs', 'channel'] },
|
||||
{ id: 'w3.cross-end', week: 'week3', label: '同一运单号网页端与运营端状态一致' },
|
||||
{ id: 'w3.warehouse', week: 'week3', label: '跟一次入库/出库扫描(或录屏)', roles: ['all', 'warehouse'] },
|
||||
|
||||
// 第4周
|
||||
{ id: 'w4.track', week: 'week4', label: '轨迹订单刷新,能读时间轴', roles: ['all', 'cs', 'implement'] },
|
||||
{ id: 'w4.unmap', week: 'week4', label: '理解未映射:有原文无标准节点先查内容映射', roles: ['all', 'cs', 'implement'] },
|
||||
{ id: 'w4.push', week: 'week4', label: '看过一条推送记录(成功或失败原因)', roles: ['all', 'implement', 'cs'] },
|
||||
{ id: 'w4.api', week: 'week4', label: '能口述上游/下游/映射/应用/发布', roles: ['all', 'implement'] },
|
||||
{ id: 'w4.log', week: 'week4', label: '打开请求日志对照最终报文', roles: ['all', 'implement'] },
|
||||
|
||||
// 总验收
|
||||
{ id: 'exam.flow', week: 'exam', label: '能画出查价→…→轨迹状态流转' },
|
||||
{ id: 'exam.price-fail', week: 'exam', label: '能解释查价有价下单失败的常见原因' },
|
||||
{ id: 'exam.pending', week: 'exam', label: '能说明待排货是什么、怎么处理' },
|
||||
{ id: 'exam.publish', week: 'exam', label: '改价客户仍旧价时,先查是否发布' },
|
||||
{ id: 'exam.track', week: 'exam', label: '能处理「官网有轨迹你们没有」' },
|
||||
{ id: 'exam.api', week: 'exam', label: '能说明上游下游映射发布;排错看请求日志' },
|
||||
{ id: 'exam.ends', week: 'exam', label: '同一运单号:网页端/H5/运营端各在哪找' },
|
||||
{ id: 'exam.notes', week: 'exam', label: '提交「一票货四端对照」个人笔记' },
|
||||
]
|
||||
|
||||
export function itemsForWeek(week: TrainingWeekKey): TrainingChecklistItem[] {
|
||||
return CHECKLIST_ITEMS.filter((i) => i.week === week)
|
||||
}
|
||||
|
||||
export function itemsForRole(role: TrainingRoleKey): TrainingChecklistItem[] {
|
||||
const weeks = new Set(ROLE_WEEK_FOCUS[role])
|
||||
return CHECKLIST_ITEMS.filter((i) => {
|
||||
if (!weeks.has(i.week)) return false
|
||||
if (!i.roles || i.roles.length === 0) return true
|
||||
if (role === 'all') return true
|
||||
return i.roles.includes(role) || i.roles.includes('all')
|
||||
})
|
||||
}
|
||||
52
src/views/kb/training/handbook-checklist.md
Normal file
52
src/views/kb/training/handbook-checklist.md
Normal file
@ -0,0 +1,52 @@
|
||||
# 总验收说明
|
||||
|
||||
> 验收安排在 **工作日**(建议第 4 周周五或下一周周一)。
|
||||
> **下方勾选清单** 即总验收题,勾选保存在本机;带教对照勾选提问即可。
|
||||
|
||||
---
|
||||
|
||||
## 带教人 checklist
|
||||
|
||||
- [ ] 测服可自助注册客户;运营账号能开
|
||||
- [ ] 练习用现有已启用销售产品即可
|
||||
- [ ] **每周五** 30 分钟对照「进度」勾选;周六日不排
|
||||
- [ ] 法定假日顺延,不压缩进周末
|
||||
- [ ] 第 4 周周五:收「一票货四端对照」笔记 + 过验收勾选
|
||||
|
||||
---
|
||||
|
||||
## 个人笔记模板
|
||||
|
||||
```text
|
||||
运单号:
|
||||
客户单号:
|
||||
销售产品:
|
||||
网页端截图:
|
||||
H5 截图:
|
||||
运营端状态:
|
||||
预报费用 / 入库费用:
|
||||
排货渠道:
|
||||
轨迹最新节点:
|
||||
本次踩坑:
|
||||
对应指引章节:
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 配套指引
|
||||
|
||||
| 主题 | 路径 |
|
||||
|------|------|
|
||||
| 渠道 | [/channel/guide](/channel/guide) |
|
||||
| 订单 | [/order/guide](/order/guide) |
|
||||
| 轨迹 | [/track/guide](/track/guide) |
|
||||
| API | [/api/apiDebugger](/api/apiDebugger) |
|
||||
| 话术 | 本页「话术」Tab |
|
||||
| 练习包 | 本页「练习包」Tab |
|
||||
|
||||
---
|
||||
|
||||
## 一句话
|
||||
|
||||
> 先当客户发一票,再当运营配通、查通;
|
||||
> 钱看渠道发布,货看订单状态,进度看轨迹映射,外系统看 API 发布与日志。
|
||||
111
src/views/kb/training/handbook-overview.md
Normal file
111
src/views/kb/training/handbook-overview.md
Normal file
@ -0,0 +1,111 @@
|
||||
# OMS 新人培训手册
|
||||
|
||||
> 面向 **运营、客服、实施、仓管** 等内部新人。
|
||||
> 只讲业务:怎么理解系统、怎么按月学会、怎么验收。
|
||||
> 渠道 / 订单 / 轨迹 / API 的细配与排障,请点开文末「配套指引」。
|
||||
|
||||
页面上方可选 **岗位轨**(勾选进度按岗位过滤,保存在本机)。
|
||||
|
||||
---
|
||||
|
||||
## 计时规则(必读)
|
||||
|
||||
- **只计工作日(周一~周五)**,周六、周日 **不排课、不计入进度**。
|
||||
- 通才四周 ≈ **20 个工作日**;遇法定节假日顺延到下一个工作日。
|
||||
- 课表里的「周一~周五」均指当周工作日,不是自然日连号。
|
||||
|
||||
---
|
||||
|
||||
## 岗位速成(怎么选课)
|
||||
|
||||
| 岗位 | 怎么学 | 大约工期 |
|
||||
|------|--------|----------|
|
||||
| **通才 / 未定岗** | 第1~4周全学 + 练习包 | 20 个工作日 |
|
||||
| **客服** | 第1、3周为主;第4周只学轨迹(周一~周二);话术 Tab 常备 | ≈12 个工作日 |
|
||||
| **渠道运营** | 第1周快速过;第2周深挖;第3周待排货与费用 | ≈12 个工作日 |
|
||||
| **仓管 / 操作** | 第1周状态机;第3周入库出库与待排货协同 | ≈8~10 个工作日 |
|
||||
| **实施 / 对接** | 第1周主线;第4周轨迹+API;练习包场景 1、5 | ≈10 个工作日 |
|
||||
|
||||
测服账号 **自己注册**;产品用环境里已有线路即可 → 见「练习包」Tab。
|
||||
|
||||
---
|
||||
|
||||
## 1. 这套系统在干什么?
|
||||
|
||||
| 模块 | 一句话 | 指引页 |
|
||||
|------|--------|--------|
|
||||
| **渠道** | 卖什么、卖多少、货走哪条下游 | [/channel/guide](/channel/guide) |
|
||||
| **订单** | 查价 → 下单 → 入库 → 付款 → 出库 | [/order/guide](/order/guide) |
|
||||
| **轨迹** | 服务商轨迹翻译成标准节点,再推给客户 | [/track/guide](/track/guide) |
|
||||
| **API** | 公司标准接口 ↔ 服务商方言 | [/api/apiDebugger](/api/apiDebugger) |
|
||||
|
||||
**主线:**
|
||||
|
||||
```
|
||||
渠道定规则并发布 → 客户下单预报计费 → 入库实测改价并排货
|
||||
→ 付款出库 → 轨迹上网 →(可选)推客户系统 / 调外部接口
|
||||
```
|
||||
|
||||
订单状态:
|
||||
|
||||
```
|
||||
草稿 → 已预报 →(入库)→ 待支付 或 待排货
|
||||
↓(付款)
|
||||
待发货 →(出库)→ 待上网 → …轨迹
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. 四个端
|
||||
|
||||
| 端 | 登录入口 | 谁用 |
|
||||
|----|----------|------|
|
||||
| **网页端** | `/login` | 发货客户 PC |
|
||||
| **H5** | `/h5` | 同一客户手机 |
|
||||
| **运营端** | `/admin` | 内部员工 |
|
||||
| **客户端** | 与网页端同一客户体系 | 「当客户」优先网页端,再用 H5 对照 |
|
||||
|
||||
**心态:** 先当客户发一票,再当运营配通、查通。
|
||||
|
||||
---
|
||||
|
||||
## 3. 四周主题
|
||||
|
||||
| 周次 | 主题 |
|
||||
|------|------|
|
||||
| **第 1 周** | 当客户跑通;分清四端 |
|
||||
| **第 2 周** | 渠道为什么有价;不发布=没改 |
|
||||
| **第 3 周** | 订单运营排障;待排货与费用 |
|
||||
| **第 4 周** | 轨迹 + API |
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[第1周 当客户] --> B[第2周 渠道配置]
|
||||
B --> C[第3周 订单排障]
|
||||
C --> D[第4周 轨迹与API]
|
||||
```
|
||||
|
||||
**刻意先不啃:** 开发 Tab、表结构、脚本细节。
|
||||
|
||||
---
|
||||
|
||||
## 4. 每日最小闭环(工作日)
|
||||
|
||||
1. 网页端或 H5 下/查一票
|
||||
2. 运营端看同一运单状态与费用
|
||||
3. 出库后看轨迹时间轴
|
||||
4. 三问:发布了吗?预报还是入库?映射还是推送?
|
||||
|
||||
周末可自愿复习,**不计入是否完成**。
|
||||
|
||||
---
|
||||
|
||||
## 5. 配套入口
|
||||
|
||||
| 主题 | 路径 |
|
||||
|------|------|
|
||||
| 练习包 | 本页「练习包」Tab |
|
||||
| 对客话术 | 本页「话术」Tab |
|
||||
| 勾选进度 | 本页「进度」Tab |
|
||||
| 渠道 / 订单 / 轨迹 / API 指引 | `/channel/guide` 等 |
|
||||
| 工作台 | 运营端工作台「培训手册」快捷入口 |
|
||||
54
src/views/kb/training/handbook-practice.md
Normal file
54
src/views/kb/training/handbook-practice.md
Normal file
@ -0,0 +1,54 @@
|
||||
# 测服练习包
|
||||
|
||||
> 账号请 **自己在测服注册**;销售产品用环境里 **已有已启用产品** 即可,不必新建专线。
|
||||
> 勾选进度见本页下方或「进度」Tab(保存在本机浏览器)。
|
||||
|
||||
---
|
||||
|
||||
## 1. 开练前准备
|
||||
|
||||
| 准备项 | 怎么做 |
|
||||
|--------|--------|
|
||||
| **客户账号** | 测服网页端 [`/login`](/login) 自行注册;手机可再用 H5 [`/h5`](/h5) 同账号登录 |
|
||||
| **运营账号** | 向带教/管理员要内部账号,入口 [`/admin`](/admin);至少能看订单、渠道、轨迹 |
|
||||
| **练习产品** | 在「我要查价 / 我要下单」里任选一条 **已启用** 销售产品;记下编码与目的国 |
|
||||
| **权限** | 若侧栏没有「培训手册」,让管理员对知识库点一次「同步子菜单」,并勾选角色菜单 |
|
||||
|
||||
---
|
||||
|
||||
## 2. 必练场景(建议按序)
|
||||
|
||||
| # | 场景 | 你要看到什么 | 备注 |
|
||||
|---|------|--------------|------|
|
||||
| 1 | **幸福路径** | 已预报 → 入库后待支付 → 付款 → 出库 → 待上网 | 用任意现有产品;件重尺填完整 |
|
||||
| 2 | **查价松 / 下单严** | 查价能出参考价;故意缺邮编或踩黑名单时下单失败 | 对客话术:查价仅供参考 |
|
||||
| 3 | **待排货** | 入库后进待排货;修好配置/重算应付后变待支付 | 可让带教临时关掉某渠道买价或清空排货再恢复 |
|
||||
| 4 | **预报失败草稿** | 订单停在草稿,有「预报失败原因」 | 常见:分区未匹配、卖价未匹配、未发布 |
|
||||
| 5 | **轨迹刷新** | 出库后轨迹订单有时间轴;若有未映射会看到原文 | 服务商尚未上网时只有已预报也正常 |
|
||||
|
||||
制造待排货/草稿时 **只用测服**,改完记得还原,避免影响他人。
|
||||
|
||||
---
|
||||
|
||||
## 3. 四端对照(同一票)
|
||||
|
||||
对场景 1 的运单号,分别打开:
|
||||
|
||||
| 端 | 看哪里 |
|
||||
|----|--------|
|
||||
| 网页端 | [`/order/myOrders`](/order/myOrders) |
|
||||
| H5 | [`/h5/orders`](/h5/orders) |
|
||||
| 运营端 | 运单管理 / 我的订单(按权限) |
|
||||
| 轨迹 | [`/track/order`](/track/order)(出库后) |
|
||||
|
||||
截图或记到个人笔记(模板见「进度 / 验收」)。
|
||||
|
||||
---
|
||||
|
||||
## 4. 带教最小配合
|
||||
|
||||
- 测服可注册客户;运营账号能开
|
||||
- 允许新人在测服改练习相关配置(或带教代改演示待排货)
|
||||
- **每周五** 对照「进度」Tab 勾选情况聊 30 分钟;周六日不排
|
||||
|
||||
产品不必单独建:现网测服已有线路全部可用。
|
||||
61
src/views/kb/training/handbook-scripts.md
Normal file
61
src/views/kb/training/handbook-scripts.md
Normal file
@ -0,0 +1,61 @@
|
||||
# 对客话术速查
|
||||
|
||||
> 客服日常页。先安抚,再给原因与下一步;涉及改价/禁运时对齐渠道同事。
|
||||
> 细配见 [订单指引](/order/guide)、[轨迹指引](/track/guide)、[渠道指引](/channel/guide)。
|
||||
|
||||
---
|
||||
|
||||
## 1. 开场与原则
|
||||
|
||||
| 原则 | 说法示例 |
|
||||
|------|----------|
|
||||
| 查价≠最终价 | 「查价是参考,最终以仓库入库实测重量和尺寸计费为准。」 |
|
||||
| 状态可查 | 「您报一下运单号或客户单号,我帮您看当前到哪一步。」 |
|
||||
| 不瞎承诺时效 | 「轨迹以服务商上网为准;我们这边看到节点会同步给您。」 |
|
||||
| 改配置要发布 | (对内)客户仍旧价 → 先问渠道是否点过发布,别只改草稿 |
|
||||
|
||||
---
|
||||
|
||||
## 2. 下单 / 费用
|
||||
|
||||
| 客户或系统说法 | 可对客户说 | 你后台先查 |
|
||||
|----------------|------------|------------|
|
||||
| 客户单号已存在 | 「这个客户单号已经用过了,请换一个再提交,或告诉我原单号我帮您查。」 | 同客户是否已有该单 |
|
||||
| 产品不存在/未启用 | 「当前线路暂时不可用,我帮您看下可发的替代线路。」 | 销售产品是否启用 |
|
||||
| 地址命中黑名单 | 「这个邮编/地区暂时无法收寄,请换地址或换线路;需要的话我帮您确认禁运范围。」 | 黑名单 + 产品关联 |
|
||||
| 价格分区未匹配 | 「目的地分区还对不上报价,我请渠道同事核对邮编分区,好了马上回您。」 | 价格分区明细、是否发布 |
|
||||
| 卖价未匹配 | 「这个重量/货物类型暂时报不出价,我们核对价卡后回您。」 | 卖价矩阵重量段/货物属性 |
|
||||
| 未命中价格/规则快照 | 「线路规则刚在调整,请稍等我们发布后再下;或先换一条已上线线路。」 | 是否发布 rules/price |
|
||||
| 查价有价、下单失败 | 「查价比较宽松,下单要完整邮编和地址。请按页面提示补全后再试。」 | 邮编、黑名单、尺寸 |
|
||||
| 一直草稿 | 「系统还在算预报运费,请稍等刷新;若一直如此,我看失败原因帮您改。」 | 预报失败原因 |
|
||||
| 入库后比预报贵 | 「入库按实测重和体积重重新计费,体积大或超重都会上调,这是正常规则。」 | 预报 vs 入库件重尺 |
|
||||
| 一直待排货 | 「货已收到,系统还在匹配承运渠道。我们处理好运费渠道后会变成待支付,再通知您付款。」 | 待排货原因;找渠道补买价/排货 |
|
||||
|
||||
---
|
||||
|
||||
## 3. 轨迹
|
||||
|
||||
| 客户说法 | 可对客户说 | 你后台先查 |
|
||||
|----------|------------|------------|
|
||||
| 官网有轨迹,你们没有 | 「我马上按单号刷新;若服务商文案还没对上我们的标准节点,会先补映射再更新给您。」 | 刷新;未映射原文;单号类型 |
|
||||
| 一直显示已预报 | 「仓库出库后,要等服务商上网才会有运输节点。我帮您确认是否已出库、拉取是否已开始。」 | 是否出库;拉取开始节点 |
|
||||
| 节点乱跳 / 缺段 | 「我们核对一下节点映射,避免关键词过宽;好了会按正确顺序展示。」 | 映射关键词、反向词 |
|
||||
| 我们系统没收到推送 | 「我查一下贵司推送开关和最近一次推送记录;必要时先手工补推一笔。」 | 自动推送、顺序、推送记录 |
|
||||
|
||||
---
|
||||
|
||||
## 4. 付款 / 出库
|
||||
|
||||
| 场景 | 可对客户说 |
|
||||
|------|------------|
|
||||
| 催付 | 「您的包裹已入库计费完成,请登录后完成支付,我们才能安排出库。」 |
|
||||
| 已付未出库 | 「支付已收到,仓库正在排队出库;出库后轨迹会进入待上网。」 |
|
||||
| 要拦截 | 「请提供运单号,我看当前状态能否拦截;已出库/已上网的需按服务商规则处理。」 |
|
||||
|
||||
---
|
||||
|
||||
## 5. 对内三句(自己先想清)
|
||||
|
||||
1. 规则/价格 **发布了吗**?
|
||||
2. 卡在 **预报** 还是 **入库/排货**?
|
||||
3. 轨迹是 **映射** 问题还是 **推送** 问题?
|
||||
58
src/views/kb/training/handbook-week1.md
Normal file
58
src/views/kb/training/handbook-week1.md
Normal file
@ -0,0 +1,58 @@
|
||||
# 第 1 周:建立业务地图 + 当客户跑通一票
|
||||
|
||||
**本周目标:** 能口述「一票货从问价到上网」;分清网页端 / H5 / 运营端角色。
|
||||
**计时:** 仅周一~周五 5 个工作日;周六日不算。
|
||||
|
||||
---
|
||||
|
||||
## 学习安排(工作日)
|
||||
|
||||
| 工作日 | 学什么 | 怎么练 |
|
||||
|--------|--------|--------|
|
||||
| **周一** | 读 [渠道指引](/channel/guide)、[订单指引](/order/guide) 前半;画业务脑图 | 纸上画出:销售产品 / 服务渠道 / 预报 vs 入库 / 待排货 |
|
||||
| **周二** | 继续补脑图;运营端只逛菜单,先别改配置 | 能讲清四个模块各管什么 |
|
||||
| **周三** | **网页端当客户**:查价 → 下单 → 看状态 → 付款(测服) | 故意漏邮编、错尺寸,感受「查价松、下单严」 |
|
||||
| **周四** | **H5 对照同一账号** | 同一目的国/重量查价与下单,记下 PC/H5 差异与话术 |
|
||||
| **周五** | 运营端找到这票:订单/运单、轨迹订单;本周验收 | 对照状态机;能讲清草稿 / 已预报 / 待支付 / 待排货 |
|
||||
|
||||
---
|
||||
|
||||
## 必记概念
|
||||
|
||||
### 查价 vs 下单
|
||||
|
||||
| | 查价 | 下单 |
|
||||
|--|------|------|
|
||||
| 目的 | 心里有数 | 真正建单 |
|
||||
| 尺寸 | 可不填(按实重大致估) | 长宽高实重都必须 > 0 |
|
||||
| 邮编 | 可不填(不校验黑名单) | 必须有邮编;命中黑名单直接拒单 |
|
||||
| 是否落库 | 否 | 是,有运单号 |
|
||||
|
||||
**对客话术:** 查价仅供参考;最终以入库实测计费为准。
|
||||
|
||||
### 幸福路径(先走通)
|
||||
|
||||
假设发马来西亚,销售产品「MY 特惠线」,预报 30×20×10 cm、实重 0.8kg:
|
||||
|
||||
1. 查价 → 看到参考运费
|
||||
2. 下单成功 → 很快变 **已预报**,有预报运费
|
||||
3. 入库称重变了 → 重算应收 → 排货成功 → **待支付**
|
||||
4. 客户付款 → **待发货**
|
||||
5. 出库 → **待上网**,之后看轨迹
|
||||
|
||||
### 刚下完单还是「草稿」?
|
||||
|
||||
多半预报还在队列里。等几秒刷新;若一直草稿,打开订单看 **预报失败原因**。
|
||||
|
||||
---
|
||||
|
||||
## 本周练习
|
||||
|
||||
请在本页 **下方勾选清单** 完成练习(进度保存在本机)。
|
||||
客服 / 仓管 / 实施:本周为必学;渠道运营可快速过状态机后进入第 2 周。
|
||||
|
||||
---
|
||||
|
||||
## 周五验收
|
||||
|
||||
能对客说清「查价仅供参考,最终以入库实测为准」;能画出状态流转;能指出同一票在网页端 / H5 / 运营端分别在哪看。
|
||||
94
src/views/kb/training/handbook-week2.md
Normal file
94
src/views/kb/training/handbook-week2.md
Normal file
@ -0,0 +1,94 @@
|
||||
# 第 2 周:渠道配置(为什么有价、为什么卡单)
|
||||
|
||||
**本周目标:** 理解钱与走货规则从哪来;会按推荐顺序在测服配一条测试线。
|
||||
**计时:** 仅周一~周五 5 个工作日;周六日不算。
|
||||
|
||||
详配见 [渠道指引](/channel/guide)。
|
||||
|
||||
---
|
||||
|
||||
## 心智模型
|
||||
|
||||
> **销售产品**决定客户怎么买、卖多少钱;
|
||||
> **服务渠道**决定货怎么走、成本多少;
|
||||
> **排货**把两者在入库时接上。
|
||||
> **改配置不发布 = 等于没改。**
|
||||
|
||||
订单计费读的是 **发布后的快照**,不是你刚改完还没点发布的草稿。
|
||||
|
||||
---
|
||||
|
||||
## 新开线路推荐顺序(照着做)
|
||||
|
||||
```
|
||||
主数据
|
||||
① 价格分区(国家/邮编落到哪一价区)
|
||||
② 黑名单(禁运)
|
||||
③ 偏远分区(可选)
|
||||
④ 计重规则 + 计重进位
|
||||
|
||||
成本侧
|
||||
⑤ 建服务渠道(下游通道)
|
||||
⑥ 配渠道买价并发布
|
||||
|
||||
卖价侧
|
||||
⑦ 建销售产品,绑上分区、计重、黑名单等
|
||||
⑧ 配产品卖价
|
||||
⑨ 配排货(挂上可用服务渠道)
|
||||
⑩ 写对客说明(可选)
|
||||
⑪ 发布「规则」+ 发布「价格」
|
||||
```
|
||||
|
||||
| 发布类型 | 大概包含 | 忘了会怎样 |
|
||||
|----------|----------|------------|
|
||||
| **规则(rules)** | 计重、黑名单、偏远、排货等 | 计重/禁运/排货仍按旧版 |
|
||||
| **价格(price)** | 卖价矩阵 + 价格分区明细 | 运费仍按旧卖价 |
|
||||
|
||||
---
|
||||
|
||||
## 学习安排(工作日)
|
||||
|
||||
| 工作日 | 重点 |
|
||||
|--------|------|
|
||||
| **周一** | 价格分区 / 黑名单 / 偏远:各做一组正反例(邮编多为左开右闭) |
|
||||
| **周二** | 计重规则 + 进位;用例子算出计费重 |
|
||||
| **周三** | 卖价矩阵:价区 × 重量段 × 货物属性;故意配错看「卖价未匹配」 |
|
||||
| **周四** | 服务渠道买价 + 排货;买价不发布 → 入库容易进 **待排货** |
|
||||
| **周五** | 规则 + 价格发布;对照订单报错表自测;本周验收 |
|
||||
|
||||
---
|
||||
|
||||
## 必记例子
|
||||
|
||||
### 计费重
|
||||
|
||||
产品:体积重 = 长×宽×高 ÷ 6000;实重与体积重取大。
|
||||
|
||||
- 件:30×20×10、实重 0.8 → 体积重 1.0 → 计费重 **1.0kg**
|
||||
- 入库后实重变 1.2 → 计费重可能升到更高档 → 应收比预报高,属正常,要跟客户讲清
|
||||
|
||||
### 黑名单 vs 偏远
|
||||
|
||||
| | 黑名单 | 偏远 |
|
||||
|--|--------|------|
|
||||
| 命中 | **不能下单** | 可以下单,订单标偏远 |
|
||||
| 运营 | 换地址或改黑名单区 | 留意偏远附加费 |
|
||||
|
||||
### 只配卖价、排货为空 / 买价未发布
|
||||
|
||||
→ 入库后容易进 **待排货**(货已收,但还没定走哪条下游)。
|
||||
|
||||
---
|
||||
|
||||
## 本周练习
|
||||
|
||||
请在本页 **下方勾选清单** 完成练习。
|
||||
**渠道运营** 本周为重头;客服至少要懂「待排货 / 未发布」话术;仓管/实施可略读。
|
||||
|
||||
产品:用测服 **已有销售产品** 练习发布与排障即可,不必新建专线。
|
||||
|
||||
---
|
||||
|
||||
## 周五验收
|
||||
|
||||
能默写新产品上线 checklist;改价忘发布能自己排查;能说清销售产品 vs 服务渠道。
|
||||
95
src/views/kb/training/handbook-week3.md
Normal file
95
src/views/kb/training/handbook-week3.md
Normal file
@ -0,0 +1,95 @@
|
||||
# 第 3 周:订单全链路运营 + 客服排障
|
||||
|
||||
**本周目标:** 会跟仓、会催付、会看费用争议;网页端 / H5 / 运营端同一票能对上。
|
||||
**计时:** 仅周一~周五 5 个工作日;周六日不算。
|
||||
|
||||
详配与报错表见 [订单指引](/order/guide)。
|
||||
|
||||
---
|
||||
|
||||
## 学习安排(工作日)
|
||||
|
||||
| 工作日 | 重点 |
|
||||
|--------|------|
|
||||
| **周一** | 幸福路径上半:下单 → 已预报 → 入库 → 待支付 |
|
||||
| **周二** | 幸福路径下半:付款 → 出库 → 待上网;四端对同一运单号 |
|
||||
| **周三** | **待排货专项**:看原因、补买价/排货、重算应付 |
|
||||
| **周四** | 预报 vs 入库费用;常见报错话术演练 |
|
||||
| **周五** | 批量导入 / 模板映射(若常用);跟一次入库出库;本周验收 |
|
||||
|
||||
---
|
||||
|
||||
## 入库与待排货
|
||||
|
||||
入库时系统会:
|
||||
|
||||
1. 写入库实测件重尺
|
||||
2. **重算客户应收**
|
||||
3. **尝试自动排货**(从销售产品排货列表选服务渠道并算成本)
|
||||
|
||||
| 结果 | 订单状态 | 含义 |
|
||||
|------|----------|------|
|
||||
| 排货成功 | **待支付** | 可以催客户付款 |
|
||||
| 排货失败 | **待排货** | 货已收、钱也能算给客户看,但还没定下游渠道 |
|
||||
|
||||
**待排货不是丢单。** 常见原因:排货列表空、渠道未启用、买价未发布、客户不在白名单、重量/分区匹配不到买价。
|
||||
|
||||
处理完后在订单侧做 **重算应付**(以现场按钮名为准),成功应变为 **待支付**。
|
||||
|
||||
---
|
||||
|
||||
## 下单成功后系统在忙什么?(运营视角)
|
||||
|
||||
| 阶段 | 你会看到 | 失败时 |
|
||||
|------|----------|--------|
|
||||
| 提交当时 | 有运单号,可能短暂「草稿/处理中」 | — |
|
||||
| 预报计费 | 变成 **已预报**,有预报应收 | 停在草稿,看预报失败原因 |
|
||||
| 面单 / 营销等 | 异步,一般不挡下单 | 可稍后重打面单 |
|
||||
| 入库后 | 实测改价 + 排货 | 待排货或待支付 |
|
||||
|
||||
拦截类自动触发发生在「点下单、还没建成单」之前:命中则直接报错,**不会留下订单**。
|
||||
|
||||
---
|
||||
|
||||
## 常见报错 ↔ 怎么回
|
||||
|
||||
| 客户或系统提示 | 可能原因 | 运营动作 |
|
||||
|----------------|----------|----------|
|
||||
| 客户单号已存在 | 同客户重复客户单号 | 换单号,或查是否已下过 |
|
||||
| 销售产品不存在或未启用 | 产品停用 / 编码错 | 查销售产品状态 |
|
||||
| 未命中价格/规则快照 | 改过配置 **没发布** | 渠道 → 销售产品 → 发布 |
|
||||
| 收件地址命中黑名单 | 地址在禁运区 | 换地址,或调整黑名单 |
|
||||
| 价格分区未匹配 | 邮编/国家不在分区 | 补分区或核对地址 |
|
||||
| 卖价未匹配 | 重量段/货物属性/价区对不上 | 查卖价矩阵 |
|
||||
| 查价有价、下单失败 | 查价未校验邮编/黑名单 | 用完整地址再试下单 |
|
||||
| 一直待排货 | 见上一节 | 先看订单上的待排货原因 |
|
||||
|
||||
---
|
||||
|
||||
## 推荐日常工作流(运营)
|
||||
|
||||
```
|
||||
① 新产品:先在渠道配齐并发布
|
||||
② 「我要查价」自测几个国家+重量
|
||||
③ 「我要下单」测单 → 确认已预报
|
||||
④ 仓库入库 → 确认待支付(待排货则先排障)
|
||||
⑤ 付款 → 出库 → 轨迹中心看是否上网
|
||||
⑥ 客诉对照上表;费用争议核对预报 vs 入库实测
|
||||
```
|
||||
|
||||
常用菜单:查价 `/order/priceCheck`、下单 `/order/placeOrder`、我的订单 `/order/myOrders`;仓侧在 **操作** 菜单(入库/出库扫描)。
|
||||
|
||||
---
|
||||
|
||||
## 本周练习
|
||||
|
||||
请在本页 **下方勾选清单** 完成练习。
|
||||
客服 / 仓管 / 渠道运营均为重点周;实施可跟一票幸福路径即可。
|
||||
|
||||
话术见「话术」Tab;待排货场景见「练习包」。
|
||||
|
||||
---
|
||||
|
||||
## 周五验收
|
||||
|
||||
给一张异常单,能定位是渠道配置、地址问题,还是还在预报队列;能处理待排货到待支付。
|
||||
91
src/views/kb/training/handbook-week4.md
Normal file
91
src/views/kb/training/handbook-week4.md
Normal file
@ -0,0 +1,91 @@
|
||||
# 第 4 周:轨迹对客 + API 对接意识
|
||||
|
||||
**本周目标:** 客服查轨迹不慌;知道外部系统怎么连进来(业务层,不写代码)。
|
||||
**计时:** 仅周一~周五 5 个工作日;周六日不算。
|
||||
|
||||
详见 [轨迹指引](/track/guide)、[API 指引](/api/apiDebugger)。
|
||||
|
||||
---
|
||||
|
||||
## 学习安排(工作日)
|
||||
|
||||
| 工作日 | 重点 |
|
||||
|--------|------|
|
||||
| **周一** | 轨迹:状态/内容主数据 → 拉取映射 → 单票刷新;「官网有、我们没有」优先查未映射 |
|
||||
| **周二** | 推送:自动推送、顺序异常、手工救急;预警概念扫一眼 |
|
||||
| **周三** | API:上游 / 下游 / 映射 / 应用 / 发布;跟一次调试;看请求日志 |
|
||||
| **周四** | 串讲:渠道发布 → 客户下单 → 出库 → 轨迹拉取 →(可选)推客户 / 调外部 |
|
||||
| **周五** | **综合演练**:一票货四端截图对照;整理 FAQ;准备总验收 |
|
||||
|
||||
---
|
||||
|
||||
## 轨迹心智模型
|
||||
|
||||
> **拉取** = 把服务商的话翻译成公司标准节点;
|
||||
> **推送** = 按约定顺序告诉客户。
|
||||
> 看到原始轨迹却没有标准节点,优先查 **内容映射**,不是「系统没拉到」。
|
||||
|
||||
```
|
||||
服务商原始轨迹
|
||||
→ 轨迹中心按规则翻译成「标准节点」
|
||||
→ 写到轨迹订单
|
||||
→(可选)推送给客户系统 / OMS
|
||||
```
|
||||
|
||||
### 新服务商接入顺序(运营向)
|
||||
|
||||
```
|
||||
① 轨迹状态(已揽收 / 运输中 / 签收 …)
|
||||
② 轨迹内容(标准话术关联状态)
|
||||
③ 轨迹标记(可选)
|
||||
④ 确认拉取接口已通
|
||||
⑤ 轨迹拉取:主配置 → 内容映射 → 频率
|
||||
⑥ 轨迹推送(若客户要回调)
|
||||
⑦ 测试单「刷新轨迹」,看时间轴与推送记录
|
||||
```
|
||||
|
||||
### 客服常见问答
|
||||
|
||||
| 客户说法 | 可能原因 | 怎么处理 |
|
||||
|----------|----------|----------|
|
||||
| 官网有轨迹,你们没有 | 未映射 / 间隔未到 / 单号类型不对 | 刷新;看未映射原文;补映射 |
|
||||
| 一直显示已预报 | 未上网,或拉取未开始 | 看出库、拉取开始节点 |
|
||||
| 我们系统没收回调 | 自动推送关了、顺序卡了、异常单 | 查推送记录;必要时手工推 |
|
||||
|
||||
---
|
||||
|
||||
## API(Like API)心智模型
|
||||
|
||||
> **上游**是公司普通话,**下游**是服务商方言;**映射**是翻译器,**发布**才上岗。
|
||||
> 排错先看 **请求日志里真正发出的那一包**。
|
||||
|
||||
| 名词 | 白话 |
|
||||
|------|------|
|
||||
| 上游接口 | 给业务用的标准口(如 `TRACK_QUERY`) |
|
||||
| 下游接口 | 服务商真实 HTTP |
|
||||
| 映射 | 字段对照 + 签名脚本 |
|
||||
| 应用 | 谁有权调用(AppKey) |
|
||||
| 发布 | 配置生效开关 |
|
||||
|
||||
推荐上手:下游(贴 cURL)→ 上游 → 映射 → 应用授权 → 调试 / 请求日志。
|
||||
|
||||
**注意:** `/api/apiDebugger` 自由调试 **不会** 自动写回下游配置;正式联调优先在已配置的上下游里调试。
|
||||
|
||||
---
|
||||
|
||||
## 本周练习
|
||||
|
||||
请在本页 **下方勾选清单** 完成练习。
|
||||
**实施** 全周必学;**客服** 重点周一~周二轨迹;渠道/仓管可浏览。
|
||||
|
||||
---
|
||||
|
||||
## 周五验收
|
||||
|
||||
能讲清三件事:
|
||||
|
||||
1. 订单卡在哪一段(预报 / 待排货 / 待支付 / 待上网)
|
||||
2. 轨迹卡在映射还是推送
|
||||
3. 接口卡在未发布、鉴权,还是签名/报文字段
|
||||
|
||||
完成后到「进度」Tab 勾总验收项(安排在工作日)。
|
||||
129
src/views/kb/training/index.vue
Normal file
129
src/views/kb/training/index.vue
Normal file
@ -0,0 +1,129 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import MarkdownViewer from '@/components/MarkdownViewer/index.vue';
|
||||
import TrainingRolePicker from './TrainingRolePicker.vue';
|
||||
import TrainingChecklist from './TrainingChecklist.vue';
|
||||
import overviewContent from './handbook-overview.md?raw';
|
||||
import week1Content from './handbook-week1.md?raw';
|
||||
import week2Content from './handbook-week2.md?raw';
|
||||
import week3Content from './handbook-week3.md?raw';
|
||||
import week4Content from './handbook-week4.md?raw';
|
||||
import practiceContent from './handbook-practice.md?raw';
|
||||
import scriptsContent from './handbook-scripts.md?raw';
|
||||
import checklistContent from './handbook-checklist.md?raw';
|
||||
import type { TrainingWeekKey } from './checklist-items';
|
||||
|
||||
defineOptions({
|
||||
name: 'KbTraining',
|
||||
});
|
||||
|
||||
const activeTab = ref('overview');
|
||||
|
||||
type TabDef = {
|
||||
key: string;
|
||||
title: string;
|
||||
content: string;
|
||||
checklistWeek?: TrainingWeekKey | 'all';
|
||||
showReset?: boolean;
|
||||
};
|
||||
|
||||
const tabs: TabDef[] = [
|
||||
{ key: 'overview', title: '总览', content: overviewContent },
|
||||
{ key: 'week1', title: '第1周', content: week1Content, checklistWeek: 'week1' },
|
||||
{ key: 'week2', title: '第2周', content: week2Content, checklistWeek: 'week2' },
|
||||
{ key: 'week3', title: '第3周', content: week3Content, checklistWeek: 'week3' },
|
||||
{ key: 'week4', title: '第4周', content: week4Content, checklistWeek: 'week4' },
|
||||
{ key: 'practice', title: '练习包', content: practiceContent, checklistWeek: 'practice' },
|
||||
{ key: 'scripts', title: '话术', content: scriptsContent },
|
||||
{
|
||||
key: 'progress',
|
||||
title: '进度',
|
||||
content: checklistContent,
|
||||
checklistWeek: 'all',
|
||||
showReset: true,
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="kb-training-page">
|
||||
<div class="kb-training-card">
|
||||
<a-tabs v-model:active-key="activeTab" type="rounded" class="kb-training-tabs">
|
||||
<a-tab-pane v-for="tab in tabs" :key="tab.key" :title="tab.title">
|
||||
<div class="kb-training-pane">
|
||||
<TrainingRolePicker />
|
||||
<MarkdownViewer :content="tab.content" />
|
||||
<TrainingChecklist
|
||||
v-if="tab.checklistWeek"
|
||||
:week="tab.checklistWeek"
|
||||
:show-reset="tab.showReset"
|
||||
:title="
|
||||
tab.checklistWeek === 'all'
|
||||
? '全部练习与验收(按岗位过滤,含总验收)'
|
||||
: '本页练习勾选'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.kb-training-page {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
background: var(--app-page-bg);
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.kb-training-card {
|
||||
height: 100%;
|
||||
background: var(--app-card-bg);
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.kb-training-tabs {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.arco-tabs-nav) {
|
||||
padding: 8px 16px 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
:deep(.arco-tabs-content) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
:deep(.arco-tabs-content-list),
|
||||
:deep(.arco-tabs-pane) {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:deep(.arco-tabs-pane) {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.kb-training-pane {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 8px 24px 24px;
|
||||
box-sizing: border-box;
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
109
src/views/kb/training/useTrainingProgress.ts
Normal file
109
src/views/kb/training/useTrainingProgress.ts
Normal file
@ -0,0 +1,109 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import {
|
||||
CHECKLIST_ITEMS,
|
||||
TRAINING_ROLES,
|
||||
itemsForRole,
|
||||
type TrainingRoleKey,
|
||||
} from './checklist-items'
|
||||
|
||||
const STORAGE_CHECKED = 'oms.kb.training.checked.v1'
|
||||
const STORAGE_ROLE = 'oms.kb.training.role.v1'
|
||||
|
||||
function readChecked(): Record<string, boolean> {
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_CHECKED)
|
||||
if (!raw) return {}
|
||||
const parsed = JSON.parse(raw) as Record<string, boolean>
|
||||
return parsed && typeof parsed === 'object' ? parsed : {}
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
function readRole(): TrainingRoleKey {
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_ROLE) as TrainingRoleKey | null
|
||||
if (raw && TRAINING_ROLES.some((r) => r.key === raw)) return raw
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
return 'all'
|
||||
}
|
||||
|
||||
const checkedMap = ref<Record<string, boolean>>(readChecked())
|
||||
const role = ref<TrainingRoleKey>(readRole())
|
||||
|
||||
watch(
|
||||
checkedMap,
|
||||
(val) => {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_CHECKED, JSON.stringify(val))
|
||||
} catch {
|
||||
// ignore quota
|
||||
}
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
|
||||
watch(role, (val) => {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_ROLE, val)
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
})
|
||||
|
||||
export function useTrainingProgress() {
|
||||
const roleMeta = computed(() => TRAINING_ROLES.find((r) => r.key === role.value)!)
|
||||
|
||||
const relevantItems = computed(() => itemsForRole(role.value))
|
||||
|
||||
const doneCount = computed(
|
||||
() => relevantItems.value.filter((i) => checkedMap.value[i.id]).length,
|
||||
)
|
||||
|
||||
const totalCount = computed(() => relevantItems.value.length)
|
||||
|
||||
const percent = computed(() =>
|
||||
totalCount.value ? Math.round((doneCount.value / totalCount.value) * 100) : 0,
|
||||
)
|
||||
|
||||
function isChecked(id: string) {
|
||||
return Boolean(checkedMap.value[id])
|
||||
}
|
||||
|
||||
function setChecked(id: string, value: boolean) {
|
||||
checkedMap.value = { ...checkedMap.value, [id]: value }
|
||||
}
|
||||
|
||||
function toggle(id: string) {
|
||||
setChecked(id, !isChecked(id))
|
||||
}
|
||||
|
||||
function resetAll() {
|
||||
checkedMap.value = {}
|
||||
}
|
||||
|
||||
function weekProgress(week: string) {
|
||||
const items = relevantItems.value.filter((i) => i.week === week)
|
||||
const done = items.filter((i) => checkedMap.value[i.id]).length
|
||||
return { done, total: items.length }
|
||||
}
|
||||
|
||||
return {
|
||||
role,
|
||||
roleMeta,
|
||||
roles: TRAINING_ROLES,
|
||||
checkedMap,
|
||||
relevantItems,
|
||||
allItems: CHECKLIST_ITEMS,
|
||||
doneCount,
|
||||
totalCount,
|
||||
percent,
|
||||
isChecked,
|
||||
setChecked,
|
||||
toggle,
|
||||
resetAll,
|
||||
weekProgress,
|
||||
}
|
||||
}
|
||||
684
src/views/operation/bagManage/index.vue
Normal file
684
src/views/operation/bagManage/index.vue
Normal file
@ -0,0 +1,684 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue'
|
||||
import { Message, Modal } from '@arco-design/web-vue'
|
||||
import HandsontablePro from '@/components/HandsontablePro/index.vue'
|
||||
import PaginationPro from '@/components/PaginationPro/index.vue'
|
||||
import SlidingTabs from '@/components/SlidingTabs/index.vue'
|
||||
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
|
||||
import { buildStatusTagHtml, type StatusTagTone } from '@/utils/statusTag'
|
||||
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
|
||||
import { getLabelTemplateList, type LabelTemplateListItem } from '@/api/channel/labelTemplate'
|
||||
import {
|
||||
addParcelToBag,
|
||||
getShipBag,
|
||||
pageShipBags,
|
||||
printShipBagLabels,
|
||||
removeParcelFromBag,
|
||||
sealShipBag,
|
||||
updateShipBagMeta,
|
||||
voidShipBag,
|
||||
type ShipBag,
|
||||
} from '@/api/operation/shipContainer'
|
||||
|
||||
defineOptions({ name: 'BagManage' })
|
||||
|
||||
const OrderPrintModal = defineAsyncComponent(
|
||||
() => import('@/components/PrintTemplate/OrderPrintModal.vue'),
|
||||
)
|
||||
|
||||
const STATUS_ALL = 'all'
|
||||
const LABEL_TYPE = 'shipBag'
|
||||
const { tableContainerRef, tableHeight } = useTableContainerHeight()
|
||||
|
||||
const listLoading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const adding = ref(false)
|
||||
const tableRows = ref<ShipBag[]>([])
|
||||
const selectedRows = ref<ShipBag[]>([])
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(50)
|
||||
const totalCount = ref(0)
|
||||
const keyword = ref('')
|
||||
const statusTab = ref(STATUS_ALL)
|
||||
const detail = ref<ShipBag | null>(null)
|
||||
const detailVisible = ref(false)
|
||||
const addWaybillNo = ref('')
|
||||
|
||||
const templateModalVisible = ref(false)
|
||||
const templateLoading = ref(false)
|
||||
const templateOptions = ref<LabelTemplateListItem[]>([])
|
||||
const selectedTemplateId = ref<number | undefined>()
|
||||
const pendingPrintBagNos = ref<string[]>([])
|
||||
const printVisible = ref(false)
|
||||
const printPreparing = ref(false)
|
||||
const printItems = ref<Array<{ id: number | string; label: string; url: string }>>([])
|
||||
const batchPrintLoading = ref(false)
|
||||
|
||||
const statusTabs = [
|
||||
{ key: STATUS_ALL, label: '全部' },
|
||||
{ key: 'open', label: '装袋中' },
|
||||
{ key: 'sealed', label: '已封袋' },
|
||||
{ key: 'shipped', label: '已出库' },
|
||||
{ key: 'voided', label: '已作废' },
|
||||
]
|
||||
|
||||
const detailEditable = computed(() => detail.value?.status === 'open')
|
||||
const metaEditable = computed(
|
||||
() => !!detail.value && detail.value.status !== 'shipped' && detail.value.status !== 'voided',
|
||||
)
|
||||
const savingMeta = ref(false)
|
||||
const metaForm = reactive({
|
||||
destinationCountry: '',
|
||||
destinationPort: '',
|
||||
channelCode: '',
|
||||
length: undefined as number | undefined,
|
||||
width: undefined as number | undefined,
|
||||
height: undefined as number | undefined,
|
||||
weight: undefined as number | undefined,
|
||||
remark: '',
|
||||
})
|
||||
|
||||
function syncMetaForm(bag: ShipBag) {
|
||||
metaForm.destinationCountry = bag.destinationCountry || ''
|
||||
metaForm.destinationPort = bag.destinationPort || ''
|
||||
metaForm.channelCode = bag.channelCode || ''
|
||||
metaForm.length = bag.length
|
||||
metaForm.width = bag.width
|
||||
metaForm.height = bag.height
|
||||
metaForm.weight = bag.weight
|
||||
metaForm.remark = bag.remark || ''
|
||||
}
|
||||
|
||||
const statusTone: Record<string, StatusTagTone> = {
|
||||
open: 'brand',
|
||||
sealed: 'wait',
|
||||
shipped: 'ok',
|
||||
voided: 'alert',
|
||||
}
|
||||
|
||||
function bagTypeLabel(type?: string) {
|
||||
return type === 'box' ? '箱子' : '麻袋'
|
||||
}
|
||||
|
||||
function renderStatusCell(row: ShipBag, value: string) {
|
||||
const code = String(value || row?.status || '')
|
||||
return buildStatusTagHtml(row?.statusName || code || '—', statusTone[code] || 'neutral')
|
||||
}
|
||||
|
||||
function renderBagTypeCell(_row: ShipBag, value: string) {
|
||||
const isBox = value === 'box'
|
||||
const mark = isBox ? '箱' : '袋'
|
||||
const title = bagTypeLabel(value)
|
||||
return `<span title="${title}" style="display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:4px;font-size:11px;font-weight:700;color:${isBox ? '#4e5969' : 'var(--app-primary-color)'};background:${isBox ? 'var(--color-fill-2)' : 'color-mix(in srgb, var(--app-primary-color) 12%, #fff)'}">${mark}</span>`
|
||||
}
|
||||
|
||||
const hotColumns = computed(() => [
|
||||
{ key: 'bagNo', label: '大包号', width: 180 },
|
||||
{ key: 'bagType', label: '类型', width: 80, renderer: renderBagTypeCell },
|
||||
{ key: 'status', label: '状态', width: 100, renderer: renderStatusCell },
|
||||
{ key: 'parcelCount', label: '件数', width: 80 },
|
||||
{ key: 'weight', label: '重量kg', width: 90 },
|
||||
{ key: 'length', label: '长cm', width: 80 },
|
||||
{ key: 'width', label: '宽cm', width: 80 },
|
||||
{ key: 'height', label: '高cm', width: 80 },
|
||||
{ key: 'destinationCountry', label: '目的国', width: 90 },
|
||||
{ key: 'destinationPort', label: '目的口岸', width: 120 },
|
||||
{ key: 'channelCode', label: '渠道', width: 120 },
|
||||
{ key: 'sealTime', label: '封袋时间', width: 170 },
|
||||
{ key: 'shipTime', label: '出库时间', width: 170 },
|
||||
{ key: 'createTime', label: '创建时间', width: 170 },
|
||||
])
|
||||
|
||||
function actionRenderer(row: ShipBag) {
|
||||
const parts: string[] = [
|
||||
renderWarehouseActionBtn('view', '详情'),
|
||||
renderWarehouseActionBtn('printLabel', '打印', 'print'),
|
||||
]
|
||||
if (row.status === 'open') {
|
||||
parts.push(renderWarehouseActionBtn('approve', '封袋', 'approve'))
|
||||
parts.push(renderWarehouseActionBtn('delete', '作废'))
|
||||
}
|
||||
return wrapWarehouseActions(parts)
|
||||
}
|
||||
|
||||
function handleActionClick(row: ShipBag, _i: number, action?: string) {
|
||||
if (action === 'view') openDetail(row)
|
||||
if (action === 'printLabel') openPrintTemplateModal([row.bagNo])
|
||||
if (action === 'approve') onSeal(row)
|
||||
if (action === 'delete') onVoid(row)
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: ShipBag[]) {
|
||||
selectedRows.value = rows || []
|
||||
}
|
||||
|
||||
async function loadTemplateOptions() {
|
||||
templateLoading.value = true
|
||||
try {
|
||||
templateOptions.value = await getLabelTemplateList({ templateType: LABEL_TYPE })
|
||||
if (
|
||||
selectedTemplateId.value == null ||
|
||||
!templateOptions.value.some((x) => x.id === selectedTemplateId.value)
|
||||
) {
|
||||
selectedTemplateId.value = templateOptions.value[0]?.id
|
||||
}
|
||||
} catch (e: any) {
|
||||
templateOptions.value = []
|
||||
Message.error(e?.message || '加载标签模板失败')
|
||||
} finally {
|
||||
templateLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function openPrintTemplateModal(bagNos: string[]) {
|
||||
const nos = bagNos.map((x) => String(x || '').trim()).filter(Boolean)
|
||||
if (!nos.length) {
|
||||
Message.warning('请先选择要打印的大包')
|
||||
return
|
||||
}
|
||||
pendingPrintBagNos.value = nos
|
||||
templateModalVisible.value = true
|
||||
await loadTemplateOptions()
|
||||
}
|
||||
|
||||
function handleBatchPrint() {
|
||||
const nos = selectedRows.value.map((x) => x.bagNo).filter(Boolean)
|
||||
void openPrintTemplateModal(nos)
|
||||
}
|
||||
|
||||
async function confirmPrintWithTemplate() {
|
||||
const nos = pendingPrintBagNos.value
|
||||
if (!nos.length) {
|
||||
Message.warning('请先选择要打印的大包')
|
||||
return false
|
||||
}
|
||||
if (!selectedTemplateId.value) {
|
||||
Message.warning('请选择打印模板(类型:大包标签)')
|
||||
return false
|
||||
}
|
||||
|
||||
batchPrintLoading.value = true
|
||||
try {
|
||||
const res = await printShipBagLabels({
|
||||
bagNos: nos,
|
||||
labelTemplateId: selectedTemplateId.value,
|
||||
})
|
||||
const urlMap = new Map(
|
||||
(res.items || [])
|
||||
.filter((x) => x.bagNo && x.printUrl)
|
||||
.map((x) => [String(x.bagNo), String(x.printUrl)]),
|
||||
)
|
||||
const items = nos.map((no) => ({
|
||||
id: no,
|
||||
label: no,
|
||||
url: urlMap.get(no) || '',
|
||||
}))
|
||||
const okCount = items.filter((x) => !!x.url).length
|
||||
if (!okCount) {
|
||||
Message.info('未获取到可打印文件')
|
||||
return false
|
||||
}
|
||||
if (okCount < nos.length) {
|
||||
Message.warning(`已获取 ${okCount}/${nos.length} 张面单`)
|
||||
}
|
||||
printItems.value = items
|
||||
printPreparing.value = false
|
||||
printVisible.value = true
|
||||
return true
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '批量打印失败')
|
||||
return false
|
||||
} finally {
|
||||
batchPrintLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
listLoading.value = true
|
||||
try {
|
||||
const res = await pageShipBags({
|
||||
pageIndex: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
keyword: keyword.value.trim() || undefined,
|
||||
status: statusTab.value === STATUS_ALL ? undefined : statusTab.value,
|
||||
})
|
||||
tableRows.value = res.items || []
|
||||
totalCount.value = Number(res.total || 0)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '加载失败')
|
||||
} finally {
|
||||
listLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
currentPage.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleStatusChange(key: string) {
|
||||
statusTab.value = key
|
||||
currentPage.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
async function refreshDetail(bagNo?: string) {
|
||||
const no = bagNo || detail.value?.bagNo
|
||||
if (!no) return
|
||||
detailLoading.value = true
|
||||
try {
|
||||
detail.value = await getShipBag(no)
|
||||
syncMetaForm(detail.value)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '加载详情失败')
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function openDetail(row: ShipBag) {
|
||||
addWaybillNo.value = ''
|
||||
detailVisible.value = true
|
||||
await refreshDetail(row.bagNo)
|
||||
}
|
||||
|
||||
async function saveMeta() {
|
||||
if (!detail.value?.bagNo || !metaEditable.value) return
|
||||
savingMeta.value = true
|
||||
try {
|
||||
detail.value = await updateShipBagMeta({
|
||||
bagNo: detail.value.bagNo,
|
||||
destinationCountry: metaForm.destinationCountry || undefined,
|
||||
destinationPort: metaForm.destinationPort || undefined,
|
||||
channelCode: metaForm.channelCode || undefined,
|
||||
length: metaForm.length ?? null,
|
||||
width: metaForm.width ?? null,
|
||||
height: metaForm.height ?? null,
|
||||
weight: metaForm.weight ?? null,
|
||||
remark: metaForm.remark || undefined,
|
||||
})
|
||||
syncMetaForm(detail.value)
|
||||
Message.success('属性已保存')
|
||||
await loadList()
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '保存失败')
|
||||
} finally {
|
||||
savingMeta.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onAddParcel() {
|
||||
if (!detail.value?.bagNo || !detailEditable.value) return
|
||||
const no = addWaybillNo.value.trim()
|
||||
if (!no) {
|
||||
Message.warning('请输入运单号')
|
||||
return
|
||||
}
|
||||
adding.value = true
|
||||
try {
|
||||
detail.value = await addParcelToBag(detail.value.bagNo, no)
|
||||
addWaybillNo.value = ''
|
||||
Message.success(`已入袋 ${no}`)
|
||||
await loadList()
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '入袋失败')
|
||||
} finally {
|
||||
adding.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onRemoveParcel(waybillNo: string) {
|
||||
if (!detail.value?.bagNo || !detailEditable.value) return
|
||||
Modal.confirm({
|
||||
title: '移出小包',
|
||||
content: `确定从 ${detail.value.bagNo} 移出 ${waybillNo}?`,
|
||||
okText: '移出',
|
||||
onOk: async () => {
|
||||
detail.value = await removeParcelFromBag(detail.value!.bagNo, waybillNo)
|
||||
Message.success('已移出')
|
||||
await loadList()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function onSeal(row: ShipBag) {
|
||||
try {
|
||||
await sealShipBag(row.bagNo)
|
||||
Message.success('封袋成功')
|
||||
await loadList()
|
||||
if (detail.value?.bagNo === row.bagNo) await refreshDetail(row.bagNo)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '封袋失败')
|
||||
}
|
||||
}
|
||||
|
||||
function onSealDetail() {
|
||||
if (!detail.value) return
|
||||
Modal.confirm({
|
||||
title: '确认封袋',
|
||||
content: `大包 ${detail.value.bagNo} 当前 ${detail.value.parcelCount} 件,封袋后不可再增删。是否继续?`,
|
||||
okText: '封袋',
|
||||
onOk: async () => {
|
||||
await onSeal(detail.value!)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function onVoid(row: ShipBag) {
|
||||
Modal.confirm({
|
||||
title: '作废大包',
|
||||
content: `确定作废 ${row.bagNo}?须为空袋。`,
|
||||
onOk: async () => {
|
||||
await voidShipBag(row.bagNo)
|
||||
Message.success('已作废')
|
||||
await loadList()
|
||||
if (detail.value?.bagNo === row.bagNo) detailVisible.value = false
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(loadList)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="bag-manage-container warehouse-list-page">
|
||||
<div class="warehouse-list-page-card">
|
||||
<div class="status-tabs">
|
||||
<SlidingTabs
|
||||
:model-value="statusTab"
|
||||
size="mini"
|
||||
:items="statusTabs"
|
||||
aria-label="大包状态"
|
||||
@change="handleStatusChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="table-toolbar">
|
||||
<div class="toolbar-left">
|
||||
<a-space wrap :size="8">
|
||||
<a-input
|
||||
v-model="keyword"
|
||||
placeholder="大包号/目的国/渠道"
|
||||
allow-clear
|
||||
style="width: 220px"
|
||||
@press-enter="handleSearch"
|
||||
/>
|
||||
<a-button class="app-btn-search" @click="handleSearch">查询</a-button>
|
||||
<a-button
|
||||
class="app-btn-toolbar"
|
||||
:loading="batchPrintLoading"
|
||||
:disabled="selectedRows.length === 0 || batchPrintLoading"
|
||||
@click="handleBatchPrint"
|
||||
>
|
||||
批量打印
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<PaginationPro
|
||||
:total-count="totalCount"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableContainerRef" class="list-wrap">
|
||||
<HandsontablePro
|
||||
:columns="hotColumns"
|
||||
:data="tableRows"
|
||||
:height="tableHeight"
|
||||
:loading="listLoading"
|
||||
:stretch-columns="true"
|
||||
show-action-column
|
||||
:action-renderer="actionRenderer"
|
||||
@action-click="handleActionClick"
|
||||
@selection-change="handleSelectionChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-modal
|
||||
v-model:visible="templateModalVisible"
|
||||
title="选择打印模板"
|
||||
:ok-loading="batchPrintLoading"
|
||||
ok-text="打印"
|
||||
unmount-on-close
|
||||
:on-before-ok="confirmPrintWithTemplate"
|
||||
>
|
||||
<a-form :model="{ selectedTemplateId }" auto-label-width>
|
||||
<a-form-item label="标签模板" required>
|
||||
<a-select
|
||||
v-model="selectedTemplateId"
|
||||
:loading="templateLoading"
|
||||
:options="templateOptions.map((x) => ({ label: x.name, value: x.id }))"
|
||||
placeholder="请选择大包标签模板"
|
||||
allow-search
|
||||
/>
|
||||
</a-form-item>
|
||||
<div class="print-tip">将打印 {{ pendingPrintBagNos.length }} 个大包 · 模板类型:大包标签</div>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<OrderPrintModal
|
||||
v-if="printVisible"
|
||||
v-model:visible="printVisible"
|
||||
:mode="printItems.length > 1 ? 'batch' : 'single'"
|
||||
:items="printItems"
|
||||
:preparing="printPreparing"
|
||||
/>
|
||||
|
||||
<a-drawer
|
||||
v-model:visible="detailVisible"
|
||||
:width="620"
|
||||
title="大包详情"
|
||||
unmount-on-close
|
||||
:footer="false"
|
||||
>
|
||||
<a-spin :loading="detailLoading" style="width: 100%">
|
||||
<template v-if="detail">
|
||||
<div class="detail-head">
|
||||
<div class="detail-no-row">
|
||||
<span
|
||||
class="detail-type-badge"
|
||||
:class="detail.bagType === 'box' ? 'is-box' : 'is-sack'"
|
||||
>
|
||||
{{ detail.bagType === 'box' ? '箱' : '袋' }}
|
||||
</span>
|
||||
<div class="detail-no">{{ detail.bagNo }}</div>
|
||||
</div>
|
||||
<div class="detail-meta">
|
||||
<a-tag size="small" color="arcoblue">{{ detail.statusName || detail.status }}</a-tag>
|
||||
<span>{{ bagTypeLabel(detail.bagType) }}</span>
|
||||
<span>件数 {{ detail.parcelCount }}</span>
|
||||
<span v-if="detail.destinationCountry">目的国 {{ detail.destinationCountry }}</span>
|
||||
<a-button size="mini" class="app-btn-toolbar" @click="openPrintTemplateModal([detail.bagNo])">
|
||||
打印面单
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-meta-form">
|
||||
<div class="detail-meta-form__title">件重尺 / 口岸</div>
|
||||
<a-form :model="metaForm" layout="vertical" size="small">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="重量(kg)">
|
||||
<a-input-number v-model="metaForm.weight" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="长(cm)">
|
||||
<a-input-number v-model="metaForm.length" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="宽(cm)">
|
||||
<a-input-number v-model="metaForm.width" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="高(cm)">
|
||||
<a-input-number v-model="metaForm.height" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="目的国">
|
||||
<a-input v-model="metaForm.destinationCountry" :disabled="!metaEditable" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="目的口岸">
|
||||
<a-input v-model="metaForm.destinationPort" :disabled="!metaEditable" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-button v-if="metaEditable" type="primary" class="app-btn-primary-soft" :loading="savingMeta" @click="saveMeta">
|
||||
保存属性
|
||||
</a-button>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
<div v-if="detailEditable" class="detail-add">
|
||||
<a-input
|
||||
v-model="addWaybillNo"
|
||||
placeholder="扫描或输入运单号入袋"
|
||||
allow-clear
|
||||
@press-enter="onAddParcel"
|
||||
/>
|
||||
<a-button type="primary" :loading="adding" @click="onAddParcel">入袋</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="app-btn-primary-soft"
|
||||
:disabled="!detail.parcelCount"
|
||||
@click="onSealDetail"
|
||||
>
|
||||
封袋
|
||||
</a-button>
|
||||
</div>
|
||||
<p v-else class="detail-hint">仅「装袋中」可增删小包;已出库/作废属性只读。</p>
|
||||
|
||||
<a-table
|
||||
:data="detail.items || []"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
size="small"
|
||||
:bordered="false"
|
||||
:stripe="true"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="运单号" data-index="waybillNo" />
|
||||
<a-table-column title="状态" data-index="orderStatusName" :width="100" />
|
||||
<a-table-column title="目的国" data-index="consigneeCountry" :width="90" />
|
||||
<a-table-column v-if="detailEditable" title="操作" :width="80" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-button type="text" size="small" status="danger" @click="onRemoveParcel(record.waybillNo)">
|
||||
移出
|
||||
</a-button>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
<div v-if="!(detail.items || []).length" class="detail-empty">暂无小包</div>
|
||||
</template>
|
||||
</a-spin>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import '@/styles/warehouse-list-page.less';
|
||||
|
||||
.detail-head {
|
||||
margin-bottom: 16px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
|
||||
border: 1px solid color-mix(in srgb, var(--app-primary-color) 18%, var(--color-border-2));
|
||||
}
|
||||
.detail-no-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.detail-type-badge {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 6px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
&.is-sack {
|
||||
color: var(--app-primary-color);
|
||||
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
|
||||
}
|
||||
&.is-box {
|
||||
color: #4e5969;
|
||||
background: var(--color-fill-2);
|
||||
}
|
||||
}
|
||||
.detail-no {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
.detail-meta {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 14px;
|
||||
font-size: 13px;
|
||||
color: var(--color-text-2);
|
||||
align-items: center;
|
||||
}
|
||||
.detail-meta-form {
|
||||
margin-bottom: 16px;
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
background: var(--color-fill-1);
|
||||
}
|
||||
.detail-meta-form__title {
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-2);
|
||||
}
|
||||
.detail-add {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.detail-hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
.detail-empty {
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
color: var(--color-text-3);
|
||||
font-size: 13px;
|
||||
}
|
||||
.print-tip {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
</style>
|
||||
704
src/views/operation/bagPack/index.vue
Normal file
704
src/views/operation/bagPack/index.vue
Normal file
@ -0,0 +1,704 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { Modal } from '@arco-design/web-vue'
|
||||
import { IconGift, IconStorage } from '@arco-design/web-vue/es/icon'
|
||||
import HandsontablePro from '@/components/HandsontablePro/index.vue'
|
||||
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
|
||||
import { useOperationScanFocus } from '@/composables/useOperationScanFocus'
|
||||
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback'
|
||||
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
|
||||
import { buildStatusTagHtml, type StatusTagTone } from '@/utils/statusTag'
|
||||
import {
|
||||
addParcelToBag,
|
||||
createShipBag,
|
||||
getShipBag,
|
||||
removeParcelFromBag,
|
||||
sealShipBag,
|
||||
type ShipBag,
|
||||
type ShipBagItem,
|
||||
} from '@/api/operation/shipContainer'
|
||||
|
||||
defineOptions({ name: 'BagPack' })
|
||||
|
||||
const SESSION_KEY = 'oms.operation.bagPack.lastBagNo'
|
||||
const { tableContainerRef, tableHeight } = useTableContainerHeight()
|
||||
|
||||
const creating = ref(false)
|
||||
const scanning = ref(false)
|
||||
const sealing = ref(false)
|
||||
const loadingBag = ref(false)
|
||||
const typeModalVisible = ref(false)
|
||||
const activeBag = ref<ShipBag | null>(null)
|
||||
const waybillNo = ref('')
|
||||
const lastWaybillNo = ref('')
|
||||
const resumeBagNo = ref('')
|
||||
const scanInputRef = ref<{ focus?: () => void; $el?: HTMLElement } | null>(null)
|
||||
|
||||
const { keepScanFocus, focusScanInput } = useOperationScanFocus('bagPack', scanInputRef)
|
||||
const {
|
||||
voiceEnabled,
|
||||
feedbackType,
|
||||
feedbackMessage,
|
||||
clearFeedback,
|
||||
showError,
|
||||
showSuccess,
|
||||
showWarning,
|
||||
} = useOperationScanFeedback('bagPack')
|
||||
|
||||
// 仓作业默认勾选「保持扫描焦点」
|
||||
if (!localStorage.getItem('oms.operation.scanFocus.bagPack')) {
|
||||
keepScanFocus.value = true
|
||||
}
|
||||
|
||||
const items = computed(() => activeBag.value?.items || [])
|
||||
const isOpen = computed(() => activeBag.value?.status === 'open')
|
||||
const isSealed = computed(() => activeBag.value?.status === 'sealed')
|
||||
const isBox = computed(() => activeBag.value?.bagType === 'box')
|
||||
const bagTypeLabel = computed(() => (isBox.value ? '箱子' : '麻袋'))
|
||||
const hasSession = computed(() => !!activeBag.value)
|
||||
|
||||
function openTypeModal() {
|
||||
typeModalVisible.value = true
|
||||
}
|
||||
|
||||
const statusTone: Record<string, StatusTagTone> = {
|
||||
open: 'brand',
|
||||
sealed: 'wait',
|
||||
shipped: 'ok',
|
||||
voided: 'alert',
|
||||
}
|
||||
|
||||
const hotColumns = computed(() => [
|
||||
{
|
||||
key: 'waybillNo',
|
||||
label: '运单号',
|
||||
width: 180,
|
||||
renderer: (row: ShipBagItem) => {
|
||||
const no = row.waybillNo || '—'
|
||||
const flash = no === lastWaybillNo.value
|
||||
return flash
|
||||
? `<span style="font-weight:700;color:var(--app-primary-color)">${no}</span>`
|
||||
: no
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'orderStatusName',
|
||||
label: '状态',
|
||||
width: 110,
|
||||
renderer: (row: ShipBagItem) =>
|
||||
buildStatusTagHtml(row.orderStatusName || row.orderStatus || '—', 'neutral'),
|
||||
},
|
||||
{ key: 'consigneeCountry', label: '目的国', width: 90 },
|
||||
])
|
||||
|
||||
function actionRenderer(row: ShipBagItem) {
|
||||
if (!isOpen.value) return ''
|
||||
return wrapWarehouseActions([renderWarehouseActionBtn('delete', '移出')])
|
||||
}
|
||||
|
||||
function handleActionClick(row: ShipBagItem, _i: number, action?: string) {
|
||||
if (action === 'delete') handleRemove(row)
|
||||
}
|
||||
|
||||
function persistSession(bagNo?: string) {
|
||||
try {
|
||||
if (bagNo) localStorage.setItem(SESSION_KEY, bagNo)
|
||||
else localStorage.removeItem(SESSION_KEY)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => activeBag.value?.bagNo,
|
||||
(no) => {
|
||||
if (no) {
|
||||
resumeBagNo.value = no
|
||||
persistSession(no)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
function selectScanInput() {
|
||||
nextTick(() => {
|
||||
const el = scanInputRef.value?.$el?.querySelector?.('input') as HTMLInputElement | undefined
|
||||
el?.select?.()
|
||||
focusScanInput()
|
||||
})
|
||||
}
|
||||
|
||||
async function handleCreate(type: 'sack' | 'box') {
|
||||
creating.value = true
|
||||
clearFeedback()
|
||||
try {
|
||||
activeBag.value = await createShipBag({ bagType: type })
|
||||
typeModalVisible.value = false
|
||||
waybillNo.value = ''
|
||||
lastWaybillNo.value = ''
|
||||
showSuccess(`已开${type === 'box' ? '箱子' : '麻袋'} ${activeBag.value.bagNo}`)
|
||||
selectScanInput()
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '开袋失败')
|
||||
} finally {
|
||||
creating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshBag(silent = false) {
|
||||
if (!activeBag.value?.bagNo) return
|
||||
try {
|
||||
activeBag.value = await getShipBag(activeBag.value.bagNo)
|
||||
if (!silent) showSuccess('已刷新', false)
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '刷新失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function handleScanEnter() {
|
||||
const no = waybillNo.value.trim()
|
||||
if (!activeBag.value?.bagNo) {
|
||||
showWarning('请先开袋或加载大包')
|
||||
return
|
||||
}
|
||||
if (!isOpen.value) {
|
||||
showWarning('当前大包已封袋,请开新袋或加载装袋中大包')
|
||||
return
|
||||
}
|
||||
if (!no) return
|
||||
if (scanning.value) return
|
||||
if (items.value.some((x) => x.waybillNo === no)) {
|
||||
showWarning(`${no} 已在袋内`)
|
||||
waybillNo.value = ''
|
||||
selectScanInput()
|
||||
return
|
||||
}
|
||||
scanning.value = true
|
||||
clearFeedback()
|
||||
try {
|
||||
activeBag.value = await addParcelToBag(activeBag.value.bagNo, no)
|
||||
lastWaybillNo.value = no
|
||||
showSuccess(`已入袋 ${no}(${activeBag.value.parcelCount} 件)`)
|
||||
waybillNo.value = ''
|
||||
selectScanInput()
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '入袋失败')
|
||||
selectScanInput()
|
||||
} finally {
|
||||
scanning.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleRemove(row: ShipBagItem) {
|
||||
if (!activeBag.value?.bagNo || !isOpen.value) return
|
||||
Modal.confirm({
|
||||
title: '移出小包',
|
||||
content: `确定从 ${activeBag.value.bagNo} 移出 ${row.waybillNo}?`,
|
||||
okText: '移出',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
activeBag.value = await removeParcelFromBag(activeBag.value!.bagNo, row.waybillNo)
|
||||
if (lastWaybillNo.value === row.waybillNo) lastWaybillNo.value = ''
|
||||
showSuccess(`已移出 ${row.waybillNo}`)
|
||||
selectScanInput()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function handleSeal() {
|
||||
if (!activeBag.value?.bagNo || !isOpen.value) return
|
||||
if (!activeBag.value.parcelCount) {
|
||||
showWarning('空袋不能封袋')
|
||||
return
|
||||
}
|
||||
const bagNo = activeBag.value.bagNo
|
||||
const count = activeBag.value.parcelCount
|
||||
Modal.confirm({
|
||||
title: '确认封袋',
|
||||
content: `大包 ${bagNo} 当前 ${count} 件,封袋后不可再扫入。是否继续?`,
|
||||
okText: '封袋',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
sealing.value = true
|
||||
try {
|
||||
activeBag.value = await sealShipBag(bagNo)
|
||||
showSuccess(`封袋成功 ${bagNo},共 ${count} 件`)
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '封袋失败')
|
||||
throw e
|
||||
} finally {
|
||||
sealing.value = false
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function loadByNo(fromSession = false) {
|
||||
const no = resumeBagNo.value.trim()
|
||||
if (!no) {
|
||||
if (!fromSession) showWarning('请输入大包号')
|
||||
return
|
||||
}
|
||||
loadingBag.value = true
|
||||
clearFeedback()
|
||||
try {
|
||||
activeBag.value = await getShipBag(no)
|
||||
waybillNo.value = ''
|
||||
lastWaybillNo.value = ''
|
||||
showSuccess(
|
||||
isOpen.value ? `继续装袋 ${activeBag.value.bagNo}` : `已加载 ${activeBag.value.bagNo}`,
|
||||
!fromSession,
|
||||
)
|
||||
await nextTick()
|
||||
if (isOpen.value) selectScanInput()
|
||||
} catch (e: any) {
|
||||
if (!fromSession) showError(e?.message || '加载失败')
|
||||
if (fromSession) persistSession()
|
||||
} finally {
|
||||
loadingBag.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleClearSession() {
|
||||
activeBag.value = null
|
||||
waybillNo.value = ''
|
||||
lastWaybillNo.value = ''
|
||||
clearFeedback()
|
||||
persistSession()
|
||||
}
|
||||
|
||||
function handleNextBag() {
|
||||
handleClearSession()
|
||||
openTypeModal()
|
||||
}
|
||||
|
||||
function copyBagNo() {
|
||||
const no = activeBag.value?.bagNo
|
||||
if (!no) return
|
||||
navigator.clipboard?.writeText(no).then(
|
||||
() => showSuccess('大包号已复制', false),
|
||||
() => showWarning('复制失败'),
|
||||
)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
try {
|
||||
const last = localStorage.getItem(SESSION_KEY)
|
||||
if (last) {
|
||||
resumeBagNo.value = last
|
||||
loadByNo(true)
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ops-page bag-pack-page">
|
||||
<div class="ops-col ops-col--main">
|
||||
<!-- 未开袋:引导开袋 / 加载 -->
|
||||
<section v-if="!hasSession" class="ops-card ops-card--scan">
|
||||
<div class="ops-card__body ops-scan">
|
||||
<div class="ops-idle-title">装袋作业</div>
|
||||
<p class="ops-scan-hint ops-idle-hint">开新袋后连续扫运单入袋;也可加载装袋中的大包继续作业。</p>
|
||||
<div class="ops-scan__row ops-scan__row--setup">
|
||||
<a-button type="primary" class="ops-setup-btn" :loading="creating" @click="openTypeModal">
|
||||
开新袋
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="ops-scan__row ops-scan__row--setup">
|
||||
<a-input
|
||||
v-model="resumeBagNo"
|
||||
class="ops-resume-input ops-resume-input--wide"
|
||||
placeholder="继续装袋:输入大包号回车"
|
||||
allow-clear
|
||||
@press-enter="() => loadByNo(false)"
|
||||
/>
|
||||
<a-button class="ops-setup-btn" :loading="loadingBag" @click="() => loadByNo(false)">
|
||||
加载
|
||||
</a-button>
|
||||
</div>
|
||||
<p
|
||||
v-if="feedbackMessage"
|
||||
class="ops-feedback ops-feedback--block"
|
||||
:class="`is-${feedbackType}`"
|
||||
>
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 已开袋:扫描为主 -->
|
||||
<template v-else>
|
||||
<section class="ops-card ops-card--scan">
|
||||
<div class="ops-card__body ops-scan">
|
||||
<div class="ops-session-bar">
|
||||
<div class="ops-session-bar__left">
|
||||
<span class="bag-type-badge" :class="isBox ? 'is-box' : 'is-sack'" :title="bagTypeLabel">
|
||||
<IconStorage v-if="isBox" />
|
||||
<IconGift v-else />
|
||||
<span>{{ bagTypeLabel }}</span>
|
||||
</span>
|
||||
<button type="button" class="ops-session-bar__no" @click="copyBagNo">
|
||||
{{ activeBag!.bagNo }}
|
||||
</button>
|
||||
<a-tag size="small" :color="isOpen ? 'arcoblue' : isSealed ? 'orangered' : 'gray'">
|
||||
{{ activeBag!.statusName || activeBag!.status }}
|
||||
</a-tag>
|
||||
<span class="ops-session-bar__meta">{{ activeBag!.parcelCount }} 件</span>
|
||||
</div>
|
||||
<div class="ops-session-bar__right">
|
||||
<a-button size="mini" @click="() => refreshBag(false)">刷新</a-button>
|
||||
<a-button size="mini" @click="handleClearSession">切换大包</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ops-scan__row">
|
||||
<a-input
|
||||
ref="scanInputRef"
|
||||
v-model="waybillNo"
|
||||
class="ops-scan-input"
|
||||
:placeholder="isOpen ? '扫描运单号入袋(回车)' : '已封袋,不可再扫入'"
|
||||
allow-clear
|
||||
:disabled="!isOpen"
|
||||
@press-enter="handleScanEnter"
|
||||
@focus="selectScanInput"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="ops-scan__row ops-scan__row--tools">
|
||||
<div class="ops-scan__opts">
|
||||
<a-checkbox v-model="keepScanFocus" class="ops-opt">保持扫描焦点</a-checkbox>
|
||||
<a-checkbox v-model="voiceEnabled" class="ops-opt">语音播报</a-checkbox>
|
||||
</div>
|
||||
<div class="ops-scan__actions">
|
||||
<a-button
|
||||
v-if="isOpen"
|
||||
type="primary"
|
||||
:loading="scanning"
|
||||
@click="handleScanEnter"
|
||||
>
|
||||
入袋
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="isOpen"
|
||||
type="primary"
|
||||
status="warning"
|
||||
:disabled="!activeBag!.parcelCount"
|
||||
:loading="sealing"
|
||||
@click="handleSeal"
|
||||
>
|
||||
封袋
|
||||
</a-button>
|
||||
<a-button v-if="isSealed" type="primary" @click="handleNextBag">开下一袋</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-if="feedbackMessage"
|
||||
class="ops-feedback ops-feedback--block"
|
||||
:class="`is-${feedbackType}`"
|
||||
>
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
<p v-else class="ops-scan-hint">同袋建议同目的国;小包也可不装袋直接出库。</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="ops-card ops-card--verify">
|
||||
<div class="ops-card__body ops-verify">
|
||||
<div class="ops-hero ops-hero--with-type">
|
||||
<div class="bag-type-icon" :class="isBox ? 'is-box' : 'is-sack'" :title="bagTypeLabel">
|
||||
<IconStorage v-if="isBox" :size="36" />
|
||||
<IconGift v-else :size="36" />
|
||||
<span>{{ bagTypeLabel }}</span>
|
||||
</div>
|
||||
<div class="ops-hero__nos">
|
||||
<div class="ops-hero__waybill">{{ activeBag!.bagNo }}</div>
|
||||
<div class="ops-hero__meta">
|
||||
<span
|
||||
v-html="
|
||||
buildStatusTagHtml(
|
||||
activeBag!.statusName || activeBag!.status,
|
||||
statusTone[activeBag!.status] || 'neutral',
|
||||
)
|
||||
"
|
||||
/>
|
||||
<span v-if="activeBag!.destinationCountry">
|
||||
目的国 {{ activeBag!.destinationCountry }}
|
||||
</span>
|
||||
<span v-if="activeBag!.channelCode">渠道 {{ activeBag!.channelCode }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ops-status-grid" style="margin-top: 16px">
|
||||
<div class="ops-status-item">
|
||||
<span>袋内件数</span>
|
||||
<strong class="ops-status-item__num">{{ activeBag!.parcelCount }}</strong>
|
||||
</div>
|
||||
<div class="ops-status-item">
|
||||
<span>最近入袋</span>
|
||||
<strong>{{ lastWaybillNo || '—' }}</strong>
|
||||
</div>
|
||||
<div class="ops-status-item">
|
||||
<span>封袋时间</span>
|
||||
<strong>{{ activeBag!.sealTime || '—' }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<aside class="ops-card ops-card--recent-wide">
|
||||
<div class="ops-card__head">
|
||||
<span>袋内明细</span>
|
||||
<span class="ops-recent__count">{{ items.length }}</span>
|
||||
</div>
|
||||
<div ref="tableContainerRef" class="ops-list-wrap bag-list-wrap">
|
||||
<HandsontablePro
|
||||
v-if="items.length"
|
||||
:columns="hotColumns"
|
||||
:data="items"
|
||||
:height="tableHeight"
|
||||
:stretch-columns="true"
|
||||
:read-only="true"
|
||||
:show-action-column="isOpen"
|
||||
:action-renderer="actionRenderer"
|
||||
@action-click="handleActionClick"
|
||||
/>
|
||||
<div v-else class="ops-recent__empty">
|
||||
{{ hasSession ? '暂无小包,扫描运单号入袋' : '开袋后这里显示袋内明细' }}
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<a-modal
|
||||
v-model:visible="typeModalVisible"
|
||||
title="选择容器类型"
|
||||
:footer="false"
|
||||
:mask-closable="!creating"
|
||||
unmount-on-close
|
||||
width="440px"
|
||||
>
|
||||
<p class="bag-type-modal__tip">请选择要开的是麻袋还是箱子</p>
|
||||
<div class="bag-type-modal__grid">
|
||||
<button
|
||||
type="button"
|
||||
class="bag-type-card is-sack"
|
||||
:disabled="creating"
|
||||
@click="handleCreate('sack')"
|
||||
>
|
||||
<IconGift :size="40" />
|
||||
<strong>麻袋</strong>
|
||||
<span>软袋 / 编织袋</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="bag-type-card is-box"
|
||||
:disabled="creating"
|
||||
@click="handleCreate('box')"
|
||||
>
|
||||
<IconStorage :size="40" />
|
||||
<strong>箱子</strong>
|
||||
<span>纸箱 / 周转箱</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="creating" class="bag-type-modal__loading">正在开袋…</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import '@/views/operation/styles/ops-scan-page.less';
|
||||
|
||||
.ops-idle-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
||||
.ops-idle-hint {
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
.ops-resume-input--wide {
|
||||
flex: 1 1 240px;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.ops-feedback--block {
|
||||
margin: 0;
|
||||
max-width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.ops-session-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
background: var(--color-fill-2);
|
||||
}
|
||||
|
||||
.ops-session-bar__left,
|
||||
.ops-session-bar__right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ops-session-bar__label {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
.ops-session-bar__no {
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: var(--app-primary-color);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.ops-session-bar__meta {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-2);
|
||||
}
|
||||
|
||||
.ops-status-item__num {
|
||||
font-size: 22px !important;
|
||||
color: var(--app-primary-color) !important;
|
||||
}
|
||||
|
||||
.bag-list-wrap {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.bag-type-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 24px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
|
||||
&.is-sack {
|
||||
color: var(--app-primary-color);
|
||||
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
|
||||
}
|
||||
|
||||
&.is-box {
|
||||
color: #86909c;
|
||||
background: var(--color-fill-2);
|
||||
}
|
||||
|
||||
:deep(.arco-icon) {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.ops-hero--with-type {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.bag-type-icon {
|
||||
flex-shrink: 0;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
|
||||
&.is-sack {
|
||||
color: var(--app-primary-color);
|
||||
background: color-mix(in srgb, var(--app-primary-color) 12%, #fff);
|
||||
border: 1px solid color-mix(in srgb, var(--app-primary-color) 22%, transparent);
|
||||
}
|
||||
|
||||
&.is-box {
|
||||
color: #4e5969;
|
||||
background: var(--color-fill-2);
|
||||
border: 1px solid var(--color-border-2);
|
||||
}
|
||||
}
|
||||
|
||||
.bag-type-modal__tip {
|
||||
margin: 0 0 16px;
|
||||
font-size: 13px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
.bag-type-modal__grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.bag-type-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 20px 12px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--color-border-2);
|
||||
background: var(--app-card-bg);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
|
||||
|
||||
strong {
|
||||
font-size: 16px;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
border-color: var(--app-primary-color);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-primary-color) 14%, transparent);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&.is-sack {
|
||||
color: var(--app-primary-color);
|
||||
}
|
||||
|
||||
&.is-box {
|
||||
color: #4e5969;
|
||||
}
|
||||
}
|
||||
|
||||
.bag-type-modal__loading {
|
||||
margin-top: 12px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
</style>
|
||||
732
src/views/operation/masterBill/index.vue
Normal file
732
src/views/operation/masterBill/index.vue
Normal file
@ -0,0 +1,732 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue'
|
||||
import { Message, Modal } from '@arco-design/web-vue'
|
||||
import HandsontablePro from '@/components/HandsontablePro/index.vue'
|
||||
import PaginationPro from '@/components/PaginationPro/index.vue'
|
||||
import SlidingTabs from '@/components/SlidingTabs/index.vue'
|
||||
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
|
||||
import { buildStatusTagHtml, type StatusTagTone } from '@/utils/statusTag'
|
||||
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
|
||||
import { getLabelTemplateList, type LabelTemplateListItem } from '@/api/channel/labelTemplate'
|
||||
import {
|
||||
addBagToMaster,
|
||||
addParcelToMaster,
|
||||
bindMasterMawb,
|
||||
getShipMaster,
|
||||
handOverMaster,
|
||||
pageShipMasters,
|
||||
printShipMasterLabels,
|
||||
removeMasterItem,
|
||||
sealShipMaster,
|
||||
updateShipMasterMeta,
|
||||
type ShipMaster,
|
||||
} from '@/api/operation/shipContainer'
|
||||
|
||||
defineOptions({ name: 'MasterBill' })
|
||||
|
||||
const OrderPrintModal = defineAsyncComponent(
|
||||
() => import('@/components/PrintTemplate/OrderPrintModal.vue'),
|
||||
)
|
||||
|
||||
const STATUS_ALL = 'all'
|
||||
const LABEL_TYPE = 'shipMaster'
|
||||
const { tableContainerRef, tableHeight } = useTableContainerHeight()
|
||||
|
||||
const listLoading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const adding = ref(false)
|
||||
const tableRows = ref<ShipMaster[]>([])
|
||||
const selectedRows = ref<ShipMaster[]>([])
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(50)
|
||||
const totalCount = ref(0)
|
||||
const keyword = ref('')
|
||||
const statusTab = ref(STATUS_ALL)
|
||||
const detail = ref<ShipMaster | null>(null)
|
||||
const detailVisible = ref(false)
|
||||
const mawbVisible = ref(false)
|
||||
const addMode = ref<'bag' | 'parcel'>('bag')
|
||||
const addNo = ref('')
|
||||
const mawbForm = reactive({ masterNo: '', externalMawb: '', flightOrVoyage: '' })
|
||||
|
||||
const templateModalVisible = ref(false)
|
||||
const templateLoading = ref(false)
|
||||
const templateOptions = ref<LabelTemplateListItem[]>([])
|
||||
const selectedTemplateId = ref<number | undefined>()
|
||||
const pendingPrintMasterNos = ref<string[]>([])
|
||||
const printVisible = ref(false)
|
||||
const printPreparing = ref(false)
|
||||
const printItems = ref<Array<{ id: number | string; label: string; url: string }>>([])
|
||||
const batchPrintLoading = ref(false)
|
||||
|
||||
const statusTabs = [
|
||||
{ key: STATUS_ALL, label: '全部' },
|
||||
{ key: 'open', label: '打板中' },
|
||||
{ key: 'sealed', label: '已封板' },
|
||||
{ key: 'handed', label: '已交运' },
|
||||
{ key: 'voided', label: '已作废' },
|
||||
]
|
||||
|
||||
const addModeTabs = [
|
||||
{ key: 'bag', label: '加大包' },
|
||||
{ key: 'parcel', label: '加小包' },
|
||||
]
|
||||
|
||||
const detailEditable = computed(() => detail.value?.status === 'open')
|
||||
const metaEditable = computed(
|
||||
() => !!detail.value && detail.value.status !== 'handed' && detail.value.status !== 'voided',
|
||||
)
|
||||
const savingMeta = ref(false)
|
||||
const metaForm = reactive({
|
||||
destinationCountry: '',
|
||||
destinationPort: '',
|
||||
flightOrVoyage: '',
|
||||
length: undefined as number | undefined,
|
||||
width: undefined as number | undefined,
|
||||
height: undefined as number | undefined,
|
||||
weight: undefined as number | undefined,
|
||||
remark: '',
|
||||
})
|
||||
const addPlaceholder = computed(() =>
|
||||
addMode.value === 'bag' ? '扫描或输入已封袋大包号' : '扫描或输入散货运单号',
|
||||
)
|
||||
|
||||
function syncMetaForm(row: ShipMaster) {
|
||||
metaForm.destinationCountry = row.destinationCountry || ''
|
||||
metaForm.destinationPort = row.destinationPort || ''
|
||||
metaForm.flightOrVoyage = row.flightOrVoyage || ''
|
||||
metaForm.length = row.length
|
||||
metaForm.width = row.width
|
||||
metaForm.height = row.height
|
||||
metaForm.weight = row.weight
|
||||
metaForm.remark = row.remark || ''
|
||||
}
|
||||
|
||||
const statusTone: Record<string, StatusTagTone> = {
|
||||
open: 'brand',
|
||||
sealed: 'wait',
|
||||
handed: 'ok',
|
||||
voided: 'alert',
|
||||
}
|
||||
|
||||
function renderStatusCell(row: ShipMaster, value: string) {
|
||||
const code = String(value || row?.status || '')
|
||||
return buildStatusTagHtml(row?.statusName || code || '—', statusTone[code] || 'neutral')
|
||||
}
|
||||
|
||||
const hotColumns = computed(() => [
|
||||
{ key: 'masterNo', label: '内部主单号', width: 180 },
|
||||
{ key: 'externalMawb', label: '外部MAWB', width: 160 },
|
||||
{ key: 'status', label: '状态', width: 100, renderer: renderStatusCell },
|
||||
{ key: 'bagCount', label: '大包数', width: 80 },
|
||||
{ key: 'parcelCount', label: '小包数', width: 80 },
|
||||
{ key: 'weight', label: '重量kg', width: 90 },
|
||||
{ key: 'length', label: '长cm', width: 80 },
|
||||
{ key: 'width', label: '宽cm', width: 80 },
|
||||
{ key: 'height', label: '高cm', width: 80 },
|
||||
{ key: 'destinationCountry', label: '目的国', width: 90 },
|
||||
{ key: 'destinationPort', label: '目的口岸', width: 120 },
|
||||
{ key: 'flightOrVoyage', label: '航班/航次', width: 120 },
|
||||
{ key: 'sealTime', label: '封板时间', width: 170 },
|
||||
{ key: 'handTime', label: '交运时间', width: 170 },
|
||||
{ key: 'createTime', label: '创建时间', width: 170 },
|
||||
])
|
||||
|
||||
function actionRenderer(row: ShipMaster) {
|
||||
const parts: string[] = [
|
||||
renderWarehouseActionBtn('view', '详情'),
|
||||
renderWarehouseActionBtn('printLabel', '打印', 'print'),
|
||||
]
|
||||
if (row.status !== 'handed' && row.status !== 'voided') {
|
||||
parts.push(renderWarehouseActionBtn('label', '绑MAWB', 'label'))
|
||||
}
|
||||
if (row.status === 'open') {
|
||||
parts.push(renderWarehouseActionBtn('approve', '封板', 'approve'))
|
||||
}
|
||||
if (row.status === 'sealed') {
|
||||
parts.push(renderWarehouseActionBtn('ship', '交运', 'ship'))
|
||||
}
|
||||
return wrapWarehouseActions(parts)
|
||||
}
|
||||
|
||||
function handleActionClick(row: ShipMaster, _i: number, action?: string) {
|
||||
if (action === 'view') openDetail(row)
|
||||
if (action === 'printLabel') openPrintTemplateModal([row.masterNo])
|
||||
if (action === 'label') openMawb(row)
|
||||
if (action === 'approve') onSeal(row)
|
||||
if (action === 'ship') onHandOver(row)
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: ShipMaster[]) {
|
||||
selectedRows.value = rows || []
|
||||
}
|
||||
|
||||
async function loadTemplateOptions() {
|
||||
templateLoading.value = true
|
||||
try {
|
||||
templateOptions.value = await getLabelTemplateList({ templateType: LABEL_TYPE })
|
||||
if (
|
||||
selectedTemplateId.value == null ||
|
||||
!templateOptions.value.some((x) => x.id === selectedTemplateId.value)
|
||||
) {
|
||||
selectedTemplateId.value = templateOptions.value[0]?.id
|
||||
}
|
||||
} catch (e: any) {
|
||||
templateOptions.value = []
|
||||
Message.error(e?.message || '加载标签模板失败')
|
||||
} finally {
|
||||
templateLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function openPrintTemplateModal(masterNos: string[]) {
|
||||
const nos = masterNos.map((x) => String(x || '').trim()).filter(Boolean)
|
||||
if (!nos.length) {
|
||||
Message.warning('请先选择要打印的主单')
|
||||
return
|
||||
}
|
||||
pendingPrintMasterNos.value = nos
|
||||
templateModalVisible.value = true
|
||||
await loadTemplateOptions()
|
||||
}
|
||||
|
||||
function handleBatchPrint() {
|
||||
const nos = selectedRows.value.map((x) => x.masterNo).filter(Boolean)
|
||||
void openPrintTemplateModal(nos)
|
||||
}
|
||||
|
||||
async function confirmPrintWithTemplate() {
|
||||
const nos = pendingPrintMasterNos.value
|
||||
if (!nos.length) {
|
||||
Message.warning('请先选择要打印的主单')
|
||||
return false
|
||||
}
|
||||
if (!selectedTemplateId.value) {
|
||||
Message.warning('请选择打印模板(类型:主单标签)')
|
||||
return false
|
||||
}
|
||||
|
||||
batchPrintLoading.value = true
|
||||
try {
|
||||
const res = await printShipMasterLabels({
|
||||
masterNos: nos,
|
||||
labelTemplateId: selectedTemplateId.value,
|
||||
})
|
||||
const urlMap = new Map(
|
||||
(res.items || [])
|
||||
.filter((x) => x.masterNo && x.printUrl)
|
||||
.map((x) => [String(x.masterNo), String(x.printUrl)]),
|
||||
)
|
||||
const items = nos.map((no) => ({
|
||||
id: no,
|
||||
label: no,
|
||||
url: urlMap.get(no) || '',
|
||||
}))
|
||||
const okCount = items.filter((x) => !!x.url).length
|
||||
if (!okCount) {
|
||||
Message.info('未获取到可打印文件')
|
||||
return false
|
||||
}
|
||||
if (okCount < nos.length) {
|
||||
Message.warning(`已获取 ${okCount}/${nos.length} 张面单`)
|
||||
}
|
||||
printItems.value = items
|
||||
printPreparing.value = false
|
||||
printVisible.value = true
|
||||
return true
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '批量打印失败')
|
||||
return false
|
||||
} finally {
|
||||
batchPrintLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
listLoading.value = true
|
||||
try {
|
||||
const res = await pageShipMasters({
|
||||
pageIndex: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
keyword: keyword.value.trim() || undefined,
|
||||
status: statusTab.value === STATUS_ALL ? undefined : statusTab.value,
|
||||
})
|
||||
tableRows.value = res.items || []
|
||||
totalCount.value = Number(res.total || 0)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '加载失败')
|
||||
} finally {
|
||||
listLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
currentPage.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleStatusChange(key: string) {
|
||||
statusTab.value = key
|
||||
currentPage.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
currentPage.value = page
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
async function refreshDetail(masterNo?: string) {
|
||||
const no = masterNo || detail.value?.masterNo
|
||||
if (!no) return
|
||||
detailLoading.value = true
|
||||
try {
|
||||
detail.value = await getShipMaster(no)
|
||||
syncMetaForm(detail.value)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '加载详情失败')
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function openDetail(row: ShipMaster) {
|
||||
addNo.value = ''
|
||||
addMode.value = 'bag'
|
||||
detailVisible.value = true
|
||||
await refreshDetail(row.masterNo)
|
||||
}
|
||||
|
||||
async function saveMeta() {
|
||||
if (!detail.value?.masterNo || !metaEditable.value) return
|
||||
savingMeta.value = true
|
||||
try {
|
||||
detail.value = await updateShipMasterMeta({
|
||||
masterNo: detail.value.masterNo,
|
||||
destinationCountry: metaForm.destinationCountry || undefined,
|
||||
destinationPort: metaForm.destinationPort || undefined,
|
||||
flightOrVoyage: metaForm.flightOrVoyage || undefined,
|
||||
length: metaForm.length ?? null,
|
||||
width: metaForm.width ?? null,
|
||||
height: metaForm.height ?? null,
|
||||
weight: metaForm.weight ?? null,
|
||||
remark: metaForm.remark || undefined,
|
||||
})
|
||||
syncMetaForm(detail.value)
|
||||
Message.success('属性已保存')
|
||||
await loadList()
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '保存失败')
|
||||
} finally {
|
||||
savingMeta.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onAddItem() {
|
||||
if (!detail.value?.masterNo || !detailEditable.value) return
|
||||
const no = addNo.value.trim()
|
||||
if (!no) {
|
||||
Message.warning(addMode.value === 'bag' ? '请输入大包号' : '请输入运单号')
|
||||
return
|
||||
}
|
||||
adding.value = true
|
||||
try {
|
||||
detail.value =
|
||||
addMode.value === 'bag'
|
||||
? await addBagToMaster(detail.value.masterNo, no)
|
||||
: await addParcelToMaster(detail.value.masterNo, no)
|
||||
addNo.value = ''
|
||||
Message.success(addMode.value === 'bag' ? `大包 ${no} 已上板` : `小包 ${no} 已上板`)
|
||||
await loadList()
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '上板失败')
|
||||
} finally {
|
||||
adding.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onRemoveItem(itemId: number, label: string) {
|
||||
if (!detail.value?.masterNo || !detailEditable.value) return
|
||||
Modal.confirm({
|
||||
title: '移出板上明细',
|
||||
content: `确定从 ${detail.value.masterNo} 移出 ${label}?`,
|
||||
okText: '移出',
|
||||
onOk: async () => {
|
||||
detail.value = await removeMasterItem(detail.value!.masterNo, itemId)
|
||||
Message.success('已移出')
|
||||
await loadList()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function openMawb(row: ShipMaster) {
|
||||
mawbForm.masterNo = row.masterNo
|
||||
mawbForm.externalMawb = row.externalMawb || ''
|
||||
mawbForm.flightOrVoyage = row.flightOrVoyage || ''
|
||||
mawbVisible.value = true
|
||||
}
|
||||
|
||||
async function saveMawb() {
|
||||
try {
|
||||
await bindMasterMawb(mawbForm.masterNo, mawbForm.externalMawb, mawbForm.flightOrVoyage || undefined)
|
||||
Message.success('已绑定 MAWB')
|
||||
mawbVisible.value = false
|
||||
await loadList()
|
||||
if (detail.value?.masterNo === mawbForm.masterNo) await refreshDetail(mawbForm.masterNo)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '绑定失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function onSeal(row: ShipMaster) {
|
||||
try {
|
||||
await sealShipMaster(row.masterNo)
|
||||
Message.success('封板成功')
|
||||
await loadList()
|
||||
if (detail.value?.masterNo === row.masterNo) await refreshDetail(row.masterNo)
|
||||
} catch (e: any) {
|
||||
Message.error(e?.message || '封板失败')
|
||||
}
|
||||
}
|
||||
|
||||
function onSealDetail() {
|
||||
if (!detail.value) return
|
||||
Modal.confirm({
|
||||
title: '确认封板',
|
||||
content: `主单 ${detail.value.masterNo}:大包 ${detail.value.bagCount}、小包合计 ${detail.value.parcelCount}。封板后不可再增删,是否继续?`,
|
||||
okText: '封板',
|
||||
onOk: async () => {
|
||||
await onSeal(detail.value!)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function onHandOver(row: ShipMaster) {
|
||||
Modal.confirm({
|
||||
title: '交运确认',
|
||||
content: `确认主单 ${row.masterNo} 已交运?`,
|
||||
onOk: async () => {
|
||||
await handOverMaster(row.masterNo)
|
||||
Message.success('已交运')
|
||||
await loadList()
|
||||
if (detail.value?.masterNo === row.masterNo) await refreshDetail(row.masterNo)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function itemLabel(record: { itemType: string; bagNo?: string; waybillNo?: string }) {
|
||||
if (record.itemType === 'bag') return `大包 ${record.bagNo || ''}`
|
||||
return `小包 ${record.waybillNo || ''}`
|
||||
}
|
||||
|
||||
onMounted(loadList)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="master-bill-container warehouse-list-page">
|
||||
<div class="warehouse-list-page-card">
|
||||
<div class="status-tabs">
|
||||
<SlidingTabs
|
||||
:model-value="statusTab"
|
||||
size="mini"
|
||||
:items="statusTabs"
|
||||
aria-label="主单状态"
|
||||
@change="handleStatusChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="table-toolbar">
|
||||
<div class="toolbar-left">
|
||||
<a-space wrap :size="8">
|
||||
<a-input
|
||||
v-model="keyword"
|
||||
placeholder="主单号/MAWB/目的国"
|
||||
allow-clear
|
||||
style="width: 220px"
|
||||
@press-enter="handleSearch"
|
||||
/>
|
||||
<a-button class="app-btn-search" @click="handleSearch">查询</a-button>
|
||||
<a-button
|
||||
class="app-btn-toolbar"
|
||||
:loading="batchPrintLoading"
|
||||
:disabled="selectedRows.length === 0 || batchPrintLoading"
|
||||
@click="handleBatchPrint"
|
||||
>
|
||||
批量打印
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<PaginationPro
|
||||
:total-count="totalCount"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableContainerRef" class="list-wrap">
|
||||
<HandsontablePro
|
||||
:columns="hotColumns"
|
||||
:data="tableRows"
|
||||
:height="tableHeight"
|
||||
:loading="listLoading"
|
||||
:stretch-columns="true"
|
||||
show-action-column
|
||||
:action-renderer="actionRenderer"
|
||||
@action-click="handleActionClick"
|
||||
@selection-change="handleSelectionChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-modal
|
||||
v-model:visible="templateModalVisible"
|
||||
title="选择打印模板"
|
||||
:ok-loading="batchPrintLoading"
|
||||
ok-text="打印"
|
||||
unmount-on-close
|
||||
:on-before-ok="confirmPrintWithTemplate"
|
||||
>
|
||||
<a-form :model="{ selectedTemplateId }" auto-label-width>
|
||||
<a-form-item label="标签模板" required>
|
||||
<a-select
|
||||
v-model="selectedTemplateId"
|
||||
:loading="templateLoading"
|
||||
:options="templateOptions.map((x) => ({ label: x.name, value: x.id }))"
|
||||
placeholder="请选择主单标签模板"
|
||||
allow-search
|
||||
/>
|
||||
</a-form-item>
|
||||
<div class="print-tip">将打印 {{ pendingPrintMasterNos.length }} 个主单 · 模板类型:主单标签</div>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
<OrderPrintModal
|
||||
v-if="printVisible"
|
||||
v-model:visible="printVisible"
|
||||
:mode="printItems.length > 1 ? 'batch' : 'single'"
|
||||
:items="printItems"
|
||||
:preparing="printPreparing"
|
||||
/>
|
||||
|
||||
<a-drawer
|
||||
v-model:visible="detailVisible"
|
||||
:width="680"
|
||||
title="主单详情"
|
||||
unmount-on-close
|
||||
:footer="false"
|
||||
>
|
||||
<a-spin :loading="detailLoading" style="width: 100%">
|
||||
<template v-if="detail">
|
||||
<div class="detail-head">
|
||||
<div class="detail-no">{{ detail.masterNo }}</div>
|
||||
<div class="detail-meta">
|
||||
<a-tag size="small" color="arcoblue">{{ detail.statusName || detail.status }}</a-tag>
|
||||
<span>大包 {{ detail.bagCount }}</span>
|
||||
<span>小包合计 {{ detail.parcelCount }}</span>
|
||||
<span v-if="detail.externalMawb">MAWB {{ detail.externalMawb }}</span>
|
||||
<span v-if="detail.destinationCountry">目的国 {{ detail.destinationCountry }}</span>
|
||||
<a-button
|
||||
size="mini"
|
||||
class="app-btn-toolbar"
|
||||
@click="openPrintTemplateModal([detail.masterNo])"
|
||||
>
|
||||
打印面单
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-meta-form">
|
||||
<div class="detail-meta-form__title">件重尺 / 口岸</div>
|
||||
<a-form :model="metaForm" layout="vertical" size="small">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="8">
|
||||
<a-form-item label="重量(kg)">
|
||||
<a-input-number v-model="metaForm.weight" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="长(cm)">
|
||||
<a-input-number v-model="metaForm.length" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="宽(cm)">
|
||||
<a-input-number v-model="metaForm.width" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="高(cm)">
|
||||
<a-input-number v-model="metaForm.height" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="目的国">
|
||||
<a-input v-model="metaForm.destinationCountry" :disabled="!metaEditable" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="目的口岸">
|
||||
<a-input v-model="metaForm.destinationPort" :disabled="!metaEditable" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-button v-if="metaEditable" type="primary" class="app-btn-primary-soft" :loading="savingMeta" @click="saveMeta">
|
||||
保存属性
|
||||
</a-button>
|
||||
</a-form>
|
||||
</div>
|
||||
|
||||
<div v-if="detailEditable" class="detail-add">
|
||||
<SlidingTabs v-model="addMode" size="mini" :items="addModeTabs" aria-label="上板类型" />
|
||||
<div class="detail-add__row">
|
||||
<a-input
|
||||
v-model="addNo"
|
||||
:placeholder="addPlaceholder"
|
||||
allow-clear
|
||||
@press-enter="onAddItem"
|
||||
/>
|
||||
<a-button type="primary" :loading="adding" @click="onAddItem">上板</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="app-btn-primary-soft"
|
||||
:disabled="!(detail.items || []).length"
|
||||
@click="onSealDetail"
|
||||
>
|
||||
封板
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else class="detail-hint">仅「打板中」可增删板上明细;已交运/作废属性只读。</p>
|
||||
|
||||
<a-table
|
||||
:data="detail.items || []"
|
||||
:pagination="false"
|
||||
row-key="id"
|
||||
size="small"
|
||||
:bordered="false"
|
||||
:stripe="true"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="类型" :width="80">
|
||||
<template #cell="{ record }">
|
||||
<a-tag :color="record.itemType === 'bag' ? 'arcoblue' : 'purple'" size="small">
|
||||
{{ record.itemType === 'bag' ? '大包' : '小包' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="大包号" data-index="bagNo">
|
||||
<template #cell="{ record }">{{ record.bagNo || '—' }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="运单号" data-index="waybillNo">
|
||||
<template #cell="{ record }">{{ record.waybillNo || '—' }}</template>
|
||||
</a-table-column>
|
||||
<a-table-column v-if="detailEditable" title="操作" :width="80" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-button
|
||||
type="text"
|
||||
size="small"
|
||||
status="danger"
|
||||
@click="onRemoveItem(record.id, itemLabel(record))"
|
||||
>
|
||||
移出
|
||||
</a-button>
|
||||
</template>
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
<div v-if="!(detail.items || []).length" class="detail-empty">暂无板上明细</div>
|
||||
</template>
|
||||
</a-spin>
|
||||
</a-drawer>
|
||||
|
||||
<a-modal v-model:visible="mawbVisible" title="绑定外部 MAWB" @ok="saveMawb">
|
||||
<a-form :model="mawbForm" layout="vertical">
|
||||
<a-form-item label="主单号">
|
||||
<a-input :model-value="mawbForm.masterNo" disabled />
|
||||
</a-form-item>
|
||||
<a-form-item label="外部 MAWB / 提单号" required>
|
||||
<a-input v-model="mawbForm.externalMawb" placeholder="承运商主单号" />
|
||||
</a-form-item>
|
||||
<a-form-item label="航班 / 航次">
|
||||
<a-input v-model="mawbForm.flightOrVoyage" placeholder="可选" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import '@/styles/warehouse-list-page.less';
|
||||
|
||||
.detail-head {
|
||||
margin-bottom: 16px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
|
||||
border: 1px solid color-mix(in srgb, var(--app-primary-color) 18%, var(--color-border-2));
|
||||
}
|
||||
.detail-no {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
.detail-meta {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 14px;
|
||||
font-size: 13px;
|
||||
color: var(--color-text-2);
|
||||
align-items: center;
|
||||
}
|
||||
.detail-meta-form {
|
||||
margin-bottom: 16px;
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
background: var(--color-fill-1);
|
||||
}
|
||||
.detail-meta-form__title {
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-2);
|
||||
}
|
||||
.detail-add {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.detail-add__row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.detail-hint {
|
||||
margin: 0 0 12px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
.detail-empty {
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
color: var(--color-text-3);
|
||||
font-size: 13px;
|
||||
}
|
||||
.print-tip {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
</style>
|
||||
597
src/views/operation/masterBoard/index.vue
Normal file
597
src/views/operation/masterBoard/index.vue
Normal file
@ -0,0 +1,597 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { Modal } from '@arco-design/web-vue'
|
||||
import HandsontablePro from '@/components/HandsontablePro/index.vue'
|
||||
import SlidingTabs from '@/components/SlidingTabs/index.vue'
|
||||
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
|
||||
import { useOperationScanFocus } from '@/composables/useOperationScanFocus'
|
||||
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback'
|
||||
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
|
||||
import { buildStatusTagHtml, type StatusTagTone } from '@/utils/statusTag'
|
||||
import {
|
||||
addBagToMaster,
|
||||
addParcelToMaster,
|
||||
createShipMaster,
|
||||
getShipMaster,
|
||||
removeMasterItem,
|
||||
sealShipMaster,
|
||||
type ShipMaster,
|
||||
type ShipMasterItem,
|
||||
} from '@/api/operation/shipContainer'
|
||||
|
||||
defineOptions({ name: 'MasterBoard' })
|
||||
|
||||
const SESSION_KEY = 'oms.operation.masterBoard.lastMasterNo'
|
||||
const { tableContainerRef, tableHeight } = useTableContainerHeight()
|
||||
|
||||
const creating = ref(false)
|
||||
const scanning = ref(false)
|
||||
const sealing = ref(false)
|
||||
const loadingMaster = ref(false)
|
||||
const scanMode = ref<'bag' | 'parcel'>('bag')
|
||||
const scanModeTabs = [
|
||||
{ key: 'bag', label: '扫大包' },
|
||||
{ key: 'parcel', label: '扫小包' },
|
||||
]
|
||||
const scanNo = ref('')
|
||||
const lastScanNo = ref('')
|
||||
const active = ref<ShipMaster | null>(null)
|
||||
const resumeMasterNo = ref('')
|
||||
const scanInputRef = ref<{ focus?: () => void; $el?: HTMLElement } | null>(null)
|
||||
|
||||
const { keepScanFocus, focusScanInput } = useOperationScanFocus('masterBoard', scanInputRef)
|
||||
const {
|
||||
voiceEnabled,
|
||||
feedbackType,
|
||||
feedbackMessage,
|
||||
clearFeedback,
|
||||
showError,
|
||||
showSuccess,
|
||||
showWarning,
|
||||
} = useOperationScanFeedback('masterBoard')
|
||||
|
||||
if (!localStorage.getItem('oms.operation.scanFocus.masterBoard')) {
|
||||
keepScanFocus.value = true
|
||||
}
|
||||
|
||||
const items = computed(() => active.value?.items || [])
|
||||
const isOpen = computed(() => active.value?.status === 'open')
|
||||
const isSealed = computed(() => active.value?.status === 'sealed')
|
||||
const hasSession = computed(() => !!active.value)
|
||||
const scanPlaceholder = computed(() => {
|
||||
if (!isOpen.value) return '已封板,不可再上板'
|
||||
return scanMode.value === 'bag' ? '扫描已封袋大包号上板(回车)' : '扫描散货运单号上板(回车)'
|
||||
})
|
||||
|
||||
const statusTone: Record<string, StatusTagTone> = {
|
||||
open: 'brand',
|
||||
sealed: 'wait',
|
||||
handed: 'ok',
|
||||
voided: 'alert',
|
||||
}
|
||||
|
||||
const hotColumns = computed(() => [
|
||||
{
|
||||
key: 'itemType',
|
||||
label: '类型',
|
||||
width: 80,
|
||||
renderer: (row: ShipMasterItem) =>
|
||||
buildStatusTagHtml(row.itemType === 'bag' ? '大包' : '小包', row.itemType === 'bag' ? 'brand' : 'neutral'),
|
||||
},
|
||||
{
|
||||
key: 'bagNo',
|
||||
label: '大包号',
|
||||
width: 160,
|
||||
renderer: (row: ShipMasterItem) => {
|
||||
const no = row.bagNo || '—'
|
||||
const flash = !!row.bagNo && row.bagNo === lastScanNo.value
|
||||
return flash
|
||||
? `<span style="font-weight:700;color:var(--app-primary-color)">${no}</span>`
|
||||
: no
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'waybillNo',
|
||||
label: '运单号',
|
||||
width: 180,
|
||||
renderer: (row: ShipMasterItem) => {
|
||||
const no = row.waybillNo || '—'
|
||||
const flash = !!row.waybillNo && row.waybillNo === lastScanNo.value
|
||||
return flash
|
||||
? `<span style="font-weight:700;color:var(--app-primary-color)">${no}</span>`
|
||||
: no
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
function actionRenderer(_row: ShipMasterItem) {
|
||||
if (!isOpen.value) return ''
|
||||
return wrapWarehouseActions([renderWarehouseActionBtn('delete', '移出')])
|
||||
}
|
||||
|
||||
function handleActionClick(row: ShipMasterItem, _i: number, action?: string) {
|
||||
if (action === 'delete') handleRemove(row)
|
||||
}
|
||||
|
||||
function persistSession(masterNo?: string) {
|
||||
try {
|
||||
if (masterNo) localStorage.setItem(SESSION_KEY, masterNo)
|
||||
else localStorage.removeItem(SESSION_KEY)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => active.value?.masterNo,
|
||||
(no) => {
|
||||
if (no) {
|
||||
resumeMasterNo.value = no
|
||||
persistSession(no)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
function selectScanInput() {
|
||||
nextTick(() => {
|
||||
const el = scanInputRef.value?.$el?.querySelector?.('input') as HTMLInputElement | undefined
|
||||
el?.select?.()
|
||||
focusScanInput()
|
||||
})
|
||||
}
|
||||
|
||||
function confirmCreateMaster(clearCurrent = false) {
|
||||
Modal.confirm({
|
||||
title: '确认开主单',
|
||||
content: clearCurrent
|
||||
? '将离开当前主单并开一张新的内部主单,确认开单?'
|
||||
: '将创建一张新的内部主单(打板中),确认开单?',
|
||||
okText: '开主单',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
if (clearCurrent) handleClearSession()
|
||||
await handleCreate()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function handleCreate() {
|
||||
creating.value = true
|
||||
clearFeedback()
|
||||
try {
|
||||
active.value = await createShipMaster({})
|
||||
scanNo.value = ''
|
||||
lastScanNo.value = ''
|
||||
showSuccess(`已开主单 ${active.value.masterNo}`)
|
||||
selectScanInput()
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '开主单失败')
|
||||
throw e
|
||||
} finally {
|
||||
creating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMaster(fromSession = false) {
|
||||
const no = resumeMasterNo.value.trim()
|
||||
if (!no) {
|
||||
if (!fromSession) showWarning('请输入内部主单号')
|
||||
return
|
||||
}
|
||||
loadingMaster.value = true
|
||||
clearFeedback()
|
||||
try {
|
||||
active.value = await getShipMaster(no)
|
||||
scanNo.value = ''
|
||||
lastScanNo.value = ''
|
||||
showSuccess(
|
||||
isOpen.value ? `继续打板 ${active.value.masterNo}` : `已加载 ${active.value.masterNo}`,
|
||||
!fromSession,
|
||||
)
|
||||
await nextTick()
|
||||
if (isOpen.value) selectScanInput()
|
||||
} catch (e: any) {
|
||||
if (!fromSession) showError(e?.message || '加载失败')
|
||||
if (fromSession) persistSession()
|
||||
} finally {
|
||||
loadingMaster.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleScan() {
|
||||
if (!active.value?.masterNo) {
|
||||
showWarning('请先开主单或加载主单')
|
||||
return
|
||||
}
|
||||
if (!isOpen.value) {
|
||||
showWarning('当前主单已封板,请开新主单或加载打板中主单')
|
||||
return
|
||||
}
|
||||
const no = scanNo.value.trim()
|
||||
if (!no) return
|
||||
if (scanning.value) return
|
||||
|
||||
const dup =
|
||||
scanMode.value === 'bag'
|
||||
? items.value.some((x) => x.itemType === 'bag' && x.bagNo === no)
|
||||
: items.value.some((x) => x.itemType === 'parcel' && x.waybillNo === no)
|
||||
if (dup) {
|
||||
showWarning(`${no} 已在板上`)
|
||||
scanNo.value = ''
|
||||
selectScanInput()
|
||||
return
|
||||
}
|
||||
|
||||
scanning.value = true
|
||||
clearFeedback()
|
||||
try {
|
||||
active.value =
|
||||
scanMode.value === 'bag'
|
||||
? await addBagToMaster(active.value.masterNo, no)
|
||||
: await addParcelToMaster(active.value.masterNo, no)
|
||||
lastScanNo.value = no
|
||||
showSuccess(
|
||||
scanMode.value === 'bag'
|
||||
? `大包 ${no} 已上板(板上 ${active.value.items?.length || 0})`
|
||||
: `小包 ${no} 已上板(板上 ${active.value.items?.length || 0})`,
|
||||
)
|
||||
scanNo.value = ''
|
||||
selectScanInput()
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '上板失败')
|
||||
selectScanInput()
|
||||
} finally {
|
||||
scanning.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleRemove(row: ShipMasterItem) {
|
||||
if (!active.value?.masterNo || !isOpen.value) return
|
||||
const label = row.itemType === 'bag' ? `大包 ${row.bagNo || ''}` : `小包 ${row.waybillNo || ''}`
|
||||
Modal.confirm({
|
||||
title: '移出板上明细',
|
||||
content: `确定从 ${active.value.masterNo} 移出 ${label}?`,
|
||||
okText: '移出',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
active.value = await removeMasterItem(active.value!.masterNo, row.id)
|
||||
if (lastScanNo.value === row.bagNo || lastScanNo.value === row.waybillNo) {
|
||||
lastScanNo.value = ''
|
||||
}
|
||||
showSuccess(`已移出 ${label}`)
|
||||
selectScanInput()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function handleSeal() {
|
||||
if (!active.value?.masterNo || !isOpen.value) return
|
||||
if (!items.value.length) {
|
||||
showWarning('空板不能封板')
|
||||
return
|
||||
}
|
||||
const masterNo = active.value.masterNo
|
||||
Modal.confirm({
|
||||
title: '确认封板',
|
||||
content: `主单 ${masterNo}:大包 ${active.value.bagCount}、小包合计 ${active.value.parcelCount}。封板后不可再上板,是否继续?`,
|
||||
okText: '封板',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
sealing.value = true
|
||||
try {
|
||||
active.value = await sealShipMaster(masterNo)
|
||||
showSuccess(`封板成功 ${masterNo}`)
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '封板失败')
|
||||
throw e
|
||||
} finally {
|
||||
sealing.value = false
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function handleClearSession() {
|
||||
active.value = null
|
||||
scanNo.value = ''
|
||||
lastScanNo.value = ''
|
||||
clearFeedback()
|
||||
persistSession()
|
||||
}
|
||||
|
||||
function handleNextMaster() {
|
||||
confirmCreateMaster(true)
|
||||
}
|
||||
|
||||
function copyMasterNo() {
|
||||
const no = active.value?.masterNo
|
||||
if (!no) return
|
||||
navigator.clipboard?.writeText(no).then(
|
||||
() => showSuccess('主单号已复制', false),
|
||||
() => showWarning('复制失败'),
|
||||
)
|
||||
}
|
||||
|
||||
async function refreshMaster() {
|
||||
if (!active.value?.masterNo) return
|
||||
try {
|
||||
active.value = await getShipMaster(active.value.masterNo)
|
||||
showSuccess('已刷新', false)
|
||||
} catch (e: any) {
|
||||
showError(e?.message || '刷新失败')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
try {
|
||||
const last = localStorage.getItem(SESSION_KEY)
|
||||
if (last) {
|
||||
resumeMasterNo.value = last
|
||||
loadMaster(true)
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ops-page master-board-page">
|
||||
<div class="ops-col ops-col--main">
|
||||
<section v-if="!hasSession" class="ops-card ops-card--scan">
|
||||
<div class="ops-card__body ops-scan">
|
||||
<div class="ops-idle-title">打板作业</div>
|
||||
<p class="ops-scan-hint ops-idle-hint">开主单后扫大包或散货小包上板;也可加载打板中主单继续。</p>
|
||||
<div class="ops-scan__row ops-scan__row--setup">
|
||||
<a-button
|
||||
type="primary"
|
||||
class="ops-setup-btn"
|
||||
:loading="creating"
|
||||
@click="() => confirmCreateMaster(false)"
|
||||
>
|
||||
开主单
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="ops-scan__row ops-scan__row--setup">
|
||||
<a-input
|
||||
v-model="resumeMasterNo"
|
||||
class="ops-resume-input ops-resume-input--wide"
|
||||
placeholder="继续打板:内部主单号回车"
|
||||
allow-clear
|
||||
@press-enter="() => loadMaster(false)"
|
||||
/>
|
||||
<a-button class="ops-setup-btn" :loading="loadingMaster" @click="() => loadMaster(false)">
|
||||
加载
|
||||
</a-button>
|
||||
</div>
|
||||
<p
|
||||
v-if="feedbackMessage"
|
||||
class="ops-feedback ops-feedback--block"
|
||||
:class="`is-${feedbackType}`"
|
||||
>
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<template v-else>
|
||||
<section class="ops-card ops-card--scan">
|
||||
<div class="ops-card__body ops-scan">
|
||||
<div class="ops-session-bar">
|
||||
<div class="ops-session-bar__left">
|
||||
<span class="ops-session-bar__label">当前</span>
|
||||
<button type="button" class="ops-session-bar__no" @click="copyMasterNo">
|
||||
{{ active!.masterNo }}
|
||||
</button>
|
||||
<a-tag size="small" :color="isOpen ? 'arcoblue' : isSealed ? 'orangered' : 'gray'">
|
||||
{{ active!.statusName || active!.status }}
|
||||
</a-tag>
|
||||
<span class="ops-session-bar__meta">
|
||||
大包 {{ active!.bagCount }} · 小包 {{ active!.parcelCount }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="ops-session-bar__right">
|
||||
<a-button size="mini" @click="refreshMaster">刷新</a-button>
|
||||
<a-button size="mini" @click="handleClearSession">切换主单</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ops-scan__row">
|
||||
<SlidingTabs
|
||||
v-model="scanMode"
|
||||
size="mini"
|
||||
:items="scanModeTabs"
|
||||
aria-label="上板模式"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="ops-scan__row">
|
||||
<a-input
|
||||
ref="scanInputRef"
|
||||
v-model="scanNo"
|
||||
class="ops-scan-input"
|
||||
:placeholder="scanPlaceholder"
|
||||
allow-clear
|
||||
:disabled="!isOpen"
|
||||
@press-enter="handleScan"
|
||||
@focus="selectScanInput"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="ops-scan__row ops-scan__row--tools">
|
||||
<div class="ops-scan__opts">
|
||||
<a-checkbox v-model="keepScanFocus" class="ops-opt">保持扫描焦点</a-checkbox>
|
||||
<a-checkbox v-model="voiceEnabled" class="ops-opt">语音播报</a-checkbox>
|
||||
</div>
|
||||
<div class="ops-scan__actions">
|
||||
<a-button v-if="isOpen" type="primary" :loading="scanning" @click="handleScan">
|
||||
上板
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="isOpen"
|
||||
type="primary"
|
||||
status="warning"
|
||||
:disabled="!items.length"
|
||||
:loading="sealing"
|
||||
@click="handleSeal"
|
||||
>
|
||||
封板
|
||||
</a-button>
|
||||
<a-button v-if="isSealed" type="primary" :loading="creating" @click="handleNextMaster">
|
||||
开下一主单
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p
|
||||
v-if="feedbackMessage"
|
||||
class="ops-feedback ops-feedback--block"
|
||||
:class="`is-${feedbackType}`"
|
||||
>
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
<p v-else class="ops-scan-hint">
|
||||
大包须已封袋;散货可不装袋上板。小包也可不走主单单独出库。
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="ops-card ops-card--verify">
|
||||
<div class="ops-card__body ops-verify">
|
||||
<div class="ops-hero">
|
||||
<div class="ops-hero__nos">
|
||||
<div class="ops-hero__waybill">{{ active!.masterNo }}</div>
|
||||
<div class="ops-hero__meta">
|
||||
<span
|
||||
v-html="
|
||||
buildStatusTagHtml(
|
||||
active!.statusName || active!.status,
|
||||
statusTone[active!.status] || 'neutral',
|
||||
)
|
||||
"
|
||||
/>
|
||||
<span v-if="active!.destinationCountry">目的国 {{ active!.destinationCountry }}</span>
|
||||
<span v-if="active!.externalMawb">MAWB {{ active!.externalMawb }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ops-status-grid" style="margin-top: 16px">
|
||||
<div class="ops-status-item">
|
||||
<span>板上条目</span>
|
||||
<strong class="ops-status-item__num">{{ items.length }}</strong>
|
||||
</div>
|
||||
<div class="ops-status-item">
|
||||
<span>最近上板</span>
|
||||
<strong>{{ lastScanNo || '—' }}</strong>
|
||||
</div>
|
||||
<div class="ops-status-item">
|
||||
<span>封板时间</span>
|
||||
<strong>{{ active!.sealTime || '—' }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<aside class="ops-card ops-card--recent-wide">
|
||||
<div class="ops-card__head">
|
||||
<span>板上明细</span>
|
||||
<span class="ops-recent__count">{{ items.length }}</span>
|
||||
</div>
|
||||
<div ref="tableContainerRef" class="ops-list-wrap board-list-wrap">
|
||||
<HandsontablePro
|
||||
v-if="items.length"
|
||||
:columns="hotColumns"
|
||||
:data="items"
|
||||
:height="tableHeight"
|
||||
:stretch-columns="true"
|
||||
:read-only="true"
|
||||
:show-action-column="isOpen"
|
||||
:action-renderer="actionRenderer"
|
||||
@action-click="handleActionClick"
|
||||
/>
|
||||
<div v-else class="ops-recent__empty">
|
||||
{{ hasSession ? '暂无条目,扫描大包或小包上板' : '开主单后这里显示板上明细' }}
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import '@/views/operation/styles/ops-scan-page.less';
|
||||
|
||||
.ops-idle-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
|
||||
.ops-idle-hint {
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
.ops-resume-input--wide {
|
||||
flex: 1 1 240px;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.ops-feedback--block {
|
||||
margin: 0;
|
||||
max-width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.ops-session-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
background: var(--color-fill-2);
|
||||
}
|
||||
|
||||
.ops-session-bar__left,
|
||||
.ops-session-bar__right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ops-session-bar__label {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
.ops-session-bar__no {
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: var(--app-primary-color);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.ops-session-bar__meta {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-2);
|
||||
}
|
||||
|
||||
.ops-status-item__num {
|
||||
font-size: 22px !important;
|
||||
color: var(--app-primary-color) !important;
|
||||
}
|
||||
|
||||
.board-list-wrap {
|
||||
padding-top: 8px;
|
||||
}
|
||||
</style>
|
||||
@ -3,11 +3,19 @@
|
||||
<div class="ops-col ops-col--main">
|
||||
<section class="ops-card ops-card--scan">
|
||||
<div class="ops-card__body ops-scan">
|
||||
<div class="ops-scan__row">
|
||||
<a-radio-group v-model="scanMode" type="button" size="small" class="ops-mode">
|
||||
<a-radio value="parcel">小包出库</a-radio>
|
||||
<a-radio value="bag">大包出库</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<div class="ops-scan__row">
|
||||
<a-input
|
||||
ref="scanInputRef"
|
||||
v-model="formData.waybillNumber"
|
||||
:placeholder="$t('operation.outbound.form.placeholder.scanOrInput')"
|
||||
:placeholder="
|
||||
scanMode === 'bag' ? '扫描或输入大包号' : $t('operation.outbound.form.placeholder.scanOrInput')
|
||||
"
|
||||
class="ops-scan-input"
|
||||
allow-clear
|
||||
@press-enter="onScanEnter"
|
||||
@ -37,7 +45,13 @@
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="ops-scan-hint">{{ $t('operation.outbound.form.hint.supportedTypes') }}</p>
|
||||
<p class="ops-scan-hint">
|
||||
{{
|
||||
scanMode === 'bag'
|
||||
? '大包须已封袋;按袋内入库/预报件重尺批量出库。小包也可不装袋单独出库。'
|
||||
: $t('operation.outbound.form.hint.supportedTypes')
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@ -51,7 +65,17 @@
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
<a-spin :loading="lookingUp" class="ops-verify-spin">
|
||||
<div v-if="formData.orderId" class="ops-panel">
|
||||
<div v-if="scanMode === 'bag'" class="ops-panel">
|
||||
<div class="ops-hero">
|
||||
<div class="ops-hero__nos">
|
||||
<div class="ops-hero__waybill">{{ formData.waybillNumber || '-' }}</div>
|
||||
<div class="ops-hero__meta">
|
||||
<span>模式:大包出库(无需再填件重尺)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="formData.orderId" class="ops-panel">
|
||||
<div class="ops-hero">
|
||||
<div class="ops-hero__nos">
|
||||
<div class="ops-hero__waybill">{{ formData.waybillNumber || '-' }}</div>
|
||||
@ -153,6 +177,7 @@ import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
|
||||
import { useOperationScanFocus } from '@/composables/useOperationScanFocus'
|
||||
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback'
|
||||
import { outboundCreate, outboundRecentList, outboundOrderLookup } from '@/api/operation'
|
||||
import { outboundByBag } from '@/api/operation/shipContainer'
|
||||
import { withServerFilterColumns } from '@/utils/headerFilterAdapter'
|
||||
|
||||
const { t } = useI18n()
|
||||
@ -171,6 +196,7 @@ const {
|
||||
|
||||
defineOptions({ name: 'OutboundScan' })
|
||||
|
||||
const scanMode = ref<'parcel' | 'bag'>('parcel')
|
||||
const submitting = ref(false)
|
||||
const lookingUp = ref(false)
|
||||
const listLoading = ref(false)
|
||||
@ -329,6 +355,10 @@ async function ensureOrderLookup(): Promise<boolean> {
|
||||
}
|
||||
|
||||
async function onScanEnter() {
|
||||
if (scanMode.value === 'bag') {
|
||||
await handleSubmit()
|
||||
return
|
||||
}
|
||||
const ok = await ensureOrderLookup()
|
||||
if (!ok) return
|
||||
if (hasMetrics()) {
|
||||
@ -340,10 +370,28 @@ async function onScanEnter() {
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!formData.waybillNumber?.trim()) {
|
||||
showWarning(t('operation.outbound.message.waybillNumberRequired'))
|
||||
showWarning(
|
||||
scanMode.value === 'bag' ? '请输入大包号' : t('operation.outbound.message.waybillNumberRequired'),
|
||||
)
|
||||
maybeRefocusScan()
|
||||
return
|
||||
}
|
||||
if (scanMode.value === 'bag') {
|
||||
submitting.value = true
|
||||
try {
|
||||
const result = await outboundByBag(formData.waybillNumber.trim())
|
||||
showSuccess(`大包出库成功,共 ${result.successCount} 票`)
|
||||
handleReset(false)
|
||||
await loadRecent()
|
||||
maybeRefocusScan()
|
||||
} catch (e: any) {
|
||||
showError(e?.message || t('operation.outbound.message.outboundFailed'))
|
||||
maybeRefocusScan()
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
const ok = await ensureOrderLookup()
|
||||
if (!ok) return
|
||||
if (!hasMetrics()) {
|
||||
|
||||
@ -643,6 +643,9 @@ async function loadRecent() {
|
||||
inbound: t('operation.printLabel.labelTemplate.inbound'),
|
||||
outbound: t('operation.printLabel.labelTemplate.outbound'),
|
||||
sku: t('operation.printLabel.labelTemplate.sku'),
|
||||
box: t('operation.printLabel.labelTemplate.box'),
|
||||
shipBag: t('operation.printLabel.labelTemplate.shipBag'),
|
||||
shipMaster: t('operation.printLabel.labelTemplate.shipMaster'),
|
||||
}
|
||||
recentOrders.value = (items || []).map((row: any, idx: number) => {
|
||||
const ok = row.printSuccess === 1 || row.printSuccess === true
|
||||
|
||||
@ -127,6 +127,81 @@
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ops-scan__row--setup {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 扫描模式 / 袋型分段:灰底白块选中,高度与 32px 工具栏按钮一致 */
|
||||
.ops-mode.arco-radio-group-button,
|
||||
.ops-mode {
|
||||
flex-shrink: 0;
|
||||
background: var(--color-fill-2) !important;
|
||||
border: 1px solid var(--color-border-2);
|
||||
border-radius: 4px;
|
||||
padding: 2px;
|
||||
gap: 0;
|
||||
|
||||
:deep(.arco-radio-button) {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
:deep(.arco-radio-button .arco-radio-button-content) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 64px;
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
border-radius: 3px;
|
||||
font-size: 13px;
|
||||
line-height: 28px;
|
||||
color: var(--color-text-2);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
|
||||
:deep(.arco-radio-button.arco-radio-checked .arco-radio-button-content) {
|
||||
color: var(--app-primary-color);
|
||||
font-weight: 600;
|
||||
background: var(--app-card-bg);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
:deep(.arco-radio-button:not(.arco-radio-checked):hover .arco-radio-button-content) {
|
||||
color: var(--app-primary-color);
|
||||
}
|
||||
|
||||
:deep(.arco-radio-disabled .arco-radio-button-content) {
|
||||
color: var(--color-text-4);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.ops-setup-btn {
|
||||
height: 32px !important;
|
||||
padding: 0 12px !important;
|
||||
border-radius: 4px !important;
|
||||
font-size: 14px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ops-resume-input {
|
||||
flex: 1 1 200px;
|
||||
min-width: 180px;
|
||||
max-width: 280px;
|
||||
|
||||
:deep(.arco-input-wrapper) {
|
||||
height: 32px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.ops-scan-input {
|
||||
width: 100%;
|
||||
|
||||
|
||||
@ -26,6 +26,8 @@ export const ORDER_COLUMN_LABEL_ZH: Record<string, string> = {
|
||||
clientNo: '客户单号',
|
||||
trackNo: '跟踪号',
|
||||
serviceNo: '运单号',
|
||||
shipBagNo: '大包号',
|
||||
shipMasterNo: '内部主单号',
|
||||
productCode: '产品编码',
|
||||
productName: '销售产品',
|
||||
maxTimeliness: '最大时效(天)',
|
||||
|
||||
@ -36,6 +36,8 @@ export const WAYBILL_MANAGE_COLUMN_CATALOG: OrderListColumnDef[] = [
|
||||
{ key: 'clientNo', labelKey: M('customerOrderNo'), width: 150 },
|
||||
{ key: 'trackNo', labelKey: M('trackingNo'), width: 160 },
|
||||
{ key: 'serviceNo', labelKey: M('waybillNo'), width: 200 },
|
||||
{ key: 'shipBagNo', labelKey: L('shipBagNo'), width: 150 },
|
||||
{ key: 'shipMasterNo', labelKey: L('shipMasterNo'), width: 150 },
|
||||
{ key: 'downstreamServiceNo', labelKey: M('downstreamServiceNo'), width: 180 },
|
||||
{ key: 'productCode', labelKey: L('productCode'), width: 110 },
|
||||
{ key: 'productName', labelKey: M('shippingMethod'), width: 120 },
|
||||
|
||||
@ -333,6 +333,8 @@
|
||||
serviceNo: serviceNo ?? '',
|
||||
clientNo: clientNo ?? '',
|
||||
trackNo: trackNo ?? '',
|
||||
shipBagNo: pick(raw, 'shipBagNo', 'ShipBagNo') ?? '',
|
||||
shipMasterNo: pick(raw, 'shipMasterNo', 'ShipMasterNo') ?? '',
|
||||
waybillNo,
|
||||
customerOrderNo: clientNo ?? '',
|
||||
trackingNo: trackNo ?? '',
|
||||
|
||||
@ -388,7 +388,8 @@ const contactRows = computed(() => [
|
||||
},
|
||||
])
|
||||
|
||||
function validateConfirmPassword(_rule: unknown, value: string, callback: (error?: string) => void) {
|
||||
// Arco Form:validator(value, callback)
|
||||
function validateConfirmPassword(value: string, callback: (error?: string) => void) {
|
||||
if (value !== pwdForm.newPassword) {
|
||||
callback(t('profile.passwordMismatch'))
|
||||
} else {
|
||||
|
||||
@ -197,7 +197,7 @@ export default defineConfig(({ mode }) => {
|
||||
secure: false,
|
||||
bypass(req) {
|
||||
const path = req.url?.split('?')[0] ?? '';
|
||||
const kbSpaPages = ['/kb/category', '/kb/article'];
|
||||
const kbSpaPages = ['/kb/category', '/kb/article', '/kb/training'];
|
||||
if (kbSpaPages.some((p) => path === p || path.startsWith(`${p}/`))) {
|
||||
return '/index.html';
|
||||
}
|
||||
@ -363,6 +363,10 @@ export default defineConfig(({ mode }) => {
|
||||
const operationSpaPrefixes = [
|
||||
'/operation/inboundScan',
|
||||
'/operation/outboundScan',
|
||||
'/operation/bagPack',
|
||||
'/operation/bagManage',
|
||||
'/operation/masterBoard',
|
||||
'/operation/masterBill',
|
||||
'/operation/printLabel',
|
||||
'/operation/parcelArrival',
|
||||
'/operation/fulfillPack',
|
||||
@ -669,6 +673,10 @@ export default defineConfig(({ mode }) => {
|
||||
// Operation 相关前端路由
|
||||
'/operation/inboundScan',
|
||||
'/operation/outboundScan',
|
||||
'/operation/bagPack',
|
||||
'/operation/bagManage',
|
||||
'/operation/masterBoard',
|
||||
'/operation/masterBill',
|
||||
'/operation/printLabel',
|
||||
'/operation/parcelArrival',
|
||||
'/operation/fulfillPack',
|
||||
@ -692,6 +700,7 @@ export default defineConfig(({ mode }) => {
|
||||
// Knowledge 前端路由(API 为 /kb/admin/*、/kb/portal/*)
|
||||
'/kb/category',
|
||||
'/kb/article',
|
||||
'/kb/training',
|
||||
// Finance 相关前端路由
|
||||
'/finance/rechargeRecord',
|
||||
'/finance/accountFlow',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user