Update App.jsx via upload script - 2026-11-05 14:51:51
This commit is contained in:
parent
6a9b7aa4c6
commit
1db22f88e7
11
App.jsx
11
App.jsx
|
|
@ -842,12 +842,19 @@ function productExportRows(p, categories) {
|
|||
|
||||
// 收集导出这份产品规格书需要翻译的全部词条(字段名 + 品类/机型这些中文数值 + 备注自由文本)
|
||||
// 按型号名称去重合并:"同一个型号只能存在1个"——如果传入的产品和列表里某个已有产品
|
||||
// 型号名称相同(但不是同一条记录本身),说明是重复建了同型号,这时用新参数覆盖旧记录
|
||||
// 型号名称相同、细分品类也相同(但不是同一条记录本身),说明是重复建了同型号,这时用新参数覆盖旧记录
|
||||
// (复用旧记录的id),但保留旧记录里手动维护的图片/对客卖点/正本价格/内部备注,不会被
|
||||
// 这次导入/新建的技术参数覆盖清空(因为AI批量导入/新建产品表单都不会填这几项)。
|
||||
// 如果传入的产品本身就是列表里已有的那一条(正常编辑保存),走普通按id更新。
|
||||
// 判断"同一个型号":型号名称相同,并且细分品类相同(或其中一个没填细分品类)。
|
||||
// 型号相同但细分品类不同的算两个产品——比如壁挂式储能一体机和落地式储能一体机都叫"2.5kWh + 3kW",各自保留,不互相覆盖。
|
||||
function sameModel(a, b) {
|
||||
if (String(a.name || '').trim() !== String(b.name || '').trim()) return false;
|
||||
const ta = String(a.type || '').trim(), tb = String(b.type || '').trim();
|
||||
return !ta || !tb || ta === tb;
|
||||
}
|
||||
function upsertProductByName(list, product) {
|
||||
const dupIdx = list.findIndex(p => p.id !== product.id && p.name.trim() === product.name.trim());
|
||||
const dupIdx = list.findIndex(p => p.id !== product.id && sameModel(p, product));
|
||||
const selfIdx = list.findIndex(p => p.id === product.id);
|
||||
if (dupIdx !== -1) {
|
||||
const existing = list[dupIdx];
|
||||
|
|
|
|||
Loading…
Reference in New Issue