diff --git a/src/views/material/packageMaterial/component/BatchImportDialog.vue b/src/views/material/packageMaterial/component/BatchImportDialog.vue
new file mode 100644
index 00000000..73c8286c
--- /dev/null
+++ b/src/views/material/packageMaterial/component/BatchImportDialog.vue
@@ -0,0 +1,440 @@
+
+
+
+
+ 选择Excel
+ 下载模板
+ 清除数据
+ 只重试失败
+ 导入
+ 已选文件:{{ fileName || '未选择' }}
+
+
+
+
+
+ {{ row.row_no }}
+
+
+
+ {{ row.material_code || '--' }}
+
+
+
+
+ {{ row.material_name || '--' }}
+
+
+
+ {{ formatCellNumber(row.length) }}
+
+
+ {{ formatCellNumber(row.width) }}
+
+
+ {{ formatCellNumber(row.height) }}
+
+
+ {{ formatCellNumber(row.weight) }}
+
+
+ {{ formatCellNumber(row.cost_price) }}
+
+
+ {{ formatStatusLabel(row.status) }}
+
+
+ 成功
+ 失败
+ 待导入
+
+
+ {{ row.import_message || '--' }}
+
+
+
+ 重试
+
+ --
+
+
+
+
+
+ 关闭
+
+
+
+
+
+
+
diff --git a/src/views/material/packageMaterial/index.vue b/src/views/material/packageMaterial/index.vue
index a86b8376..ca3e3c8c 100644
--- a/src/views/material/packageMaterial/index.vue
+++ b/src/views/material/packageMaterial/index.vue
@@ -29,7 +29,10 @@
共 {{ pagination.total }} 条
- 新增包材
+
+ 新增包材
+ 批量导入
+
@@ -186,6 +189,8 @@
保存
+
+
@@ -195,6 +200,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
+import BatchImportDialog from './component/BatchImportDialog.vue'
import {
packageMaterialCreate,
packageMaterialDelete,
@@ -240,6 +246,7 @@ const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const dialogMode = ref<'create' | 'edit'>('create')
+const batchImportVisible = ref(false)
const formRef = ref()
const formData = reactive({
id: undefined as number | undefined,
@@ -518,6 +525,14 @@ function handleBatchDelete() {
.catch(() => undefined)
}
+function openBatchImport() {
+ batchImportVisible.value = true
+}
+
+function onBatchImportSuccess() {
+ loadList()
+}
+
onMounted(() => {
loadList()
})
@@ -558,6 +573,13 @@ onMounted(() => {
min-width: 0;
}
+ .toolbar-right {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-shrink: 0;
+ }
+
.upper-wrapper {
flex: 1 1 auto;
min-height: 0;
diff --git a/src/views/order/orderManagement/archiveOrder.vue b/src/views/order/orderManagement/archiveOrder.vue
index 86955fc6..9de4fa26 100644
--- a/src/views/order/orderManagement/archiveOrder.vue
+++ b/src/views/order/orderManagement/archiveOrder.vue
@@ -77,6 +77,7 @@
+
@@ -89,6 +90,9 @@
+
+
+
@@ -141,6 +145,7 @@ import {
} from './config/order-common-config'
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
+import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
import log from './component/log.vue'
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
import { createOrderPageExport } from './utils/order-page-export'
diff --git a/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue b/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue
index 3f629311..049ffa43 100644
--- a/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue
+++ b/src/views/order/orderManagement/component/CreatePendingOrderDialog.vue
@@ -211,7 +211,7 @@
clearable
placeholder="请选择省"
:disabled="isPreviewRowLocked(row)"
- @change="(code: any) => handlePreviewProvinceChange(row, code)"
+ @change="onProvinceChange(row)"
>
handlePreviewCityChange(row, code)"
+ @change="onCityChange(row)"
>
handlePreviewAreaChange(row, code)"
+ @change="onAreaChange(row)"
>
) {
return resolveRegionCodesFromNames({
province_name: row.province,
diff --git a/src/views/order/orderManagement/component/ExpressWaybillPanel.vue b/src/views/order/orderManagement/component/ExpressWaybillPanel.vue
index cab60737..d8a1e4c1 100644
--- a/src/views/order/orderManagement/component/ExpressWaybillPanel.vue
+++ b/src/views/order/orderManagement/component/ExpressWaybillPanel.vue
@@ -14,6 +14,7 @@
+
{{ formatWeight(row.weighing_weight) }}
diff --git a/src/views/order/orderManagement/config/order-common-config.ts b/src/views/order/orderManagement/config/order-common-config.ts
index 0d5c4264..27b6d08d 100644
--- a/src/views/order/orderManagement/config/order-common-config.ts
+++ b/src/views/order/orderManagement/config/order-common-config.ts
@@ -656,7 +656,7 @@ export const pendingOrderDetailSections: OrderDetailSectionConfig[] = [
{ prop: 'sys_platform_name', label: '来源' },
{ prop: 'sys_platform_code', label: '平台编码', tag: true },
{ prop: 'source_platform_name', label: '来源平台名' },
- { prop: 'source_order_codes', label: '来源单号' },
+ { prop: 'source_order_codes', label: '平台交易单号' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
@@ -1063,7 +1063,7 @@ export const deliveryColumns = [
{ prop: 'sys_logistics_name', label: '系统快递', width: '120' },
{ prop: 'express_numbers', label: '运单号', width: '160', formatter: waybillCodesFormatter },
{ prop: 'waybill_codes', label: '运单号', width: '150', formatter: waybillCodesFormatter },
- { prop: 'source_order_codes', label: '来源单号', width: '140' },
+ { prop: 'source_order_codes', label: '平台交易单号', width: '140' },
{ prop: 'is_urgency', label: '是否紧急', width: '80' },
{ prop: 'invoice_flag', label: '发票', width: '80' },
{ prop: 'weight_type', label: '重量类型', width: '90' },
@@ -1246,7 +1246,7 @@ export const reviewOrderDetail = [
{ prop: 'invoice_flag', label: '发票标记' },
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'inspection_status', label: '审核状态' },
- { prop: 'source_order_codes', label: '来源单号' },
+ { prop: 'source_order_codes', label: '平台交易单号' },
{ prop: 'pay_no', label: '支付单号' },
// 金额与商品
@@ -1388,6 +1388,7 @@ export const pendingCloums = [
{ prop: 'pay_time', label: '支付时间', width: '160', formatter: orderTimeFormatter },
{ prop: 'place_order_time', label: '时效', width: '165', formatter: orderTimeFormatter },
{ prop: 'sys_platform_name', label: '来源', width: '120' },
+ { prop: 'source_order_codes', label: '平台交易单号', width: '140' },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'remark', label: '留言', width: '160' },
]
@@ -1402,7 +1403,7 @@ export const ORDER_LIST_FIELD_LABELS: Record = {
order_code: '发货单号',
sys_platform_code: '平台编码',
total_amount: '订单金额',
- source_order_codes: '来源单号',
+ source_order_codes: '平台交易单号',
order_type: '订单类型',
buyer_nick: '买家昵称',
pre_delivery_order_code: '前置单号',
@@ -1457,7 +1458,7 @@ export const pendingOrderDetail = [
{ prop: 'sync_status', label: '同步状态' },
{ prop: 'is_urgency', label: '是否紧急' },
{ prop: 'invoice_flag', label: '发票标记' },
- { prop: 'source_order_codes', label: '来源单号' },
+ { prop: 'source_order_codes', label: '平台交易单号' },
{ prop: 'pay_no', label: '支付单号' },
// 金额与商品
diff --git a/src/views/order/orderManagement/deliveryOrder.vue b/src/views/order/orderManagement/deliveryOrder.vue
index f53d7307..20d8f72e 100644
--- a/src/views/order/orderManagement/deliveryOrder.vue
+++ b/src/views/order/orderManagement/deliveryOrder.vue
@@ -162,6 +162,7 @@
+
@@ -178,6 +179,9 @@
+
+
+
@@ -237,6 +241,7 @@ import {
} from './config/order-common-config'
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
+import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
import log from './component/log.vue'
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
diff --git a/src/views/order/orderManagement/pendingOrder.vue b/src/views/order/orderManagement/pendingOrder.vue
index 462fc5c7..d0211c5a 100644
--- a/src/views/order/orderManagement/pendingOrder.vue
+++ b/src/views/order/orderManagement/pendingOrder.vue
@@ -168,7 +168,7 @@
-
+
diff --git a/src/views/order/waveOrder/SandanWaveBatchListPanel.vue b/src/views/order/waveOrder/SandanWaveBatchListPanel.vue
index 36addc82..ca002341 100644
--- a/src/views/order/waveOrder/SandanWaveBatchListPanel.vue
+++ b/src/views/order/waveOrder/SandanWaveBatchListPanel.vue
@@ -426,7 +426,6 @@
:error-message="platformPrintErrorMessage"
:payload="platformPrintPayload"
:request-meta="platformPrintRequestMeta"
- enable-printer-picker
@refresh="handlePlatformPrintDialogRefresh"
@print-success="handlePlatformPrintListRefresh"
/>
diff --git a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue
index 502969d2..7a5719f8 100644
--- a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue
+++ b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue
@@ -13,21 +13,23 @@
-
-
-
-
+
+
+
+
+
+
-
+
@@ -202,21 +204,32 @@
关闭
-
- 打印到打印台
-
-
- 浏览器打印
-
+
+
+ 打印
+
+
+ ▾
+
+
+
+ 打印到打印台 {{ printMode === 'station' ? '✓' : '' }}
+
+
+ 浏览器打印 {{ printMode === 'browser' ? '✓' : '' }}
+
+
+
+
+
@@ -237,7 +250,6 @@ import {
buildWaveGroupsForNotifyLock,
collectWavePlatformPrintComponents,
fetchConnectedComponentPrinters,
- parseExpressPrinterMapFromStationDetail,
sendWavePlatformBrowserPrint,
type BrowserWavePrintItemResult
} from '../config/print'
@@ -270,8 +282,6 @@ const props = defineProps<{
errorMessage: string
payload: WavePlatformPrintDataPayload | null
requestMeta: { warehouse_id: number; wave_ids: Array } | null
- /** 散单波次等场景:展示本机打印机选择 */
- enablePrinterPicker?: boolean
}>()
const emit = defineEmits<{
@@ -281,6 +291,10 @@ const emit = defineEmits<{
}>()
const printRootRef = ref(null)
+
+// 模块级缓存:打印台列表不常变,弹窗关闭再打开时复用
+let _cachedStationOptions: StationOption[] | null = null
+
/** 下拉值使用打印台主键 stationId(print.send express 的 printStationId);computer_id_legacy 用于迁移旧版本地存储 */
type StationOption = {
stationId: string
@@ -306,7 +320,40 @@ const printSettings = reactive({
defaultPrinter: '' as string
})
-const enablePrinterPicker = computed(() => props.enablePrinterPicker === true)
+const WAVE_PRINT_MODE_KEY = 'wave_platform_print_mode'
+const printMode = ref(loadPrintMode())
+
+function loadPrintMode(): string {
+ try {
+ return localStorage.getItem(WAVE_PRINT_MODE_KEY) || 'station'
+ } catch {
+ return 'station'
+ }
+}
+
+function savePrintMode(mode: string) {
+ try {
+ localStorage.setItem(WAVE_PRINT_MODE_KEY, mode)
+ } catch {
+ // ignore
+ }
+}
+
+function handlePrintModeSwitch(mode: string) {
+ printMode.value = mode
+ savePrintMode(mode)
+ if (mode === 'browser') {
+ loadPrinterOptions()
+ }
+}
+
+function handlePrint() {
+ if (printMode.value === 'station') {
+ printToStation()
+ } else {
+ printReport()
+ }
+}
const visibleProxy = computed({
get: () => props.modelValue,
@@ -367,9 +414,8 @@ watch(
void (async () => {
resetExpressPrinterOverrides()
await loadStationOptions()
- if (enablePrinterPicker.value) {
+ if (printMode.value === 'browser') {
await loadPrinterOptions()
- await applyStationPrinterDefaults()
}
})()
} else {
@@ -384,11 +430,10 @@ watch(
// 父级刷新到新 payload 后,清空本地已解锁过滤,确保页面展示后端最新状态
unlockedPlatformKeys.value = new Set()
unlockingPlatformKey.value = ''
- if (props.modelValue && enablePrinterPicker.value) {
+ if (props.modelValue && printMode.value === 'browser') {
void (async () => {
resetExpressPrinterOverrides()
await loadPrinterOptions()
- await applyStationPrinterDefaults()
})()
}
}
@@ -762,6 +807,13 @@ function mapStationRow(item: Record): StationOption {
async function loadStationOptions() {
stationLoading.value = true
try {
+ // 优先使用缓存,避免弹窗每次打开都请求
+ if (_cachedStationOptions) {
+ stationOptions.value = _cachedStationOptions
+ const savedStation = getSavedStationId()
+ if (savedStation) printSettings.station = savedStation
+ return
+ }
const stations: any = await stationApi.getList({ page: 1, pageSize: 100, where: {} })
if (!isApiSuccess(stations)) {
stationOptions.value = []
@@ -771,6 +823,7 @@ async function loadStationOptions() {
}
const rawList = extractPrintStationRows(stations)
stationOptions.value = rawList.filter((x) => x && typeof x === 'object').map((item: any) => mapStationRow(item))
+ _cachedStationOptions = stationOptions.value
// 初始化默认打印台:优先本地存储,其次当前值,最后回退到首项
const savedStation = getSavedStationId()
@@ -822,9 +875,8 @@ async function handleStationChange(val: string | number) {
return
}
saveStationId(stationId)
- if (enablePrinterPicker.value) {
+ if (printMode.value === 'browser') {
await loadComputerPrintersForStation(stationId).then((names) => mergePrinterOptionNames(names))
- await applyStationPrinterDefaults()
}
}
@@ -848,25 +900,32 @@ function mergePrinterOptionNames(names: string[]) {
printerOptions.value = [...merged.values()].sort((a, b) => a.label.localeCompare(b.label, 'zh-CN'))
}
+const _printerCache = new Map>()
+
async function loadComputerPrintersForStation(stationId: string): Promise {
const station = stationOptions.value.find((item) => item.stationId === stationId)
const computerId = String(station?.computer_id_legacy || '').trim()
if (!computerId) return []
- try {
- const res: any = await stationApi.getComputerPrinter(computerId)
- if (!isApiSuccess(res)) return []
- const root = res?.data
- const printerList = Array.isArray(root) ? root : Array.isArray(root?.list) ? root.list : []
- return printerList
- .map((item: any) => String(item?.name ?? item?.printerName ?? item ?? '').trim())
- .filter(Boolean)
- } catch {
- return []
- }
+ // 缓存 Promise 防止并发竞态,同一 computerId 并发调用共享同一个请求
+ if (_printerCache.has(computerId)) return _printerCache.get(computerId)!
+ const promise = (async () => {
+ try {
+ const res: any = await stationApi.getComputerPrinter(computerId)
+ if (!isApiSuccess(res)) return [] as string[]
+ const root = res?.data
+ const printerList = Array.isArray(root) ? root : Array.isArray(root?.list) ? root.list : []
+ return printerList
+ .map((item: any) => String(item?.name ?? item?.printerName ?? item ?? '').trim())
+ .filter(Boolean)
+ } catch {
+ return [] as string[]
+ }
+ })()
+ _printerCache.set(computerId, promise)
+ return promise
}
async function loadPrinterOptions() {
- if (!enablePrinterPicker.value) return
printerLoading.value = true
try {
usePrinterComponentStore().refreshFromRuntime()
@@ -902,34 +961,6 @@ async function loadPrinterOptions() {
}
}
-async function applyStationPrinterDefaults() {
- const stationId = String(printSettings.station || '').trim()
- if (!stationId) return
-
- const { defaultPrinter, expressPrinterMap } = await loadStationPrinterBindings(stationId)
- mergePrinterOptionNames([defaultPrinter, ...Object.values(expressPrinterMap)])
-
- const computerPrinters = await loadComputerPrintersForStation(stationId)
- mergePrinterOptionNames(computerPrinters)
-
- const saved = getSavedDefaultPrinter()
- if (saved && printerOptions.value.some((item) => item.value === saved)) {
- printSettings.defaultPrinter = saved
- } else if (defaultPrinter) {
- printSettings.defaultPrinter = defaultPrinter
- }
-
- uniqueExpressList.value.forEach((item) => {
- const code = item.sys_logistics_code
- const name = item.sys_logistics_name
- const mapped = (code && expressPrinterMap[code]) || (name && expressPrinterMap[name]) || ''
- if (mapped) {
- expressPrinterOverrides[item.key] = mapped
- mergePrinterOptionNames([mapped])
- }
- })
-}
-
function handleDefaultPrinterChange(val: string | number) {
const printer = String(val || '').trim()
if (!printer) {
@@ -1073,54 +1104,6 @@ function clearSavedStationId() {
}
}
-function unwrapPrintStationRecord(data: unknown): Record {
- if (!data || typeof data !== 'object') return {}
- const root = data as Record
- if (root.data && typeof root.data === 'object' && !Array.isArray(root.data)) {
- return root.data as Record
- }
- return root
-}
-
-async function loadStationPrinterBindings(stationId: string) {
- console.log('[wave browser print] loadStationPrinterBindings: 开始', { stationId })
- const fallback = stationOptions.value.find((item) => item.stationId === stationId)
- const fallbackDefault = fallback?.default_printer_name ?? ''
- try {
- const res: any = await stationApi.getItem(stationId)
- if (!isApiSuccess(res)) {
- console.log('[wave browser print] loadStationPrinterBindings: API 失败,使用 fallback', {
- stationId,
- fallbackDefault,
- })
- return {
- defaultPrinter: fallbackDefault,
- expressPrinterMap: {} as Record
- }
- }
- const parsed = parseExpressPrinterMapFromStationDetail(unwrapPrintStationRecord(res?.data ?? res))
- console.log('[wave browser print] loadStationPrinterBindings: 成功', {
- stationId,
- defaultPrinter: parsed.defaultPrinter || fallbackDefault,
- expressPrinterMap: parsed.expressPrinterMap,
- })
- return {
- defaultPrinter: parsed.defaultPrinter || fallbackDefault,
- expressPrinterMap: parsed.expressPrinterMap
- }
- } catch (error) {
- console.log('[wave browser print] loadStationPrinterBindings: 异常,使用 fallback', {
- stationId,
- fallbackDefault,
- error,
- })
- return {
- defaultPrinter: fallbackDefault,
- expressPrinterMap: {} as Record
- }
- }
-}
-
async function printReport() {
console.log('[wave browser print] printReport: 用户点击浏览器打印')
@@ -1168,23 +1151,15 @@ async function printReport() {
console.log('[wave browser print] printReport: 刷新打印组件 runtime 状态')
usePrinterComponentStore().refreshFromRuntime()
- const hasStation = String(printSettings.station || '').trim().length > 0
- const { defaultPrinter: stationDefaultPrinter, expressPrinterMap: stationExpressMap } = hasStation
- ? await loadStationPrinterBindings(printSettings.station)
- : { defaultPrinter: '', expressPrinterMap: {} as Record }
+ const userDefaultPrinter = String(printSettings.defaultPrinter || '').trim()
+ const expressPrinterMap = buildEffectiveExpressPrinterMap({})
- const userDefaultPrinter = String(printSettings.defaultPrinter || stationDefaultPrinter || '').trim()
- const expressPrinterMap = enablePrinterPicker.value
- ? buildEffectiveExpressPrinterMap(stationExpressMap)
- : stationExpressMap
-
- if (enablePrinterPicker.value && !userDefaultPrinter && !Object.keys(expressPrinterMap).length) {
+ if (!userDefaultPrinter && !Object.keys(expressPrinterMap).length) {
ElMessage.warning('请选择默认打印机,或为各快递指定打印机')
return
}
console.log('[wave browser print] printReport: 打印机映射来源', {
- hasStation,
userDefaultPrinter,
expressPrinterMapKeys: Object.keys(expressPrinterMap),
})