diff --git a/App.jsx b/App.jsx index dcc9a7f..3997d4f 100644 --- a/App.jsx +++ b/App.jsx @@ -259,13 +259,23 @@ const blankCustomer = () => ({ attachments: [], }); +const OUTPUT_PORT_TYPES = ['USB', 'DC', 'DC1', 'DC2', 'DC3', 'POE', 'Type-C', 'DC interface', 'POE interface']; +const DEFAULT_MINI_UPS_OUTPUT_TYPES = ['USB', 'DC1', 'DC2', 'DC3', 'POE']; + const blankProduct = () => ({ id: 'p_' + Date.now() + '_' + Math.random().toString(36).slice(2, 7), name: '', extraNames: [], brand: '', category: '', type: '', - machineVariant: '', // 标机 / 长机,仅UPS大类适用,独立于细分品类 - powerOrCapacity: '', // 非UPS大类的功率/容量,或UPS大类下"迷你UPS"的最大输出功率 + machineVariant: '', // 标机 / 长机,仅UPS大类适用,独立于细分品类(迷你UPS固定为标机) + powerOrCapacity: '', // 非UPS大类的功率/容量,或UPS大类下"迷你UPS"的输出功率 ratedPower: '', ratedPowerUnit: 'VA', powerFactor: '', // UPS大类下除"迷你UPS"外的三段式功率 - voltage: '', costPrice: '', notes: '', + voltage: '', // 非迷你UPS:电压;迷你UPS:输入电压(默认 100~240Vac/50-60Hz,可修改) + outputPortCount: '', // 迷你UPS专属:输出口数量 1-6 + outputPortTypes: [], // 迷你UPS专属:输出口类型(多选) + outputPorts: [], // 迷你UPS专属:每个已选输出口类型对应的输出电压/电流,如 [{type:'USB', voltage:'5Vdc', current:'3.0A'}] + batterySpec: '', // 迷你UPS专属:电池数量和容量,如 "5000mAh*4" + dimensions: '', // 迷你UPS专属:尺寸(mm),如 "210*130*40" + netWeight: '', // 迷你UPS专属:净重(kg) + costPrice: '', notes: '', }); function isUpsCategory(cat) { @@ -290,7 +300,19 @@ function powerInfoItems(p, categories) { ]; } if (isUpsCategory(cat) && p.type === '迷你UPS') { - return [{ key: 'maxout', label: '最大输出功率', value: p.powerOrCapacity || '—' }]; + const items = [{ key: 'maxout', label: '输出功率', value: p.powerOrCapacity || '—' }]; + items.push({ key: 'inputvoltage', label: '输入电压', value: p.voltage || '—' }); + if (p.outputPortCount) items.push({ key: 'portcount', label: '输出口数量', value: p.outputPortCount }); + if (p.outputPortTypes && p.outputPortTypes.length) items.push({ key: 'porttypes', label: '输出口类型', value: p.outputPortTypes.join(' / ') }); + (p.outputPorts || []).forEach(port => { + if (port.voltage || port.current) { + items.push({ key: 'port_' + port.type, label: `${port.type} 输出`, value: [port.voltage, port.current].filter(Boolean).join(' ') }); + } + }); + 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.netWeight) items.push({ key: 'weight', label: '净重(kg)', value: p.netWeight }); + return items; } return [{ key: 'power', label: '功率 / 容量', value: p.powerOrCapacity || '—' }]; } @@ -2995,6 +3017,23 @@ function ProductForm({ draft, setDraft, onSave, onCancel, categories, onManage } function addExtraName() { set({ extraNames: [...extraNames, ''] }); } function updateExtraName(idx, val) { const arr = [...extraNames]; arr[idx] = val; set({ extraNames: arr }); } function removeExtraName(idx) { set({ extraNames: extraNames.filter((_, i) => i !== idx) }); } + function toggleOutputPortType(t) { + const list = draft.outputPortTypes || []; + if (list.includes(t)) { + set({ + outputPortTypes: list.filter(x => x !== t), + outputPorts: (draft.outputPorts || []).filter(p => p.type !== t), + }); + } else { + set({ + outputPortTypes: [...list, t], + outputPorts: [...(draft.outputPorts || []), { type: t, voltage: '', current: '' }], + }); + } + } + function updateOutputPort(t, patch) { + set({ outputPorts: (draft.outputPorts || []).map(p => (p.type === t ? { ...p, ...patch } : p)) }); + } return (