From 98ddc2f37429637b57db4c4a98a95d4c738c15b8 Mon Sep 17 00:00:00 2001 From: zzyuan <781948537@qq.com> Date: Wed, 16 Apr 2025 18:29:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=93=81=E8=8F=9C=E8=B0=B1=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device/index.js | 2 +- src/api/dish/dish.js | 4 +- src/api/dish/menu.js | 22 +++---- src/api/superStore/device.js | 2 +- src/views/dish/dish/index.vue | 14 ++-- .../material/components/MaterialDialog.vue | 59 ++++++++++++----- src/views/dish/menu/detail.vue | 10 +-- src/views/dish/menu/edit.vue | 38 ++++++++--- src/views/dish/menu/index.vue | 66 ++++++++++++------- 9 files changed, 145 insertions(+), 72 deletions(-) diff --git a/src/api/device/index.js b/src/api/device/index.js index 62e2799b..b154b117 100644 --- a/src/api/device/index.js +++ b/src/api/device/index.js @@ -68,7 +68,7 @@ export function deleteDeviceApi(deviceId){ // 获取指定日期菜谱计划菜品详情 export function getMenuRecipeDetailApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/date/detail', + url: '/smart-canteen/menu_recipe/getDetailByDate', method: 'post', headers: { "merchant-id":"378915229716713472", diff --git a/src/api/dish/dish.js b/src/api/dish/dish.js index 2908ae40..39ca1547 100644 --- a/src/api/dish/dish.js +++ b/src/api/dish/dish.js @@ -73,11 +73,11 @@ export function removeMenuDishesTypeApi(typeId) { export function getMenuDishesListApi(data) { return request({ url: '/smart-canteen/menu_dishes/list', - method: 'get', + method: 'post', headers: { "merchant-id":"378915229716713472", }, - params: data + data: data }) } // 菜品列表-新增 diff --git a/src/api/dish/menu.js b/src/api/dish/menu.js index dcb9b566..05edb772 100644 --- a/src/api/dish/menu.js +++ b/src/api/dish/menu.js @@ -35,10 +35,10 @@ export function getmkteffectiveApi(data) { }) } -// 菜品列表 +// 弹窗-菜品列表 export function getDishesByTypePageApi(data) { return request({ - url: '/smart-canteen/api/v2/menudishes/type/dishes/list/page', + url: '/smart-canteen/menu_dishes/list', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -50,18 +50,18 @@ export function getDishesByTypePageApi(data) { // 获取当前菜谱 export function getCurrentRecipeListApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/query/current/recipe', - method: 'post', + url: '/smart-canteen/menu_recipe/list', + method: 'get', headers: { "merchant-id":"378915229716713472", }, - data: data + params: data }) } // 获取所有菜谱-分页 export function getPageRecipeListApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/page', + url: '/smart-canteen/menu_recipe/getDishesList', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -73,7 +73,7 @@ export function getPageRecipeListApi(data) { //菜谱-新增 export function addMenuRecipeApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/add', + url: '/smart-canteen/menu_recipe/add', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -85,7 +85,7 @@ export function addMenuRecipeApi(data) { //所有菜谱-删除 export function removeMenuRecipeApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/remove/recipes', + url: '/smart-canteen/menu_recipe/deleteRecipeById', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -97,7 +97,7 @@ export function removeMenuRecipeApi(data) { //当日菜谱-绑定或解绑(handleType:1绑定,2解绑) export function unbindMenuRecipeApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/app/bind', + url: '/smart-canteen/menu_recipe/app/bind', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -110,7 +110,7 @@ export function unbindMenuRecipeApi(data) { // 指定日期菜谱-获取菜谱详情 export function getMenuRecipeDetailApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/date/detail', + url: '/smart-canteen/menu_recipe/getDetailByDate', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -122,7 +122,7 @@ export function getMenuRecipeDetailApi(data) { // 每日循环(每周循环)-获取菜谱详情 export function getMenuRecipeTemplateDetailApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/template/detail', + url: '/smart-canteen/menu_recipe/detail', method: 'post', headers: { "merchant-id":"378915229716713472", diff --git a/src/api/superStore/device.js b/src/api/superStore/device.js index c4353029..440040b4 100644 --- a/src/api/superStore/device.js +++ b/src/api/superStore/device.js @@ -93,7 +93,7 @@ export function getDeviceStateLogApi(data) { // 获取指定日期菜谱计划菜品详情 export function getMenuRecipeDetailApi(data) { return request({ - url: '/smart-canteen/api/v2/menurecipe/date/detail', + url: '/smart-canteen/menu_recipe/getDetailByDate', method: 'post', headers: { "merchant-id":"378915229716713472", diff --git a/src/views/dish/dish/index.vue b/src/views/dish/dish/index.vue index c719c200..8aa3750d 100644 --- a/src/views/dish/dish/index.vue +++ b/src/views/dish/dish/index.vue @@ -1505,13 +1505,13 @@ setTimeout(() => { this.loading = false; let param = { - current: 1, + pageNum: 1, materialName: query, materialType: 1, - size: 20 + pageSize: 50 } getMaterialListApi(param).then(response => { - this.materialOptions = response.data.records + this.materialOptions = response.rows }); // this.options = this.list.filter(item => { // return item.label.toLowerCase() @@ -1561,16 +1561,16 @@ addMenuDishesApi(param).then(response => { this.openDish = false; this.$modal.msgSuccess("新增成功"); - this.getList(); - this.btnLoading=false; + this.getList(); }); + this.btnLoading=false; } else { editMenuDishesApi(param).then(response => { this.openDish = false; this.$modal.msgSuccess("修改成功"); this.getList(); - this.btnLoading=false; }); + this.btnLoading=false; } } } @@ -1581,7 +1581,7 @@ this.$modal .confirm("是否确认删除数据项?") .then(function () { - return removeMenuDishesApi(row.dishesId); + return removeMenuDishesApi({ids:[row.id]}); }) .then(() => { this.$modal.msgSuccess("删除成功"); diff --git a/src/views/dish/material/components/MaterialDialog.vue b/src/views/dish/material/components/MaterialDialog.vue index 8252569b..31c10f53 100644 --- a/src/views/dish/material/components/MaterialDialog.vue +++ b/src/views/dish/material/components/MaterialDialog.vue @@ -98,14 +98,14 @@ - + ({ value: subItem.id,//父子类别value一致时选中识别不出来,加个#号区分 label: subItem.bigType, + bigType: item.bigType, parentId:item.id, level:2 })) })); }, + // 获取父节点的类别名称 + getParentCategoryName(Id) { + const findNode = (nodes) => { + for (let node of nodes) { + if (node.value == Id) { + return node; + } + if (node.children) { + const result = findNode(node.children); + if (result) return result; + } + } + return ""; + }; + return findNode(this.cascaderOptions); + }, //选中营养信息类别 handleNutritionChange(value) { - console.log("选中营养信息类别",value) - this.nutritionAllList() - }, + console.log("选中营养信息类别",value) + let obj = this.getParentCategoryName(value) + this.bigType = obj.bigType + this.littleType = obj.label + // setTimeout(()=>{ + this.nutritionAllList() + // },300) + + }, //获取营养信息下拉 nutritionAllList(){ let param = { - bigType:this.form.str[0], - littleType:this.form.str[1] + bigType:this.bigType, + littleType:this.littleType } nutritionAllListApi(param).then((response) => { this.$set(this.form,"nutritionId",null) @@ -593,6 +618,7 @@ export default { this.$set(this.form,"areaId",row.areaId) this.getTypeTreeData() this.getDrpUnitList() + this.$set(this.form,"id",row.id) this.$set(this.form,"areaName",row.areaName) this.$set(this.form,"categoryId",row.categoryId) this.$set(this.form,"categoryName",row.categoryName) @@ -624,13 +650,16 @@ export default { // this.$set(this.form,"cutProcessList",row.cutProcessList) - if(row.bigType&&row.littleType){ - this.$set(this.form,"str",[row.bigType,row.littleType]) + if(row.nutritionType){ + this.$set(this.form,"nutritionType",Number(row.nutritionType)) + let obj = this.getParentCategoryName(row.nutritionType) + this.bigType = obj.bigType + this.littleType = obj.label this.nutritionAllList() setTimeout(()=>{ this.$set(this.form,"nutritionId",row.nutritionId) if(this.form.nutritionId){ - nutritionDetailApi(this.form.nutritionId).then((response) => { + getNutrition({nutritionId: this.form.nutritionId}).then((response) => { this.form.menuMaterialNutritionDTO = response.data }); }else{ @@ -669,7 +698,7 @@ export default { } },800) }else{ - this.$set(this.form,"str",[]) + this.$set(this.form,"nutritionType",null) this.form.menuMaterialNutritionDTO = { edible: '',//可食部分(g/100g) water: '',//水分(g/100g) @@ -739,7 +768,7 @@ export default { unitId: '',//原料单位 unitPrice: '',//原料进价(元) barCode: '',//条码 - str:[],//营养信息类型 + nutritionType:null,//营养信息类型 nutritionId:null,//营养信息 shelfLifeType:"1",//保质期类型 shelfLifeDays:"",//保质期 diff --git a/src/views/dish/menu/detail.vue b/src/views/dish/menu/detail.vue index ff244897..3d9a1c70 100644 --- a/src/views/dish/menu/detail.vue +++ b/src/views/dish/menu/detail.vue @@ -669,12 +669,12 @@ export default { "salesMode":this.queryDish.salesMode, "typeId":this.queryDish.typeId, "dishesName":this.queryDish.dishesName, - "current":1, - "size":100 + "pageNum":1, + "pageSize":100 } getDishesByTypePageApi(param).then((response) => { // console.log(response) - this.dishesPageList = response.data.records; + this.dishesPageList = response.rows; for(let i =0 ;i < this.dishesList.length ;i++){ this.dishesPageList.forEach(item=>{ if(item.dishesId==this.dishesList[i].dishesId){ @@ -690,8 +690,8 @@ export default { let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId) if(index==-1){ let dish = Object.assign({}, obj) - this.$set(dish,'salePrice',Number(dish.salePrice/100)||Number(dish.price/100)) - this.$set(dish,'price',Number(dish.price/100)) + this.$set(dish,'salePrice',Number(dish.unitPrice/100)||Number(dish.unitPrice/100)) + this.$set(dish,'price',Number(dish.unitPrice/100)) this.$set(dish,'supplyNum',dish.supplyNum||99999) this.$set(dish,'restrictNum',dish.restrictNum||99999) this.dishesList.push(dish) diff --git a/src/views/dish/menu/edit.vue b/src/views/dish/menu/edit.vue index 92b7e200..6b0d2eaf 100644 --- a/src/views/dish/menu/edit.vue +++ b/src/views/dish/menu/edit.vue @@ -579,9 +579,31 @@ export default { }, //餐次数据 getMealTimeList() { - mealTimeListApi({}).then(response => { - this.mealTimeList=response - }); + // mealTimeListApi({}).then(response => { + // this.mealTimeList=response + // }); + this.mealTimeList= [ + { + mealtimeType:"1", + mealtimeName:"早餐", + }, + { + mealtimeType:"2", + mealtimeName:"午餐", + }, + { + mealtimeType:"3", + mealtimeName:"下午茶", + }, + { + mealtimeType:"4", + mealtimeName:"晚餐", + }, + { + mealtimeType:"5", + mealtimeName:"夜宵", + } + ] }, // 返回列表页 jumpList() { @@ -829,12 +851,12 @@ export default { "salesMode":this.queryDish.salesMode, "typeId":this.queryDish.typeId, "dishesName":this.queryDish.dishesName, - "current":1, - "size":100 + "pageNum":1, + "pageSize":100 } getDishesByTypePageApi(param).then((response) => { // console.log(response) - this.dishesPageList = response.data.records; + this.dishesPageList = response.rows; for(let i =0 ;i < this.dishesList.length ;i++){ this.dishesPageList.forEach(item=>{ if(item.dishesId==this.dishesList[i].dishesId){ @@ -850,8 +872,8 @@ export default { let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId) if(index==-1){//新-加入 let dish = Object.assign({}, obj) - this.$set(dish,'salePrice',Number(dish.salePrice/100)||Number(dish.price/100)) - this.$set(dish,'price',Number(dish.price/100)) + this.$set(dish,'salePrice',Number(dish.unitPrice/100)||Number(dish.unitPrice/100)) + this.$set(dish,'price',Number(dish.unitPrice/100)) this.$set(dish,'supplyNum',dish.supplyNum||99999) this.$set(dish,'restrictNum',dish.restrictNum||99999) this.dishesList.push(dish) diff --git a/src/views/dish/menu/index.vue b/src/views/dish/menu/index.vue index 11413da8..f44d6903 100644 --- a/src/views/dish/menu/index.vue +++ b/src/views/dish/menu/index.vue @@ -102,8 +102,8 @@