diff --git a/deploy.sh b/deploy.sh index 0e61d40a..52bd99e7 100644 --- a/deploy.sh +++ b/deploy.sh @@ -10,6 +10,9 @@ LOCAL_DIST="./dist" # SSH 密钥提示:请确保本地已将 id_ed25519.pub 添加到服务器的 ~/.ssh/authorized_keys # 密钥内容:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJtwa+MFLQEgkEbcGQ6dkQOiFydRvjVeidJ/7uBsF2e 3313488199@qq.com +SSH_KEY="$HOME/.ssh/id_ed25519_admin" +SSH_OPTS="-i $SSH_KEY -o StrictHostKeyChecking=no" + echo "🚀 开始发布版本: $RELEASE_NAME" # 1. 本地打包 @@ -17,11 +20,11 @@ npm run build # 2. 压缩并上传 tar -czf dist.tar.gz -C $LOCAL_DIST . -ssh $USER@$IP "mkdir -p $BASE_PATH/releases/$RELEASE_NAME" -scp dist.tar.gz $USER@$IP:$BASE_PATH/releases/$RELEASE_NAME +ssh $SSH_OPTS $USER@$IP "mkdir -p $BASE_PATH/releases/$RELEASE_NAME" +scp $SSH_OPTS dist.tar.gz $USER@$IP:$BASE_PATH/releases/$RELEASE_NAME # 3. 远程解压、更新软链接、清理旧版本 -ssh $USER@$IP << EOF +ssh $SSH_OPTS $USER@$IP << EOF cd $BASE_PATH/releases/$RELEASE_NAME tar -xzf dist.tar.gz rm dist.tar.gz diff --git a/dist.tar.gz b/dist.tar.gz index 664644fc..b45650cf 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/src/api/index/index.ts b/src/api/index/index.ts index d465bbf5..0df94eec 100644 --- a/src/api/index/index.ts +++ b/src/api/index/index.ts @@ -13,7 +13,7 @@ export function fastWhereTree(type:any) { isSystemApi: true } as any) } -export function loadStores(type:any) { +export function loadStores() { return request({ url: '/system', method: 'post', @@ -22,7 +22,7 @@ export function loadStores(type:any) { v: '1.0', timestamp: new Date().getTime() }, - data: {type}, + data: {}, isSystemApi: true } as any) } diff --git a/src/api/waybill.warehouse/index.ts b/src/api/waybill.warehouse/index.ts index 1e6f589d..615ddf1f 100644 --- a/src/api/waybill.warehouse/index.ts +++ b/src/api/waybill.warehouse/index.ts @@ -14,6 +14,10 @@ export type WaybillWarehouseListWhere = { orderId?: number /** 订单号(模糊搜索,匹配 delivery_order_code 快照列) */ orderNo?: string + /** 运单类型:"main"/"1"=主单号,"child"/"2"=子单号 */ + waybillType?: string + /** 货主ID(等值匹配) */ + storeId?: number /** 物流公司编码(等值匹配),如 SF/YT/STO/ZTO 等 */ logisticsCode?: string /** 物流接口ID(等值匹配) */ diff --git a/src/views/express/waybill/config/template-config.ts b/src/views/express/waybill/config/template-config.ts index ef5d3352..5a09f0ea 100644 --- a/src/views/express/waybill/config/template-config.ts +++ b/src/views/express/waybill/config/template-config.ts @@ -55,6 +55,8 @@ export interface FieldDefinition { type: 'text' | 'select' | 'daterange' | 'number' group?: string options?: { label: string; value: any }[] + multiple?: boolean + filterable?: boolean } | null table: { minWidth?: number @@ -86,7 +88,8 @@ export const VALUE_MAPS: Record> = { '未分配': '未分配', '已分配': '已分配' }, waybillType: { - '主单号': '主单号', '子单号': '子单号' + '1': '主单号', '2': '子单号', + 'main': '主单号', 'child': '子单号' }, yesNo: { 'Y': '是', 'N': '否', @@ -212,11 +215,18 @@ export const FIELD_DICT: Record = { order_id: { key: 'order_id', label: '订单ID', - scanBox: null, + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, table: { minWidth: 90, align: 'center' }, slot: null, detailLabel: '订单ID' }, + keyword: { + key: 'keyword', + label: '关键词', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: null, + slot: null + }, business_key: { key: 'business_key', label: '业务键', @@ -236,7 +246,7 @@ export const FIELD_DICT: Record = { store_name: { key: 'store_name', label: '货主', - scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: [] }, + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: [], multiple: true, filterable: true }, table: { minWidth: 120, showOverflowTooltip: true }, slot: null, detailLabel: '货主名称' @@ -301,7 +311,7 @@ export const FIELD_DICT: Record = { logistics_interface_id: { key: 'logistics_interface_id', label: '物流接口ID', - scanBox: null, + scanBox: { type: 'text', group: SCANBOX_GROUPS.logistics }, table: { minWidth: 110, align: 'center' }, slot: null, detailLabel: '物流接口ID' @@ -326,7 +336,7 @@ export const FIELD_DICT: Record = { package_material_id: { key: 'package_material_id', label: '包材ID', - scanBox: null, + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, table: { minWidth: 90, align: 'center' }, slot: null, detailLabel: '包材ID' @@ -406,6 +416,13 @@ export const FIELD_DICT: Record = { slot: null, detailLabel: '称重重量' }, + hasWeighingWeight: { + key: 'hasWeighingWeight', + label: '是否已称重', + scanBox: { type: 'select', group: SCANBOX_GROUPS.status, options: getOptions('bool') }, + table: null, + slot: null + }, print_count: { key: 'print_count', label: '打印次数', @@ -439,13 +456,13 @@ export const FIELD_DICT: Record = { slot: null }, // —— 操作列 —— - operation: { - key: 'operation', - label: '操作', - scanBox: null, - table: { minWidth: 120, fixed: 'right', align: 'center' }, - slot: { type: 'operation' } - } + // operation: { + // key: 'operation', + // label: '操作', + // scanBox: null, + // table: { minWidth: 120, fixed: 'right', align: 'center' }, + // slot: { type: 'operation' } + // } } // ============================================================ @@ -582,6 +599,8 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig { type: def.scanBox.type, options: def.scanBox.options ? [...def.scanBox.options] : undefined, group: def.scanBox.group, + multiple: def.scanBox.multiple, + filterable: def.scanBox.filterable, required: (def.scanBox as any).required }) } @@ -654,30 +673,97 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig { } // ============================================================ -// 七、buildWhereConditions +// 七、buildWhereConditions(对齐 waybill.warehouse.list 接口文档) // ============================================================ + +/** ScanBox 字段 key → API where 字段名(snake_case → camelCase) */ +const WHERE_FIELD_MAP: Record = { + waybill_code: 'waybillCode', + main_waybill_code: 'mainWaybillCode', + order_no: 'orderNo', + order_id: 'orderId', + store_name: 'storeId', + logistics_code: 'logisticsCode', + logistics_interface_id: 'logisticsInterfaceId', + platform_code: 'platformCode', + is_back: 'isBack', + is_intercept: 'isIntercept', + is_galaxy_receive: 'isGalaxyReceive', + package_material_id: 'packageMaterialId', + waybill_type: 'waybillType', +} + +/** API where 字段期望类型(用于值类型转换) */ +const WHERE_FIELD_TYPE: Record = { + orderId: 'number', + storeId: 'number', + logisticsInterfaceId: 'number', + packageMaterialId: 'number', + status: 'number', + hasWeighingWeight: 'boolean', +} + +/** 将 ScanBox 值转换为 API 期望类型 */ +function coerceValue(value: any, apiKey: string): any { + const targetType = WHERE_FIELD_TYPE[apiKey] + if (!targetType) return value + if (targetType === 'number') { + if (Array.isArray(value)) return value.map((v: any) => Number(v)) + return Number(value) + } + if (targetType === 'boolean') { + if (Array.isArray(value)) return value.map((v: any) => v === 'true' || v === '1' || v === true || v === 1) + return value === 'true' || value === '1' || value === true || value === 1 + } + return value +} + export function buildWhereConditions(rawConditions: Record): Record { const where: Record = {} + for (const [key, cond] of Object.entries(rawConditions || {})) { - let value: any = undefined - if (cond && typeof cond === 'object' && 'operator' in cond) { - value = (cond as any).value - } else if (cond !== undefined && cond !== null && cond !== '') { - value = Array.isArray(cond) ? cond[0] ?? '' : cond + // 从 ScanBox 结构化条件 { value, operator, field, type, isMultiple } 中提取值 + let value: any + if (cond && typeof cond === 'object' && !Array.isArray(cond) && 'operator' in cond) { + if (['isnull', 'isnotnull'].includes(cond.operator)) continue + value = cond.value + } else { + value = cond } - if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) { + + // 跳过空值 + if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) { continue } + + // createdAtStart 日期范围 → 拆分为 createdAtStart / createdAtEnd + if (key === 'createdAtStart' && Array.isArray(value)) { + const [start, end] = value + if (start) where.createdAtStart = start + if (end) where.createdAtEnd = end + continue + } + + // 字段名映射(snake_case → camelCase) + const apiKey = WHERE_FIELD_MAP[key] || key + + // 类型转换(对齐 API 参数类型:number / boolean) + value = coerceValue(value, apiKey) + + // filterParamMap 值映射(仅单值) const def = FIELD_DICT[key] - if (def?.filterParamMap) { + if (def?.filterParamMap && !Array.isArray(value)) { const mapped = def.filterParamMap[String(value)] if (mapped !== undefined) { - where[key] = mapped + where[apiKey] = mapped continue } } - where[key] = value + + // 扁平传值(string / number / boolean / array) + where[apiKey] = value } + return where } @@ -760,12 +846,17 @@ export const tabPages: TabPageRawConfig[] = [ scanBoxFieldKeys: [ 'waybill_code', 'main_waybill_code', + 'keyword', 'waybill_type', + 'order_no', + 'order_id', 'store_name', 'logistics_code', + 'logistics_interface_id', 'platform_code', 'status', - 'pack_status', + 'package_material_id', + 'hasWeighingWeight', 'is_back', 'is_intercept', 'is_galaxy_receive', @@ -871,11 +962,6 @@ export const tabPages: TabPageRawConfig[] = [ }, buildListParams({ pagination, conditions, sort }) { const where = buildWhereConditions(conditions) - if (conditions?.createdAtStart && Array.isArray(conditions.createdAtStart)) { - const [start, end] = conditions.createdAtStart - if (start) where.createdAtStart = start - if (end) where.createdAtEnd = end - } const params: Record = { pagination: { page: pagination.page, pageSize: pagination.pageSize }, where diff --git a/src/views/express/waybill/index.vue b/src/views/express/waybill/index.vue index bfa79286..551201c7 100644 --- a/src/views/express/waybill/index.vue +++ b/src/views/express/waybill/index.vue @@ -334,13 +334,13 @@ function injectScanBoxOptions(fieldValue: string, options: { label: string; valu async function loadScanBoxOptions() { try { const [expressRes, platformRes, storesRes] = await Promise.all([ - getExpressList({}), - getPlatformList({}), - loadStores({ type: 'order' }) + getExpressList({ systemOnly: true }), + getPlatformList({ systemOnly: true }), + loadStores() ]) const expressRaw: any[] = expressRes?.data?.list ?? expressRes?.data ?? [] const platformRaw: any[] = platformRes?.data?.list ?? platformRes?.data ?? [] - const storesRaw: any[] = storesRes?.data?.list ?? storesRes?.data ?? [] + const storesRaw: any[] = storesRes?.stores ?? [] const expressOptions = expressRaw.map((item: any) => ({ label: `${item.code ?? item.logistics_code ?? ''} — ${item.name ?? item.logistics_name ?? ''}`, @@ -353,9 +353,9 @@ async function loadScanBoxOptions() { })).filter((opt: any) => opt.value) const storeOptions = storesRaw.map((item: any) => ({ - label: item.name ?? item.store_name ?? '', - value: String(item.name ?? item.store_name ?? '') - })).filter((opt: any) => opt.value) + label: item.label ?? item.name ?? item.store_name ?? '', + value: item.value ?? item.id ?? item.store_id + })).filter((opt: any) => opt.value != null && opt.value !== '') injectScanBoxOptions('logistics_code', expressOptions) injectScanBoxOptions('platform_code', platformOptions) @@ -505,11 +505,6 @@ const { function buildExportAllPayload() { const conditions = scanBoxRef.value?.getConditions?.() || {} const where = buildWhereConditions(conditions) - if (conditions?.createdAtStart && Array.isArray(conditions.createdAtStart)) { - const [start, end] = conditions.createdAtStart - if (start) where.createdAtStart = start - if (end) where.createdAtEnd = end - } return { where, sort: currentSort.prop @@ -708,7 +703,7 @@ const handleRowClick = async (row: Record) => { try { const detailRes = await waybillWarehouseDetail({ id: row.id, - waybill_code: row.waybill_code + waybillCode: row.waybill_code }) if (detailRes && (detailRes.code === 1 || detailRes.code === 200)) { const raw = detailRes.data ?? detailRes diff --git a/src/views/order/orderManagement/archiveOrder.vue b/src/views/order/orderManagement/archiveOrder.vue index e3a5fe51..fe071174 100644 --- a/src/views/order/orderManagement/archiveOrder.vue +++ b/src/views/order/orderManagement/archiveOrder.vue @@ -1,4 +1,4 @@ -