新增食谱制作时按病症筛选功能
This commit is contained in:
@ -14,6 +14,7 @@ import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { addShortCut } from "@/utils/shortCutUtils";
|
||||
import { messageTypes } from "@/utils";
|
||||
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
|
||||
|
||||
const oriState = {
|
||||
cusId: undefined,
|
||||
@ -46,6 +47,7 @@ const oriState = {
|
||||
notRecIgds: [],
|
||||
avoidFoodIds: [],
|
||||
igdTypeOptions: [],
|
||||
physicalSignsOptions: [],
|
||||
//
|
||||
curShortCutObj: {}
|
||||
};
|
||||
@ -175,6 +177,31 @@ const actions = {
|
||||
getDicts("cus_ing_type").then(response => {
|
||||
commit("updateStateData", { igdTypeOptions: response.data });
|
||||
});
|
||||
listPhysicalSigns().then(response => {
|
||||
commit("updateStateData", {
|
||||
physicalSignsOptions: response.rows.reduce((arr, cur) => {
|
||||
const tarTypeObj = arr.find(obj => obj.value === cur.typeId);
|
||||
if (!tarTypeObj) {
|
||||
arr.push({
|
||||
value: cur.typeId,
|
||||
label: cur.typeName,
|
||||
children: [
|
||||
{
|
||||
value: cur.id,
|
||||
label: cur.name
|
||||
}
|
||||
]
|
||||
});
|
||||
} else {
|
||||
tarTypeObj.children.push({
|
||||
value: cur.id,
|
||||
label: cur.name
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, [])
|
||||
});
|
||||
});
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
// 健康数据
|
||||
|
@ -149,7 +149,10 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="handleOnDelete(scope.row)"
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleOnDelete(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
@ -252,6 +255,8 @@ export default {
|
||||
//
|
||||
selRec: [],
|
||||
selNotRec: [],
|
||||
selRecIds: [],
|
||||
selNotRecIds: [],
|
||||
};
|
||||
},
|
||||
props: [
|
||||
@ -265,24 +270,41 @@ export default {
|
||||
"form.igdList": function (val) {
|
||||
const selRec = [];
|
||||
const selNotRec = [];
|
||||
const selRecIds = [];
|
||||
const selNotRecIds = [];
|
||||
val.forEach((obj) => {
|
||||
if (obj.rec) {
|
||||
obj.rec.split(",").forEach((rec) => {
|
||||
if (!selRec.includes(rec)) {
|
||||
selRec.push(rec);
|
||||
}
|
||||
});
|
||||
obj.rec
|
||||
.split(",")
|
||||
.forEach((rec) => !selRec.includes(rec) && selRec.push(rec));
|
||||
}
|
||||
if (obj.notRec) {
|
||||
obj.notRec.split(",").forEach((notRec) => {
|
||||
if (!selNotRec.includes(notRec)) {
|
||||
selNotRec.push(notRec);
|
||||
}
|
||||
});
|
||||
obj.notRec
|
||||
.split(",")
|
||||
.forEach(
|
||||
(notRec) => !selNotRec.includes(notRec) && selNotRec.push(notRec)
|
||||
);
|
||||
}
|
||||
if (obj.recIdsStr) {
|
||||
obj.recIdsStr
|
||||
.split(",")
|
||||
.forEach(
|
||||
(recId) => !selRecIds.includes(recId) && selRecIds.push(recId)
|
||||
);
|
||||
}
|
||||
if (obj.notRecIdsStr) {
|
||||
obj.notRecIdsStr
|
||||
.split(",")
|
||||
.forEach(
|
||||
(notRecId) =>
|
||||
!selNotRecIds.includes(notRecId) && selNotRecIds.push(notRecId)
|
||||
);
|
||||
}
|
||||
});
|
||||
this.selRec = selRec;
|
||||
this.selNotRec = selNotRec;
|
||||
this.selRecIds = selRecIds;
|
||||
this.selNotRecIds = selNotRecIds;
|
||||
},
|
||||
|
||||
showNotRec() {
|
||||
@ -362,6 +384,8 @@ export default {
|
||||
const data = JSON.parse(JSON.stringify(this.form));
|
||||
// console.log({ data });
|
||||
data.type = data.type.join(",");
|
||||
data.recIds = this.selRecIds;
|
||||
data.notRecIds = this.selNotRecIds;
|
||||
if (data.id != null) {
|
||||
updateDishes(data).then((response) => {
|
||||
if (response.code === 200) {
|
||||
|
@ -137,7 +137,11 @@
|
||||
<autohideinfo :data="scope.row.notRecTags" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="做法" align="center" prop="methods" />
|
||||
<el-table-column label="做法" align="center" prop="methods">
|
||||
<template slot-scope="scope">
|
||||
<auto-hide-message :data="scope.row.methods" :maxLength="20" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
@ -188,12 +192,14 @@
|
||||
<script>
|
||||
import { delDishes, exportDishes, listDishes } from "@/api/custom/dishes";
|
||||
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import EditDishesDrawer from "./EditDishesDrawer";
|
||||
|
||||
export default {
|
||||
name: "Dishes",
|
||||
components: {
|
||||
autohideinfo: AutoHideInfo,
|
||||
AutoHideMessage,
|
||||
EditDishesDrawer,
|
||||
},
|
||||
data() {
|
||||
@ -374,7 +380,7 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm('是否确认删除菜品「' + row.name + '」的数据项?', "警告", {
|
||||
this.$confirm("是否确认删除菜品「" + row.name + "」的数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
|
@ -52,6 +52,20 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="推荐体征" prop="physical">
|
||||
<el-cascader
|
||||
:disabled="lockType"
|
||||
v-model="queryParams.physical"
|
||||
placeholder="请选择推荐体征"
|
||||
clearable
|
||||
:options="physicalSignsOptions"
|
||||
size="mini"
|
||||
width="120px"
|
||||
@change="handleOnPhysicalSignsChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -71,7 +85,7 @@
|
||||
v-loading="loading"
|
||||
size="mini"
|
||||
:data="dishesList"
|
||||
height="600"
|
||||
height="550"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
@ -141,6 +155,7 @@ export default {
|
||||
smallClass: null,
|
||||
bigClass: null,
|
||||
reviewStatus: "yes",
|
||||
physical: null,
|
||||
},
|
||||
//菜品种类查询参数
|
||||
dishClassQueryParam: [],
|
||||
@ -155,6 +170,7 @@ export default {
|
||||
"typeOptions",
|
||||
"dishBigClassOptions",
|
||||
"dishSmallClassOptions",
|
||||
"physicalSignsOptions",
|
||||
]),
|
||||
...mapGetters(["dishClassOptions"]),
|
||||
},
|
||||
@ -174,7 +190,13 @@ export default {
|
||||
this.queryParams.smallClass = null;
|
||||
}
|
||||
this.loading = true;
|
||||
listDishes(this.queryParams).then((result) => {
|
||||
const qParams = {
|
||||
...this.queryParams,
|
||||
};
|
||||
if (this.queryParams.physical) {
|
||||
qParams.physical = this.queryParams.physical[1];
|
||||
}
|
||||
listDishes(qParams).then((result) => {
|
||||
this.dishesList = result.rows.map((d) => {
|
||||
const recTags = [],
|
||||
notRecTags = [];
|
||||
@ -249,6 +271,10 @@ export default {
|
||||
}
|
||||
return "";
|
||||
},
|
||||
handleOnPhysicalSignsChange(val) {
|
||||
const [typeId, id] = val;
|
||||
console.log(val);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user