The file /home/project/src/components/warehouse/ProductList.tsx has been updated. Made 1 replacement.
Here's the result of running `cat -n` on a snippet of the edited file:
121→ exit={{ height: 0, opacity: 0 }}
122→ transition={animationConfig.transition}
123→ className="border-t border-gray-100"
124→ >
125→
126→ {Object.entries(weightGroups).map(([weight, products]) => {
127→ const weightKey = `${productName}-${weight}`;
128→ const isWeightExpanded = expandedGroups[weightKey];
129→ const hasNoWeight = weight === '__no_weight__';
130→ const weightCount = Object.keys(weightGroups).length;
131→ const isSingleWeight = weightCount === 1;
132→
133→ // 如果没有克重,直接显示产品列表,不显示克重折叠卡片
134→ if (hasNoWeight) {
135→ return (
136→
137→
138→
139→
140→ | 颜色 |
141→ 产品码 |
142→ 库存 |
143→ 操作 |
144→
145→
146→
147→ {products.map(product => (
148→ onViewRecords(product)}
153→ onViewPriceHistory={() => onViewPriceHistory(product)}
154→ onViewStockHistory={() => onViewStockHistory(product)}
155→ onEdit={() => onEdit(product)}
156→ onDelete={() => onDelete(product.id)}
157→ />
158→ ))}
159→
160→
161→
162→ );
163→ }
164→
165→ // 如果只有一种克重,直接显示克重信息和产品列表,不需要折叠
166→ if (isSingleWeight) {
167→ return (
168→
169→
170→ {weight}g
171→ {products[0]?.warp_weight && products[0]?.weft_weight && (
172→ 经{products[0].warp_weight}+纬{products[0].weft_weight}
173→ )}
174→ ({products.length}个颜色)
175→
176→
177→
178→
179→ | 颜色 |
180→ 产品码 |
181→ 库存 |
182→ 操作 |
183→
184→
185→
186→ {products.map(product => (
187→ onViewRecords(product)}
192→ onViewPriceHistory={() => onViewPriceHistory(product)}
193→ onViewStockHistory={() => onViewStockHistory(product)}
194→ onEdit={() => onEdit(product)}
195→ onDelete={() => onDelete(product.id)}
196→ />
197→ ))}
198→
199→
200→
201→ );
202→ }
203→
204→ return (
205→
206→
onToggleGroup(weightKey)}
208→ className="flex items-center justify-between p-3 cursor-pointer hover:bg-gray-100 transition-colors"
209→ >
210→
211→
212→ {isWeightExpanded ? : }
213→
214→
{weight}g
215→ {products[0]?.warp_weight && products[0]?.weft_weight && (
216→
经{products[0].warp_weight}+纬{products[0].weft_weight}
217→ )}
218→
({products.length}个颜色)
219→
220→
221→
222→
223→ {isWeightExpanded && (
224→
231→
232→
233→
234→ | 颜色 |
235→ 产品码 |
236→ 库存 |
237→ 操作 |
238→
239→
240→
241→ {products.map(product => (
242→ onViewRecords(product)}
247→ onViewPriceHistory={() => onViewPriceHistory(product)}
248→ onViewStockHistory={() => onViewStockHistory(product)}
249→ onEdit={() => onEdit(product)}
250→ onDelete={() => onDelete(product.id)}
251→ />
252→ ))}
253→
254→
255→
256→ )}
257→
258→
259→ );
260→ })}
261→
262→
263→ )}
264→
265→
266→ );