完成忌口检查
This commit is contained in:
		| @@ -36,7 +36,10 @@ const oriState = { | ||||
|   fontSize: parseInt(localStorage.getItem("fontSize")) || 12, | ||||
|   dishBigClassOptions: [], | ||||
|   dishSmallClassOptions: [], | ||||
|   leftShow: false | ||||
|   // | ||||
|   leftShow: false, | ||||
|   notRecIgds: [], | ||||
|   igdTypeOptions: [] | ||||
| }; | ||||
|  | ||||
| const mutations = { | ||||
| @@ -64,7 +67,7 @@ const mutations = { | ||||
|           payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight); | ||||
|           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") { | ||||
|         tarDishes.igdList = tarDishes.igdList.filter( | ||||
|           igd => igd.id !== payload.igdId | ||||
| @@ -103,6 +106,9 @@ const mutations = { | ||||
|   toggleLeftShow(state, payload) { | ||||
|     state.leftShow = !state.leftShow; | ||||
|   }, | ||||
|   setNotRecIgds(state, payload) { | ||||
|     state.notRecIgds = payload.data; | ||||
|   }, | ||||
|   setDate(state, payload) { | ||||
|     state.startDate = payload.startDate; | ||||
|     state.endDate = payload.endDate; | ||||
| @@ -152,6 +158,9 @@ const actions = { | ||||
|     getDicts("dish_class_small").then(response => { | ||||
|       commit("updateStateData", { dishSmallClassOptions: response.data }); | ||||
|     }); | ||||
|     getDicts("cus_ing_type").then(response => { | ||||
|       commit("updateStateData", { igdTypeOptions: response.data }); | ||||
|     }); | ||||
|  | ||||
|     return new Promise((res, rej) => { | ||||
|       // 健康数据 | ||||
| @@ -559,6 +568,19 @@ const getters = { | ||||
|       }); | ||||
|       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 => | ||||
|     state.cusUnitOptions.reduce((obj, cur) => { | ||||
|       obj[cur.dictValue] = cur.dictLabel; | ||||
| @@ -583,6 +605,11 @@ const getters = { | ||||
|     state.dishSmallClassOptions.reduce((obj, cur) => { | ||||
|       obj[cur.dictValue] = cur.dictLabel; | ||||
|       return obj; | ||||
|     }, {}), | ||||
|   igdTypeDict: state => | ||||
|     state.igdTypeOptions.reduce((obj, cur) => { | ||||
|       obj[cur.dictValue] = cur.dictLabel; | ||||
|       return obj; | ||||
|     }, {}) | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -598,6 +598,11 @@ export function dealHealthy(customerHealthy) { | ||||
|       ? `,${customerHealthy.otherMotionField}` | ||||
|       : ""; | ||||
|   } | ||||
|   if (customerHealthy.hasOwnProperty("otherOperationHistory")) { | ||||
|     customerHealthy.operationHistory += customerHealthy.otherOperationHistory | ||||
|       ? `,${customerHealthy.otherOperationHistory}` | ||||
|       : ""; | ||||
|   } | ||||
|   if (customerHealthy.hasOwnProperty("defecationNum")) { | ||||
|     customerHealthy.defecationNum += "次/天"; | ||||
|   } | ||||
|   | ||||
| @@ -12,12 +12,13 @@ | ||||
|           v-model="queryParams.name" | ||||
|           placeholder="请输入菜品名称" | ||||
|           clearable | ||||
|           size="small" | ||||
|           size="mini" | ||||
|           @keyup.enter.native="handleQuery" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="菜品种类" prop="dishClass"> | ||||
|         <el-cascader | ||||
|           size="mini" | ||||
|           v-model="dishClassQueryParam" | ||||
|           :options="dishClassOptions" | ||||
|           :props="{ expandTrigger: 'hover' }" | ||||
| @@ -32,7 +33,7 @@ | ||||
|           v-model="queryParams.type" | ||||
|           placeholder="请选择菜品类型" | ||||
|           clearable | ||||
|           size="small" | ||||
|           size="mini" | ||||
|         > | ||||
|           <el-option | ||||
|             v-for="dict in typeOptions" | ||||
| @@ -113,9 +114,9 @@ | ||||
|       </el-table-column> | ||||
|  | ||||
|       <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"> | ||||
|          {{dishClassFormat(scope.row)}} | ||||
|           {{ dishClassFormat(scope.row) }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="菜品类型" align="center" prop="type"> | ||||
| @@ -199,7 +200,7 @@ | ||||
|                   :options="dishClassOptions" | ||||
|                   :props="{ expandTrigger: 'hover' }" | ||||
|                   placeholder="请选择菜品种类" | ||||
|                   ></el-cascader> | ||||
|                 ></el-cascader> | ||||
|               </el-form-item> | ||||
|             </el-col> | ||||
|             <el-col :span="8"> | ||||
| @@ -464,8 +465,8 @@ export default { | ||||
|       // | ||||
|       cusWeightOptions: [], | ||||
|       dishClassOptions: [], | ||||
|       dishClassBigOptions:[], | ||||
|       dishClassSmallOptions:[], | ||||
|       dishClassBigOptions: [], | ||||
|       dishClassSmallOptions: [], | ||||
|       // 查询参数 | ||||
|       queryParams: { | ||||
|         pageNum: 1, | ||||
| @@ -473,14 +474,14 @@ export default { | ||||
|         name: null, | ||||
|         type: null, | ||||
|         bigClass: null, | ||||
|         smallClass: null | ||||
|         smallClass: null, | ||||
|       }, | ||||
|       // 表单参数 | ||||
|       form: {}, | ||||
|       // 表单校验 | ||||
|       rules: {}, | ||||
|       //菜品种类查询种类 | ||||
|       dishClassQueryParam:[] | ||||
|       dishClassQueryParam: [], | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
| @@ -512,9 +513,12 @@ export default { | ||||
|     /** 查询菜品列表 */ | ||||
|     getList() { | ||||
|       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]; | ||||
|       }else{ | ||||
|       } else { | ||||
|         this.queryParams.smallClass = null; | ||||
|       } | ||||
|       listDishes(this.queryParams).then((response) => { | ||||
| @@ -549,23 +553,25 @@ export default { | ||||
|       }); | ||||
|     }, | ||||
|     //处理菜品大类小类的关系 | ||||
|     dealDishClassBigAndSmall(){ | ||||
|     dealDishClassBigAndSmall() { | ||||
|       this.dishClassBigOptions.forEach((item, index) => { | ||||
|           this.dishClassOptions.push({ | ||||
|               'value': parseInt(item.dictValue), | ||||
|               'label': item.dictLabel, | ||||
|               'children': [] | ||||
|         this.dishClassOptions.push({ | ||||
|           value: parseInt(item.dictValue), | ||||
|           label: item.dictLabel, | ||||
|           children: [], | ||||
|         }); | ||||
|         if (index == this.dishClassBigOptions.length - 1) { | ||||
|           this.dishClassSmallOptions.forEach((smallClass, i) => { | ||||
|             if (smallClass.remark) { | ||||
|               this.dishClassOptions[ | ||||
|                 parseInt(smallClass.remark - 1) | ||||
|               ].children.push({ | ||||
|                 value: parseInt(smallClass.dictValue), | ||||
|                 label: smallClass.dictLabel, | ||||
|               }); | ||||
|             } | ||||
|           }); | ||||
|           if(index == this.dishClassBigOptions.length - 1){ | ||||
|             this.dishClassSmallOptions.forEach((smallClass, i) => { | ||||
|               if(smallClass.remark){ | ||||
|                 this.dishClassOptions[parseInt(smallClass.remark-1)].children.push({ | ||||
|                   'value': parseInt(smallClass.dictValue), | ||||
|                   'label': smallClass.dictLabel | ||||
|                 }); | ||||
|               } | ||||
|             }); | ||||
|           } | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     // 菜品类型字典翻译 | ||||
| @@ -587,13 +593,19 @@ export default { | ||||
|       return this.selectDictLabel(this.reviewStatusOptions, row.area); | ||||
|     }, | ||||
|     //菜品种类翻译 | ||||
|     dishClassFormat(row){ | ||||
|        if(row.bigClass > 0 && row.smallClass > 0){ | ||||
|          let bigClassName = this.selectDictLabel(this.dishClassBigOptions, row.bigClass); | ||||
|          let smallClassName = this.selectDictLabel(this.dishClassSmallOptions, row.smallClass); | ||||
|          return bigClassName+"/"+smallClassName; | ||||
|        } | ||||
|        return ""; | ||||
|     dishClassFormat(row) { | ||||
|       if (row.bigClass > 0 && row.smallClass > 0) { | ||||
|         let bigClassName = this.selectDictLabel( | ||||
|           this.dishClassBigOptions, | ||||
|           row.bigClass | ||||
|         ); | ||||
|         let smallClassName = this.selectDictLabel( | ||||
|           this.dishClassSmallOptions, | ||||
|           row.smallClass | ||||
|         ); | ||||
|         return bigClassName + "/" + smallClassName; | ||||
|       } | ||||
|       return ""; | ||||
|     }, | ||||
|     // 取消按钮 | ||||
|     cancel() { | ||||
| @@ -606,7 +618,7 @@ export default { | ||||
|         id: null, | ||||
|         name: null, | ||||
|         type: [], | ||||
|         dishClass:[], | ||||
|         dishClass: [], | ||||
|         methods: null, | ||||
|         createBy: null, | ||||
|         createTime: null, | ||||
| @@ -834,7 +846,7 @@ export default { | ||||
|         (arr, cur, idx) => { | ||||
|           if (idx > 1) { | ||||
|             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 { | ||||
|               arr[idx] = data.reduce((acc, dAcc) => { | ||||
|                 if (idx === 2) { | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <template> | ||||
|   <el-form> | ||||
|   <el-form @submit.native.prevent> | ||||
|     <el-form-item label="菜品名"> | ||||
|       <span style="color: #262626; font-size: 16px; font-weight: bold">{{ | ||||
|         name | ||||
|   | ||||
| @@ -1,60 +1,71 @@ | ||||
| <template> | ||||
|   <div> | ||||
|     <el-form | ||||
|       :model="queryParams" | ||||
|       ref="queryForm" | ||||
|       :inline="true" | ||||
|       label-width="68px" | ||||
|     > | ||||
|       <el-form-item label="菜品名称" prop="name"> | ||||
|         <el-input | ||||
|           v-model="queryParams.name" | ||||
|           placeholder="请输入菜品名称" | ||||
|           clearable | ||||
|           size="mini" | ||||
|           @keyup.enter.native="handleQuery" | ||||
|         /> | ||||
|       </el-form-item> | ||||
|      <el-form-item label="菜品种类" prop="dishClass"> | ||||
|         <el-cascader | ||||
|           filterable | ||||
|           clearable | ||||
|           v-model="dishClassQueryParam" | ||||
|           :options="dishClassOptions" | ||||
|           :props="{ expandTrigger: 'hover' }" | ||||
|           :show-all-levels="true" | ||||
|           placeholder="请选择菜品种类" | ||||
|         ></el-cascader> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="菜品类型" prop="type"> | ||||
|         <el-select | ||||
|           :disabled="lockType" | ||||
|           v-model="queryParams.type" | ||||
|           placeholder="请选择菜品类型" | ||||
|           clearable | ||||
|           size="mini" | ||||
|         > | ||||
|           <el-option | ||||
|             v-for="dict in typeOptions" | ||||
|             :key="dict.dictValue" | ||||
|             :label="dict.dictLabel" | ||||
|             :value="dict.dictValue" | ||||
|           /> | ||||
|         </el-select> | ||||
|       </el-form-item> | ||||
|       <el-form-item> | ||||
|         <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-form> | ||||
|     <el-row :gutter="15"> | ||||
|       <el-form | ||||
|         :model="queryParams" | ||||
|         ref="queryForm" | ||||
|         :inline="true" | ||||
|         label-width="68px" | ||||
|         @submit.native.prevent | ||||
|       > | ||||
|         <el-col :span="6"> | ||||
|           <el-form-item label="菜品名称" prop="name"> | ||||
|             <el-input | ||||
|               v-model="queryParams.name" | ||||
|               placeholder="请输入菜品名称" | ||||
|               clearable | ||||
|               size="mini" | ||||
|               @keyup.enter.native="handleQuery" | ||||
|             /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="6"> | ||||
|           <el-form-item label="菜品种类" prop="dishClass"> | ||||
|             <el-cascader | ||||
|               filterable | ||||
|               clearable | ||||
|               size="mini" | ||||
|               v-model="dishClassQueryParam" | ||||
|               :options="dishClassOptions" | ||||
|               :props="{ expandTrigger: 'hover' }" | ||||
|               :show-all-levels="true" | ||||
|               placeholder="请选择菜品种类" | ||||
|             ></el-cascader> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="6"> | ||||
|           <el-form-item label="菜品类型" prop="type"> | ||||
|             <el-select | ||||
|               :disabled="lockType" | ||||
|               v-model="queryParams.type" | ||||
|               placeholder="请选择菜品类型" | ||||
|               clearable | ||||
|               size="mini" | ||||
|               width="120px" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in typeOptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="dict.dictValue" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-form-item> | ||||
|           <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-form> | ||||
|     </el-row> | ||||
|  | ||||
|     <el-table | ||||
|       v-loading="loading" | ||||
| @@ -67,7 +78,10 @@ | ||||
|       <el-table-column label="菜品名称" align="center" prop="name" /> | ||||
|       <el-table-column label="菜品种类" align="center" prop="bigClass"> | ||||
|         <template slot-scope="scope"> | ||||
|           <AutoHideMessage :data="dishClassFormat(scope.row)" :maxLength="10"></AutoHideMessage> | ||||
|           <AutoHideMessage | ||||
|             :data="dishClassFormat(scope.row)" | ||||
|             :maxLength="10" | ||||
|           ></AutoHideMessage> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="菜品类型" align="center" prop="type"> | ||||
| @@ -109,7 +123,7 @@ import AutoHideInfo from "@/components/AutoHideInfo"; | ||||
| import AutoHideMessage from "@/components/AutoHideMessage"; | ||||
| import { listDishes } from "@/api/custom/dishes"; | ||||
| import { createNamespacedHelpers } from "vuex"; | ||||
| const { mapState,mapGetters } = createNamespacedHelpers("recipes"); | ||||
| const { mapState, mapGetters } = createNamespacedHelpers("recipes"); | ||||
| export default { | ||||
|   name: "SelectDishes", | ||||
|   props: [], | ||||
| @@ -129,14 +143,19 @@ export default { | ||||
|         reviewStatus: "yes", | ||||
|       }, | ||||
|       //菜品种类查询参数 | ||||
|       dishClassQueryParam:[] | ||||
|       dishClassQueryParam: [], | ||||
|     }; | ||||
|   }, | ||||
|   components: { | ||||
|     AutoHideInfo,AutoHideMessage | ||||
|     AutoHideInfo, | ||||
|     AutoHideMessage, | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapState(["typeOptions","dishBigClassOptions","dishSmallClassOptions"]), | ||||
|     ...mapState([ | ||||
|       "typeOptions", | ||||
|       "dishBigClassOptions", | ||||
|       "dishSmallClassOptions", | ||||
|     ]), | ||||
|     ...mapGetters(["dishClassOptions"]), | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -146,9 +165,12 @@ export default { | ||||
|         this.lockType = true; | ||||
|         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]; | ||||
|       }else{ | ||||
|       } else { | ||||
|         this.queryParams.smallClass = null; | ||||
|       } | ||||
|       this.loading = true; | ||||
| @@ -213,13 +235,19 @@ export default { | ||||
|             .map((type) => this.selectDictLabel(this.typeOptions, type)); | ||||
|     }, | ||||
|     //菜品种类翻译 | ||||
|     dishClassFormat(row){ | ||||
|        if(row.bigClass > 0 && row.smallClass > 0){ | ||||
|          let bigClassName = this.selectDictLabel(this.dishBigClassOptions, row.bigClass); | ||||
|          let smallClassName = this.selectDictLabel(this.dishSmallClassOptions, row.smallClass); | ||||
|          return bigClassName+"/"+smallClassName; | ||||
|        } | ||||
|        return ""; | ||||
|     dishClassFormat(row) { | ||||
|       if (row.bigClass > 0 && row.smallClass > 0) { | ||||
|         let bigClassName = this.selectDictLabel( | ||||
|           this.dishBigClassOptions, | ||||
|           row.bigClass | ||||
|         ); | ||||
|         let smallClassName = this.selectDictLabel( | ||||
|           this.dishSmallClassOptions, | ||||
|           row.smallClass | ||||
|         ); | ||||
|         return bigClassName + "/" + smallClassName; | ||||
|       } | ||||
|       return ""; | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
|       :step="5" | ||||
|       :value="value" | ||||
|       @blur="handleOnBlur" | ||||
|       @keydown.enter.native="handleEnterClick" | ||||
|       @keydown="handleOnKeydown" | ||||
|     /> | ||||
|   </div> | ||||
| </template> | ||||
| @@ -43,8 +43,11 @@ export default { | ||||
|         this.$message.error("数字必须大于0"); | ||||
|       } | ||||
|     }, | ||||
|     handleEnterClick(e) { | ||||
|       e.target.blur(); | ||||
|     handleOnKeydown(e) { | ||||
|       // console.log(e); | ||||
|       if (e.keyCode === 13) { | ||||
|         e.target.blur(); | ||||
|       } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|   | ||||
| @@ -47,7 +47,7 @@ | ||||
|           </el-popover> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="菜品" prop="name" align="center" :width="180"> | ||||
|       <el-table-column label="菜品" prop="name" align="center"> | ||||
|         <template slot="header"> | ||||
|           <el-tooltip | ||||
|             class="item" | ||||
| @@ -108,7 +108,7 @@ | ||||
|           </el-popover> | ||||
|         </template> | ||||
|       </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"> | ||||
|           <span | ||||
|             v-if=" | ||||
| @@ -412,6 +412,7 @@ export default { | ||||
|       "fontSize", | ||||
|       "canCopyMenuTypes", | ||||
|       "recipesId", | ||||
|       "notRecIgds", | ||||
|     ]), | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -420,7 +421,11 @@ export default { | ||||
|       if (!columnIndex) { | ||||
|         return "recipes_first_col"; | ||||
|       } 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) { | ||||
| @@ -660,4 +665,9 @@ export default { | ||||
| .recipes_cell_18 { | ||||
|   font-size: 18px; | ||||
| } | ||||
|  | ||||
| .warning_heightlight { | ||||
|   background: #d66969; | ||||
|   color: blue; | ||||
| } | ||||
| </style> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <template> | ||||
|   <div class="verify_view_wrapper"> | ||||
|     <div>忌口</div> | ||||
|     <div>病理忌口</div> | ||||
|     <div class="content"> | ||||
|       <span | ||||
|         :class="`item ${ | ||||
| @@ -12,23 +12,46 @@ | ||||
|         >{{ item.name }}</span | ||||
|       > | ||||
|     </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> | ||||
| </template> | ||||
| <script> | ||||
| import { createNamespacedHelpers } from "vuex"; | ||||
| const { mapActions, mapState, mapGetters } = createNamespacedHelpers("recipes"); | ||||
| const { | ||||
|   mapActions, | ||||
|   mapState, | ||||
|   mapGetters, | ||||
|   mapMutations, | ||||
| } = createNamespacedHelpers("recipes"); | ||||
| export default { | ||||
|   name: "VerifyView", | ||||
|   data() { | ||||
|     return { | ||||
|       selectedNotRec: [], | ||||
|       selectedIgd: 0, | ||||
|     }; | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapGetters(["verifyNotRecData"]), | ||||
|     ...mapGetters(["verifyNotRecData", "igdTypeDict", "igdTypeDetial"]), | ||||
|   }, | ||||
|   methods: { | ||||
|     handleOnClick(data) { | ||||
|       if (this.selectedIgd !== 0) { | ||||
|         this.selectedIgd = 0; | ||||
|         this.setNotRecIgds({ data: [] }); | ||||
|       } | ||||
|       if (this.selectedNotRec.some((str) => data.name === str)) { | ||||
|         this.selectedNotRec = this.selectedNotRec.filter( | ||||
|           (str) => str !== data.name | ||||
| @@ -39,27 +62,45 @@ export default { | ||||
|       } | ||||
|  | ||||
|       const notRecIgds = this.selectedNotRec.reduce((arr, cur) => { | ||||
|         this.verifyNotRecData[cur].data.forEach((obj) => { | ||||
|           if (!arr.includes(obj.igdId)) { | ||||
|             arr.push(obj.igdId); | ||||
|           } | ||||
|         }); | ||||
|         const tarData = this.verifyNotRecData.find((obj) => obj.name === cur); | ||||
|         if (tarData) { | ||||
|           tarData.data.forEach((obj) => { | ||||
|             if (!arr.includes(obj.igdId)) { | ||||
|               arr.push(obj.igdId); | ||||
|             } | ||||
|           }); | ||||
|         } | ||||
|         return arr; | ||||
|       }, []); | ||||
|  | ||||
|       console.log({ | ||||
|         data, | ||||
|         notRecIgds, | ||||
|         verifyNotRecData: this.verifyNotRecData, | ||||
|       }); | ||||
|       // console.log({ | ||||
|       //   data, | ||||
|       //   notRecIgds, | ||||
|       //   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> | ||||
| <style lang="scss" scoped> | ||||
| .verify_view_wrapper { | ||||
|   height: calc(100vh - 32px); | ||||
|   overflow: auto; | ||||
|   .content { | ||||
|     margin-top: 8px; | ||||
|     margin: 8px 0; | ||||
|     .item { | ||||
|       font-size: 14px; | ||||
|       margin: 4px; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user