菜品类型对接

This commit is contained in:
zzyuan 2025-03-11 18:32:30 +08:00
parent 2cdc19093d
commit 7998c86aa1
2 changed files with 729 additions and 0 deletions

307
src/api/dish/type.js Normal file
View File

@ -0,0 +1,307 @@
import request from '@/utils/request'
// 查询菜品灶类列表
export function getMenuDishesCookListApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishescook/page',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 新增菜品灶类
export function addMenuDishesCookApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishescook/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑菜品灶类列表
export function editMenuDishesCookApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishescook/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除菜品灶类
export function removeMenuDishesCookApi(cookId) {
return request({
url: '/smart-canteen/api/v1/menudishescook/remove/'+ cookId,
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
// data: data
})
}
// 查询菜品标签列表
export function getMenuDishesLabelListApi(data) {
return request({
url: '/smart-canteen/api/v1/menudisheslabel/page',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 新增菜品标签
export function addMenuDishesLabelApi(data) {
return request({
url: '/smart-canteen/api/v1/menudisheslabel/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑菜品标签
export function editMenuDishesLabelApi(data) {
return request({
url: '/smart-canteen/api/v1/menudisheslabel/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除菜品标签
export function removeMenuDishesLabelApi(labelId) {
return request({
url: '/smart-canteen/api/v1/menudisheslabel/remove/'+ labelId,
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
// data: data
})
}
// 查询菜品口味列表
export function getMenuDishesTasteListApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishestaste/page',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 新增菜品口味
export function addMenuDishesTasteApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishestaste/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑菜品口味
export function editMenuDishesTasteApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishestaste/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除菜品口味
export function removeMenuDishesTasteApi(tasteId) {
return request({
url: '/smart-canteen/api/v1/menudishestaste/remove/'+ tasteId,
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
// data: data
})
}
// 查询菜品功效列表
export function getMenuDishesEffectListApi(data) {
return request({
url: '/smart-canteen/api/v1/menudisheseffect/page',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 新增菜品功效
export function addMenuDishesEffectApi(data) {
return request({
url: '/smart-canteen/api/v1/menudisheseffect/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑菜品功效
export function editMenuDishesEffectApi(data) {
return request({
url: '/smart-canteen/api/v1/menudisheseffect/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除菜品功效
export function removeMenuDishesEffectApi(effectId) {
return request({
url: '/smart-canteen/api/v1/menudisheseffect/remove/'+ effectId,
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
// data: data
})
}
// 查询菜品菜系列表
export function getMenuDishesStyleListApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishesstyle/page',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 新增菜品菜系
export function addMenuDishesStyleApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishesstyle/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑菜品菜系
export function editMenuDishesStyleApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishesstyle/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除菜品菜系
export function removeMenuDishesStyleApi(styleId) {
return request({
url: '/smart-canteen/api/v1/menudishesstyle/remove/'+ styleId,
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
// data: data
})
}
// 查询菜品适宜人群列表
export function getMenuDishesSuitListApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishessuit/page',
method: 'get',
headers: {
"merchant-id":"378915229716713472",
},
params: data
})
}
// 新增菜品适宜人群
export function addMenuDishesSuitApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishessuit/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑菜品适宜人群
export function editMenuDishesSuitApi(data) {
return request({
url: '/smart-canteen/api/v1/menudishessuit/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除菜品适宜人群
export function removeMenuDishesSuitApi(suitId) {
return request({
url: '/smart-canteen/api/v1/menudishessuit/remove/'+ suitId,
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
// data: data
})
}

View File

@ -0,0 +1,422 @@
<template>
<div class="app-container">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="菜品灶类" name="menudishescook"></el-tab-pane>
<el-tab-pane label="菜品标签" name="menudisheslabel"></el-tab-pane>
<el-tab-pane label="菜品口味" name="menudishestaste"></el-tab-pane>
<el-tab-pane label="菜品功效" name="menudisheseffect"></el-tab-pane>
<el-tab-pane label="菜品菜系" name="menudishesstyle"></el-tab-pane>
<el-tab-pane label="菜品适宜人群" name="menudishessuit"></el-tab-pane>
</el-tabs>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名称" prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="800">
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * 10 + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="名称" align="center" prop="cookName" v-if="activeName=='menudishescook'"/>
<el-table-column label="名称" align="center" prop="labelName" v-if="activeName=='menudisheslabel'"/>
<el-table-column label="名称" align="center" prop="tasteName" v-if="activeName=='menudishestaste'"/>
<el-table-column label="名称" align="center" prop="effectName" v-if="activeName=='menudisheseffect'"/>
<el-table-column label="名称" align="center" prop="styleName" v-if="activeName=='menudishesstyle'"/>
<el-table-column label="名称" align="center" prop="suitName" v-if="activeName=='menudishessuit'"/>
<el-table-column label="创建时间" align="center" prop="crtime" />
<el-table-column label="更新时间" align="center" prop="uptime"/>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" maxlength="40"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getMenuDishesCookListApi, addMenuDishesCookApi, editMenuDishesCookApi, removeMenuDishesCookApi } from "@/api/dish/type"
import { getMenuDishesLabelListApi, addMenuDishesLabelApi, editMenuDishesLabelApi, removeMenuDishesLabelApi } from "@/api/dish/type"
import { getMenuDishesTasteListApi, addMenuDishesTasteApi, editMenuDishesTasteApi, removeMenuDishesTasteApi } from "@/api/dish/type"
import { getMenuDishesEffectListApi, addMenuDishesEffectApi, editMenuDishesEffectApi, removeMenuDishesEffectApi } from "@/api/dish/type"
import { getMenuDishesStyleListApi, addMenuDishesStyleApi, editMenuDishesStyleApi, removeMenuDishesStyleApi } from "@/api/dish/type"
import { getMenuDishesSuitListApi, addMenuDishesSuitApi, editMenuDishesSuitApi, removeMenuDishesSuitApi } from "@/api/dish/type"
export default {
name: "",
dicts: [],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tableListData: [],
//
title: "",
//
open: false,
activeName:"menudishescook",
activeLabel:"菜品灶类",
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord:""
},
//
form: {},
//
rules: {
name: [
{ required: true, message: "名称不能为空", trigger: "blur" }
]
// dictType: [
// { required: true, message: "", trigger: "blur" }
// ]
}
};
},
created() {
this.getList();
},
methods: {
handleTabClick(tab, event) {
console.log(tab.name,tab.label)
this.activeLabel = tab.label
this.queryParams.keyWord=""
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
let param = {
"page":{"current":this.queryParams.pageNum,"size":this.queryParams.pageSize},
"object":{
}
}
//
if(this.activeName=="menudishescook"){
param.object.cookName = this.queryParams.keyWord
getMenuDishesCookListApi({"content":JSON.stringify(param)}).then(response => {
this.tableListData = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
}
//
if(this.activeName=="menudisheslabel"){
param.object.labelName = this.queryParams.keyWord
getMenuDishesLabelListApi({"content":JSON.stringify(param)}).then(response => {
this.tableListData = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
}
//
if(this.activeName=="menudishestaste"){
param.object.tasteName = this.queryParams.keyWord
getMenuDishesTasteListApi({"content":JSON.stringify(param)}).then(response => {
this.tableListData = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
}
//
if(this.activeName=="menudisheseffect"){
param.object.effectName = this.queryParams.keyWord
getMenuDishesEffectListApi({"content":JSON.stringify(param)}).then(response => {
this.tableListData = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
}
//
if(this.activeName=="menudishesstyle"){
param.object.styleName = this.queryParams.keyWord
getMenuDishesStyleListApi({"content":JSON.stringify(param)}).then(response => {
this.tableListData = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
}
//
if(this.activeName=="menudishessuit"){
param.object.suitName = this.queryParams.keyWord
getMenuDishesSuitListApi({"content":JSON.stringify(param)}).then(response => {
this.tableListData = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增"+this.activeLabel;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = Object.assign({}, row)
//
if(this.activeName=="menudishescook"){
this.$set(this.form,"name",row.cookName)
}
//
if(this.activeName=="menudisheslabel"){
this.$set(this.form,"name",row.labelName)
}
//
if(this.activeName=="menudishestaste"){
this.$set(this.form,"name",row.tasteName)
}
//
if(this.activeName=="menudisheseffect"){
this.$set(this.form,"name",row.effectName)
}
//
if(this.activeName=="menudishesstyle"){
this.$set(this.form,"name",row.styleName)
}
//
if(this.activeName=="menudishessuit"){
this.$set(this.form,"name",row.suitName)
}
this.open = true;
this.title = "修改"+this.activeLabel;
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {};
this.resetForm("form");
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
//
if(this.activeName=="menudishescook"){
this.form.cookName = this.form.name
if (this.form.cookId != undefined) {
editMenuDishesCookApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMenuDishesCookApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
//
if(this.activeName=="menudisheslabel"){
this.form.labelName = this.form.name
if (this.form.labelId != undefined) {
editMenuDishesLabelApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMenuDishesLabelApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
//
if(this.activeName=="menudishestaste"){
this.form.tasteName = this.form.name
if (this.form.tasteId != undefined) {
editMenuDishesTasteApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMenuDishesTasteApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
//
if(this.activeName=="menudisheseffect"){
this.form.effectName = this.form.name
if (this.form.effectId != undefined) {
editMenuDishesEffectApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMenuDishesEffectApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
//
if(this.activeName=="menudishesstyle"){
this.form.styleName = this.form.name
if (this.form.styleId != undefined) {
editMenuDishesStyleApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMenuDishesStyleApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
//
if(this.activeName=="menudishessuit"){
this.form.suitName = this.form.name
if (this.form.suitId != undefined) {
editMenuDishesSuitApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMenuDishesSuitApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
console.log(row)
var that = this
this.$modal.confirm('是否确认删除数据项?').then(function() {
//
if(that.activeName=="menudishescook"){
return removeMenuDishesCookApi(row.cookId)
}
//
if(that.activeName=="menudisheslabel"){
return removeMenuDishesLabelApi(row.labelId)
}
//
if(that.activeName=="menudishestaste"){
return removeMenuDishesTasteApi(row.tasteId)
}
//
if(that.activeName=="menudisheseffect"){
return removeMenuDishesEffectApi(row.effectId)
}
//
if(that.activeName=="menudishesstyle"){
return removeMenuDishesStyleApi(row.styleId)
}
//
if(that.activeName=="menudishessuit"){
return removeMenuDishesSuitApi(row.suitId)
}
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
}
};
</script>