|
@@ -912,6 +912,17 @@ export default {
|
|
|
buildAdjustmentReasons: function(food) {
|
|
buildAdjustmentReasons: function(food) {
|
|
|
var reasons = []
|
|
var reasons = []
|
|
|
if (!food) return reasons
|
|
if (!food) return reasons
|
|
|
|
|
+ // 后端直接下发 adjustmentReasons 数组时归一化保留(兼容 {type,text} 对象与纯字符串两种形态)
|
|
|
|
|
+ if (food.adjustmentReasons instanceof Array) {
|
|
|
|
|
+ food.adjustmentReasons.forEach(function(r) {
|
|
|
|
|
+ if (r && typeof r === 'object') {
|
|
|
|
|
+ if (r.text) reasons.push({ type: r.type || '', text: r.text })
|
|
|
|
|
+ } else if (r) {
|
|
|
|
|
+ reasons.push({ type: '', text: String(r) })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ // 后端下发独立字段时,追加配伍/加工/病症权重原因
|
|
|
if (food.pairingReason) {
|
|
if (food.pairingReason) {
|
|
|
reasons.push({ type: 'pairing', text: '配伍原因:' + food.pairingReason })
|
|
reasons.push({ type: 'pairing', text: '配伍原因:' + food.pairingReason })
|
|
|
}
|
|
}
|