修复通俗重量
This commit is contained in:
@ -4,7 +4,7 @@ import request from '@/utils/request'
|
||||
export function listIngredient(query) {
|
||||
const {recIds, notRecIds} = query;
|
||||
return request({
|
||||
url: '/custom/ingredient/list',
|
||||
url: `/custom/ingredient/list?pageSize=${query.pageSize}&pageNum=${query.pageNum}`,
|
||||
method: 'post',
|
||||
data: {
|
||||
...query,
|
||||
|
25
stdiet-ui/src/components/RecipesView/index.vue
Normal file
25
stdiet-ui/src/components/RecipesView/index.vue
Normal file
@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<div class="aspect">指标</div>
|
||||
<div class="recipes">食谱</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "RecipesView",
|
||||
components: {},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.main {
|
||||
.aspect {
|
||||
}
|
||||
|
||||
.recipies {
|
||||
}
|
||||
}
|
||||
</style>
|
@ -145,7 +145,7 @@ export const constantRoutes = [
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: "build/:cusId/:id(\\d+)",
|
||||
path: "build/:cusId/:planId/:recipesId",
|
||||
component: resolve =>
|
||||
require(["@/views/custom/recipesBuild"], resolve),
|
||||
name: "RecipiesBuild",
|
||||
|
@ -1,13 +1,15 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import app from './modules/app'
|
||||
import user from './modules/user'
|
||||
import tagsView from './modules/tagsView'
|
||||
import permission from './modules/permission'
|
||||
import settings from './modules/settings'
|
||||
import getters from './getters'
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
import app from "./modules/app";
|
||||
import user from "./modules/user";
|
||||
import tagsView from "./modules/tagsView";
|
||||
import permission from "./modules/permission";
|
||||
import settings from "./modules/settings";
|
||||
import recipes from "./modules/recipes";
|
||||
|
||||
Vue.use(Vuex)
|
||||
import getters from "./getters";
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
@ -15,9 +17,10 @@ const store = new Vuex.Store({
|
||||
user,
|
||||
tagsView,
|
||||
permission,
|
||||
settings
|
||||
settings,
|
||||
recipes
|
||||
},
|
||||
getters
|
||||
})
|
||||
});
|
||||
|
||||
export default store
|
||||
export default store;
|
||||
|
50
stdiet-ui/src/store/modules/recipes.js
Normal file
50
stdiet-ui/src/store/modules/recipes.js
Normal file
@ -0,0 +1,50 @@
|
||||
import { getOrder } from "@/api/custom/order";
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
import { dealHealthy } from "@/utils/healthyData";
|
||||
import { getRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
|
||||
const oriState = {
|
||||
healthyData: {},
|
||||
healthyDataType: 0
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
setHealtyData(state, payload) {
|
||||
state.healthyDataType = payload.healthyDataType;
|
||||
state.healthyData = payload.healthyData;
|
||||
},
|
||||
clean(state) {
|
||||
console.log("clean");
|
||||
Object.keys(oriState).forEach(key => {
|
||||
state[key] = oriState[key];
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async init({ commit }, payload) {
|
||||
const orderResult = await getOrder(payload.cusId);
|
||||
if (!orderResult.data.cusId) {
|
||||
throw new Error("未找到用户id");
|
||||
}
|
||||
|
||||
const healthyDataResult = await getCustomerPhysicalSignsByCusId(
|
||||
orderResult.data.cusId
|
||||
);
|
||||
// 设置健康数据
|
||||
commit("setHealtyData", {
|
||||
healthyDataType: healthyDataResult.data.type,
|
||||
healthyData: dealHealthy(healthyDataResult.data.customerHealthy)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getters = {};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: Object.assign({}, oriState),
|
||||
mutations,
|
||||
actions,
|
||||
getters
|
||||
};
|
@ -258,7 +258,7 @@
|
||||
step="0.5"
|
||||
:min="0.5"
|
||||
/> -->
|
||||
<el-select size="mini" v-model="scope.row.cusWei">
|
||||
<el-select size="mini" v-model="scope.row.cusWeight">
|
||||
<el-option
|
||||
v-for="dict in cusWeightOptions"
|
||||
:key="dict.dictValue"
|
||||
@ -502,7 +502,7 @@ export default {
|
||||
return this.selectDictLabel(this.cusUnitOptions, row.type);
|
||||
},
|
||||
cusWeightFormat(row, column) {
|
||||
return this.selectDictLabel(this.cusWeightOptions, row.cusWei);
|
||||
return this.selectDictLabel(this.cusWeightOptions, row.cusWeight);
|
||||
},
|
||||
// 地域字典翻译
|
||||
reviewStatusFormat(row, column) {
|
||||
@ -686,7 +686,7 @@ export default {
|
||||
newTableData.push({
|
||||
...tmpTableObj,
|
||||
weight: 100,
|
||||
cusWei: 1,
|
||||
cusWeight: 1,
|
||||
cusUnit: 1,
|
||||
});
|
||||
}
|
||||
|
@ -77,12 +77,13 @@ export default {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.msg-info {
|
||||
display: flex;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.text-info-extra {
|
||||
margin-bottom: 2px;
|
||||
|
||||
.text-info-extra {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -181,12 +181,13 @@ export default {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.msg-info {
|
||||
display: flex;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.text-info-extra {
|
||||
margin-bottom: 2px;
|
||||
|
||||
.text-info-extra {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -32,21 +32,21 @@ export default {
|
||||
props: ["title", "value", "extraclass"],
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.text_info_wrapper {
|
||||
display: flex;
|
||||
margin-right: 24px;
|
||||
min-width: 120px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.text_info_wrapper .title {
|
||||
color: #8c8c8c;
|
||||
width: auto;
|
||||
}
|
||||
.title {
|
||||
color: #8c8c8c;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.text_info_wrapper .value {
|
||||
/* color: #696969; */
|
||||
flex: 1;
|
||||
.value {
|
||||
/* color: #696969; */
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -10,10 +10,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getOrder } from "@/api/custom/order";
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
import { dealHealthy } from "@/utils/healthyData";
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
|
||||
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
|
||||
"recipes"
|
||||
);
|
||||
|
||||
import HealthyView from "./HealthyView";
|
||||
import BodySignView from "./BodySignView";
|
||||
@ -21,47 +22,54 @@ import BodySignView from "./BodySignView";
|
||||
export default {
|
||||
name: "BuildRecipies",
|
||||
data() {
|
||||
return {
|
||||
healthyData: {},
|
||||
healthyDataType: 0,
|
||||
};
|
||||
return {};
|
||||
},
|
||||
created() {
|
||||
getOrder(this.cusId).then((res) => {
|
||||
if (!res.data.cusId) {
|
||||
this.$message.error("未找到用户id");
|
||||
return;
|
||||
}
|
||||
getCustomerPhysicalSignsByCusId(res.data.cusId).then((iRes) => {
|
||||
this.healthyDataType = iRes.data.type;
|
||||
this.healthyData = dealHealthy(iRes.data.customerHealthy);
|
||||
// console.log(this.healthyData);
|
||||
});
|
||||
mounted() {
|
||||
//
|
||||
console.log({
|
||||
cusId: this.cusId,
|
||||
recipesId: this.recipesId,
|
||||
});
|
||||
this.init({ cusId: this.cusId }).catch((err) => {
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
},
|
||||
destroyed() {
|
||||
this.clean();
|
||||
},
|
||||
created() {},
|
||||
components: {
|
||||
HealthyView,
|
||||
BodySignView,
|
||||
},
|
||||
props: ["id", "cusId"],
|
||||
methods: {},
|
||||
props: ["planId", "cusId", "recipesId"],
|
||||
computed: {
|
||||
...mapState({
|
||||
healthyData: (state) => state.healthyData,
|
||||
healthyDataType: (state) => state.healthyDataType,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["init"]),
|
||||
...mapMutations(["clean"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
.content {
|
||||
display: flex;
|
||||
height: calc(100vh - 124px);
|
||||
}
|
||||
.content .left {
|
||||
flex: 4;
|
||||
border-right: 1px solid rgb(0 21 41 / 8%);
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
.content .right {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding-left: 20px;
|
||||
overflow: auto;
|
||||
.left {
|
||||
flex: 4;
|
||||
border-right: 1px solid #e6ebf5;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
.right {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
padding-left: 20px;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="content">
|
||||
<div class="left"></div>
|
||||
<div class="right"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getOrder } from "@/api/custom/order";
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
export default {
|
||||
name: "BuildRecipies",
|
||||
data() {
|
||||
return {
|
||||
healthyData: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
getOrder(this.cusId).then((res) => {
|
||||
console.log(res);
|
||||
getCustomerPhysicalSignsByCusId(res.data.cusId).then((iRes) => {
|
||||
this.healthyData = iRes.data;
|
||||
});
|
||||
});
|
||||
},
|
||||
components: {},
|
||||
props: ["id", "cusId"],
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.content .left {
|
||||
}
|
||||
.content .right {
|
||||
}
|
||||
</style>
|
@ -198,7 +198,7 @@
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleBuild(scope.row)"
|
||||
>制作食谱</el-button
|
||||
>{{ `${scope.row.recipes_id ? "编辑" : "制作"}食谱` }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -604,10 +604,20 @@ export default {
|
||||
}
|
||||
},
|
||||
handleBuild(data) {
|
||||
this.$router.push({
|
||||
name: "RecipiesBuild",
|
||||
params: { id: data.id, cusId: data.orderId },
|
||||
});
|
||||
// const params = { id: data.id, cusId: data.orderId };
|
||||
let path = `/recipes/build/${data.orderId}/${data.id}`;
|
||||
if (data.recipes_id) {
|
||||
// params.recipesId = data.recipes_id;
|
||||
path += `/${data.recipes_id}`;
|
||||
}
|
||||
// test
|
||||
// params.recipesId = "61";
|
||||
path += '/61';
|
||||
// this.$router.push({
|
||||
// name: "build",
|
||||
// params,
|
||||
// });
|
||||
this.$router.push(path);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user