38e2ea1c6c
新增 ProductCategoryOption 模型 + repo(list/create/update/deleteCategory)+ provider(productCategoryListProvider),基础数据页加「香型」tab(增删改查、 搜索、导出,仅名称字段)。接通后端 /product-options/categories。 (原型 5-tab 整合是更大 IA 任务,本次先把香型管理补齐可用。) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
175 lines
4.2 KiB
Dart
175 lines
4.2 KiB
Dart
class ProductNameOption {
|
|
final int id;
|
|
final String? code;
|
|
final String name;
|
|
final String? remark;
|
|
|
|
const ProductNameOption({
|
|
required this.id,
|
|
this.code,
|
|
required this.name,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductNameOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductNameOption(
|
|
id: (json['id'] as num).toInt(),
|
|
code: json['code'] as String?,
|
|
name: json['name'] as String,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|
|
|
|
class ProductSeriesOption {
|
|
final int id;
|
|
final String? code;
|
|
final String name;
|
|
final String? remark;
|
|
|
|
const ProductSeriesOption({
|
|
required this.id,
|
|
this.code,
|
|
required this.name,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductSeriesOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductSeriesOption(
|
|
id: (json['id'] as num).toInt(),
|
|
code: json['code'] as String?,
|
|
name: json['name'] as String,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|
|
|
|
/// 香型 / 分类字典项(对应后端 ProductCategory)。
|
|
class ProductCategoryOption {
|
|
final int id;
|
|
final String name;
|
|
|
|
const ProductCategoryOption({required this.id, required this.name});
|
|
|
|
factory ProductCategoryOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductCategoryOption(
|
|
id: (json['id'] as num).toInt(),
|
|
name: json['name'] as String,
|
|
);
|
|
}
|
|
|
|
class ProductSpecOption {
|
|
final int id;
|
|
final String? code;
|
|
final String name;
|
|
final int quantity;
|
|
final String? remark;
|
|
|
|
const ProductSpecOption({
|
|
required this.id,
|
|
this.code,
|
|
required this.name,
|
|
this.quantity = 0,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductSpecOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductSpecOption(
|
|
id: (json['id'] as num).toInt(),
|
|
code: json['code'] as String?,
|
|
name: json['name'] as String,
|
|
quantity: (json['quantity'] as num?)?.toInt() ?? 0,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|
|
|
|
// ── 商品属性字典(产地/保质期/储存方式) ─────────────────────────
|
|
|
|
class ProductOriginOption {
|
|
final int id;
|
|
final String? code;
|
|
final String name;
|
|
final String? remark;
|
|
|
|
const ProductOriginOption({
|
|
required this.id,
|
|
this.code,
|
|
required this.name,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductOriginOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductOriginOption(
|
|
id: (json['id'] as num).toInt(),
|
|
code: json['code'] as String?,
|
|
name: json['name'] as String,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|
|
|
|
class ProductShelfLifeOption {
|
|
final int id;
|
|
final String? code;
|
|
final String name;
|
|
final String? remark;
|
|
|
|
const ProductShelfLifeOption({
|
|
required this.id,
|
|
this.code,
|
|
required this.name,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductShelfLifeOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductShelfLifeOption(
|
|
id: (json['id'] as num).toInt(),
|
|
code: json['code'] as String?,
|
|
name: json['name'] as String,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|
|
|
|
class ProductStorageOption {
|
|
final int id;
|
|
final String? code;
|
|
final String name;
|
|
final String? remark;
|
|
|
|
const ProductStorageOption({
|
|
required this.id,
|
|
this.code,
|
|
required this.name,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductStorageOption.fromJson(Map<String, dynamic> json) =>
|
|
ProductStorageOption(
|
|
id: (json['id'] as num).toInt(),
|
|
code: json['code'] as String?,
|
|
name: json['name'] as String,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|
|
|
|
// ── 描述文档 ─────────────────────────────────────────────────────
|
|
|
|
class ProductDescriptionDoc {
|
|
final int id;
|
|
final String title;
|
|
final String? content;
|
|
final String? remark;
|
|
|
|
const ProductDescriptionDoc({
|
|
required this.id,
|
|
required this.title,
|
|
this.content,
|
|
this.remark,
|
|
});
|
|
|
|
factory ProductDescriptionDoc.fromJson(Map<String, dynamic> json) =>
|
|
ProductDescriptionDoc(
|
|
id: (json['id'] as num).toInt(),
|
|
title: json['title'] as String,
|
|
content: json['content'] as String?,
|
|
remark: json['remark'] as String?,
|
|
);
|
|
}
|