commit
46bd587aef
@ -82,6 +82,9 @@
|
|||||||
<update id="updateDishesDetail" parameterType="SysRecipesDailyDishes">
|
<update id="updateDishesDetail" parameterType="SysRecipesDailyDishes">
|
||||||
update sys_customer_menu_dishes
|
update sys_customer_menu_dishes
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="menuId != null">menu_id = #{menuId},</if>
|
||||||
|
<if test="dishesId != null">dishes_id = #{dishesId},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="detail != null">detail = #{detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
|
<if test="detail != null">detail = #{detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
|
@ -37,11 +37,21 @@ const mutations = {
|
|||||||
obj => obj.id === payload.id
|
obj => obj.id === payload.id
|
||||||
);
|
);
|
||||||
if (tarDishes) {
|
if (tarDishes) {
|
||||||
const tarIgd = tarDishes.igdList.find(obj => obj.id === payload.igdId);
|
if (tarDishes.dishesId !== payload.dishesId) {
|
||||||
if (tarIgd) {
|
// 替换菜品
|
||||||
payload.weight && (tarIgd.weight = payload.weight);
|
Object.keys(payload).forEach(key => {
|
||||||
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
|
if (key === "num") {
|
||||||
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
|
return;
|
||||||
|
}
|
||||||
|
tarDishes[key] = payload[key];
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const tarIgd = tarDishes.igdList.find(obj => obj.id === payload.igdId);
|
||||||
|
if (tarIgd) {
|
||||||
|
payload.weight && (tarIgd.weight = payload.weight);
|
||||||
|
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
|
||||||
|
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -49,6 +59,12 @@ const mutations = {
|
|||||||
state.recipesData[payload.num].dishes.push(payload.data);
|
state.recipesData[payload.num].dishes.push(payload.data);
|
||||||
},
|
},
|
||||||
setCurrentDay(state, payload) {
|
setCurrentDay(state, payload) {
|
||||||
|
if (state.currentDay !== payload.currentDay) {
|
||||||
|
state.currentDay = payload.currentDay;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resetCurrentDay(state, payload) {
|
||||||
|
// console.log(payload);
|
||||||
state.currentDay =
|
state.currentDay =
|
||||||
payload.currentDay === state.currentDay ? -1 : payload.currentDay;
|
payload.currentDay === state.currentDay ? -1 : payload.currentDay;
|
||||||
},
|
},
|
||||||
@ -267,11 +283,12 @@ const actions = {
|
|||||||
},
|
},
|
||||||
async addDishes({ commit, state }, payload) {
|
async addDishes({ commit, state }, payload) {
|
||||||
const tarDishesList = state.recipesData[payload.num].dishes.filter(
|
const tarDishesList = state.recipesData[payload.num].dishes.filter(
|
||||||
obj => obj.type === payload.type
|
obj => obj.type === payload.data.type
|
||||||
);
|
);
|
||||||
if (tarDishesList.some(obj => obj.dishesId === payload.dishesId)) {
|
if (tarDishesList.some(obj => obj.dishesId === payload.data.dishesId)) {
|
||||||
console.log("目标餐类已有相同的菜品");
|
return new Promise((res, rej) =>
|
||||||
throw new Error("目标餐类已有相同的菜品");
|
rej(`目标餐类已有相同的菜品「${payload.data.name}」`)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (state.recipesId) {
|
if (state.recipesId) {
|
||||||
const tarRecipesObj = state.recipesData[payload.num];
|
const tarRecipesObj = state.recipesData[payload.num];
|
||||||
@ -301,6 +318,47 @@ const actions = {
|
|||||||
commit("addRecipesDishes", payload);
|
commit("addRecipesDishes", payload);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async replaceDishes({ commit, state }, payload) {
|
||||||
|
// console.log(payload);
|
||||||
|
const tarDishesList = state.recipesData[payload.num].dishes.filter(
|
||||||
|
obj => obj.type === payload.data.type
|
||||||
|
);
|
||||||
|
if (tarDishesList.some(obj => obj.dishesId === payload.data.dishesId)) {
|
||||||
|
return new Promise((res, rej) =>
|
||||||
|
rej(`目标餐类已有相同的菜品「${payload.data.name}」`)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state.recipesId) {
|
||||||
|
const tarDishes = state.recipesData[payload.num].dishes.find(
|
||||||
|
obj => obj.id === payload.data.id
|
||||||
|
);
|
||||||
|
if (tarDishes) {
|
||||||
|
const params = {
|
||||||
|
id: tarDishes.id,
|
||||||
|
dishesId: payload.data.dishesId,
|
||||||
|
detail: payload.data.igdList.map(igd => ({
|
||||||
|
id: igd.id,
|
||||||
|
weight: igd.weight,
|
||||||
|
cus_unit: igd.cusUnit,
|
||||||
|
cus_weight: igd.cusWeight
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
// console.log(params);
|
||||||
|
const result = await updateDishesDetailApi(params);
|
||||||
|
if (result.code === 200) {
|
||||||
|
commit("updateRecipesDishesDetail", {
|
||||||
|
num: payload.num,
|
||||||
|
...payload.data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
commit("updateRecipesDishesDetail", {
|
||||||
|
num: payload.num,
|
||||||
|
...payload.data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
async updateDishes({ commit, state }, payload) {
|
async updateDishes({ commit, state }, payload) {
|
||||||
// console.log(payload);
|
// console.log(payload);
|
||||||
if (state.recipesId) {
|
if (state.recipesId) {
|
||||||
|
@ -32,7 +32,7 @@ service.interceptors.response.use(res => {
|
|||||||
// 获取错误信息
|
// 获取错误信息
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
console.log(code)
|
// console.log(code)
|
||||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
||||||
confirmButtonText: '重新登录',
|
confirmButtonText: '重新登录',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
@ -277,7 +277,6 @@
|
|||||||
v-model="scope.row.weight"
|
v-model="scope.row.weight"
|
||||||
size="mini"
|
size="mini"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
@change="handleInputChange"
|
|
||||||
:min="0"
|
:min="0"
|
||||||
:step="5"
|
:step="5"
|
||||||
/>
|
/>
|
||||||
@ -749,12 +748,9 @@ export default {
|
|||||||
}, []);
|
}, []);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleInputChange(val) {
|
|
||||||
// console.log({ val, table: this.selTableData });
|
|
||||||
},
|
|
||||||
getSummaries(param) {
|
getSummaries(param) {
|
||||||
const { columns, data } = param;
|
const { columns, data } = param;
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
return columns.reduce(
|
return columns.reduce(
|
||||||
(arr, cur, idx) => {
|
(arr, cur, idx) => {
|
||||||
if (idx > 1) {
|
if (idx > 1) {
|
||||||
|
@ -68,7 +68,7 @@ export default {
|
|||||||
this.updateChart(this.data.length > 0 ? this.data : {});
|
this.updateChart(this.data.length > 0 ? this.data : {});
|
||||||
},
|
},
|
||||||
updateChart(source) {
|
updateChart(source) {
|
||||||
console.log(this.max);
|
// console.log(this.max);
|
||||||
this.chart.clear();
|
this.chart.clear();
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
title: {
|
title: {
|
||||||
@ -141,10 +141,10 @@ export default {
|
|||||||
x: 0,
|
x: 0,
|
||||||
},
|
},
|
||||||
markLine: {
|
markLine: {
|
||||||
data: [{ name: "BMR", yAxis: this.max - 400 }],
|
data: [{ name: "BMR", yAxis: this.max ? this.max - 400 : 0 }],
|
||||||
symbol: "none",
|
symbol: "none",
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: "red",
|
color: "#d96969",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
|
@ -87,7 +87,7 @@ export default {
|
|||||||
return obj;
|
return obj;
|
||||||
}, {}),
|
}, {}),
|
||||||
}));
|
}));
|
||||||
console.log(mData);
|
// console.log(mData);
|
||||||
return mData;
|
return mData;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
slot="reference"
|
slot="reference"
|
||||||
size="mini"
|
size="mini"
|
||||||
v-if="reviewStatus"
|
v-if="reviewStatus"
|
||||||
@click="handleReview"
|
|
||||||
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
:type="reviewStatus === 1 ? 'danger' : 'success'"
|
||||||
>
|
>
|
||||||
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
{{ reviewStatus === 1 ? "未审核" : "已审核" }}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="菜品类型" prop="type">
|
<el-form-item label="菜品类型" prop="type">
|
||||||
<el-select
|
<el-select
|
||||||
|
:disabled="lockType"
|
||||||
v-model="queryParams.type"
|
v-model="queryParams.type"
|
||||||
placeholder="请选择菜品类型"
|
placeholder="请选择菜品类型"
|
||||||
clearable
|
clearable
|
||||||
@ -98,6 +99,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
lockType: false,
|
||||||
total: 0,
|
total: 0,
|
||||||
dishesList: [],
|
dishesList: [],
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@ -116,8 +118,12 @@ export default {
|
|||||||
...mapState(["typeOptions"]),
|
...mapState(["typeOptions"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList() {
|
getList({ type }) {
|
||||||
// console.log('getList')
|
// console.log('getList')
|
||||||
|
if (type) {
|
||||||
|
this.lockType = true;
|
||||||
|
this.queryParams.type = type;
|
||||||
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listDishes(this.queryParams).then((result) => {
|
listDishes(this.queryParams).then((result) => {
|
||||||
this.dishesList = result.rows.map((d) => {
|
this.dishesList = result.rows.map((d) => {
|
||||||
@ -149,12 +155,21 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
clean() {
|
||||||
|
this.queryParams = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
type: null,
|
||||||
|
reviewStatus: "yes",
|
||||||
|
};
|
||||||
|
},
|
||||||
handleCurrentChange(data) {
|
handleCurrentChange(data) {
|
||||||
this.$emit("onChange", data);
|
this.$emit("onChange", data);
|
||||||
},
|
},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
this.getList();
|
this.getList({});
|
||||||
},
|
},
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
title="添加菜品"
|
:title="title"
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:before-close="handleOnClosed"
|
:before-close="handleOnClosed"
|
||||||
@ -50,7 +50,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { createNamespacedHelpers } from "vuex";
|
import { createNamespacedHelpers } from "vuex";
|
||||||
const { mapState } = createNamespacedHelpers("recipes");
|
const { mapState, mapGetters } = createNamespacedHelpers("recipes");
|
||||||
|
|
||||||
import SelectDishes from "./SelectDishes";
|
import SelectDishes from "./SelectDishes";
|
||||||
import ConfigDishes from "./ConfigDishes";
|
import ConfigDishes from "./ConfigDishes";
|
||||||
@ -63,7 +63,10 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
id: "",
|
||||||
|
type: "",
|
||||||
visible: false,
|
visible: false,
|
||||||
|
title: "",
|
||||||
active: 0,
|
active: 0,
|
||||||
dishesTypeOptions: [],
|
dishesTypeOptions: [],
|
||||||
selDishes: {
|
selDishes: {
|
||||||
@ -76,16 +79,30 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["typeOptions"]),
|
...mapState(["typeOptions", "currentDay"]),
|
||||||
|
...mapGetters(["typeDict"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showDrawer() {
|
showDrawer({ data, type, numDay }) {
|
||||||
|
this.title = "添加菜品";
|
||||||
|
this.id = "";
|
||||||
|
this.type = "";
|
||||||
|
if (data) {
|
||||||
|
this.title = `替换第${numDay}天${this.typeDict[data.type]}的「${
|
||||||
|
data.name
|
||||||
|
}」`;
|
||||||
|
this.id = data.id;
|
||||||
|
} else if (type) {
|
||||||
|
this.title = `添加第${numDay}天${this.typeDict[type]}菜品`;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.dishesRef.getList();
|
this.$refs.dishesRef.getList({ type });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleOnClosed(done) {
|
handleOnClosed(done) {
|
||||||
|
this.$refs.dishesRef.clean();
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
handleCurrentChange(data) {
|
handleCurrentChange(data) {
|
||||||
@ -95,16 +112,18 @@ export default {
|
|||||||
// console.log(data);
|
// console.log(data);
|
||||||
this.selDishes = data;
|
this.selDishes = data;
|
||||||
this.active = 1;
|
this.active = 1;
|
||||||
this.dishesTypeOptions = data.type.split(",").reduce((arr, cur, idx) => {
|
this.dishesTypeOptions = (this.type || data.type)
|
||||||
if (idx === 0) {
|
.split(",")
|
||||||
this.selDishes.type = cur;
|
.reduce((arr, cur, idx) => {
|
||||||
}
|
if (idx === 0) {
|
||||||
const tarOpt = this.typeOptions.find((obj) => obj.dictValue === cur);
|
this.selDishes.type = cur;
|
||||||
if (tarOpt) {
|
}
|
||||||
arr.push(tarOpt);
|
const tarOpt = this.typeOptions.find((obj) => obj.dictValue === cur);
|
||||||
}
|
if (tarOpt) {
|
||||||
return arr;
|
arr.push(tarOpt);
|
||||||
}, []);
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
},
|
},
|
||||||
handleOnConfigChange(val) {
|
handleOnConfigChange(val) {
|
||||||
Object.keys(val).forEach((key) => {
|
Object.keys(val).forEach((key) => {
|
||||||
@ -114,6 +133,7 @@ export default {
|
|||||||
handleOnCancelClick() {
|
handleOnCancelClick() {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.active = 0;
|
this.active = 0;
|
||||||
|
this.$refs.dishesRef.clean();
|
||||||
},
|
},
|
||||||
handleOnLastStepClick() {
|
handleOnLastStepClick() {
|
||||||
this.active = 0;
|
this.active = 0;
|
||||||
@ -132,14 +152,17 @@ export default {
|
|||||||
igdList,
|
igdList,
|
||||||
} = this.selDishes;
|
} = this.selDishes;
|
||||||
this.$emit("onConfirm", {
|
this.$emit("onConfirm", {
|
||||||
id: new Date().getTime(),
|
type: this.id ? "replace" : "add",
|
||||||
dishesId: id,
|
data: {
|
||||||
methods,
|
id: this.id || new Date().getTime(),
|
||||||
name,
|
dishesId: id,
|
||||||
notRecTags,
|
methods,
|
||||||
recTags,
|
name,
|
||||||
type,
|
notRecTags,
|
||||||
igdList,
|
recTags,
|
||||||
|
type,
|
||||||
|
igdList,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
// console.log(this.selDishes);
|
// console.log(this.selDishes);
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="recipes_com_wrapper">
|
<div class="recipes_com_wrapper" @click="handleParentClick">
|
||||||
<el-table
|
<el-table
|
||||||
:data="mData"
|
:data="mData"
|
||||||
border
|
border
|
||||||
@ -11,15 +11,23 @@
|
|||||||
>
|
>
|
||||||
<el-table-column prop="type" :width="100" align="center">
|
<el-table-column prop="type" :width="100" align="center">
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day" @click="handleOnResetCurrentDay">
|
||||||
<!-- <div>{{ name }}</div> -->
|
|
||||||
<div>{{ `第${numDay}天` }}</div>
|
<div>{{ `第${numDay}天` }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span style="font-weight: bold; font-size: 14px">{{
|
<el-tooltip
|
||||||
typeFormatter(scope.row)
|
class="item"
|
||||||
}}</span>
|
effect="dark"
|
||||||
|
:content="`点击添加${typeFormatter(scope.row)}`"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
style="font-weight: bold; font-size: 14px; cursor: pointer"
|
||||||
|
@click="handleOnMenuTypeClick(scope.row)"
|
||||||
|
>{{ typeFormatter(scope.row) }}</span
|
||||||
|
>
|
||||||
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="菜品" prop="name" align="center" :width="180">
|
<el-table-column label="菜品" prop="name" align="center" :width="180">
|
||||||
@ -34,8 +42,17 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-popover placement="right" trigger="hover">
|
<el-popover placement="right" trigger="hover" :title="scope.row.name">
|
||||||
<div>
|
<div>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
class="fun_button"
|
||||||
|
@click="handleOnReplace(scope.row)"
|
||||||
|
>
|
||||||
|
替换
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -79,7 +96,7 @@
|
|||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day">
|
||||||
<div>蛋白质</div>
|
<div>蛋白质</div>
|
||||||
<div>/100g</div>
|
<div>/100g</div>
|
||||||
</div>
|
</div>
|
||||||
@ -92,7 +109,7 @@
|
|||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day">
|
||||||
<div>脂肪</div>
|
<div>脂肪</div>
|
||||||
<div>/100g</div>
|
<div>/100g</div>
|
||||||
</div>
|
</div>
|
||||||
@ -105,7 +122,7 @@
|
|||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day">
|
||||||
<div>碳水</div>
|
<div>碳水</div>
|
||||||
<div>/100g</div>
|
<div>/100g</div>
|
||||||
</div>
|
</div>
|
||||||
@ -119,7 +136,7 @@
|
|||||||
:formatter="nutriFormatter"
|
:formatter="nutriFormatter"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day">
|
||||||
<div>蛋白质</div>
|
<div>蛋白质</div>
|
||||||
<div>含量</div>
|
<div>含量</div>
|
||||||
</div>
|
</div>
|
||||||
@ -133,7 +150,7 @@
|
|||||||
:formatter="nutriFormatter"
|
:formatter="nutriFormatter"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day">
|
||||||
<div>脂肪</div>
|
<div>脂肪</div>
|
||||||
<div>含量</div>
|
<div>含量</div>
|
||||||
</div>
|
</div>
|
||||||
@ -147,7 +164,7 @@
|
|||||||
:formatter="nutriFormatter"
|
:formatter="nutriFormatter"
|
||||||
>
|
>
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
<div class="num_day">
|
||||||
<div>碳水</div>
|
<div>碳水</div>
|
||||||
<div>含量</div>
|
<div>含量</div>
|
||||||
</div>
|
</div>
|
||||||
@ -299,6 +316,10 @@ export default {
|
|||||||
...mapState(["currentDay"]),
|
...mapState(["currentDay"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleParentClick(e) {
|
||||||
|
// 校验某天
|
||||||
|
this.setCurrentDay({ currentDay: this.num });
|
||||||
|
},
|
||||||
spanMethod({ row, column, rowIndex, columnIndex }) {
|
spanMethod({ row, column, rowIndex, columnIndex }) {
|
||||||
if (columnIndex === 0) {
|
if (columnIndex === 0) {
|
||||||
return row.typeSpan;
|
return row.typeSpan;
|
||||||
@ -314,13 +335,17 @@ export default {
|
|||||||
nutriFormatter(row, col) {
|
nutriFormatter(row, col) {
|
||||||
return ((row.weight / 100) * row[col.property]).toFixed(1);
|
return ((row.weight / 100) * row[col.property]).toFixed(1);
|
||||||
},
|
},
|
||||||
handleOnOneDayAnalysis(e) {
|
handleOnResetCurrentDay(e) {
|
||||||
// 校验某天
|
e.stopPropagation();
|
||||||
this.setCurrentDay({ currentDay: this.num });
|
// 取消高亮
|
||||||
|
this.resetCurrentDay({ currentDay: this.num });
|
||||||
},
|
},
|
||||||
handleOnAdd() {
|
handleOnAdd() {
|
||||||
// console.log(this.num);
|
// console.log(this.num);
|
||||||
this.$refs.drawerRef.showDrawer();
|
this.$refs.drawerRef.showDrawer({});
|
||||||
|
},
|
||||||
|
handleOnReplace(data) {
|
||||||
|
this.$refs.drawerRef.showDrawer({ data, numDay: this.numDay });
|
||||||
},
|
},
|
||||||
handleOnDelete(data) {
|
handleOnDelete(data) {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
@ -347,17 +372,34 @@ export default {
|
|||||||
cusUnit,
|
cusUnit,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleOnDishesConfirm(data) {
|
handleOnDishesConfirm({ type, data }) {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
this.addDishes({
|
if (type === "add") {
|
||||||
num: this.num,
|
this.addDishes({
|
||||||
data,
|
num: this.num,
|
||||||
}).catch((err) => {
|
data,
|
||||||
this.$message.error(err.message);
|
}).catch((err) => {
|
||||||
});
|
this.$message.error(err);
|
||||||
|
});
|
||||||
|
} else if (type === "replace") {
|
||||||
|
this.replaceDishes({
|
||||||
|
num: this.num,
|
||||||
|
data,
|
||||||
|
}).catch((err) => {
|
||||||
|
this.$message.error(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
...mapActions(["updateDishes", "addDishes", "deleteDishes"]),
|
handleOnMenuTypeClick(data) {
|
||||||
...mapMutations(["setCurrentDay"]),
|
this.$refs.drawerRef.showDrawer({ type: data.type, numDay: this.numDay });
|
||||||
|
},
|
||||||
|
...mapActions([
|
||||||
|
"updateDishes",
|
||||||
|
"addDishes",
|
||||||
|
"deleteDishes",
|
||||||
|
"replaceDishes",
|
||||||
|
]),
|
||||||
|
...mapMutations(["setCurrentDay", "resetCurrentDay"]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user