订单入库: 修保质期单位选择器为空(template 需显式传 shelfLifeUnits)
卡片是 WXML <template>,只能看到调用处 data= 传入的变量,组件 data 里的 shelfLifeUnits 进不去 ⇒ 单位选择器弹出来是空的。两处 <template is="inboundCard"> 的 data 补上 shelfLifeUnits;契约测试加断言钉住(两处都要带)。
This commit is contained in:
@@ -187,7 +187,7 @@
|
||||
</view>
|
||||
<block wx:if="{{!skuGroup.multi || !skuGroup.collapsed}}">
|
||||
<block wx:for="{{skuGroup.items}}" wx:for-item="item" wx:key="id">
|
||||
<template is="inboundCard" data="{{item, submittingId, analyzingId, resultOptions, zoneRange}}" />
|
||||
<template is="inboundCard" data="{{item, submittingId, analyzingId, resultOptions, zoneRange, shelfLifeUnits}}" />
|
||||
</block>
|
||||
</block>
|
||||
</view>
|
||||
@@ -197,7 +197,7 @@
|
||||
<block wx:for="{{dayCategoryGroups}}" wx:key="groupKey" wx:for-item="group">
|
||||
<view wx:if="{{group.showDayHeader}}" class="today-day-head">{{group.dayLabel}}</view>
|
||||
<block wx:for="{{group.items}}" wx:key="id" wx:for-item="item">
|
||||
<template is="inboundCard" data="{{item, submittingId, analyzingId, resultOptions, zoneRange}}" />
|
||||
<template is="inboundCard" data="{{item, submittingId, analyzingId, resultOptions, zoneRange, shelfLifeUnits}}" />
|
||||
</block>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
@@ -29,6 +29,15 @@ describe('卡片:4 字段 + 去掉 AI 判定', () => {
|
||||
expect(wxml).toContain('bindchange="onShelfUnitChange"');
|
||||
expect(wxml).toContain('range="{{shelfLifeUnits}}"');
|
||||
expect(js).toContain('shelfLifeUnits: SHELF_LIFE_UNITS,');
|
||||
// ⚠️ 卡片是 WXML template:组件 data 进不去,必须在每个 <template is> 里显式传
|
||||
expect(
|
||||
(
|
||||
wxml.match(
|
||||
/is="inboundCard" data="\{\{item, submittingId, analyzingId, resultOptions, zoneRange, shelfLifeUnits\}\}"/g
|
||||
) || []
|
||||
).length,
|
||||
'两处 <template is="inboundCard"> 都要带上 shelfLifeUnits,否则单位选择器为空'
|
||||
).toBe(2);
|
||||
});
|
||||
|
||||
it('去掉 AI「合格/不合格」徽标与结果 picker(结果隐式合格)', () => {
|
||||
|
||||
Reference in New Issue
Block a user