完成忌口检查

This commit is contained in:
huangdeliang 2021-03-15 20:53:32 +08:00
parent 5167828ff8
commit f02235936c
8 changed files with 253 additions and 127 deletions

View File

@ -36,7 +36,10 @@ const oriState = {
fontSize: parseInt(localStorage.getItem("fontSize")) || 12, fontSize: parseInt(localStorage.getItem("fontSize")) || 12,
dishBigClassOptions: [], dishBigClassOptions: [],
dishSmallClassOptions: [], dishSmallClassOptions: [],
leftShow: false //
leftShow: false,
notRecIgds: [],
igdTypeOptions: []
}; };
const mutations = { const mutations = {
@ -64,7 +67,7 @@ const mutations = {
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight); payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit); payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
} }
console.log(JSON.parse(JSON.stringify(state.recipesData))); // console.log(JSON.parse(JSON.stringify(state.recipesData)));
} else if (actionType === "delIgd") { } else if (actionType === "delIgd") {
tarDishes.igdList = tarDishes.igdList.filter( tarDishes.igdList = tarDishes.igdList.filter(
igd => igd.id !== payload.igdId igd => igd.id !== payload.igdId
@ -103,6 +106,9 @@ const mutations = {
toggleLeftShow(state, payload) { toggleLeftShow(state, payload) {
state.leftShow = !state.leftShow; state.leftShow = !state.leftShow;
}, },
setNotRecIgds(state, payload) {
state.notRecIgds = payload.data;
},
setDate(state, payload) { setDate(state, payload) {
state.startDate = payload.startDate; state.startDate = payload.startDate;
state.endDate = payload.endDate; state.endDate = payload.endDate;
@ -152,6 +158,9 @@ const actions = {
getDicts("dish_class_small").then(response => { getDicts("dish_class_small").then(response => {
commit("updateStateData", { dishSmallClassOptions: response.data }); commit("updateStateData", { dishSmallClassOptions: response.data });
}); });
getDicts("cus_ing_type").then(response => {
commit("updateStateData", { igdTypeOptions: response.data });
});
return new Promise((res, rej) => { return new Promise((res, rej) => {
// 健康数据 // 健康数据
@ -559,6 +568,19 @@ const getters = {
}); });
return arr; return arr;
}, []), }, []),
igdTypeDetial: state =>
state.recipesData.reduce((obj, cur) => {
cur.dishes.forEach(dObj => {
dObj.igdList.forEach(iObj => {
if (!obj[iObj.type]) {
obj[iObj.type] = [{ name: iObj.name, id: iObj.id }];
} else if (!obj[iObj.type].some(tObj => tObj.id === iObj.id)) {
obj[iObj.type].push({ name: iObj.name, id: iObj.id });
}
});
});
return obj;
}, {}),
cusUnitDict: state => cusUnitDict: state =>
state.cusUnitOptions.reduce((obj, cur) => { state.cusUnitOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel; obj[cur.dictValue] = cur.dictLabel;
@ -583,6 +605,11 @@ const getters = {
state.dishSmallClassOptions.reduce((obj, cur) => { state.dishSmallClassOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel; obj[cur.dictValue] = cur.dictLabel;
return obj; return obj;
}, {}),
igdTypeDict: state =>
state.igdTypeOptions.reduce((obj, cur) => {
obj[cur.dictValue] = cur.dictLabel;
return obj;
}, {}) }, {})
}; };

View File

@ -598,6 +598,11 @@ export function dealHealthy(customerHealthy) {
? `${customerHealthy.otherMotionField}` ? `${customerHealthy.otherMotionField}`
: ""; : "";
} }
if (customerHealthy.hasOwnProperty("otherOperationHistory")) {
customerHealthy.operationHistory += customerHealthy.otherOperationHistory
? `${customerHealthy.otherOperationHistory}`
: "";
}
if (customerHealthy.hasOwnProperty("defecationNum")) { if (customerHealthy.hasOwnProperty("defecationNum")) {
customerHealthy.defecationNum += "次/天"; customerHealthy.defecationNum += "次/天";
} }

View File

@ -12,12 +12,13 @@
v-model="queryParams.name" v-model="queryParams.name"
placeholder="请输入菜品名称" placeholder="请输入菜品名称"
clearable clearable
size="small" size="mini"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="菜品种类" prop="dishClass"> <el-form-item label="菜品种类" prop="dishClass">
<el-cascader <el-cascader
size="mini"
v-model="dishClassQueryParam" v-model="dishClassQueryParam"
:options="dishClassOptions" :options="dishClassOptions"
:props="{ expandTrigger: 'hover' }" :props="{ expandTrigger: 'hover' }"
@ -32,7 +33,7 @@
v-model="queryParams.type" v-model="queryParams.type"
placeholder="请选择菜品类型" placeholder="请选择菜品类型"
clearable clearable
size="small" size="mini"
> >
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
@ -473,14 +474,14 @@ export default {
name: null, name: null,
type: null, type: null,
bigClass: null, bigClass: null,
smallClass: null smallClass: null,
}, },
// //
form: {}, form: {},
// //
rules: {}, rules: {},
// //
dishClassQueryParam:[] dishClassQueryParam: [],
}; };
}, },
created() { created() {
@ -512,7 +513,10 @@ export default {
/** 查询菜品列表 */ /** 查询菜品列表 */
getList() { getList() {
this.loading = true; this.loading = true;
if(this.dishClassQueryParam != null && this.dishClassQueryParam.length > 0){ if (
this.dishClassQueryParam != null &&
this.dishClassQueryParam.length > 0
) {
this.queryParams.smallClass = this.dishClassQueryParam[1]; this.queryParams.smallClass = this.dishClassQueryParam[1];
} else { } else {
this.queryParams.smallClass = null; this.queryParams.smallClass = null;
@ -552,16 +556,18 @@ export default {
dealDishClassBigAndSmall() { dealDishClassBigAndSmall() {
this.dishClassBigOptions.forEach((item, index) => { this.dishClassBigOptions.forEach((item, index) => {
this.dishClassOptions.push({ this.dishClassOptions.push({
'value': parseInt(item.dictValue), value: parseInt(item.dictValue),
'label': item.dictLabel, label: item.dictLabel,
'children': [] children: [],
}); });
if (index == this.dishClassBigOptions.length - 1) { if (index == this.dishClassBigOptions.length - 1) {
this.dishClassSmallOptions.forEach((smallClass, i) => { this.dishClassSmallOptions.forEach((smallClass, i) => {
if (smallClass.remark) { if (smallClass.remark) {
this.dishClassOptions[parseInt(smallClass.remark-1)].children.push({ this.dishClassOptions[
'value': parseInt(smallClass.dictValue), parseInt(smallClass.remark - 1)
'label': smallClass.dictLabel ].children.push({
value: parseInt(smallClass.dictValue),
label: smallClass.dictLabel,
}); });
} }
}); });
@ -589,8 +595,14 @@ export default {
// //
dishClassFormat(row) { dishClassFormat(row) {
if (row.bigClass > 0 && row.smallClass > 0) { if (row.bigClass > 0 && row.smallClass > 0) {
let bigClassName = this.selectDictLabel(this.dishClassBigOptions, row.bigClass); let bigClassName = this.selectDictLabel(
let smallClassName = this.selectDictLabel(this.dishClassSmallOptions, row.smallClass); this.dishClassBigOptions,
row.bigClass
);
let smallClassName = this.selectDictLabel(
this.dishClassSmallOptions,
row.smallClass
);
return bigClassName + "/" + smallClassName; return bigClassName + "/" + smallClassName;
} }
return ""; return "";
@ -834,7 +846,7 @@ export default {
(arr, cur, idx) => { (arr, cur, idx) => {
if (idx > 1) { if (idx > 1) {
if (idx === 6) { if (idx === 6) {
arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + ' kcal'; arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + " kcal";
} else { } else {
arr[idx] = data.reduce((acc, dAcc) => { arr[idx] = data.reduce((acc, dAcc) => {
if (idx === 2) { if (idx === 2) {

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form> <el-form @submit.native.prevent>
<el-form-item label="菜品名"> <el-form-item label="菜品名">
<span style="color: #262626; font-size: 16px; font-weight: bold">{{ <span style="color: #262626; font-size: 16px; font-weight: bold">{{
name name

View File

@ -1,11 +1,14 @@
<template> <template>
<div> <div>
<el-row :gutter="15">
<el-form <el-form
:model="queryParams" :model="queryParams"
ref="queryForm" ref="queryForm"
:inline="true" :inline="true"
label-width="68px" label-width="68px"
@submit.native.prevent
> >
<el-col :span="6">
<el-form-item label="菜品名称" prop="name"> <el-form-item label="菜品名称" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
@ -15,10 +18,13 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="菜品种类" prop="dishClass"> <el-form-item label="菜品种类" prop="dishClass">
<el-cascader <el-cascader
filterable filterable
clearable clearable
size="mini"
v-model="dishClassQueryParam" v-model="dishClassQueryParam"
:options="dishClassOptions" :options="dishClassOptions"
:props="{ expandTrigger: 'hover' }" :props="{ expandTrigger: 'hover' }"
@ -26,6 +32,8 @@
placeholder="请选择菜品种类" placeholder="请选择菜品种类"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="菜品类型" prop="type"> <el-form-item label="菜品类型" prop="type">
<el-select <el-select
:disabled="lockType" :disabled="lockType"
@ -33,6 +41,7 @@
placeholder="请选择菜品类型" placeholder="请选择菜品类型"
clearable clearable
size="mini" size="mini"
width="120px"
> >
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
@ -42,6 +51,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<el-form-item> <el-form-item>
<el-button <el-button
type="cyan" type="cyan"
@ -55,6 +65,7 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-row>
<el-table <el-table
v-loading="loading" v-loading="loading"
@ -67,7 +78,10 @@
<el-table-column label="菜品名称" align="center" prop="name" /> <el-table-column label="菜品名称" align="center" prop="name" />
<el-table-column label="菜品种类" align="center" prop="bigClass"> <el-table-column label="菜品种类" align="center" prop="bigClass">
<template slot-scope="scope"> <template slot-scope="scope">
<AutoHideMessage :data="dishClassFormat(scope.row)" :maxLength="10"></AutoHideMessage> <AutoHideMessage
:data="dishClassFormat(scope.row)"
:maxLength="10"
></AutoHideMessage>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="菜品类型" align="center" prop="type"> <el-table-column label="菜品类型" align="center" prop="type">
@ -129,14 +143,19 @@ export default {
reviewStatus: "yes", reviewStatus: "yes",
}, },
// //
dishClassQueryParam:[] dishClassQueryParam: [],
}; };
}, },
components: { components: {
AutoHideInfo,AutoHideMessage AutoHideInfo,
AutoHideMessage,
}, },
computed: { computed: {
...mapState(["typeOptions","dishBigClassOptions","dishSmallClassOptions"]), ...mapState([
"typeOptions",
"dishBigClassOptions",
"dishSmallClassOptions",
]),
...mapGetters(["dishClassOptions"]), ...mapGetters(["dishClassOptions"]),
}, },
methods: { methods: {
@ -146,7 +165,10 @@ export default {
this.lockType = true; this.lockType = true;
this.queryParams.type = type; this.queryParams.type = type;
} }
if(this.dishClassQueryParam != null && this.dishClassQueryParam.length > 0){ if (
this.dishClassQueryParam != null &&
this.dishClassQueryParam.length > 0
) {
this.queryParams.smallClass = this.dishClassQueryParam[1]; this.queryParams.smallClass = this.dishClassQueryParam[1];
} else { } else {
this.queryParams.smallClass = null; this.queryParams.smallClass = null;
@ -215,8 +237,14 @@ export default {
// //
dishClassFormat(row) { dishClassFormat(row) {
if (row.bigClass > 0 && row.smallClass > 0) { if (row.bigClass > 0 && row.smallClass > 0) {
let bigClassName = this.selectDictLabel(this.dishBigClassOptions, row.bigClass); let bigClassName = this.selectDictLabel(
let smallClassName = this.selectDictLabel(this.dishSmallClassOptions, row.smallClass); this.dishBigClassOptions,
row.bigClass
);
let smallClassName = this.selectDictLabel(
this.dishSmallClassOptions,
row.smallClass
);
return bigClassName + "/" + smallClassName; return bigClassName + "/" + smallClassName;
} }
return ""; return "";

View File

@ -9,7 +9,7 @@
:step="5" :step="5"
:value="value" :value="value"
@blur="handleOnBlur" @blur="handleOnBlur"
@keydown.enter.native="handleEnterClick" @keydown="handleOnKeydown"
/> />
</div> </div>
</template> </template>
@ -43,8 +43,11 @@ export default {
this.$message.error("数字必须大于0"); this.$message.error("数字必须大于0");
} }
}, },
handleEnterClick(e) { handleOnKeydown(e) {
// console.log(e);
if (e.keyCode === 13) {
e.target.blur(); e.target.blur();
}
}, },
}, },
}; };

View File

@ -47,7 +47,7 @@
</el-popover> </el-popover>
</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">
<template slot="header"> <template slot="header">
<el-tooltip <el-tooltip
class="item" class="item"
@ -108,7 +108,7 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="食材" prop="igdName" align="center" :width="180"> <el-table-column label="食材" prop="igdName" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span <span
v-if=" v-if="
@ -412,6 +412,7 @@ export default {
"fontSize", "fontSize",
"canCopyMenuTypes", "canCopyMenuTypes",
"recipesId", "recipesId",
"notRecIgds",
]), ]),
}, },
methods: { methods: {
@ -420,7 +421,11 @@ export default {
if (!columnIndex) { if (!columnIndex) {
return "recipes_first_col"; return "recipes_first_col";
} else { } else {
return `recipes_cell recipes_cell_${this.fontSize}`; return `recipes_cell recipes_cell_${this.fontSize} ${
columnIndex === 2 && this.notRecIgds.includes(row.igdId)
? "warning_heightlight"
: ""
}`;
} }
}, },
handleParentClick(e) { handleParentClick(e) {
@ -660,4 +665,9 @@ export default {
.recipes_cell_18 { .recipes_cell_18 {
font-size: 18px; font-size: 18px;
} }
.warning_heightlight {
background: #d66969;
color: blue;
}
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="verify_view_wrapper"> <div class="verify_view_wrapper">
<div>忌口</div> <div>病理忌口</div>
<div class="content"> <div class="content">
<span <span
:class="`item ${ :class="`item ${
@ -12,23 +12,46 @@
>{{ item.name }}</span >{{ item.name }}</span
> >
</div> </div>
<div style="margin: 24px 0 8px 0">涉及食材</div>
<div v-for="key in Object.keys(igdTypeDetial).reverse()" :key="key">
<div style="font-size: 14px; color: #8c8c8c">{{ igdTypeDict[key] }}</div>
<div class="content">
<span
:class="`item ${selectedIgd === item.id ? 'selected_item' : ''} `"
v-for="item in igdTypeDetial[key]"
:key="item.id"
@click="handleOnIgdClick(item)"
>{{ item.name }}
</span>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import { createNamespacedHelpers } from "vuex"; import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers("recipes"); const {
mapActions,
mapState,
mapGetters,
mapMutations,
} = createNamespacedHelpers("recipes");
export default { export default {
name: "VerifyView", name: "VerifyView",
data() { data() {
return { return {
selectedNotRec: [], selectedNotRec: [],
selectedIgd: 0,
}; };
}, },
computed: { computed: {
...mapGetters(["verifyNotRecData"]), ...mapGetters(["verifyNotRecData", "igdTypeDict", "igdTypeDetial"]),
}, },
methods: { methods: {
handleOnClick(data) { handleOnClick(data) {
if (this.selectedIgd !== 0) {
this.selectedIgd = 0;
this.setNotRecIgds({ data: [] });
}
if (this.selectedNotRec.some((str) => data.name === str)) { if (this.selectedNotRec.some((str) => data.name === str)) {
this.selectedNotRec = this.selectedNotRec.filter( this.selectedNotRec = this.selectedNotRec.filter(
(str) => str !== data.name (str) => str !== data.name
@ -39,27 +62,45 @@ export default {
} }
const notRecIgds = this.selectedNotRec.reduce((arr, cur) => { const notRecIgds = this.selectedNotRec.reduce((arr, cur) => {
this.verifyNotRecData[cur].data.forEach((obj) => { const tarData = this.verifyNotRecData.find((obj) => obj.name === cur);
if (tarData) {
tarData.data.forEach((obj) => {
if (!arr.includes(obj.igdId)) { if (!arr.includes(obj.igdId)) {
arr.push(obj.igdId); arr.push(obj.igdId);
} }
}); });
}
return arr; return arr;
}, []); }, []);
console.log({ // console.log({
data, // data,
notRecIgds, // notRecIgds,
verifyNotRecData: this.verifyNotRecData, // verifyNotRecData: this.verifyNotRecData,
}); // });
this.setNotRecIgds({ data: notRecIgds });
}, },
handleOnIgdClick(data) {
if (this.selectedNotRec.length > 0) {
this.selectedNotRec = [];
this.setNotRecIgds({ data: [] });
}
this.selectedIgd = data.id;
this.setNotRecIgds({ data: [this.selectedIgd] });
},
...mapMutations(["setNotRecIgds"]),
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.verify_view_wrapper { .verify_view_wrapper {
height: calc(100vh - 32px);
overflow: auto;
.content { .content {
margin-top: 8px; margin: 8px 0;
.item { .item {
font-size: 14px; font-size: 14px;
margin: 4px; margin: 4px;