Update App.jsx via upload script - 2026-11-05 11:57:23
This commit is contained in:
parent
9c4175c998
commit
632b7b67a9
23
App.jsx
23
App.jsx
|
|
@ -2532,6 +2532,10 @@ function MainApp({ username, onLogout }) {
|
||||||
const [dragCustomerIdx, setDragCustomerIdx] = useState(null);
|
const [dragCustomerIdx, setDragCustomerIdx] = useState(null);
|
||||||
const [dragCustomerVip, setDragCustomerVip] = useState(false); // 正在拖拽的卡片属于VIP组还是普通组
|
const [dragCustomerVip, setDragCustomerVip] = useState(false); // 正在拖拽的卡片属于VIP组还是普通组
|
||||||
const [dragGroupState, setDragGroupState] = useState(null); // { category, index }
|
const [dragGroupState, setDragGroupState] = useState(null); // { category, index }
|
||||||
|
// 产品分组:各大类默认收拢(只显示类目名、数量、品牌、类型),点类目标题展开产品列表;离开页面再进来又是全部收拢
|
||||||
|
const [groupsOpen, setGroupsOpen] = useState(() => new Set());
|
||||||
|
useEffect(() => { if (view === 'groups') setGroupsOpen(new Set()); }, [view]);
|
||||||
|
const toggleGroup = (id) => setGroupsOpen(prev => { const n = new Set(prev); if (n.has(id)) n.delete(id); else n.add(id); return n; });
|
||||||
|
|
||||||
const [pwCurrent, setPwCurrent] = useState('');
|
const [pwCurrent, setPwCurrent] = useState('');
|
||||||
const [pwNew, setPwNew] = useState('');
|
const [pwNew, setPwNew] = useState('');
|
||||||
|
|
@ -4026,13 +4030,24 @@ function MainApp({ username, onLogout }) {
|
||||||
|
|
||||||
{view === 'groups' && (
|
{view === 'groups' && (
|
||||||
<>
|
<>
|
||||||
<div className="disclaimer">按产品大类分组浏览;每个类目右上角管理品牌,类目内第二行管理类型;新建产品时先选类目,再从对应的品牌 / 类型里选。</div>
|
<div className="disclaimer">按产品大类分组浏览;每个类目右上角管理品牌,类目内第二行管理类型;新建产品时先选类目,再从对应的品牌 / 类型里选。点类目名称展开或收拢产品列表。</div>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8, margin: '0 0 8px' }}>
|
||||||
|
<button className="btn btn-sm" onClick={() => setGroupsOpen(new Set(productCategories.map(c => c.id)))}>全部展开</button>
|
||||||
|
<button className="btn btn-sm" onClick={() => setGroupsOpen(new Set())}>全部收拢</button>
|
||||||
|
</div>
|
||||||
{productCategories.map(cat => {
|
{productCategories.map(cat => {
|
||||||
const items = products.filter(p => p.category === cat.id);
|
const items = products.filter(p => p.category === cat.id);
|
||||||
|
const open = groupsOpen.has(cat.id);
|
||||||
return (
|
return (
|
||||||
<div className="panel section-gap" key={cat.id}>
|
<div className="panel section-gap" key={cat.id}>
|
||||||
<div className="panel-header" style={{ flexWrap: 'wrap', gap: 10 }}>
|
<div className="panel-header" style={{ flexWrap: 'wrap', gap: 10 }}>
|
||||||
<div className="panel-title"><Layers size={15} />{cat.name}({items.length})</div>
|
<div className="panel-title" role="button" tabIndex={0} aria-expanded={open} title={open ? '收拢产品列表' : '展开产品列表'}
|
||||||
|
style={{ cursor: 'pointer', userSelect: 'none' }}
|
||||||
|
onClick={() => toggleGroup(cat.id)}
|
||||||
|
onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleGroup(cat.id); } }}>
|
||||||
|
<ChevronRight size={15} style={{ transform: open ? 'rotate(90deg)' : 'none', transition: 'transform .15s', opacity: .7 }} />
|
||||||
|
<Layers size={15} />{cat.name}({items.length})
|
||||||
|
</div>
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||||
<TaxPillRow
|
<TaxPillRow
|
||||||
label={null} values={cat.brands} catId={cat.id} kind="brand"
|
label={null} values={cat.brands} catId={cat.id} kind="brand"
|
||||||
|
|
@ -4051,7 +4066,7 @@ function MainApp({ username, onLogout }) {
|
||||||
onOpenAdd={openAddPill} onConfirmAdd={confirmAddPill} onCancelAdd={cancelAddPill} onRemove={removeTaxonomyValue}
|
onOpenAdd={openAddPill} onConfirmAdd={confirmAddPill} onCancelAdd={cancelAddPill} onRemove={removeTaxonomyValue}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="panel-body">
|
{open && <div className="panel-body">
|
||||||
{items.length === 0 ? (
|
{items.length === 0 ? (
|
||||||
<div className="empty-state" style={{ padding: '20px 10px' }}>暂无产品</div>
|
<div className="empty-state" style={{ padding: '20px 10px' }}>暂无产品</div>
|
||||||
) : items.map((p, idx) => (
|
) : items.map((p, idx) => (
|
||||||
|
|
@ -4073,7 +4088,7 @@ function MainApp({ username, onLogout }) {
|
||||||
<button className="btn btn-sm" onClick={() => { setView('products'); setProductDraft(null); setSelectedProductId(p.id); }}>查看</button>
|
<button className="btn btn-sm" onClick={() => { setView('products'); setProductDraft(null); setSelectedProductId(p.id); }}>查看</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue