fix(intake): move import rowNumber off the shared sku export row type
the optional numeric rowNumber on NonIntegratedSkuExportRow broke the dynamic template column writes (string vs never) in the production build type check; import rows now use a dedicated NonIntegratedSkuImportRow type that extends the export row with a required rowNumber.
This commit is contained in:
parent
4f6510271f
commit
2dbb214006
@ -24,12 +24,15 @@ export type NonIntegratedSkuExportRow = {
|
||||
batchNo: string
|
||||
batchChangeType: string
|
||||
dingTalkFlowNo: string
|
||||
rowNumber?: number
|
||||
}
|
||||
|
||||
export type NonIntegratedSkuImportRow = NonIntegratedSkuExportRow & {
|
||||
rowNumber: number
|
||||
}
|
||||
|
||||
export function findSkuImportSpuPrefixErrors(
|
||||
rows: ReadonlyArray<
|
||||
Pick<NonIntegratedSkuExportRow, 'skuCode'> & { rowNumber?: number }
|
||||
Pick<NonIntegratedSkuImportRow, 'skuCode' | 'rowNumber'>
|
||||
>,
|
||||
spu: string,
|
||||
) {
|
||||
@ -65,7 +68,7 @@ export type NonIntegratedSkuFuzzyImportRow = {
|
||||
export type NonIntegratedSkuWorkbookImport =
|
||||
| {
|
||||
mode: "standard"
|
||||
rows: NonIntegratedSkuExportRow[]
|
||||
rows: NonIntegratedSkuImportRow[]
|
||||
sheetName: string
|
||||
}
|
||||
| {
|
||||
@ -389,7 +392,7 @@ export async function parseNonIntegratedSkuWorkbook(
|
||||
if (missingLabels.length === 0) {
|
||||
const rows = sheetRows
|
||||
.slice(headerRowIndex + 1)
|
||||
.map((row, index) => {
|
||||
.map((row, index): NonIntegratedSkuImportRow => {
|
||||
const importRow = createEmptyImportRow()
|
||||
for (const column of NON_INTEGRATED_SKU_TEMPLATE_COLUMNS) {
|
||||
const cellIndex = headerIndexByLabel.get(column.label)
|
||||
@ -398,8 +401,7 @@ export async function parseNonIntegratedSkuWorkbook(
|
||||
? ''
|
||||
: normalizeWorkbookCellValue(row[cellIndex])
|
||||
}
|
||||
importRow.rowNumber = headerRowIndex + index + 2
|
||||
return importRow
|
||||
return { ...importRow, rowNumber: headerRowIndex + index + 2 }
|
||||
})
|
||||
.filter((row) =>
|
||||
NON_INTEGRATED_SKU_TEMPLATE_COLUMNS.some(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user