导入菜谱

This commit is contained in:
sxu 2025-06-05 11:07:05 +08:00
parent 83a8b29bd5
commit 8a4d868c5d
2 changed files with 112 additions and 113 deletions

View File

@ -74,7 +74,7 @@ export function getPageRecipeListApi(data) {
params: data params: data
}) })
} }
//菜谱-新增 //菜谱-新增
export function addMenuRecipeApi(data) { export function addMenuRecipeApi(data) {
return request({ return request({
@ -145,14 +145,14 @@ export function getMenuRecipeTemplateDetailApi(data) {
data: data data: data
}) })
} }
export function menuUpLoadApi(param){ export function menuUpLoadApi(param){
const formData = new FormData() const formData = new FormData()
formData.append('file', param.file) formData.append('file', param.file)
formData.append('recipeId', param.recipeId) formData.append('recipeId', param.recipeId)
return request({ return request({
url: '/smart-canteen/menu_recipe/recipe/import/dishes', url: '/smart-canteen/cook_recipe/recipe/import/dishes',
method: 'post', method: 'post',
data: formData, data: formData,
header:'multipart/form-data' header:'multipart/form-data'

View File

@ -2,8 +2,8 @@
<div class="app-container"> <div class="app-container">
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="当前菜谱" name="currentRecipe"></el-tab-pane> <el-tab-pane label="当前菜谱" name="currentRecipe"></el-tab-pane>
<el-tab-pane label="菜谱列表" name="pageRecipe"></el-tab-pane> <el-tab-pane label="菜谱列表" name="pageRecipe"></el-tab-pane>
</el-tabs> </el-tabs>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-row class="mb8" v-if="activeName=='currentRecipe'"> <el-row class="mb8" v-if="activeName=='currentRecipe'">
<el-button plain v-for="item in menuTypeList" :key="item.id" :class="queryParams.key==item.id?'primary':''" @click="choseMenuType(item)">{{ item.name }}</el-button> <el-button plain v-for="item in menuTypeList" :key="item.id" :class="queryParams.key==item.id?'primary':''" @click="choseMenuType(item)">{{ item.name }}</el-button>
@ -11,14 +11,14 @@
<el-row class="mb8" v-if="activeName=='currentRecipe'"> <el-row class="mb8" v-if="activeName=='currentRecipe'">
<span style="margin: 0px 20px;">日期</span> <span style="margin: 0px 20px;">日期</span>
<el-radio-group v-model="queryParams.applyDate" @change="handleQuery"> <el-radio-group v-model="queryParams.applyDate" @change="handleQuery">
<el-radio v-for="item in daysList" :key="item.data" :label="item.data">{{item.data}} {{ item.weekValue }}</el-radio> <el-radio v-for="item in daysList" :key="item.data" :label="item.data">{{item.data}} {{ item.weekValue }}</el-radio>
</el-radio-group> </el-radio-group>
</el-row> </el-row>
<el-row class="mb8"> <el-row class="mb8">
<el-form-item label="所属区域" prop="areaId"> <el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="queryParams.areaId" <el-cascader v-model="queryParams.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false" :options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{ :props="{
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'label' value:'id',label:'label'
@ -32,7 +32,7 @@
:label="item.canteenName" :label="item.canteenName"
:value="item.canteenId" :value="item.canteenId"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属档口" prop="stallId"> <el-form-item label="所属档口" prop="stallId">
<el-select v-model="queryParams.stallId" clearable placeholder="请选择所属档口" style="width: 100%;" > <el-select v-model="queryParams.stallId" clearable placeholder="请选择所属档口" style="width: 100%;" >
@ -41,8 +41,8 @@
:label="item.stallName" :label="item.stallName"
:value="item.stallId" :value="item.stallId"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="菜谱名称" prop="recipeName"> <el-form-item label="菜谱名称" prop="recipeName">
<el-input <el-input
v-model="queryParams.recipeName" v-model="queryParams.recipeName"
@ -51,14 +51,14 @@
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
<el-row :gutter="10" class="mb8" v-if="activeName=='pageRecipe'"> <el-row :gutter="10" class="mb8" v-if="activeName=='pageRecipe'">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -68,10 +68,10 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="tableListData" height="800"> <el-table v-loading="loading" :data="tableListData" height="800">
<el-table-column label="序号" align="center" width="80" type="index" fixed="left"> <el-table-column label="序号" align="center" width="80" type="index" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
@ -84,7 +84,7 @@
<el-table-column label="菜谱名称" align="center" prop="recipeName" :show-overflow-tooltip="true" width="200"> <el-table-column label="菜谱名称" align="center" prop="recipeName" :show-overflow-tooltip="true" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex;align-items: center;justify-content: center;" v-if="activeName=='currentRecipe'"> <div style="display: flex;align-items: center;justify-content: center;" v-if="activeName=='currentRecipe'">
<span v-if="scope.row.recipeId">{{scope.row.recipeName}}</span> <span v-if="scope.row.recipeId">{{scope.row.recipeName}}</span>
<img v-if="scope.row.recipeId" src="../../../assets/canteen/replace.png" style="width: 16px;height: 16px;margin-left: 10px;cursor: pointer;" alt="" @click="choseMenuRecipe(scope.row)"> <img v-if="scope.row.recipeId" src="../../../assets/canteen/replace.png" style="width: 16px;height: 16px;margin-left: 10px;cursor: pointer;" alt="" @click="choseMenuRecipe(scope.row)">
<i v-if="scope.row.recipeId" class="el-icon-delete" style="color: red;font-size: 16px;margin-left: 10px;cursor: pointer;" @click="handleUnbind(scope.row)" ></i> <i v-if="scope.row.recipeId" class="el-icon-delete" style="color: red;font-size: 16px;margin-left: 10px;cursor: pointer;" @click="handleUnbind(scope.row)" ></i>
@ -92,13 +92,13 @@
<span style="color: #0099ff;">选择菜谱</span> <span style="color: #0099ff;">选择菜谱</span>
<img src="../../../assets/canteen/add.png" style="width: 16px;height: 16px;margin-left: 10px;" alt=""> <img src="../../../assets/canteen/add.png" style="width: 16px;height: 16px;margin-left: 10px;" alt="">
</div> </div>
</div> </div>
<div v-if="activeName=='pageRecipe'"> <div v-if="activeName=='pageRecipe'">
<span>{{scope.row.recipeName}}</span> <span>{{scope.row.recipeName}}</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-for="item in mealTimeList" :key="item.mealtimeType" :label="item.mealtimeName" :show-overflow-tooltip="true" align="center" v-if="activeName=='currentRecipe'"> <el-table-column v-for="item in mealTimeList" :key="item.mealtimeType" :label="item.mealtimeName" :show-overflow-tooltip="true" align="center" v-if="activeName=='currentRecipe'">
<template slot-scope="scope"> <template slot-scope="scope">
@ -111,11 +111,11 @@
<div>{{ lastItem.dishesName }}; </div> <div>{{ lastItem.dishesName }}; </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<span>无菜品</span> <span>无菜品</span>
</div> </div>
</div> </div>
<div v-if="scope.row.detail"> <div v-if="scope.row.detail">
@ -124,19 +124,19 @@
<div v-for="(lastItem,index) in subItem.dishesList" :key="lastItem.dishesId"> <div v-for="(lastItem,index) in subItem.dishesList" :key="lastItem.dishesId">
<div v-if="index<4">{{ lastItem.dishesName }}</div> <div v-if="index<4">{{ lastItem.dishesName }}</div>
<div v-if="index==4">...</div> <div v-if="index==4">...</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<span>无菜品</span> <span>无菜品</span>
</div> </div>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="菜谱更新时间" align="center" prop="uptime" width="150" v-if="activeName=='currentRecipe'"/> <el-table-column label="菜谱更新时间" align="center" prop="uptime" width="150" v-if="activeName=='currentRecipe'"/>
<el-table-column label="菜谱类型" align="center" prop="recipeType" v-if="activeName=='pageRecipe'"> <el-table-column label="菜谱类型" align="center" prop="recipeType" v-if="activeName=='pageRecipe'">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.recipeType==1">指定日期菜谱</span> <span v-if="scope.row.recipeType==1">指定日期菜谱</span>
<span v-if="scope.row.recipeType==2">每日循环菜谱</span> <span v-if="scope.row.recipeType==2">每日循环菜谱</span>
@ -146,54 +146,54 @@
<el-table-column label="菜品数量" align="center" prop="dishesCount" v-if="activeName=='pageRecipe'"/> <el-table-column label="菜品数量" align="center" prop="dishesCount" v-if="activeName=='pageRecipe'"/>
<el-table-column label="菜谱生效日期" align="center" prop="applyDateStringList" v-if="activeName=='pageRecipe'"> <el-table-column label="菜谱生效日期" align="center" prop="applyDateStringList" v-if="activeName=='pageRecipe'">
<template slot-scope="scope" v-if="activeName=='pageRecipe'"> <template slot-scope="scope" v-if="activeName=='pageRecipe'">
<el-popover placement="top" width="400"> <el-popover placement="top" width="400">
<div style="width: 100%;padding: 10px;border-bottom: 1px solid #ccc;margin-bottom: 10px;"> <div style="width: 100%;padding: 10px;border-bottom: 1px solid #ccc;margin-bottom: 10px;">
{{currentMonth}} {{currentMonth}}
</div> </div>
<div style="width: 100%;display: flex;align-items: center;margin-bottom: 10px;"> <div style="width: 100%;display: flex;align-items: center;margin-bottom: 10px;">
<div v-for="(item,index) in currentWeekList" :key="index" style="width: 14%;text-align: center;">{{item}}</div> <div v-for="(item,index) in currentWeekList" :key="index" style="width: 14%;text-align: center;">{{item}}</div>
</div> </div>
<div style="width: 100%;display: flex;align-items: center;margin-bottom: 10px;flex-wrap: wrap;"> <div style="width: 100%;display: flex;align-items: center;margin-bottom: 10px;flex-wrap: wrap;">
<div v-for="(item,index) in monthDaysList" :key="index" :class="scope.row.applyDateStringList.findIndex(v=>v==item)>-1 ? 'dateTable2' : 'dateTable'" class="" >{{item}}</div> <div v-for="(item,index) in monthDaysList" :key="index" :class="scope.row.applyDateStringList.findIndex(v=>v==item)>-1 ? 'dateTable2' : 'dateTable'" class="" >{{item}}</div>
</div> </div>
<div style="color: #1890ff;cursor: pointer;" slot="reference">查看详情</div> <div style="color: #1890ff;cursor: pointer;" slot="reference">查看详情</div>
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="用户范围" align="center" prop="effName" v-if="activeName=='pageRecipe'"/> --> <!-- <el-table-column label="用户范围" align="center" prop="effName" v-if="activeName=='pageRecipe'"/> -->
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width" v-if="activeName=='currentRecipe'" > <el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width" v-if="activeName=='currentRecipe'" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" v-if="queryParams.key=='2'" type="text" v-if="queryParams.key=='2'"
@click="handleDevice(scope.row)" @click="handleDevice(scope.row)"
>设备详情</el-button> >设备详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right" v-if="activeName=='pageRecipe'"> <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right" v-if="activeName=='pageRecipe'">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
>删除</el-button> >删除</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" v-if="scope.row.recipeType==1" type="text" v-if="scope.row.recipeType==1"
@click="handleImport(scope.row)" @click="handleImport(scope.row)"
>导入</el-button> >导入</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -209,7 +209,7 @@
<el-option label="指定日期" value="1"></el-option> <el-option label="指定日期" value="1"></el-option>
<el-option label="每日循环" value="2"></el-option> <el-option label="每日循环" value="2"></el-option>
<el-option label="每周循环" value="3"></el-option> <el-option label="每周循环" value="3"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="菜谱名称" prop="recipeId"> <el-form-item label="菜谱名称" prop="recipeId">
<el-select v-model="menuForm.recipeId" placeholder="请选择菜谱名称" style="width: 300px;" clearable> <el-select v-model="menuForm.recipeId" placeholder="请选择菜谱名称" style="width: 300px;" clearable>
@ -217,10 +217,10 @@
:key="item.recipeId" :key="item.recipeId"
:label="item.recipeName" :label="item.recipeName"
:value="item.recipeId" :value="item.recipeId"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmBindMenu"> </el-button> <el-button type="primary" @click="confirmBindMenu"> </el-button>
<el-button @click="openMenu=false"> </el-button> <el-button @click="openMenu=false"> </el-button>
@ -233,10 +233,10 @@
<span>1下载模板按规范填写信息</span> <span>1下载模板按规范填写信息</span>
<el-button <el-button
size="mini" type="text" size="mini" type="text"
@click="importTemplate" @click="importTemplate"
style="margin-left: 40px;" style="margin-left: 40px;"
>模板下载 >模板下载
</el-button> </el-button>
</div> </div>
<div style="width: 80%;display: flex;align-items: center;justify-content: space-between;"> <div style="width: 80%;display: flex;align-items: center;justify-content: space-between;">
<span>2上传文件</span> <span>2上传文件</span>
@ -244,29 +244,29 @@
ref="upload" ref="upload"
:http-request="fileUpLoad" :http-request="fileUpLoad"
action="#" action="#"
accept=".xlsx, .xls" accept=".xlsx, .xls"
:show-file-list="false" :show-file-list="false"
> >
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
>上传导入 >上传导入
</el-button> </el-button>
</el-upload> </el-upload>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="openUpload=false"> </el-button> <el-button type="primary" @click="openUpload=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { mealTimeListApi,menuTypeListApi } from "@/api/dish/menu"; import { mealTimeListApi,menuTypeListApi } from "@/api/dish/menu";
import { getCurrentRecipeListApi, getPageRecipeListApi,removeMenuRecipeApi,unbindMenuRecipeApi,menuUpLoadApi } from "@/api/dish/menu"; import { getCurrentRecipeListApi, getPageRecipeListApi,removeMenuRecipeApi,unbindMenuRecipeApi,menuUpLoadApi } from "@/api/dish/menu";
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { downloadFileByUrl } from '@/utils/download' import { downloadFileByUrl } from '@/utils/download'
export default { export default {
@ -287,7 +287,7 @@
// //
total: 0, total: 0,
// //
tableListData: [], tableListData: [],
activeName:"currentRecipe", activeName:"currentRecipe",
bindType:"", bindType:"",
// //
@ -296,9 +296,9 @@
pageSize: 10, pageSize: 10,
key:"2", key:"2",
applyDate:"", applyDate:"",
areaId:null, areaId:null,
canteenId:null, canteenId:null,
stallId:null, stallId:null,
recipeName:"", recipeName:"",
}, },
mealTimeList:[],// mealTimeList:[],//
@ -327,26 +327,26 @@
], ],
recipeId: [ recipeId: [
{ required: true, message: "菜谱名称不能为空", trigger: "change" } { required: true, message: "菜谱名称不能为空", trigger: "change" }
] ]
}, },
// //
upload: { upload: {
// //
isUploading: false, isUploading: false,
// //
headers: { Authorization: 'Bearer ' + getToken() }, headers: { Authorization: 'Bearer ' + getToken() },
// //
url: process.env.VUE_APP_BASE_API + '/smart-canteen/menu_recipe/recipe/import/dishes', url: process.env.VUE_APP_BASE_API + '/smart-canteen/cook_recipe/recipe/import/dishes',
}, },
uploadRow:{}, uploadRow:{},
openUpload:false openUpload:false
}; };
}, },
created() { created() {
this.getMealTimeList(); this.getMealTimeList();
this.getMealTypeList(); this.getMealTypeList();
this.daysList = this.getRecentWeekDates(); this.daysList = this.getRecentWeekDates();
this.monthDaysList = this.getRecentMonthDates(); this.monthDaysList = this.getRecentMonthDates();
// console.log(this.currentWeekList) // console.log(this.currentWeekList)
// console.log(this.monthDaysList) // console.log(this.monthDaysList)
this.queryParams.applyDate = this.daysList[0].data; this.queryParams.applyDate = this.daysList[0].data;
@ -354,12 +354,12 @@
this.getList()// this.getList()//
}, },
methods: { methods: {
handleTabClick(tab, event) { handleTabClick(tab, event) {
console.log(tab.name,tab.label) console.log(tab.name,tab.label)
if(this.activeName=='currentRecipe'){ if(this.activeName=='currentRecipe'){
this.queryParams.key="2" this.queryParams.key="2"
this.queryParams.applyDate = this.daysList[0].data; this.queryParams.applyDate = this.daysList[0].data;
}else if(this.activeName=='pageRecipe'){ }else if(this.activeName=='pageRecipe'){
this.queryParams.key=undefined this.queryParams.key=undefined
this.queryParams.applyDate=undefined this.queryParams.applyDate=undefined
@ -367,7 +367,7 @@
this.handleQuery() this.handleQuery()
}, },
// //
getMealTimeList() { getMealTimeList() {
this.mealTimeList= [ this.mealTimeList= [
{ {
mealtimeType:"1", mealtimeType:"1",
@ -392,10 +392,10 @@
] ]
// mealTimeListApi({}).then(response => { // mealTimeListApi({}).then(response => {
// this.mealTimeList=response // this.mealTimeList=response
// }); // });
}, },
// //
getMealTypeList() { getMealTypeList() {
// menuTypeListApi({}).then(response => { // menuTypeListApi({}).then(response => {
// response.data.forEach(item=>{ // response.data.forEach(item=>{
// if(item.id==2||item.id==6||item.id==7||item.id==8){ // if(item.id==2||item.id==6||item.id==7||item.id==8){
@ -404,7 +404,7 @@
// }) // })
this.menuTypeList = [{bindType: 7,id: 2,name: "智慧餐台/消费机"},{bindType: 1,id: 6,name: "移动端当餐点餐"},{bindType: 2,id: 7,name: "移动端预订餐"},{bindType: 3,id: 8,name: "移动端一周菜谱"}] this.menuTypeList = [{bindType: 7,id: 2,name: "智慧餐台/消费机"},{bindType: 1,id: 6,name: "移动端当餐点餐"},{bindType: 2,id: 7,name: "移动端预订餐"},{bindType: 3,id: 8,name: "移动端一周菜谱"}]
this.bindType = this.menuTypeList[0].bindType this.bindType = this.menuTypeList[0].bindType
// }); // });
}, },
choseMenuType(item){ choseMenuType(item){
this.bindType = item.bindType this.bindType = item.bindType
@ -414,7 +414,7 @@
// //
getRecentWeekDates() { getRecentWeekDates() {
let currentDate = new Date(); // let currentDate = new Date(); //
let weekDates = []; let weekDates = [];
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
let day = currentDate.getDate(); let day = currentDate.getDate();
let month = currentDate.getMonth() + 1; // 0+1 let month = currentDate.getMonth() + 1; // 0+1
@ -431,7 +431,7 @@
"dateValue":formattedDate, "dateValue":formattedDate,
"weekValue":days[dayOfWeek] "weekValue":days[dayOfWeek]
} }
weekDates.push(obj); weekDates.push(obj);
currentDate.setDate(currentDate.getDate() + 1); // currentDate.setDate(currentDate.getDate() + 1); //
} }
return weekDates; return weekDates;
@ -439,14 +439,14 @@
// 28 // 28
getRecentMonthDates() { getRecentMonthDates() {
let currentDate = new Date(new Date().getTime()-24*60*60*1000); // let currentDate = new Date(new Date().getTime()-24*60*60*1000); //
let monthDates = []; let monthDates = [];
let month = new Date().getMonth() + 1; // 0+1 let month = new Date().getMonth() + 1; // 0+1
let year = new Date().getFullYear(); let year = new Date().getFullYear();
this.currentMonth = `${year}${month < 10 ? '0' + month : month}`; this.currentMonth = `${year}${month < 10 ? '0' + month : month}`;
for (let i = 0; i < 28; i++) { for (let i = 0; i < 28; i++) {
let day = currentDate.getDate(); let day = currentDate.getDate();
let month = currentDate.getMonth() + 1; // 0+1 let month = currentDate.getMonth() + 1; // 0+1
// //
let formattedDate = `${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`; let formattedDate = `${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
// //
@ -455,19 +455,19 @@
if(i<7){ if(i<7){
this.currentWeekList.push(days[dayOfWeek]) this.currentWeekList.push(days[dayOfWeek])
} }
monthDates.push(formattedDate); monthDates.push(formattedDate);
currentDate.setDate(currentDate.getDate() + 1); // currentDate.setDate(currentDate.getDate() + 1); //
} }
return monthDates; return monthDates;
}, },
// //
getAreaTreeData() { getAreaTreeData() {
systemAreaTreeApi({}).then((response) => { systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data; this.treeAreaOptions = response.data;
}); });
}, },
//- //-
handleAreaChange(e){ handleAreaChange(e){
let param= { let param= {
areaId:this.queryParams.areaId,canteenType: 1 areaId:this.queryParams.areaId,canteenType: 1
} }
@ -479,7 +479,7 @@
}); });
}, },
//- //-
handleCanteenChange(e){ handleCanteenChange(e){
let param= { let param= {
canteenId:this.queryParams.canteenId canteenId:this.queryParams.canteenId
} }
@ -487,8 +487,8 @@
this.stallOptions=response.rows||[] this.stallOptions=response.rows||[]
this.queryParams.stallId=null this.queryParams.stallId=null
}); });
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
@ -501,9 +501,9 @@
pageSize: 10, pageSize: 10,
key:"2", key:"2",
applyDate:this.daysList[0].data, applyDate:this.daysList[0].data,
areaId:null, areaId:null,
canteenId:null, canteenId:null,
stallId:null, stallId:null,
recipeName:"", recipeName:"",
} }
this.resetForm("queryForm"); this.resetForm("queryForm");
@ -511,39 +511,39 @@
}, },
/** 查询当前菜谱列表 */ /** 查询当前菜谱列表 */
getList() { getList() {
this.loading = true; this.loading = true;
this.queryParams.pageNum = this.queryParams.pageNum this.queryParams.pageNum = this.queryParams.pageNum
this.queryParams.pageSize = this.queryParams.pageSize this.queryParams.pageSize = this.queryParams.pageSize
if(this.activeName=='currentRecipe'){ if(this.activeName=='currentRecipe'){
getCurrentRecipeListApi(this.queryParams).then(response => { getCurrentRecipeListApi(this.queryParams).then(response => {
this.tableListData = response.rows; this.tableListData = response.rows;
this.total = Number(response.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
}); });
}else if(this.activeName=='pageRecipe'){ }else if(this.activeName=='pageRecipe'){
getPageRecipeListApi(this.queryParams).then(response => { getPageRecipeListApi(this.queryParams).then(response => {
this.tableListData = response.rows; this.tableListData = response.rows;
this.total = Number(response.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
}); });
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$router.push({ path: "/dish/menuDetail" }); this.$router.push({ path: "/dish/menuDetail" });
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
// let param = { // let param = {
// recipeId:row.recipeId // recipeId:row.recipeId
// } // }
// getPageRecipeListApi(param).then(response => { // getPageRecipeListApi(param).then(response => {
// let obj = response.rows[0] // let obj = response.rows[0]
this.$router.push({ path: "/dish/menuEdit",query: {pageJson:JSON.stringify(row)} }); this.$router.push({ path: "/dish/menuEdit",query: {pageJson:JSON.stringify(row)} });
// }); // });
}, },
/** 查看设备 */ /** 查看设备 */
handleDevice(row) { handleDevice(row) {
@ -552,13 +552,13 @@
canteenId:row.canteenId, canteenId:row.canteenId,
stallId:row.stallId, stallId:row.stallId,
} }
this.$router.push({ path: "/device/doubleScreen",query: obj }); this.$router.push({ path: "/device/doubleScreen",query: obj });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
console.log(row) console.log(row)
this.$modal.confirm('是否确认删除菜谱?').then(function() { this.$modal.confirm('是否确认删除菜谱?').then(function() {
return removeMenuRecipeApi({"recipeId":row.recipeId}) return removeMenuRecipeApi({"recipeId":row.recipeId})
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
@ -566,7 +566,7 @@
}, },
//- //-
handleUnbind(row) { handleUnbind(row) {
console.log(row) console.log(row)
let param = { let param = {
bindType: this.bindType, bindType: this.bindType,
handleType: 2,// handleType: 2,//
@ -576,7 +576,7 @@
} }
this.$modal.confirm('是否确认解绑菜谱?').then(function() { this.$modal.confirm('是否确认解绑菜谱?').then(function() {
return unbindMenuRecipeApi(param) return unbindMenuRecipeApi(param)
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("解绑成功"); this.$modal.msgSuccess("解绑成功");
@ -607,13 +607,13 @@
} }
}) })
} }
console.log(this.recipeOptions) console.log(this.recipeOptions)
}, },
//- //-
confirmBindMenu(){ confirmBindMenu(){
console.log(this.menuForm) console.log(this.menuForm)
this.$refs["menuForm"].validate(valid => { this.$refs["menuForm"].validate(valid => {
if (valid) { if (valid) {
console.log(this.menuForm) console.log(this.menuForm)
let param = { let param = {
bindType: this.bindType, bindType: this.bindType,
@ -627,12 +627,12 @@
this.openMenu=false this.openMenu=false
}); });
} }
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.cookId != undefined) { if (this.form.cookId != undefined) {
// editMenuDishesCookApi(this.form).then(response => { // editMenuDishesCookApi(this.form).then(response => {
// this.$modal.msgSuccess(""); // this.$modal.msgSuccess("");
@ -651,31 +651,31 @@
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleImport(row) { handleImport(row) {
this.uploadRow = row this.uploadRow = row
this.openUpload = true this.openUpload = true
}, },
fileUpLoad(param){ fileUpLoad(param){
param.recipeId = this.uploadRow.recipeId param.recipeId = this.uploadRow.recipeId
menuUpLoadApi(param).then((res) => { menuUpLoadApi(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.openUpload = false; this.openUpload = false;
this.getList() this.getList()
} else { } else {
this.$modal.msgError(res.msg); this.$modal.msgError(res.msg);
} }
}).catch((error) => { }).catch((error) => {
this.$modal.msgError(error) this.$modal.msgError(error)
}) })
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
let url = window.location.origin + '/glweb/template/导入菜谱模板.xlsx'; let url = window.location.origin + '/glweb/template/导入菜谱模板.xlsx';
downloadFileByUrl(url) downloadFileByUrl(url)
}, },
} }
}; };
</script> </script>
@ -690,7 +690,7 @@
color: #606266; color: #606266;
display: flex;align-items: center;justify-content: center; display: flex;align-items: center;justify-content: center;
border: 1px solid #e6ebf5; border: 1px solid #e6ebf5;
} }
.dateTable2{ .dateTable2{
width: 14%; width: 14%;
@ -700,4 +700,3 @@
border: 1px solid #FFF; border: 1px solid #FFF;
} }
</style> </style>