修复删除&食谱展示
This commit is contained in:
parent
6d912988ac
commit
c536b20b63
@ -254,22 +254,29 @@ const actions = {
|
||||
const tarDetail = cur.detail.find(
|
||||
obj => obj.id === igdData.id
|
||||
);
|
||||
if (tarDetail) {
|
||||
if (tarDetail && tarDetail.weight === -1) {
|
||||
return igdArr;
|
||||
}
|
||||
igdArr.push({
|
||||
id: igdData.id,
|
||||
name: igdData.name,
|
||||
carbonRatio: igdData.carbonRatio,
|
||||
fatRatio: igdData.fatRatio,
|
||||
proteinRatio: igdData.proteinRatio,
|
||||
cusUnit: tarDetail.cus_unit,
|
||||
cusWeight: tarDetail.cus_weight,
|
||||
weight: parseFloat(tarDetail.weight),
|
||||
cusUnit: tarDetail
|
||||
? tarDetail.cus_unit
|
||||
: igdData.cusUnit,
|
||||
cusWeight: tarDetail
|
||||
? tarDetail.cus_weight
|
||||
: igdData.cusWeight,
|
||||
weight: parseFloat(
|
||||
tarDetail ? tarDetail.weight : igdData.weight
|
||||
),
|
||||
notRec: igdData.notRec,
|
||||
rec: igdData.rec,
|
||||
type: igdData.type
|
||||
});
|
||||
}
|
||||
}
|
||||
return igdArr;
|
||||
}, [])
|
||||
});
|
||||
@ -400,17 +407,12 @@ const actions = {
|
||||
}));
|
||||
} else if (actionType === "delIgd") {
|
||||
// 删除某食材
|
||||
params.detail = mTarDishes.igdList.reduce((arr, igd) => {
|
||||
if (igd.id !== payload.igdId) {
|
||||
arr.push({
|
||||
params.detail = mTarDishes.igdList.map(igd => ({
|
||||
id: igd.id,
|
||||
weight: igd.weight,
|
||||
weight: igd.id === payload.igdId ? -1 : igd.weight,
|
||||
cus_unit: igd.cusUnit,
|
||||
cus_weight: igd.cusWeight
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
}));
|
||||
} else if (actionType === "unit" || actionType === "weight") {
|
||||
// 修改食材
|
||||
params.detail = mTarDishes.igdList.map(igd => {
|
||||
|
@ -337,7 +337,8 @@ export default {
|
||||
}
|
||||
lastNameHit =
|
||||
arr[arr.length - 1].name === cur.name &&
|
||||
arr[arr.length - 1].type === cur.type;
|
||||
arr[arr.length - 1].type === cur.type
|
||||
// arr[arr.length - 1].dishesId === cur.dishesId;
|
||||
if (lastNameHit) {
|
||||
let namePos = arr.length - 1;
|
||||
for (let i = namePos; i >= 0; i--) {
|
||||
|
@ -15,7 +15,10 @@
|
||||
</div>
|
||||
<div v-for="mObj in obj.values" :key="mObj.id">
|
||||
<div class="dishes_item">
|
||||
<div v-if="!mObj.methods && !mObj.remark" class="simple_dishes">
|
||||
<div
|
||||
v-if="!mObj.methods && !mObj.remark && !mObj.igdList"
|
||||
class="simple_dishes"
|
||||
>
|
||||
<span>{{ mObj.name }}</span>
|
||||
<span class="weight_style">
|
||||
<span style="margin-right: 20px">{{ mObj.cusStr }}</span>
|
||||
@ -87,7 +90,7 @@ export default {
|
||||
typeName: this.menuTypeDict[type],
|
||||
values: mData[type],
|
||||
}));
|
||||
// console.log(mMenus);
|
||||
console.log(mMenus);
|
||||
return mMenus;
|
||||
},
|
||||
...mapState(["cusUnitDict", "cusWeightDict", "menuTypeDict"]),
|
||||
|
@ -5,8 +5,7 @@ export function getProcessMenuData(menuData) {
|
||||
cur.dishesId > -1 &&
|
||||
cur.name &&
|
||||
cur.igdList.length > 0 &&
|
||||
cur.type !== "0" &&
|
||||
cur.detail.length > 0
|
||||
cur.type !== "0"
|
||||
) {
|
||||
arr.push({
|
||||
id: cur.id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user