菜品营养问题修改
This commit is contained in:
parent
d62b8344b5
commit
0e96ed0db2
|
|
@ -605,8 +605,6 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<!-- 组成成分 -->
|
<!-- 组成成分 -->
|
||||||
|
|
||||||
|
|
||||||
<el-tab-pane label="组成成分" name="2" style="height: 600px;overflow-y: auto;" :disabled="(baseForm.weight==null||baseForm.weight=='')&&(baseForm.largeWeight==null||baseForm.largeWeight=='')&&(baseForm.littleWeight==null||baseForm.littleWeight=='')">
|
<el-tab-pane label="组成成分" name="2" style="height: 600px;overflow-y: auto;" :disabled="(baseForm.weight==null||baseForm.weight=='')&&(baseForm.largeWeight==null||baseForm.largeWeight=='')&&(baseForm.littleWeight==null||baseForm.littleWeight=='')">
|
||||||
<template #label>
|
<template #label>
|
||||||
<el-tooltip content="请先填写份量" placement="top">
|
<el-tooltip content="请先填写份量" placement="top">
|
||||||
|
|
@ -624,9 +622,10 @@
|
||||||
<el-table-column label="原料" align="center" key="materialId" prop="materialId" width="200">
|
<el-table-column label="原料" align="center" key="materialId" prop="materialId" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.materialId" filterable remote
|
<el-select v-model="scope.row.materialId" filterable remote
|
||||||
reserve-keyword placeholder="请选择原料" style="width: 180px;margin-right: 20px;"
|
reserve-keyword placeholder="请查询并选择原料" style="width: 180px;margin-right: 20px;"
|
||||||
:remote-method="remoteMethod" :loading="loading">
|
:remote-method="remoteMethod" :loading="loading" @change="chosenMaterial">
|
||||||
<el-option v-for="lab in materialOptions"
|
<el-option v-for="lab in materialOptions"
|
||||||
|
:disabled="lab.disabled"
|
||||||
:key="lab.materialId"
|
:key="lab.materialId"
|
||||||
:label="lab.materialName"
|
:label="lab.materialName"
|
||||||
:value="lab.materialId">
|
:value="lab.materialId">
|
||||||
|
|
@ -708,7 +707,7 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="营养信息" name="3" style="height: 600px;overflow-y: auto;" v-if="title=='修改'">
|
<el-tab-pane label="营养信息" name="3" style="height: 600px;overflow-y: auto;" v-if="title=='修改'">
|
||||||
<div v-if="baseForm.sizeType==1" style="font-size: 18px;font-weight: bold;color: #606266;">每{{ baseForm.weight }}g 含营养信息</div>
|
<div v-if="baseForm.sizeType==1" style="font-size: 18px;font-weight: bold;color: #606266;">每{{ baseForm.weight }}g 含营养信息</div>
|
||||||
<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.calories||0}}
|
{{baseForm.calories||0}}
|
||||||
|
|
@ -1561,6 +1560,9 @@
|
||||||
this.checkUrlList=[]
|
this.checkUrlList=[]
|
||||||
}
|
}
|
||||||
this.$set(this,"materialOptions",response.data.materialList)
|
this.$set(this,"materialOptions",response.data.materialList)
|
||||||
|
this.materialOptions.forEach(item=>{
|
||||||
|
item.disabled = true
|
||||||
|
})
|
||||||
this.activeName="1"
|
this.activeName="1"
|
||||||
this.title = "修改";
|
this.title = "修改";
|
||||||
this.openDish = true;
|
this.openDish = true;
|
||||||
|
|
@ -1585,6 +1587,7 @@
|
||||||
}
|
}
|
||||||
this.materialList.push(obj)
|
this.materialList.push(obj)
|
||||||
}
|
}
|
||||||
|
this.materialOptions = [];
|
||||||
},
|
},
|
||||||
//删除原料
|
//删除原料
|
||||||
delDishMaterial(index){
|
delDishMaterial(index){
|
||||||
|
|
@ -1603,19 +1606,38 @@
|
||||||
pageSize: 50
|
pageSize: 50
|
||||||
}
|
}
|
||||||
getMaterialListApi(param).then(response => {
|
getMaterialListApi(param).then(response => {
|
||||||
this.materialOptions = response.rows
|
this.materialOptions = response.rows;
|
||||||
|
this.materialOptions.forEach(item=>{
|
||||||
|
let ifIndex = this.materialList.findIndex(v=>v.materialId==item.materialId)
|
||||||
|
if(ifIndex!=-1){
|
||||||
|
item.disabled = true
|
||||||
|
}else{
|
||||||
|
item.disabled = false
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
// this.options = this.list.filter(item => {
|
|
||||||
// return item.label.toLowerCase()
|
|
||||||
// .indexOf(query.toLowerCase()) > -1;
|
|
||||||
// });
|
|
||||||
}, 200);
|
}, 200);
|
||||||
} else {
|
} else {
|
||||||
this.materialOptions = [];
|
this.materialOptions = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
chosenMaterial(e){
|
||||||
|
this.loading=true
|
||||||
|
this.setDisabled()
|
||||||
|
this.loading=false
|
||||||
|
},
|
||||||
|
//组成成分,已选过的原料不能再选择
|
||||||
|
setDisabled(){
|
||||||
|
this.materialOptions.forEach(item=>{
|
||||||
|
let index = this.materialList.findIndex(v=>v.materialId==item.materialId)
|
||||||
|
if(index!=-1){
|
||||||
|
item.disabled = true
|
||||||
|
}else{
|
||||||
|
item.disabled = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
/** 处理对话框提交 */
|
/** 处理对话框提交 */
|
||||||
handleDialogSubmit() {
|
handleDialogSubmit() {
|
||||||
this.$refs.baseForm.validate(valid => {
|
this.$refs.baseForm.validate(valid => {
|
||||||
|
|
@ -1628,7 +1650,16 @@
|
||||||
if(param.sizeType==1){
|
if(param.sizeType==1){
|
||||||
param.price = Number(param.price)*100;
|
param.price = Number(param.price)*100;
|
||||||
param.materialCost = Number(param.materialCost)*100;
|
param.materialCost = Number(param.materialCost)*100;
|
||||||
param.materialList = this.materialList
|
param.materialList=[]
|
||||||
|
this.materialList.forEach(item=>{
|
||||||
|
if(item.materialId!=null){
|
||||||
|
param.materialList.push({
|
||||||
|
materialId: item.materialId,
|
||||||
|
materialType: item.materialType,
|
||||||
|
weight: Number(item.weight)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}else{
|
}else{
|
||||||
param.littlePrice = Number(param.littlePrice)*100;
|
param.littlePrice = Number(param.littlePrice)*100;
|
||||||
param.largePrice = Number(param.largePrice)*100;
|
param.largePrice = Number(param.largePrice)*100;
|
||||||
|
|
@ -1637,6 +1668,7 @@
|
||||||
param.materialList=[]
|
param.materialList=[]
|
||||||
param.littleMaterialList=[]
|
param.littleMaterialList=[]
|
||||||
this.materialList.forEach(item=>{
|
this.materialList.forEach(item=>{
|
||||||
|
if(item.materialId!=null){
|
||||||
param.materialList.push({
|
param.materialList.push({
|
||||||
materialId: item.materialId,
|
materialId: item.materialId,
|
||||||
materialType: item.materialType,
|
materialType: item.materialType,
|
||||||
|
|
@ -1647,23 +1679,25 @@
|
||||||
materialType: item.materialType,
|
materialType: item.materialType,
|
||||||
weight: item.littleWeight
|
weight: item.littleWeight
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (this.title === "新增") {
|
console.log(param.materialList)
|
||||||
addMenuDishesApi(param).then(response => {
|
// if (this.title === "新增") {
|
||||||
this.openDish = false;
|
// addMenuDishesApi(param).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
// this.openDish = false;
|
||||||
this.getList();
|
// this.$modal.msgSuccess("新增成功");
|
||||||
});
|
// this.getList();
|
||||||
|
// });
|
||||||
|
// this.btnLoading=false;
|
||||||
|
// } else {
|
||||||
|
// editMenuDishesApi(param).then(response => {
|
||||||
|
// this.openDish = false;
|
||||||
|
// this.$modal.msgSuccess("修改成功");
|
||||||
|
// this.getList();
|
||||||
|
// });
|
||||||
this.btnLoading=false;
|
this.btnLoading=false;
|
||||||
} else {
|
// }
|
||||||
editMenuDishesApi(param).then(response => {
|
|
||||||
this.openDish = false;
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
this.btnLoading=false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -970,12 +970,16 @@ export default {
|
||||||
if (parts.length === 2 && parts[1].length > 2) {
|
if (parts.length === 2 && parts[1].length > 2) {
|
||||||
newValue = parts[0] + '.' + parts[1].substring(0, 2);
|
newValue = parts[0] + '.' + parts[1].substring(0, 2);
|
||||||
}
|
}
|
||||||
|
if(field=='edible'||field=='water'||field=='protein'||field=='fat'||field=='carbohydrate'||field=='dietaryFiber'||field=='ash'){
|
||||||
// 限制最大值为100
|
|
||||||
if (parseFloat(newValue) > 100) {
|
if (parseFloat(newValue) > 100) {
|
||||||
newValue = '100.00';
|
newValue = '100';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 限制最大值为100
|
||||||
|
if (parseFloat(newValue) > 99999) {
|
||||||
|
newValue = '100000';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.form[field] = newValue;
|
this.form[field] = newValue;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -985,7 +989,6 @@ export default {
|
||||||
*/
|
*/
|
||||||
formatNumericValue(field) {
|
formatNumericValue(field) {
|
||||||
let value = this.form[field];
|
let value = this.form[field];
|
||||||
|
|
||||||
if (!value || value === '' || value === '.') {
|
if (!value || value === '' || value === '.') {
|
||||||
this.form[field] = '0.00';
|
this.form[field] = '0.00';
|
||||||
return;
|
return;
|
||||||
|
|
@ -997,10 +1000,9 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 限制最大值为100
|
// 限制最大值为100
|
||||||
if (value > 100) {
|
if (value > 99999) {
|
||||||
value = 100;
|
value = 100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化为两位小数
|
// 格式化为两位小数
|
||||||
this.form[field] = value.toFixed(2);
|
this.form[field] = value.toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue