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