添加市场

This commit is contained in:
liu
2026-08-20 15:39:39 +08:00
parent cd7007bc49
commit 22237a47e7
20 changed files with 134 additions and 239 deletions
+4 -3
View File
@@ -20,7 +20,7 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class ProductExport implements FromCollection, WithStrictNullComparison, WithStyles
{
/** 列头(与 ProductImport 的解析顺序一一对应,改动需同步) */
public const array HEADERS = ['品名', '分类', '供应商', '规格/包规', '单位', '成本价', '排序', '库存', '保质期', '状态', '备注'];
public const array HEADERS = ['品名', '分类', '供应商', '市场', '规格/包规', '单位', '成本价', '排序', '库存', '保质期', '状态', '备注'];
private ?Collection $rows = null;
@@ -46,7 +46,7 @@ class ProductExport implements FromCollection, WithStrictNullComparison, WithSty
$rows = [self::HEADERS];
if ($this->template) {
$rows[] = ['西红柿', '蔬菜/茄果类', '示例供应商', '10斤/箱', '斤', 2.5, 0, 100, 3, '上架', '示例行,导入前请删除'];
$rows[] = ['西红柿', '蔬菜/茄果类', '示例供应商', '新发地', '10斤/箱', '斤', 2.5, 0, 100, 3, '上架', '示例行,导入前请删除'];
return $this->rows = collect($rows);
}
@@ -65,6 +65,7 @@ class ProductExport implements FromCollection, WithStrictNullComparison, WithSty
$product->name,
$categoryPaths[(int) $product->category_id] ?? '',
$supplierNames[(int) $product->supplier_id] ?? '',
$product->market,
$product->spec,
$product->unit,
(float) $product->cost_price,
@@ -87,7 +88,7 @@ class ProductExport implements FromCollection, WithStrictNullComparison, WithSty
$this->collection();
$sheet->freezePane('A2');
$widths = [20, 16, 14, 14, 8, 10, 8, 8, 8, 8, 24];
$widths = [20, 16, 14, 12, 14, 8, 10, 8, 8, 8, 8, 24];
foreach ($widths as $index => $width) {
$sheet->getColumnDimension(Coordinate::stringFromColumnIndex($index + 1))->setWidth($width);
}