人脸,菜品修改

This commit is contained in:
zzyuan 2025-04-21 11:12:25 +08:00
parent b4ec2b3f84
commit d4431a98ca
4 changed files with 241 additions and 90 deletions

View File

@ -94,7 +94,7 @@ export function addMenuDishesApi(data) {
// 菜品列表-修改 // 菜品列表-修改
export function editMenuDishesApi(data) { export function editMenuDishesApi(data) {
return request({ return request({
url: '/smart-canteen/menu_dishes/edit', url: '/smart-canteen/menu_dishes/deitMenuDishes',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",
@ -105,7 +105,7 @@ export function editMenuDishesApi(data) {
// 菜品列表-详情 // 菜品列表-详情
export function menuDishesDetailApi(data) { export function menuDishesDetailApi(data) {
return request({ return request({
url: '/smart-canteen/api/v2/menudishes/detail/'+data.dishesId, url: '/smart-canteen/menu_dishes/check',
method: 'post', method: 'post',
headers: { headers: {
"merchant-id":"378915229716713472", "merchant-id":"378915229716713472",

View File

@ -39,6 +39,7 @@ const user = {
id: '', id: '',
name: '', name: '',
avatar: '', avatar: '',
face: '',
roles: [], roles: [],
permissions: [] permissions: []
}, },
@ -62,6 +63,9 @@ const user = {
SET_AVATAR(state, avatar) { SET_AVATAR(state, avatar) {
state.avatar = avatar state.avatar = avatar
}, },
SET_FACE(state, face) {
state.face = face
},
SET_ROLES(state, roles) { SET_ROLES(state, roles) {
state.roles = roles state.roles = roles
}, },
@ -129,6 +133,7 @@ const user = {
commit('SET_PHONE', user.phonenumber) commit('SET_PHONE', user.phonenumber)
commit('SET_NAME', user.userName) commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
commit('SET_FACE', user.photoUrl)
return res return res
}) })
.catch(error => Promise.reject(error)) .catch(error => Promise.reject(error))

View File

@ -160,8 +160,8 @@
<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="tableList" ref="multipleTable" height="620px" border :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="tableList" ref="multipleTable" height="620px" border :row-key="(row)=>{return row.dishesId}" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/> <!-- <el-table-column type="selection" width="50" align="center" :reserve-selection="true"/> -->
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span> <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
@ -344,7 +344,7 @@
<el-form-item label="规格" prop="sizeType" v-if="baseForm.salesMode==1"> <el-form-item label="规格" prop="sizeType" v-if="baseForm.salesMode==1">
<el-select v-model="baseForm.sizeType" style="width: 100%;" @change="changeSizeType"> <el-select v-model="baseForm.sizeType" style="width: 100%;" @change="changeSizeType">
<el-option label="标准" value="1" /> <el-option label="标准" value="1" />
<el-option label="大小份" value="2"/> <!-- <el-option label="大小份" value="2"/> -->
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -475,11 +475,11 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="餐次" prop="mealList"> <el-form-item label="餐次" prop="mealList">
<el-select v-model="baseForm.mealList" multiple style="width: 100%;" clearable> <el-select v-model="baseForm.mealList" multiple style="width: 100%;" clearable>
<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-option label="晚餐" value="4"></el-option> <el-option label="晚餐" :value="4"></el-option>
<el-option label="夜宵" value="5"></el-option> <el-option label="夜宵" :value="5"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -501,7 +501,7 @@
<el-option v-for="item in dishesLabelOptions" <el-option v-for="item in dishesLabelOptions"
:key="item.value" :key="item.value"
:label="item.key" :label="item.key"
:value="item.value" :value="Number(item.value)"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -513,7 +513,7 @@
<el-option v-for="item in dishesTasteOptions" <el-option v-for="item in dishesTasteOptions"
:key="item.value" :key="item.value"
:label="item.key" :label="item.key"
:value="item.value" :value="Number(item.value)"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -533,11 +533,11 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="适用季节" prop="season"> <el-form-item label="适用季节" prop="season">
<el-select v-model="baseForm.season" multiple style="width: 100%;" clearable> <el-select v-model="baseForm.season" multiple style="width: 100%;" clearable>
<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-option label="冬" value="4"></el-option> <el-option label="冬" :value="4"></el-option>
<el-option label="四季皆宜" value="5"></el-option> <el-option label="四季皆宜" :value="5"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -559,7 +559,7 @@
<el-option v-for="item in dishesSuitOptions" <el-option v-for="item in dishesSuitOptions"
:key="item.value" :key="item.value"
:label="item.key" :label="item.key"
:value="item.value" :value="Number(item.value)"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -622,7 +622,7 @@
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="主/辅料" align="center" key="materialId" prop="materialId" width="120"> <el-table-column label="主/辅料" align="center" key="materialType" prop="materialType" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.materialType" placeholder="请选择" style="width: 100px;margin-right: 20px;" clearable> <el-select v-model="scope.row.materialType" placeholder="请选择" style="width: 100px;margin-right: 20px;" clearable>
<el-option label="主料" :value="1" /> <el-option label="主料" :value="1" />
@ -632,7 +632,7 @@
</el-table-column> </el-table-column>
<el-table-column label="大份克数" align="center" key="materialId" prop="materialId" width="180" v-if="baseForm.sizeType==1"> <el-table-column label="大份克数" align="center" key="weight" prop="weight" width="180" v-if="baseForm.sizeType==1">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.weight" placeholder="克数" maxlength="9" style="width: 170px;margin-right: 20px;" clearable @input="(v)=>(scope.row.weight=v.replace(/[^\d]/g,''))"> <el-input v-model="scope.row.weight" placeholder="克数" maxlength="9" style="width: 170px;margin-right: 20px;" clearable @input="(v)=>(scope.row.weight=v.replace(/[^\d]/g,''))">
<template slot="append">g</template> <template slot="append">g</template>
@ -640,7 +640,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="大份克数" align="center" key="materialId" prop="materialId" width="180" v-if="baseForm.sizeType==2"> <el-table-column label="大份克数" align="center" key="largeWeight" prop="largeWeight" width="180" v-if="baseForm.sizeType==2">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.largeWeight" placeholder="大份克数" maxlength="9" style="width: 170px;margin-right: 20px;" clearable @input="(v)=>(scope.row.largeWeight=v.replace(/[^\d]/g,''))"> <el-input v-model="scope.row.largeWeight" placeholder="大份克数" maxlength="9" style="width: 170px;margin-right: 20px;" clearable @input="(v)=>(scope.row.largeWeight=v.replace(/[^\d]/g,''))">
<template slot="append">g</template> <template slot="append">g</template>
@ -648,7 +648,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="小份克数" align="center" key="materialId" prop="materialId" width="180" v-if="baseForm.sizeType==2"> <el-table-column label="小份克数" align="center" key="littleWeight" prop="littleWeight" width="180" v-if="baseForm.sizeType==2">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.littleWeight" placeholder="小份克数" maxlength="9" style="width: 170px;margin-right: 20px;" clearable @input="(v)=>(scope.row.littleWeight=v.replace(/[^\d]/g,''))"> <el-input v-model="scope.row.littleWeight" placeholder="小份克数" maxlength="9" style="width: 170px;margin-right: 20px;" clearable @input="(v)=>(scope.row.littleWeight=v.replace(/[^\d]/g,''))">
<template slot="append">g</template> <template slot="append">g</template>
@ -699,84 +699,84 @@
<el-descriptions v-if="baseForm.sizeType==1" title="" :column="2" size="small" border labelStyle="width:150px;"> <el-descriptions v-if="baseForm.sizeType==1" title="" :column="2" size="small" border labelStyle="width:150px;">
<el-descriptions-item> <el-descriptions-item>
<template slot="label">热量(千卡)</template> <template slot="label">热量(千卡)</template>
{{baseForm.dishesNutrition.calories||0}} {{baseForm.calories||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">蛋白质(g)</template> <template slot="label">蛋白质(g)</template>
{{baseForm.dishesNutrition.protein||0}} {{baseForm.protein||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">脂肪(g)</template> <template slot="label">脂肪(g)</template>
{{baseForm.dishesNutrition.fat||0}} {{baseForm.fat||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">碳水化合物(g)</template> <template slot="label">碳水化合物(g)</template>
{{baseForm.dishesNutrition.carbohydrate||0}} {{baseForm.carbohydrate||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">膳食纤维(g)</template> <template slot="label">膳食纤维(g)</template>
{{baseForm.dishesNutrition.dietaryFiber||0}} {{baseForm.dietaryFiber||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">胆固醇(mg)</template> <template slot="label">胆固醇(mg)</template>
{{baseForm.dishesNutrition.cholesterol||0}} {{baseForm.cholesterol||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.calcium||0}} {{baseForm.calcium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.sodium||0}} {{baseForm.sodium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">总嘌呤含量(mg)</template> <template slot="label">总嘌呤含量(mg)</template>
{{baseForm.dishesNutrition.purine||0}} {{baseForm.purine||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.iron||0}} {{baseForm.iron||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(μg)</template> <template slot="label">(μg)</template>
{{baseForm.dishesNutrition.iodine||0}} {{baseForm.iodine||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.kalium||0}} {{baseForm.kalium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">维生素a(μg)</template> <template slot="label">维生素a(μg)</template>
{{baseForm.dishesNutrition.vitaminA||0}} {{baseForm.vitaminA||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">维生素c(mg)</template> <template slot="label">维生素c(mg)</template>
{{baseForm.dishesNutrition.vitaminC||0}} {{baseForm.vitaminC||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">维生素e(mg)</template> <template slot="label">维生素e(mg)</template>
{{baseForm.dishesNutrition.vitaminE||0}} {{baseForm.vitaminE||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.magnesium||0}} {{baseForm.magnesium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.zinc||0}} {{baseForm.zinc||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">血糖生成指数(GI)</template> <template slot="label">血糖生成指数(GI)</template>
{{baseForm.dishesNutrition.glycemicIndex||0}} {{baseForm.glycemicIndex||0}}
</el-descriptions-item> </el-descriptions-item>
@ -785,84 +785,84 @@
<el-descriptions v-if="baseForm.sizeType==2" title="" :column="2" size="small" border labelStyle="width:150px;"> <el-descriptions v-if="baseForm.sizeType==2" title="" :column="2" size="small" border labelStyle="width:150px;">
<el-descriptions-item> <el-descriptions-item>
<template slot="label">热量(千卡)</template> <template slot="label">热量(千卡)</template>
{{baseForm.dishesNutrition.calories||0}} {{baseForm.calories||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">蛋白质(g)</template> <template slot="label">蛋白质(g)</template>
{{baseForm.dishesNutrition.protein||0}} {{baseForm.protein||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">脂肪(g)</template> <template slot="label">脂肪(g)</template>
{{baseForm.dishesNutrition.fat||0}} {{baseForm.fat||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">碳水化合物(g)</template> <template slot="label">碳水化合物(g)</template>
{{baseForm.dishesNutrition.carbohydrate||0}} {{baseForm.carbohydrate||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">膳食纤维(g)</template> <template slot="label">膳食纤维(g)</template>
{{baseForm.dishesNutrition.dietaryFiber||0}} {{baseForm.dietaryFiber||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">胆固醇(mg)</template> <template slot="label">胆固醇(mg)</template>
{{baseForm.dishesNutrition.cholesterol||0}} {{baseForm.cholesterol||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.calcium||0}} {{baseForm.calcium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.sodium||0}} {{baseForm.sodium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">总嘌呤含量(mg)</template> <template slot="label">总嘌呤含量(mg)</template>
{{baseForm.dishesNutrition.purine||0}} {{baseForm.purine||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.iron||0}} {{baseForm.iron||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(μg)</template> <template slot="label">(μg)</template>
{{baseForm.dishesNutrition.iodine||0}} {{baseForm.iodine||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.kalium||0}} {{baseForm.kalium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">维生素a(μg)</template> <template slot="label">维生素a(μg)</template>
{{baseForm.dishesNutrition.vitaminA||0}} {{baseForm.vitaminA||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">维生素c(mg)</template> <template slot="label">维生素c(mg)</template>
{{baseForm.dishesNutrition.vitaminC||0}} {{baseForm.vitaminC||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">维生素e(mg)</template> <template slot="label">维生素e(mg)</template>
{{baseForm.dishesNutrition.vitaminE||0}} {{baseForm.vitaminE||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.magnesium||0}} {{baseForm.magnesium||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">(mg)</template> <template slot="label">(mg)</template>
{{baseForm.dishesNutrition.zinc||0}} {{baseForm.zinc||0}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label">血糖生成指数(GI)</template> <template slot="label">血糖生成指数(GI)</template>
{{baseForm.dishesNutrition.glycemicIndex||0}} {{baseForm.glycemicIndex||0}}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<div v-if="baseForm.sizeType==2" style="font-size: 18px;font-weight: bold;color: #606266;">小份{{ baseForm.littleWeight }}g 含营养信息</div> <div v-if="baseForm.sizeType==2" style="font-size: 18px;font-weight: bold;color: #606266;">小份{{ baseForm.littleWeight }}g 含营养信息</div>
@ -1429,25 +1429,27 @@
menuDishesDetailApi({"dishesId":row.dishesId}).then(response => { menuDishesDetailApi({"dishesId":row.dishesId}).then(response => {
this.getAllSelectList() this.getAllSelectList()
this.resetDishDialog() this.resetDishDialog()
this.baseForm = response this.baseForm = response.data
getCanteenByAreaApi({areaId:this.baseForm.areaId,canteenType: 1}).then((response) => { getCanteenByAreaApi({areaId:this.baseForm.areaId,canteenType: 1}).then((response) => {
this.canteenOptions2=response.rows||[] this.canteenOptions2=response.rows||[]
}); });
getStallByCanteenApi({canteenId:this.baseForm.canteenId}).then((response) => { getStallByCanteenApi({canteenId:this.baseForm.canteenId}).then((response) => {
this.stallOptions2=response.rows||[] this.stallOptions2=response.rows||[]
}); });
this.$set(this.baseForm,"salesMode",response.salesMode) this.$set(this.baseForm,"salesMode",response.data.salesMode)
this.$set(this.baseForm,"sizeType",response.sizeType+'') this.$set(this.baseForm,"sizeType",response.data.sizeType+'')
this.$set(this.baseForm,"mealType",response.mealType) this.$set(this.baseForm,"mealType",response.data.mealType)
if(this.baseForm.sizeType==1){ if(this.baseForm.sizeType==1){
this.$set(this.baseForm,"price",Number(response.price)/100) this.$set(this.baseForm,"price",Number(response.data.price)/100)
this.$set(this.baseForm,"materialCost",Number(response.materialCost)/100) this.$set(this.baseForm,"materialCost",Number(response.data.materialCost)/100)
this.$set(this,"materialList",response.materialList) this.$set(this,"materialList",response.data.materialList)
}else{ }else{
this.$set(this.baseForm,"littlePrice",Number(response.littlePrice)/100) this.$set(this.baseForm,"littlePrice",Number(response.data.littlePrice)/100)
this.$set(this.baseForm,"largePrice",Number(response.largePrice)/100) this.$set(this.baseForm,"largePrice",Number(response.data.largePrice)/100)
this.$set(this.baseForm,"littleMaterialCost",Number(response.littleMaterialCost)/100) this.$set(this.baseForm,"littleMaterialCost",Number(response.data.littleMaterialCost)/100)
this.$set(this.baseForm,"materialCost",Number(response.materialCost)/100) this.$set(this.baseForm,"materialCost",Number(response.data.materialCost)/100)
if(this.baseForm.materialList.length>0){
let arr = [] let arr = []
this.baseForm.materialList.forEach((item,index)=>{ this.baseForm.materialList.forEach((item,index)=>{
let obj = { let obj = {
@ -1460,6 +1462,9 @@
arr.push(obj) arr.push(obj)
}) })
this.$set(this,"materialList",arr) this.$set(this,"materialList",arr)
}else{
this.$set(this,"materialList",[])
}
} }
if(this.baseForm.imageUrl){ if(this.baseForm.imageUrl){
this.fileList=[{url:this.baseForm.imageUrl}] this.fileList=[{url:this.baseForm.imageUrl}]
@ -1468,7 +1473,7 @@
this.fileList=[] this.fileList=[]
this.checkUrlList=[] this.checkUrlList=[]
} }
this.$set(this,"materialOptions",response.materialList) this.$set(this,"materialOptions",response.data.materialList)
this.activeName="1" this.activeName="1"
this.title = "修改"; this.title = "修改";
this.openDish = true; this.openDish = true;
@ -1591,7 +1596,7 @@
}, },
handleSelectionChange(selection){ handleSelectionChange(selection){
this.batchIds = [] this.batchIds = []
this.batchIds = selection.map((item) => item.materialId) this.batchIds = selection.map((item) => item.dishesId)
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },

View File

@ -316,6 +316,11 @@
>更多</el-button >更多</el-button
> >
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item
command="handleUpFace"
icon="el-icon-key"
>人脸上传
</el-dropdown-item>
<el-dropdown-item <el-dropdown-item
command="handleResetPwd" command="handleResetPwd"
icon="el-icon-key" icon="el-icon-key"
@ -575,6 +580,44 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 人脸上传弹窗 -->
<el-dialog title="上传人脸" :visible.sync="openFace" width="500px" append-to-body>
<el-form ref="baseForm" :model="baseForm" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="人脸图片">
<el-upload
:http-request="
(obj) => imgUpLoad(obj, 'fileUrl')
"
action="#"
:limit="1"
:file-list="fileList"
:show-file-list="true"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
:on-success="handleAvatarSuccess"
:class="{ disabled: uploadDisabled }"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFace"> </el-button>
<el-button @click="openFace=false"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisible" append-to-body width="550px">
<img style="height: 500px;width: 500px;" :src="dialogImageUrl" alt="">
</el-dialog>
<!-- 用户导入对话框 --> <!-- 用户导入对话框 -->
<el-dialog <el-dialog
:title="upload.title" :title="upload.title"
@ -641,6 +684,9 @@ import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { validateNewPassword } from '@/utils/validate' import { validateNewPassword } from '@/utils/validate'
import store from "@/store";
import { imgUpLoadTwo } from '@/api/system/upload'
export default { export default {
name: 'User', name: 'User',
dicts: [ dicts: [
@ -799,6 +845,26 @@ export default {
// }, // },
// ], // ],
}, },
openFace:false,
baseForm:{},
fileList:[],
checkUrlList: [],//
checkUrlNameList: [],//
dialogVisible:false,//
dialogImageUrl:"",//
// cropper
visible: false,
options: {
img: store.getters.face, //
autoCrop: true, //
autoCropWidth: 200, //
autoCropHeight: 200, //
fixedBox: true, //
outputType:"png", // PNG
filename: 'face' //
},
previews: {},
resizeHandler: null
} }
}, },
computed: { computed: {
@ -814,6 +880,10 @@ export default {
} }
) // JSON ) // JSON
}, },
//1
uploadDisabled() {
return this.checkUrlList.length > 0
},
}, },
watch: { watch: {
// //
@ -971,6 +1041,9 @@ export default {
case 'approvalStatus': case 'approvalStatus':
this.handleApprovalStatus(row) this.handleApprovalStatus(row)
break break
case 'handleUpFace':
this.handleUpFace(row)
break
default: default:
break break
} }
@ -1173,7 +1246,6 @@ export default {
submitFileForm() { submitFileForm() {
this.$refs.upload.submit() this.$refs.upload.submit()
}, },
hasSystemOrAuditrRole(roles) { hasSystemOrAuditrRole(roles) {
if (!roles || !Array.isArray(roles)) { if (!roles || !Array.isArray(roles)) {
return false // roles false return false // roles false
@ -1183,7 +1255,6 @@ export default {
role.roleKey === 'systemAdmin' || role.roleKey === 'audit', role.roleKey === 'systemAdmin' || role.roleKey === 'audit',
) // roleKey admin ) // roleKey admin
}, },
// //
checkSelectable(row) { checkSelectable(row) {
return !( return !(
@ -1192,15 +1263,85 @@ export default {
this.hasSystemOrAuditrRole(row.roles) this.hasSystemOrAuditrRole(row.roles)
) )
}, },
getRowClassName(row) { getRowClassName(row) {
return !this.checkSelectable(row) ? 'disabled-row' : '' return !this.checkSelectable(row) ? 'disabled-row' : ''
}, },
//-----------
handleUpFace(row){
console.log(row)
const userId = row.userId || this.ids
getUser(userId).then((response) => {
this.baseForm = response.data
this.openFace = true
})
},
submitFace(){
// console.log(this.baseForm)
console.log(this.checkUrlList)
if(this.checkUrlList.length==0){
this.$message.warning('请先上传人脸图片')
}else{
this.baseForm.photoUrl = this.checkUrlList[0]
updateUser(this.baseForm).then((response) => {
this.$modal.msgSuccess('上传成功')
store.commit('SET_FACE', this.checkUrlList[0]);
this.openFace = false;
this.getList()
})
}
},
//
imgUpLoad(param, name, index) {
// console.log(param,'image')
param.type = 'face'
console.log(param.file)
imgUpLoadTwo(param).then((res) => {
if (res.code == 200) {
this.checkUrlList.push(res.data.url)
this.checkUrlNameList.push(res.data.name)
} else {
this.$modal.msgError(res.msg)
}
})
.catch((error) => {
this.$modal.msgError(error)
})
},
handleAvatarSuccess(res, file) {
console.log('success')
},
handleExceed(files, fileList) {
this.$message.warning('最多只可以上传一张图片')
},
handleRemove(file, fileList) {
let sum = 0
this.checkUrlNameList.forEach((item, index) => {
if (item == file.name) {
sum = index
}
})
this.checkUrlNameList.splice(sum, 1)
this.checkUrlList.splice(sum, 1)
},
//
handlePictureCardPreview(file) {
console.log(file)
this.dialogImageUrl = file.url
this.dialogVisible = true
}
}, },
} }
</script> </script>
<style> <style lang="scss" scoped>
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
.disabled-row { .disabled-row {
background-color: #f5f7fa !important; background-color: #f5f7fa !important;
color: #909399; color: #909399;