修改样式,修改逻辑
This commit is contained in:
@ -65,6 +65,7 @@
|
||||
"vue-count-to": "1.0.13",
|
||||
"vue-cropper": "0.4.9",
|
||||
"vue-router": "3.0.2",
|
||||
"vue-scrollto": "^2.20.0",
|
||||
"vue-splitpane": "1.0.4",
|
||||
"vuedraggable": "2.20.0",
|
||||
"vuex": "3.1.0"
|
||||
|
@ -4,7 +4,6 @@
|
||||
:title="title"
|
||||
:close-on-press-escape="false"
|
||||
:visible.sync="visible"
|
||||
:wrapperClosable="false"
|
||||
@closed="handleOnClosed"
|
||||
size="40%"
|
||||
>
|
||||
|
@ -4,7 +4,6 @@
|
||||
:title="title"
|
||||
:close-on-press-escape="false"
|
||||
:visible.sync="visible"
|
||||
:wrapperClosable="false"
|
||||
@closed="handleOnClosed"
|
||||
size="40%"
|
||||
>
|
||||
|
81
stdiet-ui/src/components/RecipesPlanDrawer/index.vue
Normal file
81
stdiet-ui/src/components/RecipesPlanDrawer/index.vue
Normal file
@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-drawer
|
||||
:title="title"
|
||||
:close-on-press-escape="false"
|
||||
:visible.sync="visible"
|
||||
@closed="handleOnClosed"
|
||||
size="40%"
|
||||
>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleInnerOpen"
|
||||
>查看暂停记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-drawer
|
||||
:title="innerTitle"
|
||||
:append-to-body="true"
|
||||
:close-on-press-escape="false"
|
||||
:visible.sync="innerVisible"
|
||||
@closed="handleOnInnerClosed"
|
||||
>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleInnerOpen"
|
||||
>查看暂停记录
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "RecipesPlanDrawer",
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
innerVisible: false,
|
||||
title: "",
|
||||
innerTitle: "",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showDrawer(data) {
|
||||
this.data = data;
|
||||
if (!this.data) {
|
||||
return;
|
||||
}
|
||||
this.visible = true;
|
||||
this.title = `「${this.data.name}」食谱计划`;
|
||||
},
|
||||
handleOnClosed() {
|
||||
this.data = undefined;
|
||||
},
|
||||
handleInnerOpen() {
|
||||
this.innerVisible = true;
|
||||
this.innerTitle = `「${this.data.name}」暂停记录`;
|
||||
},
|
||||
handleOnInnerClosed() {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ :focus {
|
||||
outline: 0;
|
||||
}
|
||||
</style>
|
@ -1,22 +1,24 @@
|
||||
import Vue from 'vue'
|
||||
import Vue from "vue";
|
||||
|
||||
import Cookies from 'js-cookie'
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
|
||||
import Element from 'element-ui'
|
||||
import './assets/styles/element-variables.scss'
|
||||
import "normalize.css/normalize.css"; // a modern alternative to CSS resets
|
||||
import Element from "element-ui";
|
||||
import "./assets/styles/element-variables.scss";
|
||||
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
import '@/assets/styles/ruoyi.scss' // ruoyi css
|
||||
import App from './App'
|
||||
import store from './store'
|
||||
import router from './router'
|
||||
import permission from './directive/permission'
|
||||
import "@/assets/styles/index.scss"; // global css
|
||||
import "@/assets/styles/ruoyi.scss"; // ruoyi css
|
||||
import App from "./App";
|
||||
import store from "./store";
|
||||
import router from "./router";
|
||||
import permission from "./directive/permission";
|
||||
|
||||
import "./assets/icons"; // icon
|
||||
import "./permission"; // permission control
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/system/config";
|
||||
import VueScrollTo from "vue-scrollto";
|
||||
|
||||
import './assets/icons' // icon
|
||||
import './permission' // permission control
|
||||
import {getDicts} from "@/api/system/dict/data";
|
||||
import {getConfigKey} from "@/api/system/config";
|
||||
import {
|
||||
addDateRange,
|
||||
download,
|
||||
@ -32,40 +34,40 @@ import {
|
||||
} from "@/utils/ruoyi";
|
||||
import Pagination from "@/components/Pagination";
|
||||
//自定义表格工具扩展
|
||||
import RightToolbar from "@/components/RightToolbar"
|
||||
import RightToolbar from "@/components/RightToolbar";
|
||||
|
||||
// 全局方法挂载
|
||||
Vue.prototype.getDicts = getDicts
|
||||
Vue.prototype.getConfigKey = getConfigKey
|
||||
Vue.prototype.parseTime = parseTime
|
||||
Vue.prototype.resetForm = resetForm
|
||||
Vue.prototype.addDateRange = addDateRange
|
||||
Vue.prototype.selectDictLabel = selectDictLabel
|
||||
Vue.prototype.selectDictLabels = selectDictLabels
|
||||
Vue.prototype.download = download
|
||||
Vue.prototype.downloadResource = downloadResource
|
||||
Vue.prototype.handleTree = handleTree
|
||||
Vue.prototype.toThousands = toThousands
|
||||
Vue.prototype.digitUppercase = digitUppercase
|
||||
Vue.prototype.validatorIDCard = validatorIDCard
|
||||
Vue.prototype.getDicts = getDicts;
|
||||
Vue.prototype.getConfigKey = getConfigKey;
|
||||
Vue.prototype.parseTime = parseTime;
|
||||
Vue.prototype.resetForm = resetForm;
|
||||
Vue.prototype.addDateRange = addDateRange;
|
||||
Vue.prototype.selectDictLabel = selectDictLabel;
|
||||
Vue.prototype.selectDictLabels = selectDictLabels;
|
||||
Vue.prototype.download = download;
|
||||
Vue.prototype.downloadResource = downloadResource;
|
||||
Vue.prototype.handleTree = handleTree;
|
||||
Vue.prototype.toThousands = toThousands;
|
||||
Vue.prototype.digitUppercase = digitUppercase;
|
||||
Vue.prototype.validatorIDCard = validatorIDCard;
|
||||
|
||||
Vue.prototype.msgSuccess = function (msg) {
|
||||
this.$message({showClose: true, message: msg, type: "success"});
|
||||
}
|
||||
Vue.prototype.msgSuccess = function(msg) {
|
||||
this.$message({ showClose: true, message: msg, type: "success" });
|
||||
};
|
||||
|
||||
Vue.prototype.msgError = function (msg) {
|
||||
this.$message({showClose: true, message: msg, type: "error"});
|
||||
}
|
||||
Vue.prototype.msgError = function(msg) {
|
||||
this.$message({ showClose: true, message: msg, type: "error" });
|
||||
};
|
||||
|
||||
Vue.prototype.msgInfo = function (msg) {
|
||||
Vue.prototype.msgInfo = function(msg) {
|
||||
this.$message.info(msg);
|
||||
}
|
||||
};
|
||||
|
||||
// 全局组件挂载
|
||||
Vue.component('Pagination', Pagination)
|
||||
Vue.component('RightToolbar', RightToolbar)
|
||||
Vue.component("Pagination", Pagination);
|
||||
Vue.component("RightToolbar", RightToolbar);
|
||||
|
||||
Vue.use(permission)
|
||||
Vue.use(permission);
|
||||
|
||||
/**
|
||||
* If you don't want to use mock-server
|
||||
@ -77,14 +79,34 @@ Vue.use(permission)
|
||||
*/
|
||||
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||
})
|
||||
size: Cookies.get("size") || "medium" // set element-ui default size
|
||||
});
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Vue.directive("title", {
|
||||
inserted: function(el, binding) {
|
||||
document.title = el.dataset.title;
|
||||
}
|
||||
});
|
||||
|
||||
Vue.use(VueScrollTo, {
|
||||
container: "body",
|
||||
duration: 500,
|
||||
easing: "ease",
|
||||
offset: 0,
|
||||
force: true,
|
||||
cancelable: true,
|
||||
onStart: false,
|
||||
onDone: false,
|
||||
onCancel: false,
|
||||
x: false,
|
||||
y: true
|
||||
});
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
el: "#app",
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
})
|
||||
});
|
||||
|
@ -140,19 +140,11 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: "/recipes",
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: "build",
|
||||
component: resolve =>
|
||||
require(["@/views/custom/recipesBuild"], resolve),
|
||||
name: "RecipiesBuild",
|
||||
props: true,
|
||||
meta: { title: "食谱制作" }
|
||||
}
|
||||
]
|
||||
path: "/recipes/build",
|
||||
component: resolve => require(["@/views/custom/recipesBuild"], resolve),
|
||||
name: "RecipiesBuild",
|
||||
meta: { title: "食谱制作" },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: "/f/contract/:id(\\d+)",
|
||||
@ -174,14 +166,13 @@ export const constantRoutes = [
|
||||
hidden: true,
|
||||
meta: { title: "胜唐体控健康评估表" }
|
||||
},
|
||||
{
|
||||
{
|
||||
path: "/foodHeatCalculator/:id",
|
||||
component: resolve =>
|
||||
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
|
||||
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
|
||||
hidden: true,
|
||||
meta: { title: "外食计算器" }
|
||||
},
|
||||
|
||||
}
|
||||
];
|
||||
|
||||
export default new Router({
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
addRecipesApi
|
||||
} from "@/api/custom/recipes";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const oriState = {
|
||||
cusId: undefined,
|
||||
@ -24,8 +23,8 @@ const oriState = {
|
||||
dishesTypeOptions: [],
|
||||
typeOptions: [],
|
||||
currentDay: -1,
|
||||
startDate: "",
|
||||
endDate: ""
|
||||
startNum: 0,
|
||||
endNum: 0
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@ -36,9 +35,9 @@ const mutations = {
|
||||
if (tarDishes) {
|
||||
const tarIgd = tarDishes.igdList.find(obj => obj.id === payload.igdId);
|
||||
if (tarIgd) {
|
||||
Object.keys(payload).forEach(key => {
|
||||
tarIgd[key] = payload[key];
|
||||
});
|
||||
payload.weight && (tarIgd.weight = payload.weight);
|
||||
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
|
||||
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -125,63 +124,73 @@ const actions = {
|
||||
healthyData
|
||||
});
|
||||
},
|
||||
async getRecipesInfo({ commit }, payload) {
|
||||
async getRecipesInfo({ commit, state }, payload) {
|
||||
commit("updateStateData", {
|
||||
recipesDataLoading: true
|
||||
});
|
||||
const recipesDataResult = await getRecipesApi(payload.recipesId);
|
||||
let recipesData = undefined;
|
||||
let recipesData = [];
|
||||
if (recipesDataResult.code === 200) {
|
||||
recipesData = recipesDataResult.data.map(dayData => {
|
||||
return {
|
||||
id: dayData.id,
|
||||
numDay: dayData.numDay,
|
||||
dishes: dayData.dishes.reduce((arr, cur) => {
|
||||
if (
|
||||
cur.dishesId > -1 &&
|
||||
cur.name &&
|
||||
cur.igdList.length > 0 &&
|
||||
cur.type !== "0"
|
||||
) {
|
||||
arr.push({
|
||||
id: cur.id,
|
||||
dishesId: cur.dishesId,
|
||||
name: cur.name,
|
||||
menuId: cur.menuId,
|
||||
methods: cur.methods,
|
||||
type: cur.type,
|
||||
isMain: cur.isMain,
|
||||
igdList: cur.igdList.reduce((igdArr, igdData) => {
|
||||
if (igdData.id > 0) {
|
||||
const tarDetail = cur.detail.find(
|
||||
obj => obj.id === igdData.id
|
||||
);
|
||||
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
|
||||
? parseFloat(tarDetail.cus_weight)
|
||||
: igdData.cusWeight,
|
||||
weight: tarDetail
|
||||
? parseFloat(tarDetail.weight)
|
||||
: igdData.weight,
|
||||
notRec: igdData.notRec,
|
||||
rec: igdData.rec,
|
||||
type: igdData.type
|
||||
});
|
||||
}
|
||||
return igdArr;
|
||||
}, [])
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, [])
|
||||
};
|
||||
});
|
||||
const { endNum, startNum } = state;
|
||||
let length = null;
|
||||
if (endNum && startNum) {
|
||||
length = endNum - startNum;
|
||||
}
|
||||
recipesData = recipesDataResult.data.reduce((outArr, dayData, idx) => {
|
||||
if (!length || (length && length >= idx)) {
|
||||
outArr.push({
|
||||
id: dayData.id,
|
||||
numDay: startNum ? startNum + idx : dayData.numDay,
|
||||
dishes: dayData.dishes.reduce((arr, cur) => {
|
||||
if (
|
||||
cur.dishesId > -1 &&
|
||||
cur.name &&
|
||||
cur.igdList.length > 0 &&
|
||||
cur.type !== "0"
|
||||
) {
|
||||
arr.push({
|
||||
id: cur.id,
|
||||
dishesId: cur.dishesId,
|
||||
name: cur.name,
|
||||
menuId: cur.menuId,
|
||||
methods: cur.methods,
|
||||
type: cur.type,
|
||||
isMain: cur.isMain,
|
||||
igdList: cur.igdList.reduce((igdArr, igdData) => {
|
||||
if (igdData.id > 0) {
|
||||
const tarDetail = cur.detail.find(
|
||||
obj => obj.id === igdData.id
|
||||
);
|
||||
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
|
||||
? parseFloat(tarDetail.cus_weight)
|
||||
: igdData.cusWeight,
|
||||
weight: tarDetail
|
||||
? parseFloat(tarDetail.weight)
|
||||
: igdData.weight,
|
||||
notRec: igdData.notRec,
|
||||
rec: igdData.rec,
|
||||
type: igdData.type
|
||||
});
|
||||
}
|
||||
return igdArr;
|
||||
}, [])
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, [])
|
||||
});
|
||||
}
|
||||
return outArr;
|
||||
}, []);
|
||||
} else {
|
||||
throw new Error(recipesDataResult.msg);
|
||||
}
|
||||
@ -193,9 +202,7 @@ const actions = {
|
||||
cusId,
|
||||
planId,
|
||||
menus: recipesData.map((menu, idx) => ({
|
||||
date: dayjs(state.startDate)
|
||||
.add(idx, "day")
|
||||
.format("YYYY-MM-DD"),
|
||||
numDay: menu.numDay,
|
||||
cusId,
|
||||
dishes: menu.dishes.map(dObj => ({
|
||||
dishesId: dObj.dishesId,
|
||||
@ -209,11 +216,19 @@ const actions = {
|
||||
}))
|
||||
}))
|
||||
};
|
||||
|
||||
const result = await addRecipesApi(params);
|
||||
if (result.code === 200) {
|
||||
const recipesId = result.data;
|
||||
commit("updateStateData", { recipesId });
|
||||
dispatch("getRecipesInfo", { recipesId });
|
||||
payload.callback &&
|
||||
payload.callback({
|
||||
recipesId: result.data,
|
||||
name: state.healthyData.name,
|
||||
cusId: state.cusId,
|
||||
planId: state.planId
|
||||
});
|
||||
}
|
||||
// console.log(params);
|
||||
},
|
||||
@ -247,6 +262,7 @@ const actions = {
|
||||
}
|
||||
},
|
||||
async updateDishes({ commit, state }, payload) {
|
||||
// console.log(payload);
|
||||
if (state.recipesId) {
|
||||
const tarDishes = state.recipesData[payload.num].dishes.find(
|
||||
obj => obj.dishesId === payload.dishesId
|
||||
@ -273,9 +289,9 @@ const actions = {
|
||||
commit("updateRecipesDishesDetail", payload);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
commit("updateRecipesDishesDetail", payload);
|
||||
}
|
||||
} else {
|
||||
commit("updateRecipesDishesDetail", payload);
|
||||
}
|
||||
},
|
||||
async deleteDishes({ commit, state }, payload) {
|
||||
|
@ -346,6 +346,7 @@
|
||||
<!-- 外食热量统计 -->
|
||||
<heatStatisticsDrawer ref="heatStatisticsRef"></heatStatisticsDrawer>
|
||||
<!-- 食谱计划抽屉 -->
|
||||
<RecipesPlanDrawer ref="recipesPlanDrawerRef"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -364,6 +365,7 @@ import OrderDrawer from "@/components/OrderDrawer";
|
||||
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
|
||||
import ContractDrawer from "@/components/ContractDrawer";
|
||||
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
|
||||
import RecipesPlanDrawer from '@/components/RecipesPlanDrawer'
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
@ -373,6 +375,7 @@ export default {
|
||||
"physical-signs-dialog": PhysicalSignsDialog,
|
||||
"contract-drawer": ContractDrawer,
|
||||
heatStatisticsDrawer: HeatStatisticsDrawer,
|
||||
RecipesPlanDrawer
|
||||
},
|
||||
data() {
|
||||
const userId = store.getters && store.getters.userId;
|
||||
@ -392,14 +395,6 @@ export default {
|
||||
total: 0,
|
||||
// 客户档案表格数据
|
||||
customerCenterList: [],
|
||||
// 售前字典
|
||||
// preSaleIdOptions: [],
|
||||
// 售后字典
|
||||
// afterSaleIdOptions: [],
|
||||
// 主营养师字典
|
||||
// nutritionistIdOptions: [],
|
||||
// 助理营养师字典
|
||||
// nutriAssisIdOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
@ -459,9 +454,13 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
// 售前字典
|
||||
"preSaleIdOptions",
|
||||
// 售后字典
|
||||
"afterSaleIdOptions",
|
||||
// 主营养师字典
|
||||
"nutritionistIdOptions",
|
||||
// 助理营养师字典
|
||||
"nutriAssisIdOptions",
|
||||
]),
|
||||
},
|
||||
@ -511,6 +510,7 @@ export default {
|
||||
},
|
||||
handleOnMenuClick(row) {
|
||||
// console.log(row);
|
||||
this.$refs['recipesPlanDrawerRef'].showDrawer(row);
|
||||
},
|
||||
handleClickHeatStatistics(row) {
|
||||
this.$refs["heatStatisticsRef"].showDrawer(row);
|
||||
|
@ -335,7 +335,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||
<!-- <el-table-column label="手机号" align="center" prop="phone" width="100" /> -->
|
||||
<el-table-column label="手机号" align="center" prop="phone" width="100" />
|
||||
<el-table-column label="成交金额" align="center" prop="amount">
|
||||
<template slot-scope="scope">
|
||||
{{ toThousands(scope.row.amount) }}
|
||||
@ -391,14 +391,14 @@
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-s-data"
|
||||
@click="orderPauseManage(scope.row)"
|
||||
v-hasPermi="['orderPause:pause:query']"
|
||||
>暂停记录管理
|
||||
</el-button> -->
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-if="
|
||||
@ -660,7 +660,7 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm(
|
||||
'是否确认删除销售订单编号为"' + orderIds + '"的数据项?',
|
||||
'是否确认删除销售订单编号为"' + row.orderId + '"的数据项?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
|
@ -4,9 +4,11 @@
|
||||
|
||||
<script>
|
||||
import echarts from "echarts";
|
||||
import VueScrollTo from "vue-scrollto";
|
||||
require("@/utils/echarts/myShine");
|
||||
import resize from "@/views/dashboard/mixins/resize";
|
||||
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
const { mapMutations } = createNamespacedHelpers("recipes");
|
||||
const animationDuration = 6000;
|
||||
|
||||
export default {
|
||||
@ -55,8 +57,10 @@ export default {
|
||||
// console.log("updated");
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(["setCurrentDay"]),
|
||||
initChart() {
|
||||
this.chart = echarts.init(this.$el, "myShine");
|
||||
this.chart.on("click", this.handleOnClick);
|
||||
this.updateChart(this.data.length > 0 ? this.data : {});
|
||||
},
|
||||
updateChart(source) {
|
||||
@ -134,6 +138,14 @@ export default {
|
||||
})),
|
||||
});
|
||||
},
|
||||
handleOnClick(params) {
|
||||
// console.log(params);
|
||||
const { dataIndex } = params;
|
||||
this.setCurrentDay({ currentDay: dataIndex });
|
||||
VueScrollTo.scrollTo(`#recipes${dataIndex}`, 500, {
|
||||
container: "#recipes_content",
|
||||
});
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
data(newVal, oldVal) {
|
||||
|
@ -124,6 +124,7 @@ export default {
|
||||
text: `${data.name}营养统计`,
|
||||
},
|
||||
tooltip: {
|
||||
position: 'right',
|
||||
trigger: "item",
|
||||
appendToBody: true,
|
||||
formatter: (params) => {
|
||||
|
@ -60,7 +60,12 @@ export default {
|
||||
this.$emit("update:collapse", !this.collapse);
|
||||
},
|
||||
handleOnSave() {
|
||||
this.saveRecipes();
|
||||
this.saveRecipes({
|
||||
callback: (query) => {
|
||||
console.log(query);
|
||||
this.$router.replace({ path: "/recipes/build", query });
|
||||
},
|
||||
});
|
||||
},
|
||||
...mapActions(["saveRecipes"]),
|
||||
},
|
||||
|
@ -6,7 +6,7 @@
|
||||
}}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="菜品类型">
|
||||
<el-radio-group v-model="type" @change="handleOnTypeChange">
|
||||
<el-radio-group v-model="mType" @change="handleOnTypeChange">
|
||||
<el-radio
|
||||
v-for="item in typeOptions"
|
||||
:key="item.dictValue"
|
||||
@ -41,11 +41,7 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="proteinRatio"
|
||||
label="P/100g"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="proteinRatio" label="P/100g" align="center" />
|
||||
<el-table-column prop="fatRatio" label="F/100g" align="center" />
|
||||
<el-table-column prop="carbonRatio" label="C/100g" align="center" />
|
||||
</el-table>
|
||||
@ -80,7 +76,7 @@ export default {
|
||||
name: "ConfigDishes",
|
||||
data() {
|
||||
return {
|
||||
nType: this.type,
|
||||
mType: this.type,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@ -113,14 +109,19 @@ export default {
|
||||
EditableText,
|
||||
EditableUnit,
|
||||
},
|
||||
watch: {
|
||||
type(val) {
|
||||
this.mType = val;
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
handleOnTypeChange(type) {
|
||||
this.$emit("onChane", { type });
|
||||
this.$emit("onChange", { type });
|
||||
},
|
||||
handleOnWeightChange(data, val) {
|
||||
// console.log({ data, val });
|
||||
this.$emit("onChane", {
|
||||
this.$emit("onChange", {
|
||||
igdList: produce(this.igdList, (draftState) => {
|
||||
const tarIgd = draftState.find((obj) => obj.id === data.id);
|
||||
if (tarIgd) {
|
||||
@ -131,7 +132,7 @@ export default {
|
||||
},
|
||||
handleOnCustomUnitChange(data, val) {
|
||||
// console.log({ data, val });
|
||||
this.$emit("onChane", {
|
||||
this.$emit("onChange", {
|
||||
igdList: produce(this.igdList, (draftState) => {
|
||||
const tarIgd = draftState.find((obj) => obj.id === data.id);
|
||||
if (tarIgd) {
|
||||
|
@ -7,15 +7,14 @@
|
||||
:cell-style="{ padding: '2px 0' }"
|
||||
:header-cell-style="{ padding: '4px 0', height: 'unset' }"
|
||||
size="mini"
|
||||
:style="`outline: ${
|
||||
currentDay + 1 === num ? '1px solid #d96969' : 'none'
|
||||
}`"
|
||||
:style="`outline: ${currentDay === num ? '1px solid #d96969' : 'none'}`"
|
||||
>
|
||||
<el-table-column prop="type" :width="100" align="center">
|
||||
<template slot="header">
|
||||
<span class="num_day" @click="handleOnOneDayAnalysis">{{
|
||||
`${name}第${num}天`
|
||||
}}</span>
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>{{ name }}</div>
|
||||
<div>{{ `第${numDay}天` }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<span style="font-weight: bold; font-size: 14px">{{
|
||||
@ -23,7 +22,7 @@
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="菜品" prop="name" align="center">
|
||||
<el-table-column label="菜品" prop="name" align="center" :width="180">
|
||||
<template slot="header">
|
||||
<el-tooltip
|
||||
class="item"
|
||||
@ -50,7 +49,12 @@
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="食材" prop="igdName" align="center" />
|
||||
<el-table-column
|
||||
label="食材"
|
||||
prop="igdName"
|
||||
align="center"
|
||||
:width="180"
|
||||
/>
|
||||
<el-table-column label="分量估算" :width="80" align="center">
|
||||
<template slot-scope="scope">
|
||||
<EditableUnit
|
||||
@ -71,42 +75,84 @@
|
||||
<el-table-column
|
||||
label="蛋白质/100g"
|
||||
prop="proteinRatio"
|
||||
:width="100"
|
||||
:width="60"
|
||||
align="center"
|
||||
/>
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>蛋白质</div>
|
||||
<div>/100g</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="脂肪/100g"
|
||||
prop="fatRatio"
|
||||
:width="90"
|
||||
:width="60"
|
||||
align="center"
|
||||
/>
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>脂肪</div>
|
||||
<div>/100g</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="碳水/100g"
|
||||
prop="carbonRatio"
|
||||
:width="90"
|
||||
:width="60"
|
||||
align="center"
|
||||
/>
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>碳水</div>
|
||||
<div>/100g</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="蛋白质含量"
|
||||
prop="proteinRatio"
|
||||
:width="90"
|
||||
:width="60"
|
||||
align="center"
|
||||
:formatter="nutriFormatter"
|
||||
/>
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>蛋白质</div>
|
||||
<div>含量</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="脂肪含量"
|
||||
prop="fatRatio"
|
||||
:width="90"
|
||||
:width="60"
|
||||
align="center"
|
||||
:formatter="nutriFormatter"
|
||||
/>
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>脂肪</div>
|
||||
<div>含量</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="碳水含量"
|
||||
prop="carbonRatio"
|
||||
:width="90"
|
||||
:width="60"
|
||||
align="center"
|
||||
:formatter="nutriFormatter"
|
||||
/>
|
||||
>
|
||||
<template slot="header">
|
||||
<div class="num_day" @click="handleOnOneDayAnalysis">
|
||||
<div>碳水</div>
|
||||
<div>含量</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="做法" prop="methods" />
|
||||
</el-table>
|
||||
<AddDishesDrawer ref="drawerRef" @onConfirm="handleOnDishesConfirm" />
|
||||
@ -141,6 +187,10 @@ export default {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
numDay: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
EditableText,
|
||||
@ -266,7 +316,7 @@ export default {
|
||||
},
|
||||
handleOnOneDayAnalysis(e) {
|
||||
// 校验某天
|
||||
this.setCurrentDay({ currentDay: this.num - 1 });
|
||||
this.setCurrentDay({ currentDay: this.num });
|
||||
},
|
||||
handleOnAdd() {
|
||||
// console.log(this.num);
|
||||
@ -274,12 +324,12 @@ export default {
|
||||
},
|
||||
handleOnDelete(data) {
|
||||
// console.log(data);
|
||||
this.deleteDishes({ num: this.num - 1, id: data.id });
|
||||
this.deleteDishes({ num: this.num, id: data.id });
|
||||
},
|
||||
handleOnWeightChange(data, weight) {
|
||||
// console.log({ data, weight });
|
||||
console.log({ data, weight });
|
||||
this.updateDishes({
|
||||
num: this.num - 1,
|
||||
num: this.num,
|
||||
dishesId: data.dishesId,
|
||||
igdId: data.igdId,
|
||||
weight,
|
||||
@ -288,7 +338,7 @@ export default {
|
||||
handleOnCustomUnitChange(data, { cusWeight, cusUnit }) {
|
||||
// console.log({ data, cusWeight, cusUnit });
|
||||
this.updateDishes({
|
||||
num: this.num - 1,
|
||||
num: this.num,
|
||||
dishesId: data.dishesId,
|
||||
igdId: data.igdId,
|
||||
cusWeight,
|
||||
@ -298,7 +348,7 @@ export default {
|
||||
handleOnDishesConfirm(data) {
|
||||
// console.log(data);
|
||||
this.addDishes({
|
||||
num: this.num - 1,
|
||||
num: this.num,
|
||||
data,
|
||||
});
|
||||
},
|
||||
|
@ -2,15 +2,18 @@
|
||||
<div class="recipes_view_wrapper">
|
||||
<RecipesAspectCom :collapse.sync="collapse" :data="analyseData" />
|
||||
<div
|
||||
id="recipes_content"
|
||||
class="recipes_content"
|
||||
:style="`height: calc(100vh - ${collapse ? 142 : 312}px)`"
|
||||
:style="`height: calc(100vh - ${collapse ? 62 : 232}px)`"
|
||||
>
|
||||
<RecipesCom
|
||||
v-for="(item, index) in data"
|
||||
:id="`recipes${index}`"
|
||||
:key="item.id"
|
||||
:data="item"
|
||||
:name="name"
|
||||
:num="index + 1"
|
||||
:num="index"
|
||||
:numDay="item.numDay"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="recipes_build_wrapper">
|
||||
<div class="recipes_build_wrapper" v-title :data-title="$route.query.name">
|
||||
<div class="left" v-loading="recipesDataLoading">
|
||||
<RecipesView
|
||||
v-if="!!recipesData.length"
|
||||
@ -35,13 +35,13 @@ export default {
|
||||
return {};
|
||||
},
|
||||
mounted() {
|
||||
const { cusId, planId, startDate, endDate, recipesId } = this.$route.query;
|
||||
const { cusId, planId, startNum, endNum, recipesId } = this.$route.query;
|
||||
|
||||
this.init({
|
||||
cusId,
|
||||
planId,
|
||||
startDate,
|
||||
endDate,
|
||||
startNum: parseInt(startNum),
|
||||
endNum: parseInt(endNum),
|
||||
recipesId,
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.message);
|
||||
@ -78,7 +78,7 @@ export default {
|
||||
.recipes_build_wrapper {
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
height: calc(100vh - 86px);
|
||||
height: 100vh;
|
||||
.left {
|
||||
flex: 4;
|
||||
border-right: 1px solid #e6ebf5;
|
||||
|
@ -113,18 +113,24 @@
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="客户姓名" align="center" prop="customer" />
|
||||
<!-- <el-table-column
|
||||
<el-table-column
|
||||
label="客户手机号"
|
||||
align="center"
|
||||
prop="hidePhone"
|
||||
width="180"
|
||||
/> -->
|
||||
/>
|
||||
<el-table-column
|
||||
label="食谱日期范围"
|
||||
align="center"
|
||||
prop="scopeDate"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
label="食谱天数范围"
|
||||
align="center"
|
||||
prop="scopeDay"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column label="营养师" align="center" prop="nutritionist" />
|
||||
<el-table-column
|
||||
label="营养师助理"
|
||||
@ -447,8 +453,9 @@ export default {
|
||||
this.recipesPlanList.forEach(function (item, index) {
|
||||
item.scopeDate =
|
||||
dayjs(item.startDate).format("YYYY-MM-DD") +
|
||||
" 到 " +
|
||||
" 至 " +
|
||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||
item.scopeDay = `第${item.startNumDay} 至 ${item.endNumDay}天`;
|
||||
});
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
@ -603,25 +610,25 @@ export default {
|
||||
},
|
||||
handleBuild(data) {
|
||||
// console.log(data);
|
||||
const { startDate, endDate, id, cusId, recipesId } = data;
|
||||
const { id, cusId, recipesId, customer, startNumDay, endNumDay } = data;
|
||||
|
||||
// const params = { id: data.id, cusId: data.orderId };
|
||||
// const path = `/recipes/build/${orderId}/${id}/${recipesId || 0}`;
|
||||
// this.$router.push({
|
||||
// name: "build",
|
||||
// params,
|
||||
// });
|
||||
const queryParam = {
|
||||
planId: id,
|
||||
cusId,
|
||||
name: customer,
|
||||
};
|
||||
if (!recipesId) {
|
||||
queryParam.startDate = startDate;
|
||||
queryParam.endDate = endDate;
|
||||
} else {
|
||||
if (recipesId) {
|
||||
queryParam.recipesId = recipesId;
|
||||
} else {
|
||||
queryParam.startNum = startNumDay;
|
||||
queryParam.endNum = endNumDay;
|
||||
}
|
||||
this.$router.push({ path: "/recipes/build", query: queryParam });
|
||||
const routeUrl = this.$router.resolve({
|
||||
path: "/recipes/build",
|
||||
query: queryParam,
|
||||
});
|
||||
window.open(routeUrl.href, "_blank");
|
||||
// this.$router.push({ path: "/recipes/build", query: queryParam });
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user