人脸,菜品修改
This commit is contained in:
parent
b4ec2b3f84
commit
d4431a98ca
|
|
@ -94,7 +94,7 @@ export function addMenuDishesApi(data) {
|
|||
// 菜品列表-修改
|
||||
export function editMenuDishesApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/menu_dishes/edit',
|
||||
url: '/smart-canteen/menu_dishes/deitMenuDishes',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -105,7 +105,7 @@ export function editMenuDishesApi(data) {
|
|||
// 菜品列表-详情
|
||||
export function menuDishesDetailApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/menudishes/detail/'+data.dishesId,
|
||||
url: '/smart-canteen/menu_dishes/check',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ const user = {
|
|||
id: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
face: '',
|
||||
roles: [],
|
||||
permissions: []
|
||||
},
|
||||
|
|
@ -62,6 +63,9 @@ const user = {
|
|||
SET_AVATAR(state, avatar) {
|
||||
state.avatar = avatar
|
||||
},
|
||||
SET_FACE(state, face) {
|
||||
state.face = face
|
||||
},
|
||||
SET_ROLES(state, roles) {
|
||||
state.roles = roles
|
||||
},
|
||||
|
|
@ -129,6 +133,7 @@ const user = {
|
|||
commit('SET_PHONE', user.phonenumber)
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_AVATAR', avatar)
|
||||
commit('SET_FACE', user.photoUrl)
|
||||
return res
|
||||
})
|
||||
.catch(error => Promise.reject(error))
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@
|
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</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-column type="selection" width="50" align="center" :reserve-selection="true"/>
|
||||
<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 label="序号" align="center" width="80" type="index">
|
||||
<template slot-scope="scope">
|
||||
<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-select v-model="baseForm.sizeType" style="width: 100%;" @change="changeSizeType">
|
||||
<el-option label="标准" value="1" />
|
||||
<el-option label="大小份" value="2"/>
|
||||
<!-- <el-option label="大小份" value="2"/> -->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -475,11 +475,11 @@
|
|||
<el-col :span="12">
|
||||
<el-form-item label="餐次" prop="mealList">
|
||||
<el-select v-model="baseForm.mealList" multiple style="width: 100%;" clearable>
|
||||
<el-option label="早餐" value="1"></el-option>
|
||||
<el-option label="午餐" value="2"></el-option>
|
||||
<el-option label="下午茶" value="3"></el-option>
|
||||
<el-option label="晚餐" value="4"></el-option>
|
||||
<el-option label="夜宵" value="5"></el-option>
|
||||
<el-option label="早餐" :value="1"></el-option>
|
||||
<el-option label="午餐" :value="2"></el-option>
|
||||
<el-option label="下午茶" :value="3"></el-option>
|
||||
<el-option label="晚餐" :value="4"></el-option>
|
||||
<el-option label="夜宵" :value="5"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -501,7 +501,7 @@
|
|||
<el-option v-for="item in dishesLabelOptions"
|
||||
:key="item.value"
|
||||
:label="item.key"
|
||||
:value="item.value"
|
||||
:value="Number(item.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
|
@ -513,7 +513,7 @@
|
|||
<el-option v-for="item in dishesTasteOptions"
|
||||
:key="item.value"
|
||||
:label="item.key"
|
||||
:value="item.value"
|
||||
:value="Number(item.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
|
@ -533,11 +533,11 @@
|
|||
<el-col :span="12">
|
||||
<el-form-item label="适用季节" prop="season">
|
||||
<el-select v-model="baseForm.season" multiple style="width: 100%;" clearable>
|
||||
<el-option label="春" value="1"></el-option>
|
||||
<el-option label="夏" value="2"></el-option>
|
||||
<el-option label="秋" value="3"></el-option>
|
||||
<el-option label="冬" value="4"></el-option>
|
||||
<el-option label="四季皆宜" value="5"></el-option>
|
||||
<el-option label="春" :value="1"></el-option>
|
||||
<el-option label="夏" :value="2"></el-option>
|
||||
<el-option label="秋" :value="3"></el-option>
|
||||
<el-option label="冬" :value="4"></el-option>
|
||||
<el-option label="四季皆宜" :value="5"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -559,7 +559,7 @@
|
|||
<el-option v-for="item in dishesSuitOptions"
|
||||
:key="item.value"
|
||||
:label="item.key"
|
||||
:value="item.value"
|
||||
:value="Number(item.value)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
|
@ -622,7 +622,7 @@
|
|||
</el-select>
|
||||
</template>
|
||||
</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">
|
||||
<el-select v-model="scope.row.materialType" placeholder="请选择" style="width: 100px;margin-right: 20px;" clearable>
|
||||
<el-option label="主料" :value="1" />
|
||||
|
|
@ -632,7 +632,7 @@
|
|||
</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">
|
||||
<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>
|
||||
|
|
@ -640,7 +640,7 @@
|
|||
</template>
|
||||
</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">
|
||||
<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>
|
||||
|
|
@ -648,7 +648,7 @@
|
|||
</template>
|
||||
</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">
|
||||
<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>
|
||||
|
|
@ -699,84 +699,84 @@
|
|||
<el-descriptions v-if="baseForm.sizeType==1" title="" :column="2" size="small" border labelStyle="width:150px;">
|
||||
<el-descriptions-item>
|
||||
<template slot="label">热量(千卡)</template>
|
||||
{{baseForm.dishesNutrition.calories||0}}
|
||||
{{baseForm.calories||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">蛋白质(g)</template>
|
||||
{{baseForm.dishesNutrition.protein||0}}
|
||||
{{baseForm.protein||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">脂肪(g)</template>
|
||||
{{baseForm.dishesNutrition.fat||0}}
|
||||
{{baseForm.fat||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">碳水化合物(g)</template>
|
||||
{{baseForm.dishesNutrition.carbohydrate||0}}
|
||||
{{baseForm.carbohydrate||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">膳食纤维(g)</template>
|
||||
{{baseForm.dishesNutrition.dietaryFiber||0}}
|
||||
{{baseForm.dietaryFiber||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">胆固醇(mg)</template>
|
||||
{{baseForm.dishesNutrition.cholesterol||0}}
|
||||
{{baseForm.cholesterol||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钙(mg)</template>
|
||||
{{baseForm.dishesNutrition.calcium||0}}
|
||||
{{baseForm.calcium||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钠(mg)</template>
|
||||
{{baseForm.dishesNutrition.sodium||0}}
|
||||
{{baseForm.sodium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">总嘌呤含量(mg)</template>
|
||||
{{baseForm.dishesNutrition.purine||0}}
|
||||
{{baseForm.purine||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">铁(mg)</template>
|
||||
{{baseForm.dishesNutrition.iron||0}}
|
||||
{{baseForm.iron||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">碘(μg)</template>
|
||||
{{baseForm.dishesNutrition.iodine||0}}
|
||||
{{baseForm.iodine||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钾(mg)</template>
|
||||
{{baseForm.dishesNutrition.kalium||0}}
|
||||
{{baseForm.kalium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素a(μg)</template>
|
||||
{{baseForm.dishesNutrition.vitaminA||0}}
|
||||
{{baseForm.vitaminA||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素c(mg)</template>
|
||||
{{baseForm.dishesNutrition.vitaminC||0}}
|
||||
{{baseForm.vitaminC||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素e(mg)</template>
|
||||
{{baseForm.dishesNutrition.vitaminE||0}}
|
||||
{{baseForm.vitaminE||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">镁(mg)</template>
|
||||
{{baseForm.dishesNutrition.magnesium||0}}
|
||||
{{baseForm.magnesium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">锌(mg)</template>
|
||||
{{baseForm.dishesNutrition.zinc||0}}
|
||||
{{baseForm.zinc||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">血糖生成指数(GI)</template>
|
||||
{{baseForm.dishesNutrition.glycemicIndex||0}}
|
||||
{{baseForm.glycemicIndex||0}}
|
||||
</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-item>
|
||||
<template slot="label">热量(千卡)</template>
|
||||
{{baseForm.dishesNutrition.calories||0}}
|
||||
{{baseForm.calories||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">蛋白质(g)</template>
|
||||
{{baseForm.dishesNutrition.protein||0}}
|
||||
{{baseForm.protein||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">脂肪(g)</template>
|
||||
{{baseForm.dishesNutrition.fat||0}}
|
||||
{{baseForm.fat||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">碳水化合物(g)</template>
|
||||
{{baseForm.dishesNutrition.carbohydrate||0}}
|
||||
{{baseForm.carbohydrate||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">膳食纤维(g)</template>
|
||||
{{baseForm.dishesNutrition.dietaryFiber||0}}
|
||||
{{baseForm.dietaryFiber||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">胆固醇(mg)</template>
|
||||
{{baseForm.dishesNutrition.cholesterol||0}}
|
||||
{{baseForm.cholesterol||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钙(mg)</template>
|
||||
{{baseForm.dishesNutrition.calcium||0}}
|
||||
{{baseForm.calcium||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钠(mg)</template>
|
||||
{{baseForm.dishesNutrition.sodium||0}}
|
||||
{{baseForm.sodium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">总嘌呤含量(mg)</template>
|
||||
{{baseForm.dishesNutrition.purine||0}}
|
||||
{{baseForm.purine||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">铁(mg)</template>
|
||||
{{baseForm.dishesNutrition.iron||0}}
|
||||
{{baseForm.iron||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">碘(μg)</template>
|
||||
{{baseForm.dishesNutrition.iodine||0}}
|
||||
{{baseForm.iodine||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">钾(mg)</template>
|
||||
{{baseForm.dishesNutrition.kalium||0}}
|
||||
{{baseForm.kalium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素a(μg)</template>
|
||||
{{baseForm.dishesNutrition.vitaminA||0}}
|
||||
{{baseForm.vitaminA||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素c(mg)</template>
|
||||
{{baseForm.dishesNutrition.vitaminC||0}}
|
||||
{{baseForm.vitaminC||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">维生素e(mg)</template>
|
||||
{{baseForm.dishesNutrition.vitaminE||0}}
|
||||
{{baseForm.vitaminE||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">镁(mg)</template>
|
||||
{{baseForm.dishesNutrition.magnesium||0}}
|
||||
{{baseForm.magnesium||0}}
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template slot="label">锌(mg)</template>
|
||||
{{baseForm.dishesNutrition.zinc||0}}
|
||||
{{baseForm.zinc||0}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">血糖生成指数(GI)</template>
|
||||
{{baseForm.dishesNutrition.glycemicIndex||0}}
|
||||
{{baseForm.glycemicIndex||0}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div v-if="baseForm.sizeType==2" style="font-size: 18px;font-weight: bold;color: #606266;">小份{{ baseForm.littleWeight }}g 含营养信息</div>
|
||||
|
|
@ -1429,37 +1429,42 @@
|
|||
menuDishesDetailApi({"dishesId":row.dishesId}).then(response => {
|
||||
this.getAllSelectList()
|
||||
this.resetDishDialog()
|
||||
this.baseForm = response
|
||||
this.baseForm = response.data
|
||||
getCanteenByAreaApi({areaId:this.baseForm.areaId,canteenType: 1}).then((response) => {
|
||||
this.canteenOptions2=response.rows||[]
|
||||
});
|
||||
getStallByCanteenApi({canteenId:this.baseForm.canteenId}).then((response) => {
|
||||
this.stallOptions2=response.rows||[]
|
||||
});
|
||||
this.$set(this.baseForm,"salesMode",response.salesMode)
|
||||
this.$set(this.baseForm,"sizeType",response.sizeType+'')
|
||||
this.$set(this.baseForm,"mealType",response.mealType)
|
||||
this.$set(this.baseForm,"salesMode",response.data.salesMode)
|
||||
this.$set(this.baseForm,"sizeType",response.data.sizeType+'')
|
||||
this.$set(this.baseForm,"mealType",response.data.mealType)
|
||||
if(this.baseForm.sizeType==1){
|
||||
this.$set(this.baseForm,"price",Number(response.price)/100)
|
||||
this.$set(this.baseForm,"materialCost",Number(response.materialCost)/100)
|
||||
this.$set(this,"materialList",response.materialList)
|
||||
this.$set(this.baseForm,"price",Number(response.data.price)/100)
|
||||
this.$set(this.baseForm,"materialCost",Number(response.data.materialCost)/100)
|
||||
this.$set(this,"materialList",response.data.materialList)
|
||||
}else{
|
||||
this.$set(this.baseForm,"littlePrice",Number(response.littlePrice)/100)
|
||||
this.$set(this.baseForm,"largePrice",Number(response.largePrice)/100)
|
||||
this.$set(this.baseForm,"littleMaterialCost",Number(response.littleMaterialCost)/100)
|
||||
this.$set(this.baseForm,"materialCost",Number(response.materialCost)/100)
|
||||
let arr = []
|
||||
this.baseForm.materialList.forEach((item,index)=>{
|
||||
let obj = {
|
||||
materialId: item.materialId,
|
||||
materialName: item.materialName,
|
||||
materialType: item.materialType,
|
||||
littleWeight: this.baseForm.littleMaterialList[index].weight,
|
||||
largeWeight: item.weight
|
||||
}
|
||||
arr.push(obj)
|
||||
})
|
||||
this.$set(this,"materialList",arr)
|
||||
this.$set(this.baseForm,"littlePrice",Number(response.data.littlePrice)/100)
|
||||
this.$set(this.baseForm,"largePrice",Number(response.data.largePrice)/100)
|
||||
this.$set(this.baseForm,"littleMaterialCost",Number(response.data.littleMaterialCost)/100)
|
||||
this.$set(this.baseForm,"materialCost",Number(response.data.materialCost)/100)
|
||||
|
||||
if(this.baseForm.materialList.length>0){
|
||||
let arr = []
|
||||
this.baseForm.materialList.forEach((item,index)=>{
|
||||
let obj = {
|
||||
materialId: item.materialId,
|
||||
materialName: item.materialName,
|
||||
materialType: item.materialType,
|
||||
littleWeight: this.baseForm.littleMaterialList[index].weight,
|
||||
largeWeight: item.weight
|
||||
}
|
||||
arr.push(obj)
|
||||
})
|
||||
this.$set(this,"materialList",arr)
|
||||
}else{
|
||||
this.$set(this,"materialList",[])
|
||||
}
|
||||
}
|
||||
if(this.baseForm.imageUrl){
|
||||
this.fileList=[{url:this.baseForm.imageUrl}]
|
||||
|
|
@ -1468,7 +1473,7 @@
|
|||
this.fileList=[]
|
||||
this.checkUrlList=[]
|
||||
}
|
||||
this.$set(this,"materialOptions",response.materialList)
|
||||
this.$set(this,"materialOptions",response.data.materialList)
|
||||
this.activeName="1"
|
||||
this.title = "修改";
|
||||
this.openDish = true;
|
||||
|
|
@ -1591,7 +1596,7 @@
|
|||
},
|
||||
handleSelectionChange(selection){
|
||||
this.batchIds = []
|
||||
this.batchIds = selection.map((item) => item.materialId)
|
||||
this.batchIds = selection.map((item) => item.dishesId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
|
|
|||
|
|
@ -316,6 +316,11 @@
|
|||
>更多</el-button
|
||||
>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
command="handleUpFace"
|
||||
icon="el-icon-key"
|
||||
>人脸上传
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="handleResetPwd"
|
||||
icon="el-icon-key"
|
||||
|
|
@ -575,6 +580,44 @@
|
|||
</div>
|
||||
</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
|
||||
:title="upload.title"
|
||||
|
|
@ -641,6 +684,9 @@ import Treeselect from '@riophae/vue-treeselect'
|
|||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import { validateNewPassword } from '@/utils/validate'
|
||||
|
||||
import store from "@/store";
|
||||
import { imgUpLoadTwo } from '@/api/system/upload'
|
||||
|
||||
export default {
|
||||
name: 'User',
|
||||
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: {
|
||||
|
|
@ -814,6 +880,10 @@ export default {
|
|||
}
|
||||
) // 获取 JSON 对象
|
||||
},
|
||||
//图片上传1张后,隐藏上传框
|
||||
uploadDisabled() {
|
||||
return this.checkUrlList.length > 0
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
|
|
@ -971,6 +1041,9 @@ export default {
|
|||
case 'approvalStatus':
|
||||
this.handleApprovalStatus(row)
|
||||
break
|
||||
case 'handleUpFace':
|
||||
this.handleUpFace(row)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
@ -1172,8 +1245,7 @@ export default {
|
|||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit()
|
||||
},
|
||||
|
||||
},
|
||||
hasSystemOrAuditrRole(roles) {
|
||||
if (!roles || !Array.isArray(roles)) {
|
||||
return false // 如果 roles 为空或不是数组,返回 false
|
||||
|
|
@ -1182,8 +1254,7 @@ export default {
|
|||
(role) =>
|
||||
role.roleKey === 'systemAdmin' || role.roleKey === 'audit',
|
||||
) // 检查是否存在 roleKey 为 admin 的角色
|
||||
},
|
||||
|
||||
},
|
||||
// 检查行是否可选
|
||||
checkSelectable(row) {
|
||||
return !(
|
||||
|
|
@ -1191,16 +1262,86 @@ export default {
|
|||
row.isBuiltIn === '0' ||
|
||||
this.hasSystemOrAuditrRole(row.roles)
|
||||
)
|
||||
},
|
||||
|
||||
},
|
||||
getRowClassName(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>
|
||||
|
||||
<style>
|
||||
<style lang="scss" scoped>
|
||||
//隐藏图片上传框的css
|
||||
::v-deep.disabled {
|
||||
.el-upload--picture-card {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.disabled-row {
|
||||
background-color: #f5f7fa !important;
|
||||
color: #909399;
|
||||
|
|
|
|||
Loading…
Reference in New Issue