Merge branch 'master' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
		| @@ -1,147 +0,0 @@ | ||||
| <template> | ||||
|   <div class="simple_igd_view_wrapper"> | ||||
|     <el-row :gutter="12"> | ||||
|       <el-form :model="queryParams" ref="queryForm" :inline="true"> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="名称" prop="name" size="mini"> | ||||
|             <el-input | ||||
|               v-model="queryParams.name" | ||||
|               placeholder="请输入食材名称" | ||||
|               clearable | ||||
|               size="mini" | ||||
|               @keyup.enter.native="handleQuery" | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="类别" prop="type" size="mini" width="130px"> | ||||
|             <el-select | ||||
|               v-model="queryParams.type" | ||||
|               placeholder="请选择食材类别" | ||||
|               clearable | ||||
|               size="mini" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in ingTypeOptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="dict.dictValue" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item size="mini"> | ||||
|             <el-button | ||||
|               type="cyan" | ||||
|               icon="el-icon-search" | ||||
|               size="mini" | ||||
|               @click="handleQuery" | ||||
|               >搜索 | ||||
|             </el-button> | ||||
|             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" | ||||
|               >重置 | ||||
|             </el-button> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|       </el-form> | ||||
|     </el-row> | ||||
|     <el-table | ||||
|       v-loading="loading" | ||||
|       border | ||||
|       :data="ingredientList" | ||||
|       :cell-style="{ padding: 0 }" | ||||
|       :header-cell-style="{ padding: 0, height: 'unset' }" | ||||
|     > | ||||
|       <el-table-column label="食材名称" align="center" prop="name" /> | ||||
|       <el-table-column | ||||
|         label="食材类别" | ||||
|         align="center" | ||||
|         prop="type" | ||||
|         :formatter="typeFormat" | ||||
|       /> | ||||
|       <el-table-column label="操作" align="center"> | ||||
|         <template slot-scope="scope"> | ||||
|           <el-button type="text" size="mini" @click="handleOnSelect(scope.row)" | ||||
|             >选用</el-button | ||||
|           > | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|  | ||||
|     <pagination | ||||
|       v-show="total > 0" | ||||
|       :background="false" | ||||
|       :total="total" | ||||
|       :page.sync="queryParams.pageNum" | ||||
|       :limit.sync="queryParams.pageSize" | ||||
|       @pagination="getList" | ||||
|       layout="total, prev, pager, next" | ||||
|     /> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import { listIngredient } from "@/api/custom/ingredient"; | ||||
| export default { | ||||
|   name: "SimpleIngredientListViewT", | ||||
|   data() { | ||||
|     return { | ||||
|       loading: false, | ||||
|       total: 0, | ||||
|       ingredientList: [], | ||||
|       ingTypeOptions: [], | ||||
|       queryParams: { | ||||
|         pageNum: 1, | ||||
|         pageSize: 10, | ||||
|         name: null, | ||||
|         type: null, | ||||
|         area: null, | ||||
|         reviewStatus: "yes", | ||||
|       }, | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|     this.getDicts("cus_ing_type").then((response) => { | ||||
|       this.ingTypeOptions = response.data; | ||||
|     }); | ||||
|   }, | ||||
|   watch: {}, | ||||
|   methods: { | ||||
|     getList() { | ||||
|       this.loading = true; | ||||
|       listIngredient(this.queryParams).then((response) => { | ||||
|         this.ingredientList = response.rows; | ||||
|         this.total = response.total; | ||||
|         this.loading = false; | ||||
|       }); | ||||
|     }, | ||||
|     reset() { | ||||
|       this.resetForm("queryForm"); | ||||
|     }, | ||||
|     // 食材类别字典翻译 | ||||
|     typeFormat(row, column) { | ||||
|       return this.selectDictLabel(this.ingTypeOptions, row.type); | ||||
|     }, | ||||
|     /** 搜索按钮操作 */ | ||||
|     handleQuery() { | ||||
|       this.queryParams.pageNum = 1; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     /** 重置按钮操作 */ | ||||
|     resetQuery() { | ||||
|       this.resetForm("queryForm"); | ||||
|       this.handleQuery(); | ||||
|     }, | ||||
|     handleOnSelect(data) { | ||||
|       this.$emit("onSelect", data); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| .simple_igd_view_wrapper { | ||||
|   /deep/ .el-input { | ||||
|     width: 130px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| @@ -1,103 +0,0 @@ | ||||
| <template> | ||||
|   <div class="avoid_certain_food_com_wrapper"> | ||||
|     <el-popover | ||||
|       placement="right" | ||||
|       trigger="click" | ||||
|       width="600" | ||||
|       title="忌口" | ||||
|       @hide="handleOnHide" | ||||
|     > | ||||
|       <SimpleIngredientListView @onSelect="handleOnSelect" /> | ||||
|       <span slot="reference" class="trigger">忌口: </span> | ||||
|     </el-popover> | ||||
|     <div class="content"> | ||||
|       <el-tag | ||||
|         v-for="item in data" | ||||
|         :key="item.id" | ||||
|         closable | ||||
|         size="mini" | ||||
|         type="danger" | ||||
|         @close="handleOnClose(item)" | ||||
|       > | ||||
|         {{ item.name }} | ||||
|       </el-tag> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import { createNamespacedHelpers } from "vuex"; | ||||
| const { mapMutations } = createNamespacedHelpers("recipes"); | ||||
| import SimpleIngredientListViewT from "./SimpleIngredientListViewT"; | ||||
| import { editPhysicalSigns } from "@/api/custom/healthy"; | ||||
|  | ||||
| export default { | ||||
|   name: "ACFComT", | ||||
|   props: ["value", "id"], | ||||
|   components: { | ||||
|     SimpleIngredientListViewT, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       data: [], | ||||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     value(val) { | ||||
|       this.data = val; | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
|     handleOnSelect(data) { | ||||
|       // console.log(data); | ||||
|       if (!this.data.some((obj) => obj.id === data.id)) { | ||||
|         this.data.push({ | ||||
|           id: data.id, | ||||
|           name: data.name, | ||||
|         }); | ||||
|         // console.log(this.data); | ||||
|         this.$emit("update:value", this.data); | ||||
|         this.updateAvoidFoodIds({ | ||||
|           avoidFoodIds: this.data.map((obj) => obj.id), | ||||
|         }); | ||||
|       } | ||||
|     }, | ||||
|     handleOnClose(data) { | ||||
|       // console.log(data); | ||||
|       this.data = this.data.filter((obj) => data.id !== obj.id); | ||||
|       this.$emit("update:value", this.data); | ||||
|       this.updateAvoidFoodIds({ avoidFoodIds: this.data.map((obj) => obj.id) }); | ||||
|       // 删除后更新 | ||||
|       this.handleOnHide(); | ||||
|     }, | ||||
|     handleOnHide() { | ||||
|       editPhysicalSigns({ id: this.id, avoidFood: this.data }).then((res) => { | ||||
|         if (res.code === 200) { | ||||
|           this.$message.success("忌口修改成功"); | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     ...mapMutations(["updateAvoidFoodIds"]), | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| .avoid_certain_food_com_wrapper { | ||||
|   display: flex; | ||||
|   margin-bottom: 8px; | ||||
|  | ||||
|   .trigger { | ||||
|     font-size: 14px; | ||||
|     width: 42px; | ||||
|     color: #8c8c8c; | ||||
|     cursor: pointer; | ||||
|   } | ||||
|  | ||||
|   .content { | ||||
|     flex: 1; | ||||
|  | ||||
|     & > span { | ||||
|       margin: 0 4px 4px 4px; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| @@ -1,99 +0,0 @@ | ||||
| <template> | ||||
|   <div class="simple_remark_com_wrapper"> | ||||
|     <el-popover | ||||
|       placement="right" | ||||
|       trigger="click" | ||||
|       width="400" | ||||
|       title="备注" | ||||
|       @hide="handleOnHide" | ||||
|     > | ||||
|       <el-input | ||||
|         type="textarea" | ||||
|         v-model="nData" | ||||
|         rows="6" | ||||
|         placeholder="请输入备注信息" | ||||
|         maxlength="300" | ||||
|         show-word-limit | ||||
|       /> | ||||
|       <span slot="reference" class="trigger">备注: </span> | ||||
|     </el-popover> | ||||
|     <div class="content"> | ||||
|       <span v-if="newLine"> | ||||
|         <div v-for="v in mValue" :key="v"> | ||||
|           {{ v }} | ||||
|         </div> | ||||
|       </span> | ||||
|       <span v-else>{{ mValue }}</span> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import { editPhysicalSigns } from "@/api/custom/healthy"; | ||||
|  | ||||
| export default { | ||||
|   name: "RemarkComT", | ||||
|   props: ["value", "id"], | ||||
|   components: {}, | ||||
|   data() { | ||||
|     return { | ||||
|       newLine: false, | ||||
|       nData: "", | ||||
|     }; | ||||
|   }, | ||||
|   watch: { | ||||
|     value(val) { | ||||
|       this.nData = val; | ||||
|     }, | ||||
|     nData(val) { | ||||
|       this.$emit("updata:value", val); | ||||
|     }, | ||||
|   }, | ||||
|   computed: { | ||||
|     mValue: function () { | ||||
|       if ( | ||||
|         this.nData && | ||||
|         typeof this.nData === "string" && | ||||
|         (this.nData.includes("</br>") || this.nData.includes("\n")) | ||||
|       ) { | ||||
|         this.newLine = true; | ||||
|         if (this.nData.includes("</br>")) { | ||||
|           return this.nData.split("</br>"); | ||||
|         } else if (this.nData.includes("\n")) { | ||||
|           return this.nData.split("\n"); | ||||
|         } | ||||
|         this.newLine = false; | ||||
|         return this.nData; | ||||
|       } | ||||
|       this.newLine = false; | ||||
|       return this.nData; | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
|     handleOnHide() { | ||||
|       // console.log("handleOnHide"); | ||||
|       editPhysicalSigns({ id: this.id, remark: this.nData }).then((res) => { | ||||
|         if (res.code === 200) { | ||||
|           this.$message.success("备注修改成功"); | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| .simple_remark_com_wrapper { | ||||
|   display: flex; | ||||
|   margin-bottom: 8px; | ||||
|   font-size: 14px; | ||||
|  | ||||
|   .trigger { | ||||
|     width: 42px; | ||||
|     color: #8c8c8c; | ||||
|     cursor: pointer; | ||||
|   } | ||||
|  | ||||
|   .content { | ||||
|     flex: 1; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| @@ -10,14 +10,23 @@ | ||||
|         extraclass="text-info-extra" | ||||
|       /> | ||||
|     </div> | ||||
|     <RemarkComT v-if="dev" :value.sync="data.remark" :id="data.id" /> | ||||
|     <ACFComT v-if="dev" :value.sync="data.avoidFood" :id="data.id" /> | ||||
|     <RemarkCom | ||||
|       v-if="dev" | ||||
|       :value.sync="data.remark" | ||||
|       @onConfirm="handleOnConfirm" | ||||
|     /> | ||||
|     <ACFCom | ||||
|       v-if="dev" | ||||
|       :value.sync="data.avoidFood" | ||||
|       @onConfirm="handleOnConfirm" | ||||
|     /> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import TextInfo from "@/components/TextInfo"; | ||||
| import ACFComT from "./ACFComT"; | ||||
| import RemarkComT from "./RemarkComT"; | ||||
| import ACFCom from "@/components/HealthyView/ACFCom"; | ||||
| import RemarkCom from "@/components/HealthyView/RemarkCom"; | ||||
| import { editPhysicalSigns } from "@/api/custom/healthy"; | ||||
|  | ||||
| export default { | ||||
|   name: "BodySignView", | ||||
| @@ -33,8 +42,8 @@ export default { | ||||
|   }, | ||||
|   components: { | ||||
|     "text-info": TextInfo, | ||||
|     ACFComT, | ||||
|     RemarkComT, | ||||
|     ACFCom, | ||||
|     RemarkCom, | ||||
|   }, | ||||
|   data() { | ||||
|     const basicInfo = [ | ||||
| @@ -89,22 +98,27 @@ export default { | ||||
|       basicInfo.splice(6, 0, [ | ||||
|         { title: "不运动总热量", value: "notSportHeat" }, | ||||
|       ]); | ||||
|       // basicInfo.splice(basicInfo.length, 0, [ | ||||
|       //   { title: "备注", value: "remark" }, | ||||
|       // ]); | ||||
|     } | ||||
|     return { | ||||
|       basicInfo, | ||||
|     }; | ||||
|   }, | ||||
|   methods: { | ||||
|     handleOnConfirm(data) { | ||||
|       editPhysicalSigns({ id: this.data.id, ...data }).then((res) => { | ||||
|         if (res.code === 200) { | ||||
|           this.$message.success("修改成功"); | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| .body_sign_view_wrapper { | ||||
|   position: relative; | ||||
|  | ||||
|   .remark_btn { | ||||
|     position: absolute; | ||||
|     top: 0; | ||||
|     right: 16px; | ||||
|   } | ||||
|   .msg-info { | ||||
|     display: flex; | ||||
|     margin-bottom: 8px; | ||||
|   | ||||
| @@ -33,10 +33,16 @@ const { | ||||
|   mapGetters, | ||||
| } = createNamespacedHelpers("recipes"); | ||||
| import SimpleIngredientListView from "./SimpleIngredientListView"; | ||||
| import { updateHealthy } from "@/api/custom/healthy"; | ||||
| export default { | ||||
|   name: "ACFCom", | ||||
|   props: ["value", "id"], | ||||
|   props: { | ||||
|     value: { | ||||
|       type: Array, | ||||
|       default() { | ||||
|         return []; | ||||
|       }, | ||||
|     }, | ||||
|   }, | ||||
|   components: { | ||||
|     SimpleIngredientListView, | ||||
|   }, | ||||
| @@ -47,7 +53,7 @@ export default { | ||||
|   }, | ||||
|   watch: { | ||||
|     value(val) { | ||||
|       this.data = val; | ||||
|       this.data = val || []; | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -74,11 +80,7 @@ export default { | ||||
|       this.handleOnHide(); | ||||
|     }, | ||||
|     handleOnHide() { | ||||
|       updateHealthy({ id: this.id, avoidFood: this.data }).then((res) => { | ||||
|         if (res.code === 200) { | ||||
|           this.$message.success("忌口修改成功"); | ||||
|         } | ||||
|       }); | ||||
|       this.$emit("onConfirm", { avoidFood: this.data }); | ||||
|     }, | ||||
|     ...mapMutations(["updateAvoidFoodIds"]), | ||||
|   }, | ||||
|   | ||||
| @@ -28,11 +28,14 @@ | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import { updateHealthy } from "@/api/custom/healthy"; | ||||
|  | ||||
| export default { | ||||
|   name: "RemarkCom", | ||||
|   props: ["value", "id"], | ||||
|   props: { | ||||
|     value: { | ||||
|       type: String, | ||||
|       default: "", | ||||
|     }, | ||||
|   }, | ||||
|   components: {}, | ||||
|   data() { | ||||
|     return { | ||||
| @@ -42,6 +45,7 @@ export default { | ||||
|   }, | ||||
|   watch: { | ||||
|     value(val) { | ||||
|       console.log(val); | ||||
|       this.nData = val; | ||||
|     }, | ||||
|     nData(val) { | ||||
| @@ -70,12 +74,7 @@ export default { | ||||
|   }, | ||||
|   methods: { | ||||
|     handleOnHide() { | ||||
|       // console.log("handleOnHide"); | ||||
|       updateHealthy({ id: this.id, remark: this.nData }).then((res) => { | ||||
|         if (res.code === 200) { | ||||
|           this.$message.success("备注修改成功"); | ||||
|         } | ||||
|       }); | ||||
|       this.$emit("onConfirm", { remark: this.nData }); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <template> | ||||
|   <div class="health_view_wrapper"> | ||||
|     <div> | ||||
|       <h2>{{ this.data.name }}</h2> | ||||
|       <h2>{{ data.name }}</h2> | ||||
|       <div class="msg-info" v-for="(info, idx) in basicInfo" :key="idx"> | ||||
|         <text-info | ||||
|           v-for="i in info" | ||||
| @@ -11,8 +11,16 @@ | ||||
|           extraclass="text-info-extra" | ||||
|         /> | ||||
|       </div> | ||||
|       <RemarkCom v-if="dev" :value.sync="data.remark" :id="data.id" /> | ||||
|       <ACFCom v-if="dev" :value.sync="data.avoidFood" :id="data.id" /> | ||||
|       <RemarkCom | ||||
|         v-if="dev" | ||||
|         :value.sync="data.remark" | ||||
|         @onConfirm="handleOnConfirm" | ||||
|       /> | ||||
|       <ACFCom | ||||
|         v-if="dev" | ||||
|         :value.sync="data.avoidFood" | ||||
|         @onConfirm="handleOnConfirm" | ||||
|       /> | ||||
|     </div> | ||||
|     <el-collapse> | ||||
|       <el-collapse-item | ||||
| @@ -47,6 +55,7 @@ | ||||
| import TextInfo from "@/components/TextInfo"; | ||||
| import ACFCom from "./ACFCom"; | ||||
| import RemarkCom from "./RemarkCom"; | ||||
| import { updateHealthy } from "@/api/custom/healthy"; | ||||
|  | ||||
| export default { | ||||
|   name: "HealthyView", | ||||
| @@ -220,18 +229,18 @@ export default { | ||||
|     getImgUrl(path) { | ||||
|       return `${window.location.origin}${path}`; | ||||
|     }, | ||||
|     handleOnConfirm(data) { | ||||
|       updateHealthy({ id: this.data.id, ...data }).then((res) => { | ||||
|         if (res.code === 200) { | ||||
|           this.$message.success("修改成功"); | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| .health_view_wrapper { | ||||
|   position: relative; | ||||
|   .remark_btn { | ||||
|     position: absolute; | ||||
|     top: 0; | ||||
|     right: 16px; | ||||
|   } | ||||
|  | ||||
|   .msg-info { | ||||
|     display: flex; | ||||
|     margin-bottom: 8px; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user