修复菜品修改问题
This commit is contained in:
		| @@ -169,12 +169,12 @@ | ||||
|       <div class="drawer_content"> | ||||
|         <el-row class="content_detail"> | ||||
|           <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="菜品名称" prop="name"> | ||||
|                 <el-input v-model="form.name" placeholder="请输入菜品名称" /> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="12"> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="菜品类型" prop="type"> | ||||
|                 <el-select | ||||
|                   v-model="form.type" | ||||
| @@ -190,7 +190,7 @@ | ||||
|                 </el-select> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="12"> | ||||
|             <el-col :span="12"> | ||||
|               <el-form-item label="是否主食" prop="type"> | ||||
|                 <el-radio-group v-model="form.isMain"> | ||||
|                   <el-radio :label="0">是</el-radio> | ||||
| @@ -198,7 +198,7 @@ | ||||
|                 </el-radio-group> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="食材" prop="ingIds"> | ||||
|                 <el-transfer | ||||
|                   style="text-align: left; display: inline-block" | ||||
| @@ -237,7 +237,7 @@ | ||||
|                 </el-transfer> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="分量" prop="weight"> | ||||
|                 <el-table | ||||
|                   :data="selTableData" | ||||
| @@ -259,7 +259,7 @@ | ||||
|                           :min="0.5" | ||||
|                         /> --> | ||||
|                         <el-select size="mini" v-model="scope.row.cusWeight"> | ||||
|                            <el-option | ||||
|                           <el-option | ||||
|                             v-for="dict in cusWeightOptions" | ||||
|                             :key="dict.dictValue" | ||||
|                             :label="dict.dictLabel" | ||||
| @@ -286,7 +286,7 @@ | ||||
|                         controls-position="right" | ||||
|                         @change="handleInputChange" | ||||
|                         :min="0" | ||||
|                         step="50" | ||||
|                         :step="50" | ||||
|                       /> | ||||
|                     </template> | ||||
|                   </el-table-column> | ||||
| @@ -301,7 +301,7 @@ | ||||
|                 </el-table> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="推荐人群"> | ||||
|                 <el-tag | ||||
|                   style="margin-right: 4px" | ||||
| @@ -313,7 +313,7 @@ | ||||
|                 </el-tag> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="忌口人群"> | ||||
|                 <el-tag | ||||
|                   style="margin-right: 4px" | ||||
| @@ -325,7 +325,7 @@ | ||||
|                 </el-tag> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="审核状态" prop="reviewStatus"> | ||||
|                 <el-select | ||||
|                   v-model="form.reviewStatus" | ||||
| @@ -341,7 +341,7 @@ | ||||
|                 </el-select> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col span="24"> | ||||
|             <el-col :span="24"> | ||||
|               <el-form-item label="做法" prop="methods"> | ||||
|                 <el-input | ||||
|                   v-model="form.methods" | ||||
| @@ -448,7 +448,7 @@ export default { | ||||
|     this.getDicts("cus_cus_unit").then((response) => { | ||||
|       this.cusUnitOptions = response.data; | ||||
|     }); | ||||
|      this.getDicts("cus_cus_weight").then((response) => { | ||||
|     this.getDicts("cus_cus_weight").then((response) => { | ||||
|       this.cusWeightOptions = response.data; | ||||
|     }); | ||||
|     this.getDicts("cus_review_status").then((response) => { | ||||
| @@ -485,7 +485,7 @@ export default { | ||||
|             notRecTags, | ||||
|           }; | ||||
|         }); | ||||
|         console.log(this.dishesList); | ||||
|         // console.log(this.dishesList); | ||||
|         this.total = response.total; | ||||
|         this.loading = false; | ||||
|       }); | ||||
| @@ -614,10 +614,15 @@ export default { | ||||
|     submitForm() { | ||||
|       this.$refs["form"].validate((valid) => { | ||||
|         if (valid) { | ||||
|           this.form.igdList = this.selTableData; | ||||
|           this.form.type = this.form.type.join(","); | ||||
|           if (this.form.id != null) { | ||||
|             updateDishes(this.form).then((response) => { | ||||
|           if (!this.selTableData.length) { | ||||
|             this.$message.error("食材不能为空"); | ||||
|             return; | ||||
|           } | ||||
|           const data = JSON.parse(JSON.stringify(this.form)); | ||||
|           data.igdList = this.selTableData; | ||||
|           data.type = data.type.join(","); | ||||
|           if (data.id != null) { | ||||
|             updateDishes(data).then((response) => { | ||||
|               if (response.code === 200) { | ||||
|                 this.msgSuccess("修改成功"); | ||||
|                 this.open = false; | ||||
| @@ -625,7 +630,7 @@ export default { | ||||
|               } | ||||
|             }); | ||||
|           } else { | ||||
|             addDishes(this.form).then((response) => { | ||||
|             addDishes(data).then((response) => { | ||||
|               if (response.code === 200) { | ||||
|                 this.msgSuccess("新增成功"); | ||||
|                 this.open = false; | ||||
| @@ -727,7 +732,7 @@ export default { | ||||
|       }); | ||||
|     }, | ||||
|     handleInputChange(val) { | ||||
|       console.log({ val, table: this.selTableData }); | ||||
|       // console.log({ val, table: this.selTableData }); | ||||
|     }, | ||||
|     getSummaries(param) { | ||||
|       const { columns, data } = param; | ||||
| @@ -755,13 +760,12 @@ export default { | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
|  | ||||
|   <style   > | ||||
| /** | ||||
| /deep/ :focus { | ||||
|    outline: 0; | ||||
|  } | ||||
|  */ | ||||
| <style rel="stylesheet/scss" lang="scss"> | ||||
| #el-drawer__title { | ||||
|   & > span:focus { | ||||
|     outline: 0; | ||||
|   } | ||||
| } | ||||
|  | ||||
| .el-transfer-panel__filter { | ||||
|   margin: 2px; | ||||
| @@ -769,66 +773,68 @@ export default { | ||||
|  | ||||
| .cus-unit { | ||||
|   display: inline-flex; | ||||
| } | ||||
|   .el-input-number--mini { | ||||
|     width: 38px; | ||||
|   } | ||||
|  | ||||
| .cus-unit .el-input-number--mini { | ||||
|   width: 38px; | ||||
| } | ||||
|   .el-input-number { | ||||
|     .el-input-number__decrease { | ||||
|       display: none; | ||||
|     } | ||||
|     .el-input-number__increase { | ||||
|       display: none; | ||||
|     } | ||||
|  | ||||
| .cus-unit .el-input-number .el-input-number__decrease { | ||||
|   display: none; | ||||
| } | ||||
|     .el-input { | ||||
|       width: 38px; | ||||
|     } | ||||
|  | ||||
| .cus-unit .el-input-number .el-input-number__increase { | ||||
|   display: none; | ||||
| } | ||||
|     .el-input .el-input__inner { | ||||
|       padding: 0; | ||||
|       border-radius: 0; | ||||
|       border: unset; | ||||
|       border-bottom: 1px solid #dcdfe6; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| .cus-unit .el-input-number .el-input { | ||||
|   width: 38px; | ||||
| } | ||||
|   .el-select { | ||||
|     .el-input__suffix { | ||||
|       display: none; | ||||
|     } | ||||
|  | ||||
| .cus-unit .el-input-number .el-input .el-input__inner { | ||||
|   padding: 0; | ||||
|   border-radius: 0; | ||||
|   border: unset; | ||||
|   border-bottom: 1px solid #dcdfe6; | ||||
| } | ||||
|  | ||||
| .cus-unit .el-select .el-input__suffix { | ||||
|   display: none; | ||||
| } | ||||
|  | ||||
| .cus-unit .el-select .el-input__inner { | ||||
|   padding: 0 4px; | ||||
|   /* border: unset; */ | ||||
|   text-align: center; | ||||
|     .el-input__inner { | ||||
|       padding: 0 4px; | ||||
|       /* border: unset; */ | ||||
|       text-align: center; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| .weight { | ||||
|   width: 70px; | ||||
| } | ||||
|  | ||||
| .weight .el-input .el-input__inner { | ||||
|   padding: 0 32px 0 4px; | ||||
|   .el-input .el-input__inner { | ||||
|     padding: 0 32px 0 4px; | ||||
|   } | ||||
| } | ||||
|  | ||||
| .drawer_content { | ||||
|   height: 100%; | ||||
|   display: flex; | ||||
|   flex-direction: column; | ||||
| } | ||||
|  | ||||
| .drawer_content .content_detail { | ||||
|   flex: 1 1 0; | ||||
|   padding: 12px; | ||||
|   overflow: auto; | ||||
| } | ||||
|   .content_detail { | ||||
|     flex: 1 1 0; | ||||
|     padding: 12px; | ||||
|     overflow: auto; | ||||
|   } | ||||
|  | ||||
| .drawer_content .dialog-footer { | ||||
|   flex: 0 0 45px; | ||||
|   display: inline-flex; | ||||
|   align-items: center; | ||||
|   justify-content: flex-end; | ||||
|   padding: 0 12px; | ||||
|   .dialog-footer { | ||||
|     flex: 0 0 45px; | ||||
|     display: inline-flex; | ||||
|     align-items: center; | ||||
|     justify-content: flex-end; | ||||
|     padding: 0 12px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user