fix(category-config): 规模行导入表头对齐导出格式(含一级类目/分类/带单位列名)

导入、导出、下载模板三处表头统一为导出格式;导入兼容带单位列名(业绩起点(元)/日销起点(件/天)),一级类目与分类列接受但忽略
This commit is contained in:
WuYongJie 2026-09-24 15:00:27 +08:00
parent fddf877d9e
commit d42d500071
2 changed files with 8 additions and 3 deletions

View File

@ -6,10 +6,14 @@ import { handleRequest, jsonError } from '@/server/core/response'
import { supplyChainProductArchiveCategoryScaleRowService } from '@/server/services/supply-chain-product-archive-category-scale-row.service'
const HEADER_MAP: Record<string, string> = {
一级类目: 'categoryL1',
二级类目: 'categoryL2',
分类: 'categoryGroup',
规模标签: 'scaleLabel',
'业绩起点(元)': 'performanceStart',
业绩起点: 'performanceStart',
业绩终点: 'performanceEnd',
'日销起点(件/天)': 'dailySalesStart',
日销起点: 'dailySalesStart',
日销终点: 'dailySalesEnd',
categoryL2: 'categoryL2',

View File

@ -185,11 +185,12 @@ export function CategoryConfigPanel({ canEdit }: { canEdit: boolean }) {
const downloadTemplate = async () => {
const XLSX = await import('xlsx')
const headers = ['二级类目', '规模标签', '业绩起点', '业绩终点', '日销起点', '日销终点']
// 模板表头与导出完全一致,导出文件可直接回导
const headers = ['一级类目', '二级类目', '分类', '规模标签', '业绩起点(元)', '业绩终点', '日销起点(件/天)', '日销终点']
const sheet = XLSX.utils.aoa_to_sheet([
headers,
['住宅家具 - 书架', '爆款', 48000, '', 20, ''],
['住宅家具 - 书架', '热卖款', 36000, 48000, 10, 20],
['桌类', '住宅家具 - 书桌', '电脑桌/书桌', '爆款', 60000, '', 20, ''],
['桌类', '住宅家具 - 书桌', '电脑桌/书桌', '热卖款', 48000, 72000, 10, 20],
])
sheet['!cols'] = headers.map((header) => ({ wch: Math.max(14, header.length * 2 + 6) }))
const workbook = XLSX.utils.book_new()