Merge branch 'master' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
@ -568,13 +568,15 @@ export default {
|
||||
detailHealthy.secondSmoke = detailHealthy.secondSmoke == 1 ? "是" : "否";
|
||||
let smokeRateString = "";
|
||||
if (detailHealthy.smokeRate != null) {
|
||||
detailHealthy.smokeRate.split(",").forEach(function (item, index) {
|
||||
smokeRateString +=
|
||||
(smokeRateString != "" ? "," : "") +
|
||||
healthyData["smokeRateArray"][index] +
|
||||
item +
|
||||
healthyData["smokeRateUnitArray"][index];
|
||||
});
|
||||
(detailHealthy.smokeRate || "")
|
||||
.split(",")
|
||||
.forEach(function (item, index) {
|
||||
smokeRateString +=
|
||||
(smokeRateString != "" ? "," : "") +
|
||||
healthyData["smokeRateArray"][index] +
|
||||
item +
|
||||
healthyData["smokeRateUnitArray"][index];
|
||||
});
|
||||
}
|
||||
detailHealthy.smokeRate = smokeRateString;
|
||||
detailHealthy.defecationNum = detailHealthy.defecationNum + "次/天";
|
||||
@ -686,7 +688,7 @@ export default {
|
||||
? medicalReportNameArray[2]
|
||||
: "体检报告(3)"
|
||||
: "";
|
||||
detailHealthy.moistureDate = detailHealthy.moistureDate
|
||||
detailHealthy.moistureDate = (detailHealthy.moistureDate || "")
|
||||
.split(",")
|
||||
.reduce((arr, cur) => {
|
||||
const tarData = healthyData.moistureDateArray.find(
|
||||
@ -697,7 +699,7 @@ export default {
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
detailHealthy.bloodData = detailHealthy.bloodData
|
||||
detailHealthy.bloodData = (detailHealthy.bloodData || "")
|
||||
.split(",")
|
||||
.reduce((arr, cur) => {
|
||||
const tarData = healthyData.bloodDataArray.find(
|
||||
|
@ -437,6 +437,8 @@ const actions = {
|
||||
const result = await updateDishesDetailApi(params);
|
||||
if (result.code === 200) {
|
||||
commit("updateRecipesDishesDetail", payload);
|
||||
} else {
|
||||
return new Promise((res, rej) => rej(result.msg));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -374,14 +374,13 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除菜品编号为"' + ids + '"的数据项?', "警告", {
|
||||
this.$confirm('是否确认删除菜品「' + row.name + '」的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return delDishes(ids);
|
||||
return delDishes(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
@ -664,14 +664,13 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除食材编号为"' + ids + '"的数据项?', "警告", {
|
||||
this.$confirm("是否确认删除食材「" + row.name + "」的数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return delIngredient(ids);
|
||||
return delIngredient(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
@ -68,11 +68,6 @@ export default {
|
||||
]),
|
||||
...mapGetters(["analyseData"]),
|
||||
},
|
||||
watch: {
|
||||
healthyData(val) {
|
||||
console.log({ val });
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleOnTabClick(tab) {
|
||||
this.activeName = tab.name;
|
||||
|
@ -504,6 +504,8 @@ export default {
|
||||
igdId: data.igdId,
|
||||
weight,
|
||||
actionType: "weight",
|
||||
}).catch((err) => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
},
|
||||
handleOnCustomUnitChange(data, { cusWeight, cusUnit }) {
|
||||
@ -517,6 +519,8 @@ export default {
|
||||
cusWeight,
|
||||
cusUnit,
|
||||
actionType: "unit",
|
||||
}).catch((err) => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
},
|
||||
handleOnDishesConfirm({ type, data }) {
|
||||
@ -547,6 +551,8 @@ export default {
|
||||
id,
|
||||
type,
|
||||
actionType: "menuType",
|
||||
}).catch((err) => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
},
|
||||
handleOnMenuTypeClick(data) {
|
||||
@ -560,6 +566,8 @@ export default {
|
||||
id,
|
||||
igdId,
|
||||
actionType: "delIgd",
|
||||
}).catch((err) => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
},
|
||||
handleOnEditRemark(data) {
|
||||
@ -573,6 +581,8 @@ export default {
|
||||
id,
|
||||
remark,
|
||||
actionType: "remark",
|
||||
}).catch((err) => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
},
|
||||
...mapActions([
|
||||
|
@ -3,7 +3,16 @@
|
||||
<!-- 营养分析 -->
|
||||
<!-- <NutriComputeCom :date="date" :value="value" /> -->
|
||||
<div class="top">
|
||||
<img :src="logo" style="width: auto; height: 32px" alt="logo" />
|
||||
<img
|
||||
class="logo"
|
||||
:src="logo"
|
||||
style="width: auto; height: 32px"
|
||||
alt="logo"
|
||||
/>
|
||||
<em
|
||||
class="el-icon-shopping-cart-full icon_style shopping_cart"
|
||||
@click="handleOnShoppingPlanClick"
|
||||
/>
|
||||
</div>
|
||||
<!-- 食谱详细 -->
|
||||
<el-card v-for="obj in menus" :key="obj.type" style="margin-top: 12px">
|
||||
@ -34,6 +43,8 @@
|
||||
</el-card>
|
||||
<!-- 复杂菜品展示 -->
|
||||
<DishesDetailDialog ref="detailDialogRef" />
|
||||
<!-- 当天采购计划 -->
|
||||
<TodayShoppingPlanDrawer ref="shoppingPlanRef" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -46,12 +57,14 @@ const {
|
||||
} = createNamespacedHelpers("recipesShow");
|
||||
// import NutriComputeCom from "./NutriComputeCom";
|
||||
import DishesDetailDialog from "./DishesDetailDialog";
|
||||
import TodayShoppingPlanDrawer from "../PlanDrawer/ShoppingPlanDrawer";
|
||||
export default {
|
||||
name: "menuDetail",
|
||||
props: ["value", "date"],
|
||||
components: {
|
||||
// NutriComputeCom,
|
||||
DishesDetailDialog,
|
||||
TodayShoppingPlanDrawer,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -99,6 +112,17 @@ export default {
|
||||
handleOnDetailClick(data) {
|
||||
this.$refs["detailDialogRef"].showDialog(data);
|
||||
},
|
||||
handleOnShoppingPlanClick() {
|
||||
this.$refs["shoppingPlanRef"].showDrawer({
|
||||
num: -1,
|
||||
data: [
|
||||
{
|
||||
dishes: this.value,
|
||||
},
|
||||
],
|
||||
label: this.date,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -106,8 +130,27 @@ export default {
|
||||
.menu_detail_wrapper {
|
||||
padding: 0 12px 12px 12px;
|
||||
.top {
|
||||
text-align: center;
|
||||
padding: 10px 14px;
|
||||
height: 50px;
|
||||
position: relative;
|
||||
.logo {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.shopping_cart {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&::after {
|
||||
margin-left: 2px;
|
||||
content: "采购";
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header_style {
|
||||
|
@ -74,17 +74,19 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showDrawer(data) {
|
||||
// console.log(data);
|
||||
const { recipesId, num, label } = data;
|
||||
showDrawer(obj) {
|
||||
const { recipesId, num, label, data } = obj;
|
||||
console.log(obj);
|
||||
this.label = label;
|
||||
// num < 0 全部计算
|
||||
this.title = `${
|
||||
num === 3 ? "前3" : num === 4 ? "后4" : Math.abs(num)
|
||||
}天采购计划`;
|
||||
this.visible = true;
|
||||
if (this.recipes[recipesId]) {
|
||||
this.processShoppingCart(num, recipesId);
|
||||
if (data) {
|
||||
this.processShoppingCart(num, data);
|
||||
} else if (this.recipes[recipesId]) {
|
||||
this.processShoppingCart(num, this.recipes[recipesId]);
|
||||
} else {
|
||||
this.loading = true;
|
||||
this.fetchFullRecipes({
|
||||
@ -92,61 +94,56 @@ export default {
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
setTimeout(() => {
|
||||
this.processShoppingCart(num, recipesId);
|
||||
this.processShoppingCart(num, this.recipes[recipesId]);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
},
|
||||
processShoppingCart(num, recipesId) {
|
||||
this.shoppingCart = (this.recipes[recipesId] || []).reduce(
|
||||
(obj, cur, idx) => {
|
||||
if (
|
||||
num < 0 || // 全部计算
|
||||
num === 7 ||
|
||||
(num === 3 && num > idx) ||
|
||||
(num === 4 && idx > 2)
|
||||
) {
|
||||
cur.dishes.forEach((dObj) => {
|
||||
dObj.igdList.forEach((iObj) => {
|
||||
const tarTypeName = this.idgTypeDict[iObj.type];
|
||||
const tarObj = obj[tarTypeName];
|
||||
if (tarObj) {
|
||||
const tarIObj = tarObj.find(
|
||||
(zObj) => zObj.name === iObj.name
|
||||
);
|
||||
if (tarIObj) {
|
||||
tarIObj.weight += this.igdUnitDict[iObj.name]
|
||||
? iObj.cusWeight
|
||||
: iObj.weight;
|
||||
} else {
|
||||
tarObj.push({
|
||||
type: iObj.type,
|
||||
name: iObj.name,
|
||||
weight: this.igdUnitDict[iObj.name]
|
||||
? iObj.cusWeight
|
||||
: iObj.weight,
|
||||
unit: this.igdUnitDict[iObj.name] || "g",
|
||||
});
|
||||
}
|
||||
processShoppingCart(num, data = []) {
|
||||
this.shoppingCart = data.reduce((obj, cur, idx) => {
|
||||
if (
|
||||
num < 0 || // 全部计算
|
||||
num === 7 ||
|
||||
(num === 3 && num > idx) ||
|
||||
(num === 4 && idx > 2)
|
||||
) {
|
||||
cur.dishes.forEach((dObj) => {
|
||||
dObj.igdList.forEach((iObj) => {
|
||||
const tarTypeName = this.idgTypeDict[iObj.type];
|
||||
const tarObj = obj[tarTypeName];
|
||||
if (tarObj) {
|
||||
const tarIObj = tarObj.find((zObj) => zObj.name === iObj.name);
|
||||
if (tarIObj) {
|
||||
tarIObj.weight += this.igdUnitDict[iObj.name]
|
||||
? iObj.cusWeight
|
||||
: iObj.weight;
|
||||
} else {
|
||||
obj[tarTypeName] = [
|
||||
{
|
||||
type: iObj.type,
|
||||
name: iObj.name,
|
||||
weight: this.igdUnitDict[iObj.name]
|
||||
? iObj.cusWeight
|
||||
: iObj.weight,
|
||||
unit: this.igdUnitDict[iObj.name] || "g",
|
||||
},
|
||||
];
|
||||
tarObj.push({
|
||||
type: iObj.type,
|
||||
name: iObj.name,
|
||||
weight: this.igdUnitDict[iObj.name]
|
||||
? iObj.cusWeight
|
||||
: iObj.weight,
|
||||
unit: this.igdUnitDict[iObj.name] || "g",
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
obj[tarTypeName] = [
|
||||
{
|
||||
type: iObj.type,
|
||||
name: iObj.name,
|
||||
weight: this.igdUnitDict[iObj.name]
|
||||
? iObj.cusWeight
|
||||
: iObj.weight,
|
||||
unit: this.igdUnitDict[iObj.name] || "g",
|
||||
},
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
{}
|
||||
);
|
||||
});
|
||||
}
|
||||
return obj;
|
||||
}, {});
|
||||
// console.log(this.shoppingCart);
|
||||
},
|
||||
handleOnBackClick() {
|
||||
|
Reference in New Issue
Block a user