Compare commits

..

3 Commits

Author SHA1 Message Date
zzyuan 7998c86aa1 菜品类型对接 2025-03-11 18:32:30 +08:00
zzyuan 2cdc19093d 原料,营养信息对接 2025-03-11 18:32:06 +08:00
zzyuan 5afb4de81a 页面优化绘制(基础设置,设备管理) 2025-03-11 18:31:37 +08:00
10 changed files with 1494 additions and 442 deletions

View File

@ -11,6 +11,39 @@ export function systemMaterialTreeApi(data) {
data: data
})
}
// 新增原料类别
export function addMaterialTypeApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterialcategory/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
//修改原料类别
export function updateMaterialTypeApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterialcategory/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
//删除原料类别
export function removeMaterialTypeApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterialcategory/remove',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 系统区域权限树
export function systemAreaTreeApi(data) {
@ -24,7 +57,7 @@ export function systemAreaTreeApi(data) {
})
}
// 查询区域列表
// 查询原料列表
export function getMaterialListApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterial/page',
@ -35,54 +68,72 @@ export function getMaterialListApi(data) {
data: data
})
}
// 根据区域id查询区域名称
export function getMaterialNameApi(data) {
return request({
url: '/smart-canteen/api/v2/alloc/area/get-area-name',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 查询区域(食堂,档口,餐线)编号
export function getMaterialNumApi(data) {
return request({
url: 'smart-canteen/api/v2/alloc/canteen/get-canteen-num',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 新增区域
// 新增原料
export function addMaterialApi(data) {
return request({
url: 'smart-canteen/api/v2/alloc/area/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
//修改区域
return request({
url: '/smart-canteen/api/v1/menumaterial/add',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 编辑原料
export function updateMaterialApi(data) {
return request({
url: 'smart-canteen/api/v2/alloc/area/update',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
//删除区域
return request({
url: '/smart-canteen/api/v1/menumaterial/edit',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 删除原料
export function removeMaterialApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterial/remove',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 批量删除原料
export function batchRemoveMaterialApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterial/remove/batch',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 批量修改原料
export function batchUpdateMaterialApi(data) {
return request({
url: '/smart-canteen/api/v1/menumaterial/material/batch/update/category',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
},
data: data
})
}
// 根据区域ID-获取原料单位下拉选
//{current: 1, size: -1, ifListUse: 1, areaId: '421488254718578688'}
export function getDrpUnitListApi(data) {
return request({
url: 'smart-canteen/api/v2/alloc/area/remove',
url: '/smart-canteen//api/v1/drpunit/page',
method: 'post',
headers: {
"merchant-id":"378915229716713472",
@ -90,3 +141,21 @@ export function removeMaterialApi(data) {
data: data
})
}
// // 查询区域(食堂,档口,餐线)编号
// export function getMaterialNumApi(data) {
// return request({
// url: 'smart-canteen/api/v2/alloc/canteen/get-canteen-num',
// method: 'post',
// headers: {
// "merchant-id":"378915229716713472",
// },
// data: data
// })
// }

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 查询获取所有食材营养信息
// 查询获取所有营养信息
export function listNutrition(query) {
return request({
url: '/smart-canteen/api/v1/menunutrition/getMenuNutritionPage',
@ -45,7 +45,7 @@ export function delNutrition(data) {
})
}
// 获取所有食材类别
// 获取营养信息类别
export function typeList(data) {
return request({
url: '/smart-canteen/api/v1/menunutrition/all/type/list',
@ -53,4 +53,20 @@ export function typeList(data) {
data: data
})
}
// 获取所有营养信息
export function nutritionAllListApi(data) {
return request({
url: '/smart-canteen/api/v1/menunutrition/all/list',
method: 'post',
data: data
})
}
// 获取营养信息-详细数据
export function nutritionDetailApi(nutritionId) {
return request({
url: '/smart-canteen/api/v1/menumaterial/nutrition/detail/'+nutritionId,
method: 'post',
// data: data
})
}

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

@ -121,7 +121,6 @@
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>
编辑
@ -129,7 +128,7 @@
<el-button
size="mini"
type="text"
icon="el-icon-delete"
style="color: red;"
@click="handleDelete(scope.row)"
>
删除

View File

@ -91,7 +91,7 @@
<span style="color: #4b80fd;">详情</span>
</template>
</el-table-column>
<el-table-column label="食堂图片" align="center" prop="imgUrl" :show-overflow-tooltip="true" width="100">
<el-table-column label="食堂图片" align="center" prop="imgUrl" width="100">
<template slot-scope="scope">
<img :src="scope.row.imgUrl" alt="" style="width: 80px;height: 40px;" @click="openImg(scope.row)">
</template>
@ -118,7 +118,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="crtime" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="更新时间" align="center" prop="uptime" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
@ -132,7 +132,8 @@
>编辑</el-button>
<el-button
size="mini"
type="text"
type="text"
style="color: red;"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
@ -151,7 +152,7 @@
<el-dialog :title="title+'-食堂'" :visible.sync="open" width="1000px" append-to-body>
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<!-- 基础设置 -->
<el-tab-pane label="基础设置" name="baseSetting" style="height: 550px;">
<el-tab-pane label="基础设置" name="baseSetting" style="height: 600px;overflow-y: auto;">
<el-form ref="baseForm" :model="baseForm" :rules="baseFormRules" label-width="80px">
<el-row>
<el-col :span="12">
@ -214,8 +215,8 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="负责人" prop="labelName">
<el-select v-model="baseForm.labelName" placeholder="请选择负责人" style="width: 100%;" @focus="chosenCharger"></el-select>
<el-form-item label="负责人" prop="custName">
<el-select v-model="baseForm.custName" placeholder="请选择负责人" style="width: 100%;" @focus="openChosenCharger"></el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -289,17 +290,62 @@
</el-form>
</el-tab-pane>
<!-- 支付设置 -->
<el-tab-pane label="支付设置" name="paySetting">
支付设置
<el-tab-pane label="支付设置" name="paySetting" style="height: 600px;overflow-y: auto;">
<div style="width: 100%;height: auto;">
<div>
<span style="font-weight: bold;">启用本食堂独立规则</span>
<el-switch v-model="payDTO.ifEnablePay"
active-text="开启" inactive-text="关闭"
:active-value="1" :inactive-value="2"></el-switch>
</div>
<div style="color: red;">
*提示需勾选对应的支付方式后配置方可生效只针对下层的设备生效小程序不生效
</div>
<div style="margin: 10px;">
<el-checkbox-group v-model="payTypeList" size="small">
<el-checkbox label="1" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;margin-left: 10px;">支付宝</el-checkbox>
<el-checkbox label="2" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">微信</el-checkbox>
<el-checkbox label="3" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">云闪付</el-checkbox>
<el-checkbox label="4" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">农业银行</el-checkbox>
<el-checkbox label="5" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">工商银行</el-checkbox>
<el-checkbox label="6" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">兴业银行</el-checkbox>
<el-checkbox label="7" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">建设银行</el-checkbox>
<el-checkbox label="8" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">苏州农商银行</el-checkbox>
<el-checkbox label="9" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">银联支付</el-checkbox>
<el-checkbox label="10" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">富友支付</el-checkbox>
<el-checkbox label="11" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">太仓农商行</el-checkbox>
<el-checkbox label="12" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">宁波银行</el-checkbox>
<el-checkbox label="13" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">南京银行</el-checkbox>
<el-checkbox label="14" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">无锡农商行</el-checkbox>
<el-checkbox label="15" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">扫呗支付</el-checkbox>
<el-checkbox label="16" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">甘肃农信社</el-checkbox>
</el-checkbox-group>
</div>
</div>
</el-tab-pane>
<!-- 配送设置 -->
<el-tab-pane label="配送设置" name="deliverySetting">
配送设置
<el-tab-pane label="配送设置" name="deliverySetting" style="height: 600px;overflow-y: auto;">
<div style="width: 100%;height: auto;">
<div>
<span style="font-weight: bold;">启用本食堂独立规则</span>
<el-switch v-model="deliveryModel.ifEnableDelivery"
active-text="开启" inactive-text="关闭"
:active-value="1" :inactive-value="2"></el-switch>
</div>
<div style="margin: 10px;">
<el-checkbox-group v-model="deliveriesList" size="small">
<el-checkbox label="1" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">自取堂食</el-checkbox>
<el-checkbox label="2" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">商家配送</el-checkbox>
<el-checkbox label="3" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">取餐柜配送</el-checkbox><br>
<el-checkbox label="4" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">生鲜柜配送</el-checkbox>
<el-checkbox label="5" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">自取外带</el-checkbox>
<el-checkbox label="6" border style="width: 180px;background: #e8f0ff;margin-bottom: 10px;">取餐点自取</el-checkbox>
</el-checkbox-group>
</div>
</div>
</el-tab-pane>
<!-- 预订/点餐/报餐设置 -->
<el-tab-pane label="预订/点餐/报餐设置" name="orderSetting">
<el-tab-pane label="预订/点餐/报餐设置" name="orderSetting" style="height: 600px;overflow-y: auto;">
</el-tab-pane>
@ -314,15 +360,15 @@
<el-dialog title="选择负责人" :visible.sync="openJob" width="800px" append-to-body>
<el-form :model="dialogQueryParams" ref="dialogQueryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="" prop="keyWord">
<el-input v-model="dialogQueryParams.keyWord" placeholder="请输入姓名,编号,手机号" clearable style="width: 240px"/>
<el-form-item label="" prop="keyword">
<el-input v-model="dialogQueryParams.keyword" placeholder="请输入姓名,编号,手机号" clearable style="width: 240px"/>
</el-form-item>
<el-form-item label="" prop="canteenName">
<el-select v-model="baseForm.labelName" placeholder="请选择职位" style="width: 100%;">
<el-form-item label="" prop="job">
<el-select v-model="dialogQueryParams.job" placeholder="请选择职位" style="width: 100%;">
<el-option v-for="item in jobOptions"
:key="item.jobId"
:label="item.jobName"
:value="item.jobId"
:value="item.jobCode"
></el-option>
</el-select>
</el-form-item>
@ -330,7 +376,7 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDialogQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-table :data="jobTableData" height="500">
<el-table :data="jobTableData" height="500" highlight-current-row @current-change="handleCurrentChange">
<el-table-column label="负责人姓名" align="center" prop="custName" :show-overflow-tooltip="true"/>
<el-table-column label="负责人编号" align="center" prop="custNum" :show-overflow-tooltip="true"/>
<el-table-column label="负责人手机号" align="center" prop="mobile" :show-overflow-tooltip="true"/>
@ -346,8 +392,8 @@
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click=""> </el-button>
<el-button @click=""> </el-button>
<el-button type="primary" @click="confirmChosenCharger"> </el-button>
<el-button @click="openJob=false"> </el-button>
</div>
</el-dialog>
@ -442,15 +488,53 @@
},
jobTableData:[],//
//
dialogTotal: 0,
dialogTotal: 0,
currentCustRow:{},//
fileList: [],//
checkUrlList: [],//
checkUrlNameList: [],//
dialogVisible:false,//
dialogImageUrl:"",//
payDTO:{
"ifEnablePay": "2",
"payMap": {},
"payTypes": ""
},//
payTypeList:[],//
deliveryModel:{//
"ifEnableDelivery": "2",
"deliveries": "",
"minDeliveryFeeOnOff": 1,
"deliveryList": [
{
"deliveryEndTime": "23:59:59",
"deliveryStartTime": "00:00:00",
"deliveryType": 2
},
{
"deliveryEndTime": "23:59:59",
"deliveryStartTime": "00:00:00",
"deliveryType": 3
},
{
"deliveryEndTime": "23:59:59",
"deliveryStartTime": "00:00:00",
"deliveryType": 4
},
{
"deliveryEndTime": "23:59:59",
"deliveryStartTime": "00:00:00",
"deliveryType": 5
},
{
"deliveryEndTime": "23:59:59",
"deliveryStartTime": "00:00:00",
"deliveryType": 6
}
],
},
deliveriesList:[],//
deliveryModel:{},//
payDTO:{},//
orderDTO:{},//
mealtimeList:[],//
@ -556,6 +640,10 @@
console.log(response)
this.canteenId = response.canteenId;
this.baseForm = response.canteenSaveDTO;
if(response.canteenSaveDTO.imgUrl){
this.fileList=[{url:response.canteenSaveDTO.imgUrl}]
this.checkUrlList=[response.canteenSaveDTO.imgUrl]
}
this.deliveryModel = response.deliveryModel;
this.orderDTO = response.orderDTO;
this.payDTO = response.payDTO;
@ -681,8 +769,9 @@
});
},
//
chosenCharger(){
openChosenCharger(){
this.queryCustJobPage()
this.currentCustRow = {}
this.openJob=true
},
//
@ -702,7 +791,9 @@
let param = {
"current": this.dialogQueryParams.pageNum,
"ifQueryJob": 1,
"size": this.dialogQueryParams.pageSize
"size": this.dialogQueryParams.pageSize,
"job": this.dialogQueryParams.job,
"keyword": this.dialogQueryParams.keyword
}
queryCustJobPageApi(param).then((response) => {
this.jobTableData = response.records
@ -710,6 +801,20 @@
console.log(response)
});
},
handleCurrentChange(val) {
console.log(val)
this.currentCustRow = val;
},
confirmChosenCharger(){
if(this.currentCustRow != {}){
this.baseForm.custName = this.currentCustRow.custName
this.baseForm.custId = this.currentCustRow.custId
}else{
this.baseForm.custName = this.baseForm.custName||""
this.baseForm.custId = this.baseForm.custId||""
}
this.openJob=false
},
//
handleRemove(file, fileList) {
console.log(file, fileList);
@ -778,4 +883,12 @@
}
};
</script>
<style lang="scss" scoped>
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>

View File

@ -104,7 +104,7 @@
</el-table-column>
<el-table-column label="线上流水号前缀" align="center" prop="onLineMealCodePrefix" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="线下流水号前缀" align="center" prop="offLineMealCodePrefix" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="档口图片" align="center" prop="imgUrl" :show-overflow-tooltip="true" width="100">
<el-table-column label="档口图片" align="center" prop="imgUrl" width="100">
<template slot-scope="scope">
<img :src="scope.row.imgUrl" alt="" style="width: 80px;height: 40px;" @click="openImg(scope.row)">
</template>
@ -127,7 +127,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="crtime" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="更新时间" align="center" prop="uptime" :show-overflow-tooltip="true" width="160"/>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
@ -141,7 +141,7 @@
>编辑</el-button>
<el-button
size="mini"
type="text"
type="text" style="color: red;"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
@ -160,7 +160,7 @@
<el-dialog :title="title+'-档口'" :visible.sync="open" width="1000px" append-to-body>
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<!-- 基础设置 -->
<el-tab-pane label="基础设置" name="baseSetting" style="height: 550px;">
<el-tab-pane label="基础设置" name="baseSetting" style="height: 600px;overflow-y: auto;">
<el-form ref="baseForm" :model="baseForm" :rules="baseFormRules" label-width="80px">
<el-row>
<el-col :span="12">
@ -202,8 +202,8 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="负责人" prop="labelName">
<el-select v-model="baseForm.labelName" placeholder="请选择负责人" style="width: 100%;" @focus="chosenCharger"></el-select>
<el-form-item label="负责人" prop="custName">
<el-select v-model="baseForm.custName" placeholder="请选择负责人" style="width: 100%;" @focus="openChosenCharger"></el-select>
</el-form-item>
</el-col>
<el-col :span="12">
@ -315,9 +315,7 @@
<el-col :span="12">
<el-form-item label="档口图片">
<el-upload
:http-request="
(obj) => imgUpLoad(obj, 'fileUrl')
"
:http-request="(obj) => imgUpLoad(obj, 'fileUrl')"
action="#"
:limit="1"
:file-list="fileList"
@ -336,36 +334,37 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<!-- 配送设置 -->
<el-tab-pane label="配送设置" name="deliverySetting">
<el-tab-pane label="配送设置" name="deliverySetting" style="height: 600px;overflow-y: auto;">
配送设置
</el-tab-pane>
<!-- 预订/点餐/报餐设置 -->
<el-tab-pane label="预订/点餐/报餐设置" name="orderSetting">
<el-tab-pane label="预订/点餐/报餐设置" name="orderSetting" style="height: 600px;overflow-y: auto;">
</el-tab-pane>
</el-tabs>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog title="选择负责人" :visible.sync="openJob" width="800px" append-to-body>
<el-form :model="dialogQueryParams" ref="dialogQueryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="" prop="keyWord">
<el-input v-model="dialogQueryParams.keyWord" placeholder="请输入姓名,编号,手机号" clearable style="width: 240px"/>
<el-form-item label="" prop="keyword">
<el-input v-model="dialogQueryParams.keyword" placeholder="请输入姓名,编号,手机号" clearable style="width: 240px"/>
</el-form-item>
<el-form-item label="" prop="jobName">
<el-select v-model="dialogQueryParams.jobName" placeholder="请选择职位" style="width: 100%;">
<el-form-item label="" prop="job">
<el-select v-model="dialogQueryParams.job" placeholder="请选择职位" style="width: 100%;">
<el-option v-for="item in jobOptions"
:key="item.jobId"
:label="item.jobName"
:value="item.jobId"
:value="item.jobCode"
></el-option>
</el-select>
</el-form-item>
@ -373,7 +372,7 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDialogQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-table :data="jobTableData" height="500">
<el-table :data="jobTableData" height="500" highlight-current-row @current-change="handleCurrentChange">
<el-table-column label="负责人姓名" align="center" prop="custName" :show-overflow-tooltip="true"/>
<el-table-column label="负责人编号" align="center" prop="custNum" :show-overflow-tooltip="true"/>
<el-table-column label="负责人手机号" align="center" prop="mobile" :show-overflow-tooltip="true"/>
@ -389,8 +388,8 @@
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click=""> </el-button>
<el-button @click=""> </el-button>
<el-button type="primary" @click="confirmChosenCharger"> </el-button>
<el-button @click="openJob=false"> </el-button>
</div>
</el-dialog>
@ -503,7 +502,8 @@ export default {
},
jobTableData:[],//
//
dialogTotal: 0,
dialogTotal: 0,
currentCustRow:null,//
fileList: [],//
checkUrlList: [],//
checkUrlNameList: [],//
@ -632,6 +632,10 @@ export default {
console.log(response)
this.stallId = response.stallId;
this.baseForm = response.stallSaveDTO;
if(response.canteenSaveDTO.imgUrl){
this.fileList=[{url:response.stallSaveDTO.imgUrl}]
this.checkUrlList=[response.stallSaveDTO.imgUrl]
}
this.areaId = this.baseForm.areaId
let arr=[this.baseForm.areaId]
//
@ -791,8 +795,9 @@ export default {
});
},
//
chosenCharger(){
openChosenCharger(){
this.queryCustJobPage()
this.currentCustRow = null
this.openJob=true
},
//
@ -812,7 +817,9 @@ export default {
let param = {
"current": this.dialogQueryParams.pageNum,
"ifQueryJob": 1,
"size": this.dialogQueryParams.pageSize
"size": this.dialogQueryParams.pageSize,
"job": this.dialogQueryParams.job,
"keyword": this.dialogQueryParams.keyword
}
queryCustJobPageApi(param).then((response) => {
this.jobTableData = response.records
@ -820,6 +827,20 @@ export default {
console.log(response)
});
},
handleCurrentChange(val) {
console.log(val)
this.currentCustRow = val;
},
confirmChosenCharger(){
if(this.currentCustRow){
this.baseForm.custName = this.currentCustRow.custName
this.baseForm.custId = this.currentCustRow.custId
}else{
this.baseForm.custName = this.baseForm.custName||""
this.baseForm.custId = this.baseForm.custId||""
}
this.openJob=false
},
//
handleRemove(file, fileList) {
console.log(file, fileList);
@ -888,3 +909,11 @@ export default {
}
};
</script>
<style lang="scss" scoped>
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>

View File

@ -101,19 +101,17 @@
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="openLogDialog(scope.row)"
>异常</el-button>
<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"
style="color: red;"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
@ -807,10 +805,6 @@
this.menuSubData = this.menuSubData.concat(item.dishesList)
}
});
});
},

View File

@ -7,7 +7,7 @@
<div class="head-container">
原料类别
<el-input
v-model="materialName"
v-model="keyWord"
placeholder="请输入关键字进行搜索"
clearable
maxlength="50"
@ -22,20 +22,16 @@
style="height: 700px; overflow: scroll"
:data="treeOptions"
:props="defaultProps"
:show-checkbox="true"
:default-expand-all="false"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
ref="typeTree"
node-key="id"
:default-expand-all="false"
highlight-current
@node-click="handleNodeClick"
>
<span
class="custom-tree-node"
slot-scope="{ node, data }"
@mousemove="onMousemove(data)"
@mouseleave="onMouseleave()"
>
<span class="custom-tree-node" slot-scope="{ node, data }" @mousemove="onMousemove(data)" @mouseleave="onMouseleave()">
<span v-if="isMousemoveId === data.id && node.label.length > 10">{{
node.label.slice(0, 10) + "..."
}}</span>
@ -81,27 +77,44 @@
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="原料名称" prop="keyword">
>
<el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="queryParams.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{
emitPath: false,// falseid
checkStrictly: true,//
value:'id',label:'treeName'
}" clearable>
</el-cascader>
</el-form-item>
<el-form-item label="原料名称" prop="materialName">
<el-input
v-model="queryParams.keyword"
v-model="queryParams.materialName"
placeholder="请输入原料名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="条码" prop="keyword">
<el-form-item label="条码" prop="barCode">
<el-input
v-model="queryParams.keyword"
v-model="queryParams.barCode"
placeholder="请输入条码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="原料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入原料编码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
@ -125,30 +138,73 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['dish:material:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDel"
>批量删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="multiple"
@click="handleBatchEdit"
>批量修改类别
</el-button>
</el-col>
<el-col :span="1.5">
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url"
:show-file-list="false"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
>
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
>批量导入
</el-button>
</el-upload>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeList" border>
<el-table v-loading="loading" :data="tableList" ref="multipleTable" border :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
<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" key="materialNum" prop="materialNum" show-overflow-tooltip/>
<el-table-column label="所属区域" align="center" key="region" prop="region" show-overflow-tooltip/>
<el-table-column label="原料类别" align="center" key="materialType" prop="materialType" show-overflow-tooltip/>
<el-table-column label="原料名称" align="center" key="materialName" prop="materialName" show-overflow-tooltip/>
<el-table-column label="营养信息名称" align="center" key="nutritionName" prop="nutritionName" show-overflow-tooltip/>
<el-table-column label="单位" align="center" key="unit" prop="unit" show-overflow-tooltip/>
<el-table-column label="条码" align="center" key="barcode" prop="barcode" show-overflow-tooltip/>
<el-table-column label="原料进价(元)" align="center" key="purchasePrice" prop="purchasePrice" show-overflow-tooltip/>
<el-table-column label="最近进价(元)" align="center" key="recentPrice" prop="recentPrice" show-overflow-tooltip/>
<el-table-column label="最近入库时间" align="center" key="lastStockTime" prop="lastStockTime" show-overflow-tooltip/>
<el-table-column label="月度均价(元)" align="center" key="monthlyAvgPrice" prop="monthlyAvgPrice" show-overflow-tooltip/>
<el-table-column label="操作" align="center" width="180">
<el-table-column label="原料编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="原料类别" align="center" key="categoryName" prop="categoryName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="原料名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="营养信息名称" align="center" key="nutritionName" prop="nutritionName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="条码" align="center" key="barcode" prop="barcode" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="原料进价(元)" align="center" key="purchasePrice" prop="purchasePrice" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="最近进价(元)" align="center" key="recentPrice" prop="recentPrice" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="最近入库时间" align="center" key="lastStockTime" prop="lastStockTime" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="月度均价(元)" align="center" key="monthlyAvgPrice" prop="monthlyAvgPrice" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="操作" align="center" width="180" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
@ -189,13 +245,15 @@
:close-on-click-modal="false"
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="所属区域" prop="areaNameStr">
<el-cascader
v-model="form.areaNameStr" :show-all-levels="false" :filterable="true"
:options="treeAreaOptions" :props="treeProps" collapse-tags
@change="handleTreeChange"></el-cascader>
<el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="form.areaId" :disabled="isEditType"
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{
emitPath: false,// falseid
checkStrictly: true,//
value:'id',label:'treeName'
}" clearable>
</el-cascader>
</el-form-item>
<el-row>
@ -210,7 +268,7 @@
</el-col>
</el-row>
<el-row>
<el-row v-if="isEditType">
<el-col :span="24">
<el-form-item label="原类别父节点" prop="superAreaName">
<el-input
@ -221,37 +279,71 @@
</el-form-item>
</el-col>
</el-row>
<el-form-item label="新类别父节点" prop="areaNameStr">
<el-cascader
v-model="form.areaNameStr" :show-all-levels="false" :filterable="true"
:options="treeAreaOptions" :props="treeProps" collapse-tags
@change="handleTreeChange"></el-cascader>
</el-form-item>
<el-row v-if="isEditType">
<el-col :span="24">
<el-form-item label="新类别父节点" prop="newParentId">
<el-cascader v-model="form.newParentId"
:options="treeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{
emitPath: false,// falseid
checkStrictly: true,//
value:'id',label:'categoryName'
}" clearable >
</el-cascader>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmit"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button @click="open=false"> </el-button>
</div>
</el-dialog>
<!-- 批量修改原料类别对话框 -->
<el-dialog title="批量修改原料类别" :visible.sync="openEdit"
width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="原料名称" prop="categoryNames">
<el-input v-model="editForm.categoryNames" placeholder="请输入原料名称" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="新类别" prop="categroyId">
<el-cascader v-model="editForm.categroyId"
:options="treeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{
emitPath: false,// falseid
checkStrictly: true,//
value:'id',label:'categoryName'
}" clearable >
</el-cascader>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmitEdit"> </el-button>
<el-button @click="openEdit=false"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改用户配置对话框 -->
<material-dialog
:visible.sync="dialogVisible"
:title="title"
@submit="handleDialogSubmit"
ref="materialDialog"
/>
<material-dialog :visible.sync="dialogVisible" :title="title" @submit="handleDialogSubmit" ref="materialDialog" />
</div>
</template>
<script>
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { systemMaterialTreeApi,systemAreaTreeApi,getMaterialListApi,getMaterialNameApi,getMaterialNumApi,addMaterialApi,updateMaterialApi,removeMaterialApi } from "@/api/dish/material";
import { systemMaterialTreeApi,addMaterialTypeApi,updateMaterialTypeApi,removeMaterialTypeApi,systemAreaTreeApi} from "@/api/dish/material";
import { getMaterialListApi,addMaterialApi, updateMaterialApi, removeMaterialApi,batchRemoveMaterialApi,batchUpdateMaterialApi} from "@/api/dish/material";
import MaterialDialog from './components/MaterialDialog.vue';
import { getToken } from '@/utils/auth'
export default {
name: "Material",
components: {
@ -278,17 +370,23 @@ export default {
children: "children",
label: "categoryName",
},
materialName:"",
materialId:"",
keyWord:"",//-
isEditType:false,//
//
queryParams: {
pageNum: 1,
pageSize: 10,
areaId:null,
materialName:"",
barCode:"",
materialCode:"",
materialType:1, //(12)
categoryIdList:[]
},
//
total: 0,
//
typeList: undefined,
tableList: undefined,
//
open: false,
dialogVisible: false,
@ -298,9 +396,8 @@ export default {
form: {
categoryName: "",
parentId: "",
categoryType: "",
superAreaName: "",
categoryCode: "",
description: ""
},
//
rules: {
@ -310,30 +407,40 @@ export default {
message: "类别名称不能为空",
trigger: "blur",
},
],
categoryCode: [
]
},
parentId: undefined,
treeAreaOptions:[],//
batchIds:[],
openEdit:false,
editForm:{
categoryNames:"",
categroyId:null
},
editRules: {
categroyId: [
{
required: true,
message: "类别编码不能为空",
trigger: "blur",
message: "类别不能为空",
trigger: "change",
},
]
},
parentId: undefined,
treeAreaOptions:[],//
treeProps:{
multiple: true,
value:"id",
label:"treeName",
children:"children",
//
upload: {
//
isUploading: false,
//
headers: { Authorization: 'Bearer ' + getToken() },
//
url: process.env.VUE_APP_BASE_API + '/smart-canteen/api/v1/menumaterial/batch/import/material',
},
};
},
watch: {
//
materialName(val) {
this.$refs.tree.filter(val);
keyWord(val) {
this.$refs.typeTree.filter(val);
},
},
created() {
@ -348,226 +455,47 @@ export default {
},
/** 查询新增页面-上级类型下拉树结构 */
getTreeData() {
systemMaterialTreeApi({}).then((response) => {
systemMaterialTreeApi({categoryType:1}).then((response) => {
this.treeOptions = response.data;
console.log("this.treeOptions",this.treeOptions)
if(this.treeOptions && this.treeOptions.length > 0){
//
this.treeOptions = this.treeOptions.map(node => ({
...node,
categoryName: node.categoryName || node.treeName || node.label || '未命名'
}));
this.materialId = this.treeOptions[0].id;
this.queryParams.materialType=this.treeOptions[0].categoryType;
if(this.treeOptions && this.treeOptions.length > 0){
this.getList();
} else {
this.materialId = "";
} else {
this.getList();
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10;
this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
let params= {
"materialName":this.materialName,
"materialId":this.materialId,
"size": this.queryParams.pageSize,
"current": this.queryParams.pageNum
}
getMaterialListApi(params).then((response) => {
this.typeList = response.records;
this.total = Number(response.total);
this.loading = false;
});
},
// -
async handleNodeClick(data, node) {
console.log(data)
this.materialId = data.id;
this.handleQuery();
// this.handleQuery();
},
// -
async getMaterialName(data) {
let params= {
"materialId":data.id
}
const res = await getMaterialNameApi(params);
this.$set(this.form,"superMaterialName",res.msg)
},
// -
async getMaterialNum(data) {
let params= {
"superId":data.id||""
}
if(data.parentId=="-1"){
params.canteenTreeType=-1
}else{
params.canteenTreeType=0
}
const res = await getMaterialNumApi(params);
this.$set(this.form,"materialNum",res.data)
},
/* 树节点增加 */
appendTreeNode(data) {
this.reset();
if(data.parentId=="-1"){
this.$set(this.form,"superAreaName",data.categoryName)
}else{
this.$set(this.form,"superAreaName",data.categoryName)
}
this.isEditType=false;
this.form={}
this.resetForm("form");
this.$set(this.form,"parentId",data.id)
this.$set(this.form,"categoryType",data.categoryType)
this.open = true;
this.title = "新增";
},
/* 树节点删除 */
removeTreeNode(data) {
console.log(data, "删除时的数据源--");
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return removeMaterialApi({"materialId":data.id});
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
this.getTreeData();
})
.catch(() => {});
},
},
/* 树节点修改 */
editTreeNode(data) {
this.reset();
this.isEditType=true;
this.form={}
this.resetForm("form");
this.form = {
...data,
categoryId:data.id,
superAreaName: data.parentId === "-1" ? "" : this.getParentCategoryName(data.parentId)
};
console.log(this.form)
console.log(this.treeOptions)
this.open = true;
this.title = "修改";
},
onMousemove(data) {
this.isMousemoveId = data.id;
},
onMouseleave() {
this.isMousemoveId = null;
},
//
cancel() {
this.dialogVisible = false;
this.reset();
},
//
reset() {
this.form = {};
this.resetForm("form");
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.dialogVisible = true;
this.title = "新增";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.dialogVisible = true;
this.title = "修改";
// $refs 访
this.$nextTick(() => {
// setFormData
this.$refs.materialDialog.setFormData(row);
});
},
/** 处理对话框提交 */
handleDialogSubmit(formData) {
if (this.title === "新增") {
addMaterialApi(formData).then(response => {
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.getList();
this.getTreeData();
});
} else {
updateMaterialApi(formData).then(response => {
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
this.getTreeData();
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return removeMaterialApi({"materialId":row.materialId});
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
this.getTreeData();
})
.catch(() => {});
},
getParentName(list, id) {
try {
list.forEach((e) => {
if (e.id == id) {
this.form.label = e.label;
throw new Error();
} else {
if (e.children && e.children.length > 0) {
this.getParentName(e.children, id);
}
}
});
} catch (error) {}
},
/** 表单提交 */
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateMaterialApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMaterialApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
//
getParentCategoryName(parentId) {
const findNode = (nodes) => {
@ -584,18 +512,200 @@ export default {
};
return findNode(this.treeOptions);
},
handleTreeChange(e){
console.log(e)
/* 树节点删除 */
removeTreeNode(data) {
console.log(data, "删除时的数据源--");
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return removeMaterialTypeApi({"categoryId":data.id});
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
this.getTreeData();
})
.catch(() => {});
},
//
getAreaTreeData() {
systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response;
console.log(this.treeAreaOptions)
onMousemove(data) {
this.isMousemoveId = data.id;
},
onMouseleave() {
this.isMousemoveId = null;
},
/** 操作左侧树-表单提交 */
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateMaterialTypeApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getTreeData();
});
} else {
console.log(this.form)
addMaterialTypeApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getTreeData();
});
}
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10;
// this.$refs.typeTree.setCheckedNodes([]);
this.handleQuery();
},
/** 查询列表 */
getList() {
console.log(this.$refs.typeTree.getCheckedKeys())
this.loading = true;
let params= {
"size": this.queryParams.pageSize,
"current": this.queryParams.pageNum,
"areaId": this.queryParams.areaId,
"materialName": this.queryParams.materialName,
"barCode": this.queryParams.barCode,
"materialCode": this.queryParams.materialCode,
"materialType": this.queryParams.materialType,//(12)
"categoryIdList": this.$refs.typeTree.getCheckedKeys(),
}
getMaterialListApi(params).then((response) => {
this.tableList = response.data.records;
this.total = Number(response.data.total);
this.loading = false;
});
},
//-
getAreaTreeData() {
systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response;
});
},
/** 新增按钮操作 */
handleAdd() {
this.title = "新增";
this.dialogVisible = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.title = "修改";
this.dialogVisible = true;
// $refs 访
this.$nextTick(() => {
// setFormData
this.$refs.materialDialog.setFormData(row);
});
},
/** 处理对话框提交 */
handleDialogSubmit(formData) {
if (this.title === "新增") {
addMaterialApi(formData).then(response => {
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.getList();
});
} else {
updateMaterialApi(formData).then(response => {
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return removeMaterialApi({"materialId":row.materialId});
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
})
.catch(() => {});
},
handleSelectionChange(selection){
this.batchIds = []
this.batchIds = selection.map((item) => item.materialId)
this.editForm.categoryNames = "";
this.editForm.categoryNames = selection.map((item) => item.materialName);
this.single = selection.length !== 1
this.multiple = !selection.length
},
//
handleBatchDel(){
console.log(this.batchIds)
batchRemoveMaterialApi(this.batchIds).then(response => {
this.$modal.msgSuccess("删除成功");
this.$refs.multipleTable.clearSelection()
this.getList();
});
},
//
handleBatchEdit(){
this.editForm.categroyId=null
this.openEdit=true;
},
handleSubmitEdit(){
let param = {
materialIdList:this.batchIds,
categroyId:this.editForm.categroyId
}
batchUpdateMaterialApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.openEdit=false
this.$refs.multipleTable.clearSelection()
this.getList();
});
},
//
// /api/v1/menumaterial/batch/import/material
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
//
handleFileSuccess(response, file, fileList) {
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$modal.msgSuccess("后台导入中...");
this.getList()
},
// getParentName(list, id) {
// try {
// list.forEach((e) => {
// if (e.id == id) {
// this.form.label = e.label;
// throw new Error();
// } else {
// if (e.children && e.children.length > 0) {
// this.getParentName(e.children, id);
// }
// }
// });
// } catch (error) {}
// },
},
};
@ -615,35 +725,35 @@ export default {
font-size: 16px;
}
}
::v-deep .el-tree .el-tree-node__expand-icon.expanded {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
::v-deep .el-tree .el-icon-caret-right:before {
content: "\e783";
font-size: 16px;
}
::v-deep
.el-tree
.el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
content: "\e781";
font-size: 16px;
color: #1890ff;
}
// ::v-deep .el-tree .el-tree-node__expand-icon.expanded {
// -webkit-transform: rotate(0deg);
// transform: rotate(0deg);
// }
// ::v-deep .el-tree .el-icon-caret-right:before {
// content: "\e783";
// font-size: 16px;
// }
// ::v-deep
// .el-tree
// .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
// content: "\e781";
// font-size: 16px;
// color: #1890ff;
// }
::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
color: #1890ff !important;
}
::v-deep .el-tree-node__expand-icon.is-leaf {
color: transparent !important;
}
// ::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
// color: #1890ff !important;
// }
// ::v-deep .el-tree-node__expand-icon.is-leaf {
// color: transparent !important;
// }
::v-deep
.el-tree--highlight-current
.el-tree-node.is-current
> .el-tree-node__content {
background-color: #8decf1;
}
// ::v-deep
// .el-tree--highlight-current
// .el-tree-node.is-current
// > .el-tree-node__content {
// background-color: #8decf1;
// }
::v-deep .el-dialog .material-dialog {
//

View File

@ -1,9 +1,9 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="营养信息类别" prop="status" >
<el-form-item label="营养信息类别" prop="type" >
<el-cascader
v-model="selectedOptions"
v-model="typeSelected"
:options="cascaderOptions"
@change="handleChange"
></el-cascader>
@ -83,7 +83,7 @@
<!-- 添加或修改岗位对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="190px">
<el-form ref="form" :model="form" :rules="rules" label-width="180px" label-position="left">
<el-row>
<el-col :span="12">
@ -91,10 +91,6 @@
<el-cascader
v-model="form.nutritionCategory"
:options="cascaderOptions"
:props="{
checkStrictly: false,
emitPath: true
}"
placeholder="请选择营养信息类别"
clearable
style="width: 100%;"
@ -124,7 +120,9 @@
</el-form-item>
</el-col>
</el-row>
<div style="font-size: 18px;font-weight: bold;margin-bottom: 20px;">
营养信息
</div>
<el-row>
<el-col :span="12">
<el-form-item label="加工时间min">
@ -484,13 +482,14 @@ export default {
title: "",
//
open: false,
//
queryParams: {
current: 1,
size: 10,
nutritionCode: undefined,
nutritionName: undefined,
status: undefined,
type: undefined,
bigType: undefined,
littleType: undefined
},
@ -539,10 +538,9 @@ export default {
{ required: true, message: "食材编码不能为空", trigger: "blur" }
]
},
selectedOptions: [], //
cascaderOptions: [] //
typeSelected: [], //
typeTreeData:[],//
cascaderOptions: [] //
};
},
@ -558,34 +556,28 @@ export default {
*/
getFoodType() {
typeList().then(response => {
this.queryParams.status = response.data;
this.updateCascaderOptions(); //
this.typeTreeData = response.data;
this.cascaderOptions = this.cascaderOptionsMethod();
console.log(this.cascaderOptions)
// this.updateCascaderOptions(); //
}).catch(error => {
console.error("Failed to fetch food types:", error);
});
},
/**
* 更新级联选择器选项
* @returns {void}
*/
updateCascaderOptions() {
this.cascaderOptions = this.cascaderOptionsMethod();
},
},
/**
* 生成级联选择器的选项数据
* @returns {Array<{value: string, label: string, children: Array<{value: string, label: string}>}>}
*/
cascaderOptionsMethod() {
if (!this.queryParams.status) {
if (this.typeTreeData.length==0) {
return [];
}
return this.queryParams.status.map(item => ({
return this.typeTreeData.map(item => ({
value: item.bigType,
label: item.bigType,
children: item.littleTypeList.map(subItem => ({
value: subItem,
value: '#'+subItem,//value#
label: subItem
}))
}));
@ -596,9 +588,10 @@ export default {
* @param {Array<string>} value - 选中的值数组
*/
handleChange(value) {
console.log(value)
if (value && value.length >= 2) {
this.queryParams.bigType = value[0];
this.queryParams.littleType = value[1];
this.queryParams.littleType = value[1].split("#")[1];
} else {
this.queryParams.bigType = undefined;
this.queryParams.littleType = undefined;
@ -667,7 +660,7 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.selectedOptions = []; //
this.typeSelected = []; //
this.queryParams.bigType = undefined;
this.queryParams.littleType = undefined;
this.handleQuery();
@ -703,7 +696,7 @@ export default {
//
if (formData.nutritionCategory && formData.nutritionCategory.length >= 2) {
formData.bigType = formData.nutritionCategory[0];
formData.littleType = formData.nutritionCategory[1];
formData.littleType = formData.nutritionCategory[1].split("#")[1];
}
delete formData.nutritionCategory; //

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>