Update App.jsx via upload script - 2026-08-02 17:30:20

This commit is contained in:
mike 2026-08-02 17:30:42 +08:00
parent 50e76b2594
commit 98e2e1bf70
1 changed files with 44 additions and 0 deletions

44
App.jsx
View File

@ -592,6 +592,11 @@ function productExportRows(p, categories) {
if (p.powerOrCapacity) rows.push({ labelKey: '功率 / 容量', value: p.powerOrCapacity }); if (p.powerOrCapacity) rows.push({ labelKey: '功率 / 容量', value: p.powerOrCapacity });
if (p.voltage) rows.push({ labelKey: '电压', value: p.voltage }); if (p.voltage) rows.push({ labelKey: '电压', value: p.voltage });
} }
// ""AIschema
//
(p.extraSpecs || []).forEach(item => {
if (item && item.label && item.value) rows.push({ labelKey: item.label, value: item.value });
});
return rows; return rows;
} }
@ -773,6 +778,9 @@ const blankProduct = () => ({
netWeight: '', // (kg)UPS/线/线UPS netWeight: '', // (kg)UPS/线/线UPS
productImageFileName: '', productImageOriginalName: '', // PDF productImageFileName: '', productImageOriginalName: '', // PDF
sellingPoints: '', // /costPrice/notes sellingPoints: '', // /costPrice/notes
extraSpecs: [], // "" [{label:'', value:'Type II'}]
// AIschema
//
costPrice: '', notes: '', costPrice: '', notes: '',
}); });
@ -833,6 +841,9 @@ function powerInfoItems(p, categories) {
if (p.safetyStandard) items.push({ key: 'safetystd', label: '安规/EMC标准', value: p.safetyStandard }); if (p.safetyStandard) items.push({ key: 'safetystd', label: '安规/EMC标准', value: p.safetyStandard });
if (p.gridStandard) items.push({ key: 'gridstd', label: '并网标准', value: p.gridStandard }); if (p.gridStandard) items.push({ key: 'gridstd', label: '并网标准', value: p.gridStandard });
if (p.otherStandard) items.push({ key: 'otherstd', label: '其他标准', value: p.otherStandard }); if (p.otherStandard) items.push({ key: 'otherstd', label: '其他标准', value: p.otherStandard });
(p.extraSpecs || []).forEach((item, idx) => {
if (item && item.label && item.value) items.push({ key: 'extraspec' + idx, label: item.label, value: item.value });
});
return items; return items;
} }
if (isBatteryCategory(cat) && p.type === 'UPS配套锂电池系统') { if (isBatteryCategory(cat) && p.type === 'UPS配套锂电池系统') {
@ -859,6 +870,9 @@ function powerInfoItems(p, categories) {
if (p.cabinetWeight) items.push({ key: 'cabinetweight', label: '系统柜重量(kg)', value: p.cabinetWeight }); if (p.cabinetWeight) items.push({ key: 'cabinetweight', label: '系统柜重量(kg)', value: p.cabinetWeight });
if (p.altitude) items.push({ key: 'altitude', label: '海拔(m)', value: p.altitude }); if (p.altitude) items.push({ key: 'altitude', label: '海拔(m)', value: p.altitude });
if (p.selfDischargeRate) items.push({ key: 'selfdischarge', label: '自放电率', value: p.selfDischargeRate }); if (p.selfDischargeRate) items.push({ key: 'selfdischarge', label: '自放电率', value: p.selfDischargeRate });
(p.extraSpecs || []).forEach((item, idx) => {
if (item && item.label && item.value) items.push({ key: 'extraspec' + idx, label: item.label, value: item.value });
});
return items; return items;
} }
if (isUpsCategory(cat) && (p.type === '离线式UPS' || p.type === '在线互动式UPS')) { if (isUpsCategory(cat) && (p.type === '离线式UPS' || p.type === '在线互动式UPS')) {
@ -885,6 +899,9 @@ function powerInfoItems(p, categories) {
if (p.noiseLevel) items.push({ key: 'noiselevel', label: '噪音', value: p.noiseLevel }); if (p.noiseLevel) items.push({ key: 'noiselevel', label: '噪音', value: p.noiseLevel });
if (p.dimensions) items.push({ key: 'dim', label: '尺寸(mm)', value: p.dimensions }); if (p.dimensions) items.push({ key: 'dim', label: '尺寸(mm)', value: p.dimensions });
if (p.netWeight) items.push({ key: 'weight', label: '净重(kg)', value: p.netWeight }); if (p.netWeight) items.push({ key: 'weight', label: '净重(kg)', value: p.netWeight });
(p.extraSpecs || []).forEach((item, idx) => {
if (item && item.label && item.value) items.push({ key: 'extraspec' + idx, label: item.label, value: item.value });
});
return items; return items;
} }
if (isUpsCategory(cat) && (p.type === '机架式UPS' || p.type === '在线式高频UPS')) { if (isUpsCategory(cat) && (p.type === '机架式UPS' || p.type === '在线式高频UPS')) {
@ -920,6 +937,9 @@ function powerInfoItems(p, categories) {
if (p.noiseLevel) items.push({ key: 'noiselevel', label: '噪音', value: p.noiseLevel }); if (p.noiseLevel) items.push({ key: 'noiselevel', label: '噪音', value: p.noiseLevel });
if (p.interfacePort) items.push({ key: 'interfaceport', label: '控制管理', value: p.interfacePort }); if (p.interfacePort) items.push({ key: 'interfaceport', label: '控制管理', value: p.interfacePort });
if (p.optionalSnmp) items.push({ key: 'snmp', label: '可选SNMP', value: p.optionalSnmp }); if (p.optionalSnmp) items.push({ key: 'snmp', label: '可选SNMP', value: p.optionalSnmp });
(p.extraSpecs || []).forEach((item, idx) => {
if (item && item.label && item.value) items.push({ key: 'extraspec' + idx, label: item.label, value: item.value });
});
return items; return items;
} }
if (isUpsCategory(cat) && p.type !== '迷你UPS') { if (isUpsCategory(cat) && p.type !== '迷你UPS') {
@ -943,6 +963,9 @@ function powerInfoItems(p, categories) {
if (p.batterySpec) items.push({ key: 'battery', label: '电池数量和容量', value: p.batterySpec }); if (p.batterySpec) items.push({ key: 'battery', label: '电池数量和容量', value: p.batterySpec });
if (p.dimensions) items.push({ key: 'dim', label: '尺寸(mm)', value: p.dimensions }); if (p.dimensions) items.push({ key: 'dim', label: '尺寸(mm)', value: p.dimensions });
if (p.netWeight) items.push({ key: 'weight', label: '净重(kg)', value: p.netWeight }); if (p.netWeight) items.push({ key: 'weight', label: '净重(kg)', value: p.netWeight });
(p.extraSpecs || []).forEach((item, idx) => {
if (item && item.label && item.value) items.push({ key: 'extraspec' + idx, label: item.label, value: item.value });
});
return items; return items;
} }
return [{ key: 'power', label: '功率 / 容量', value: p.powerOrCapacity || '—' }]; return [{ key: 'power', label: '功率 / 容量', value: p.powerOrCapacity || '—' }];
@ -2532,6 +2555,9 @@ function MainApp({ username, onLogout }) {
otherStandard: p.otherStandard || '', otherStandard: p.otherStandard || '',
sellingPoints: p.sellingPoints || '', // AI/ sellingPoints: p.sellingPoints || '', // AI/
batterySpec: p.batterySpec || '', dimensions: p.dimensions || '', netWeight: p.netWeight || '', notes: p.notes || '', batterySpec: p.batterySpec || '', dimensions: p.dimensions || '', netWeight: p.netWeight || '', notes: p.notes || '',
extraSpecs: Array.isArray(p.extraSpecs)
? p.extraSpecs.filter(it => it && (it.label || it.value)).map(it => ({ label: it.label || '', value: it.value || '' }))
: [], // schema""
})); }));
setAiImportDrafts(drafts); setAiImportDrafts(drafts);
} catch (e) { } catch (e) {
@ -2609,6 +2635,7 @@ function MainApp({ username, onLogout }) {
otherStandard: d.otherStandard || '', otherStandard: d.otherStandard || '',
sellingPoints: d.sellingPoints || '', sellingPoints: d.sellingPoints || '',
batterySpec: d.batterySpec || '', dimensions: d.dimensions || '', netWeight: d.netWeight || '', notes: d.notes || '', batterySpec: d.batterySpec || '', dimensions: d.dimensions || '', netWeight: d.netWeight || '', notes: d.notes || '',
extraSpecs: Array.isArray(d.extraSpecs) ? d.extraSpecs.filter(it => it && (it.label || it.value)) : [],
}; };
} }
function confirmAiImport() { function confirmAiImport() {
@ -3926,6 +3953,7 @@ function MainApp({ username, onLogout }) {
d.netWeight && `净重:${d.netWeight}`, d.netWeight && `净重:${d.netWeight}`,
(d.outputPortTypes && d.outputPortTypes.length) ? `输出口:${d.outputPortTypes.join('/')}` : '', (d.outputPortTypes && d.outputPortTypes.length) ? `输出口:${d.outputPortTypes.join('/')}` : '',
d.sellingPoints ? `✓已识别对客卖点(${d.sellingPoints.split('\n').filter(Boolean).length}条)` : '', d.sellingPoints ? `✓已识别对客卖点(${d.sellingPoints.split('\n').filter(Boolean).length}条)` : '',
(d.extraSpecs && d.extraSpecs.length) ? `✓其他参数(${d.extraSpecs.length}项:${d.extraSpecs.map(it => it.label).filter(Boolean).join('、')}` : '',
].filter(Boolean).join(' · ') || '(无更多规格信息)'} ].filter(Boolean).join(' · ') || '(无更多规格信息)'}
</div> </div>
</div> </div>
@ -4629,6 +4657,10 @@ function ProductForm({ draft, setDraft, onSave, onCancel, categories, onManage,
function addExtraName() { set({ extraNames: [...extraNames, ''] }); } function addExtraName() { set({ extraNames: [...extraNames, ''] }); }
function updateExtraName(idx, val) { const arr = [...extraNames]; arr[idx] = val; set({ extraNames: arr }); } function updateExtraName(idx, val) { const arr = [...extraNames]; arr[idx] = val; set({ extraNames: arr }); }
function removeExtraName(idx) { set({ extraNames: extraNames.filter((_, i) => i !== idx) }); } function removeExtraName(idx) { set({ extraNames: extraNames.filter((_, i) => i !== idx) }); }
const extraSpecs = draft.extraSpecs || [];
function addExtraSpec() { set({ extraSpecs: [...extraSpecs, { label: '', value: '' }] }); }
function updateExtraSpec(idx, patch) { set({ extraSpecs: extraSpecs.map((it, i) => (i === idx ? { ...it, ...patch } : it)) }); }
function removeExtraSpec(idx) { set({ extraSpecs: extraSpecs.filter((_, i) => i !== idx) }); }
function toggleOutputPortType(t) { function toggleOutputPortType(t) {
const list = draft.outputPortTypes || []; const list = draft.outputPortTypes || [];
if (list.includes(t)) { if (list.includes(t)) {
@ -5069,6 +5101,18 @@ function ProductForm({ draft, setDraft, onSave, onCancel, categories, onManage,
/> />
</div> </div>
<div className="field">
<span className="field-label">其他参数可选原文规格表里有但上面没有专属字段的参数AI批量导入时会自动补充在这里也可以手动增删会一起显示在产品详情和多语言PDF导出里</span>
{extraSpecs.map((item, idx) => (
<div key={idx} style={{ display: 'flex', gap: 8, alignItems: 'center', marginBottom: 6 }}>
<input className="input" style={{ flex: 1 }} value={item.label} onChange={e => updateExtraSpec(idx, { label: e.target.value })} placeholder="参数名,如:防雷等级" />
<input className="input" style={{ flex: 1 }} value={item.value} onChange={e => updateExtraSpec(idx, { value: e.target.value })} placeholder="参数值Type II" />
<button type="button" className="btn btn-ghost btn-sm" onClick={() => removeExtraSpec(idx)}><Trash2 size={13} /></button>
</div>
))}
<button type="button" className="btn btn-ghost btn-sm" onClick={addExtraSpec}><Plus size={13} />添加参数</button>
</div>
<div className="field"><span className="field-label">正本价格</span><input className="input" value={draft.costPrice} onChange={e => set({ costPrice: e.target.value })} placeholder="采购/成本价,人民币" /></div> <div className="field"><span className="field-label">正本价格</span><input className="input" value={draft.costPrice} onChange={e => set({ costPrice: e.target.value })} placeholder="采购/成本价,人民币" /></div>
<div className="field"> <div className="field">
<span className="field-label">内部备注仅自己可见不会出现在任何导出的文档里</span> <span className="field-label">内部备注仅自己可见不会出现在任何导出的文档里</span>