Update App.jsx via upload script - 2026-09-18 11:28:01

This commit is contained in:
mike 2026-09-18 11:28:13 +08:00
parent ad86489393
commit 632568906a
1 changed files with 24 additions and 5 deletions

29
App.jsx
View File

@ -707,8 +707,8 @@ function productExportRows(p, categories) {
if (p.dimensions) rows.push({ labelKey: '尺寸(mm)', value: p.dimensions }); if (p.dimensions) rows.push({ labelKey: '尺寸(mm)', value: p.dimensions });
if (p.netWeight) rows.push({ labelKey: '净重(kg)', value: p.netWeight }); if (p.netWeight) rows.push({ labelKey: '净重(kg)', value: p.netWeight });
} else if (isUpsCategory(cat) && ['机架式UPS', '在线式高频UPS', '工频UPS', '高频塔式UPS', '模块化UPS'].includes(p.type)) { } else if (isUpsCategory(cat) && ['机架式UPS', '在线式高频UPS', '工频UPS', '高频塔式UPS', '模块化UPS'].includes(p.type)) {
if (p.phase) rows.push({ labelKey: '相数', value: p.phase });
if (p.powerOrCapacity) rows.push({ labelKey: '容量', value: p.powerOrCapacity }); if (p.powerOrCapacity) rows.push({ labelKey: '容量', value: p.powerOrCapacity });
if (p.phase) rows.push({ labelKey: '相数', value: p.phase });
if (p.inputVoltage) rows.push({ labelKey: '输入电压', value: p.inputVoltage }); if (p.inputVoltage) rows.push({ labelKey: '输入电压', value: p.inputVoltage });
if (p.inputVoltageRange) rows.push({ labelKey: '输入电压范围', value: p.inputVoltageRange }); if (p.inputVoltageRange) rows.push({ labelKey: '输入电压范围', value: p.inputVoltageRange });
if (p.inputFrequency) rows.push({ labelKey: '输入频率', value: p.inputFrequency }); if (p.inputFrequency) rows.push({ labelKey: '输入频率', value: p.inputFrequency });
@ -1078,8 +1078,8 @@ function powerInfoItems(p, categories) {
} }
if (isUpsCategory(cat) && ['机架式UPS', '在线式高频UPS', '工频UPS', '高频塔式UPS', '模块化UPS'].includes(p.type)) { if (isUpsCategory(cat) && ['机架式UPS', '在线式高频UPS', '工频UPS', '高频塔式UPS', '模块化UPS'].includes(p.type)) {
const items = []; const items = [];
if (p.phase) items.push({ key: 'phase', label: '相数', value: p.phase });
if (p.powerOrCapacity) items.push({ key: 'capacity', label: '容量', value: p.powerOrCapacity }); if (p.powerOrCapacity) items.push({ key: 'capacity', label: '容量', value: p.powerOrCapacity });
if (p.phase) items.push({ key: 'phase', label: '相数', value: p.phase });
if (p.inputVoltage) items.push({ key: 'inputvoltage', label: '输入电压', value: p.inputVoltage }); if (p.inputVoltage) items.push({ key: 'inputvoltage', label: '输入电压', value: p.inputVoltage });
if (p.inputVoltageRange) items.push({ key: 'inputvoltagerange', label: '输入电压范围', value: p.inputVoltageRange }); if (p.inputVoltageRange) items.push({ key: 'inputvoltagerange', label: '输入电压范围', value: p.inputVoltageRange });
if (p.inputFrequency) items.push({ key: 'inputfreq', label: '输入频率', value: p.inputFrequency }); if (p.inputFrequency) items.push({ key: 'inputfreq', label: '输入频率', value: p.inputFrequency });
@ -2916,6 +2916,11 @@ function MainApp({ username, onLogout }) {
function confirmAiImport() { function confirmAiImport() {
const included = (aiImportDrafts || []).filter(d => d.include && d.name.trim()); const included = (aiImportDrafts || []).filter(d => d.include && d.name.trim());
if (!included.length) { notify('没有勾选任何要导入的产品'); return; } if (!included.length) { notify('没有勾选任何要导入的产品'); return; }
const missingCapacity = included.filter(d => d.category === 'UPS不间断电源' && !(d.powerOrCapacity || '').trim());
if (missingCapacity.length) {
const names = missingCapacity.map(d => d.name).join('、');
if (!window.confirm(`以下 ${missingCapacity.length} 个UPS型号还没有填容量${names}\n\n容量是UPS产品的核心信息建议先补上再导入。确定要先不填、直接导入吗`)) return;
}
const { categories: newCats, resolved } = resolveCategoriesForImport(productCategories, included); const { categories: newCats, resolved } = resolveCategoriesForImport(productCategories, included);
let working = products; let working = products;
let newCount = 0; let newCount = 0;
@ -4164,8 +4169,12 @@ function MainApp({ username, onLogout }) {
</div> </div>
)} )}
<div style={{ display: 'flex', flexDirection: 'column', gap: 10, maxHeight: 420, overflowY: 'auto' }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 10, maxHeight: 420, overflowY: 'auto' }}>
{aiImportDrafts.map(d => ( {aiImportDrafts.map(d => {
<div key={d._localId} className="tax-manage-list-row" style={{ flexDirection: 'column', alignItems: 'stretch', gap: 8 }}> // UPS
// 便
const needsCapacity = d.category === 'UPS不间断电源' && !(d.powerOrCapacity || '').trim();
return (
<div key={d._localId} className="tax-manage-list-row" style={{ flexDirection: 'column', alignItems: 'stretch', gap: 8, border: needsCapacity ? '1.5px solid var(--led-red)' : undefined }}>
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 8 }}> <div style={{ display: 'flex', alignItems: 'flex-start', gap: 8 }}>
<input <input
type="checkbox" checked={d.include} type="checkbox" checked={d.include}
@ -4180,6 +4189,15 @@ function MainApp({ username, onLogout }) {
</div> </div>
<button className="btn btn-sm btn-ghost btn-danger" onClick={() => removeAiImportDraft(d._localId)}><Trash2 size={12} /></button> <button className="btn btn-sm btn-ghost btn-danger" onClick={() => removeAiImportDraft(d._localId)}><Trash2 size={12} /></button>
</div> </div>
{needsCapacity && (
<div style={{ display: 'flex', alignItems: 'center', gap: 8, paddingLeft: 26 }}>
<span style={{ fontSize: 11.5, color: 'var(--led-red)', fontWeight: 600, flexShrink: 0 }}> 没识别到容量请手动填一下</span>
<input
className="input" style={{ flex: 1 }} placeholder="如 250KVA/200KW"
value={d.powerOrCapacity || ''} onChange={e => updateAiImportDraft(d._localId, { powerOrCapacity: e.target.value })}
/>
</div>
)}
<div style={{ fontSize: 11.5, color: 'var(--ink-soft)', paddingLeft: 26 }}> <div style={{ fontSize: 11.5, color: 'var(--ink-soft)', paddingLeft: 26 }}>
{[ {[
d.machineVariant && `机型:${d.machineVariant}`, d.machineVariant && `机型:${d.machineVariant}`,
@ -4193,7 +4211,8 @@ function MainApp({ username, onLogout }) {
].filter(Boolean).join(' · ') || '(无更多规格信息)'} ].filter(Boolean).join(' · ') || '(无更多规格信息)'}
</div> </div>
</div> </div>
))} );
})}
</div> </div>
</> </>
)} )}