Merge branch 'bonus-jyy-smart-canteen' of http://192.168.0.75:3000/bonus/bonus-ui into bonus-jyy-smart-canteen
This commit is contained in:
commit
af993f60f7
|
|
@ -1370,7 +1370,11 @@
|
|||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal
|
||||
if (Number(row.hasInventory) === 1) {
|
||||
this.$modal.msgWarning("该物料仍有库存,无法删除!");
|
||||
return;
|
||||
}
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMenuDishesApi({dishesId:row.dishesId});
|
||||
|
|
@ -1379,7 +1383,7 @@
|
|||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {});
|
||||
},
|
||||
handleSelectionChange(selection){
|
||||
this.batchIds = []
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
:close-on-click-modal="false"
|
||||
:destroy-on-close="true"
|
||||
@close="handleClose"
|
||||
>
|
||||
>
|
||||
<div style="width: 100%;height: 600px;overflow-y: auto;">
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="基础信息" name="basic">
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<el-form-item label="原料类别" prop="materialTypeId">
|
||||
<el-cascader v-model="form.materialTypeId"
|
||||
:options="treeTypeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: true,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'categoryName'
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<el-form-item label="所属区域" prop="areaId">
|
||||
<el-cascader v-model="form.areaId"
|
||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'label'
|
||||
|
|
@ -64,18 +64,18 @@
|
|||
<el-option label="称重" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="原料单位" prop="unitId">
|
||||
<el-select v-model="form.unitId" filterable placeholder="请选择原料单位" style="width: 100%">
|
||||
<el-select v-model="form.unitId" placeholder="请选择原料单位" style="width: 100%">
|
||||
<el-option v-for="item in this.unitOptions"
|
||||
:key="item.unitId"
|
||||
:label="item.unitName"
|
||||
:value="item.unitId"
|
||||
:value="item.unitId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12">
|
||||
<el-form-item label="原料进价" prop="unitPrice">
|
||||
<el-input
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input
|
||||
|
|
@ -99,11 +99,11 @@
|
|||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="营养信息类别" prop="nutritionTypeId">
|
||||
<el-form-item label="营养信息类别" prop="nutritionTypeId">
|
||||
<el-cascader
|
||||
v-model="form.nutritionTypeId"
|
||||
:options="cascaderOptions"
|
||||
:props="{
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'label'
|
||||
|
|
@ -113,21 +113,21 @@
|
|||
@change="handleNutritionChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="营养信息" prop="nutritionId">
|
||||
<el-select v-model="form.nutritionId" placeholder="请选择营养信息" style="width: 100%" clearable @change="chosenNutrition">
|
||||
<el-option v-for="item in this.nutritionOptions"
|
||||
:key="item.nutritionId"
|
||||
:label="item.nutritionName"
|
||||
:value="item.nutritionId"
|
||||
:value="item.nutritionId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<h3>营养信息</h3>
|
||||
<el-row class="nutrition-info">
|
||||
<el-row class="nutrition-info">
|
||||
<el-col :span="24">
|
||||
<el-table :data="formTable" size="mini" >
|
||||
<el-table-column label="加工时间(min)" prop="processingTime" align="center" width="140"></el-table-column>
|
||||
|
|
@ -135,14 +135,14 @@
|
|||
<el-table-column label="水分(g/100g)" prop="water" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="热量(千卡/100g)" prop="calories" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="蛋白质(g/100g)" prop="protein" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="脂肪(g/100g)" prop="fat" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="脂肪(g/100g)" prop="fat" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="碳水化合物(g/100g)" prop="carbohydrate" align="center" width="150"></el-table-column>
|
||||
<el-table-column label="膳食纤维(g/100g)" prop="dietaryFiber" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="胆固醇(mg/100g)" prop="cholesterol" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="膳食纤维(g/100g)" prop="dietaryFiber" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="胆固醇(mg/100g)" prop="cholesterol" align="center" width="140"></el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-table :data="formTable" size="mini" >
|
||||
<el-table :data="formTable" size="mini" >
|
||||
<el-table-column label="灰分(g/100g)" prop="ash" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="维生素A(μg/100g)" prop="vitaminA" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="胡萝卜素(μg/100g)" prop="carotene" align="center" width="140"></el-table-column>
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-table :data="formTable" size="mini" >
|
||||
<el-table :data="formTable" size="mini" >
|
||||
<el-table-column label="维生素E(mg/100g)" prop="vitaminE" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="钙(mg/100g)" prop="calcium" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="磷(mg/100g)" prop="phosphorus" align="center" width="140"></el-table-column>
|
||||
|
|
@ -164,16 +164,16 @@
|
|||
<el-table-column label="镁(mg/100g)" prop="magnesium" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="铁 (mg/100g)" prop="iron" align="center" width="150"></el-table-column>
|
||||
<el-table-column label="锌(mg/100g)" prop="zinc" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="硒(μg/100g)" prop="selenium" align="center" width="140"></el-table-column>
|
||||
<el-table-column label="硒(μg/100g)" prop="selenium" align="center" width="140"></el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
|
|
@ -202,22 +202,22 @@ export default {
|
|||
activeTab: 'basic',
|
||||
treeAreaOptions:[],//区域树
|
||||
treeTypeOptions:[],//类型树
|
||||
unitOptions:[],//单位下拉
|
||||
unitOptions:[],//单位下拉
|
||||
nutritionTypeTreeData:[],//类别接口返回数据(未处理)
|
||||
cascaderOptions: [], // 级联选择器的选项(已处理)
|
||||
nutritionOptions:[],
|
||||
nutritionOptions:[],
|
||||
menuMaterialNutritionDTO:{
|
||||
processingTime: '0',//加工时间(min)
|
||||
edible: '0',//可食部分(g/100g)
|
||||
water: '0',//水分(g/100g)
|
||||
calories: '0',//热量(千卡/100g)
|
||||
protein: '0',//蛋白质(g/100g)
|
||||
protein: '0',//蛋白质(g/100g)
|
||||
fat: '0',//脂肪(g/100g)
|
||||
carbohydrate: '0',//碳水化合物(g/100g)
|
||||
dietaryFiber: '0',//膳食纤维(g/100g)
|
||||
cholesterol: '0',//胆固醇(mg/100g)
|
||||
ash: '0',//灰分(g/100g)
|
||||
vitaminA: '0',//维生素a(μg/100g)
|
||||
vitaminA: '0',//维生素a(μg/100g)
|
||||
carotene: '0',//胡萝卜素(μg/100g)
|
||||
retinol: '0',//视黄醇(μg/100g)
|
||||
thiamine: '0',//硫胺素(mg/100g)
|
||||
|
|
@ -227,13 +227,13 @@ export default {
|
|||
vitaminE: '0',//维生素e(g/100g)
|
||||
calcium: '0',//钙(mg/100g)
|
||||
phosphorus: '0',//磷(mg/100g)
|
||||
kalium: '0',//钾(mg/100g)
|
||||
kalium: '0',//钾(mg/100g)
|
||||
sodium: '0',//钠(mg/100g)
|
||||
magnesium: '0',//镁(mg/100g)
|
||||
iron: '0',//铁(mg/100g)
|
||||
zinc: '0',//锌(mg/100g)
|
||||
selenium: '0',//硒(μg/100g)
|
||||
cuprum: '0',//铜(mg/100g)
|
||||
cuprum: '0',//铜(mg/100g)
|
||||
manganese: '0',//锰(mg/100g)
|
||||
iodine: '0'
|
||||
},
|
||||
|
|
@ -241,29 +241,29 @@ export default {
|
|||
materialCode: '',//原料名称
|
||||
materialName: '',//原料名称
|
||||
areaId: null,//所属区域
|
||||
materialTypeId: null,//原料类别
|
||||
salesMode: '2',//计量类型
|
||||
materialTypeId: null,//原料类别
|
||||
salesMode: '1',//计量类型
|
||||
unitId: '',//原料单位
|
||||
unitPrice: '',//原料进价(元)
|
||||
barCode: '',//条码
|
||||
nutritionTypeId:null,//营养信息类型
|
||||
nutritionId:null,//营养信息
|
||||
nutritionId:null,//营养信息
|
||||
//营养信息
|
||||
menuMaterialNutritionDTO: {}
|
||||
},
|
||||
formTable:[
|
||||
{
|
||||
{
|
||||
processingTime: '0',//加工时间(min)
|
||||
edible: '0',//可食部分(g/100g)
|
||||
water: '0',//水分(g/100g)
|
||||
calories: '0',//热量(千卡/100g)
|
||||
protein: '0',//蛋白质(g/100g)
|
||||
protein: '0',//蛋白质(g/100g)
|
||||
fat: '0',//脂肪(g/100g)
|
||||
carbohydrate: '0',//碳水化合物(g/100g)
|
||||
dietaryFiber: '0',//膳食纤维(g/100g)
|
||||
cholesterol: '0',//胆固醇(mg/100g)
|
||||
ash: '0',//灰分(g/100g)
|
||||
vitaminA: '0',//维生素a(μg/100g)
|
||||
vitaminA: '0',//维生素a(μg/100g)
|
||||
carotene: '0',//胡萝卜素(μg/100g)
|
||||
retinol: '0',//视黄醇(μg/100g)
|
||||
thiamine: '0',//硫胺素(mg/100g)
|
||||
|
|
@ -273,13 +273,13 @@ export default {
|
|||
vitaminE: '0',//维生素e(g/100g)
|
||||
calcium: '0',//钙(mg/100g)
|
||||
phosphorus: '0',//磷(mg/100g)
|
||||
kalium: '0',//钾(mg/100g)
|
||||
kalium: '0',//钾(mg/100g)
|
||||
sodium: '0',//钠(mg/100g)
|
||||
magnesium: '0',//镁(mg/100g)
|
||||
iron: '0',//铁(mg/100g)
|
||||
zinc: '0',//锌(mg/100g)
|
||||
selenium: '0',//硒(μg/100g)
|
||||
cuprum: '0',//铜(mg/100g)
|
||||
cuprum: '0',//铜(mg/100g)
|
||||
manganese: '0',//锰(mg/100g)
|
||||
iodine: '0'
|
||||
}
|
||||
|
|
@ -289,7 +289,7 @@ export default {
|
|||
materialName: [{ required: true, message: '请输入原料名称', trigger: 'blur' }],
|
||||
areaId: [{ required: true, message: '请选择所属区域', trigger: 'change' }],
|
||||
materialTypeId: [{ required: true, message: '请选择原料类别', trigger: 'change' }],
|
||||
salesMode: [{ required: true, message: '请选择计量类型', trigger: 'change' }],
|
||||
salesMode: [{ required: true, message: '请选择计量类型', trigger: 'change' }],
|
||||
nutritionTypeId: [{ required: true, message: '请选择营养信息类别', trigger: 'change' }],
|
||||
nutritionId: [{ required: true, message: '请选择营养信息', trigger: 'change' }],
|
||||
},
|
||||
|
|
@ -333,18 +333,18 @@ export default {
|
|||
created() {
|
||||
this.getAreaTreeData();//获取区域树
|
||||
this.getTypeTreeData();//获取原料类别树
|
||||
this.getDrpUnitList();//获取单位类型下拉
|
||||
this.getDrpUnitList();//获取单位类型下拉
|
||||
this.getNutritionTypeList()//获取营养信息类别树
|
||||
},
|
||||
methods: {
|
||||
//区域树
|
||||
getAreaTreeData() {
|
||||
systemAreaTreeApi({}).then((response) => {
|
||||
this.treeAreaOptions = response.data;
|
||||
this.treeAreaOptions = response.data;
|
||||
});
|
||||
},
|
||||
//基础设置-选择区域
|
||||
handleAreaChange(val){
|
||||
handleAreaChange(val){
|
||||
// this.form.categoryId=null
|
||||
// this.getTypeTreeData()
|
||||
// this.getDrpUnitList()
|
||||
|
|
@ -361,25 +361,25 @@ export default {
|
|||
},
|
||||
//单位类型拉下选
|
||||
getDrpUnitList() {
|
||||
let param = {
|
||||
let param = {
|
||||
"weighType":this.form.salesMode,
|
||||
"pageNum": 1,
|
||||
"pageNum": 1,
|
||||
"pageSize": 100
|
||||
}
|
||||
this.form.unitId=null
|
||||
getDrpUnitListApi(param).then((response) => {
|
||||
this.unitOptions = response.rows;
|
||||
this.unitOptions = response.rows;
|
||||
});
|
||||
},
|
||||
//获取营养信息类别
|
||||
},
|
||||
//获取营养信息类别
|
||||
getNutritionTypeList() {
|
||||
nutritionTypeListApi().then(response => {
|
||||
this.typeTreeData = response.data;
|
||||
this.cascaderOptions = this.cascaderOptionsMethod();
|
||||
this.cascaderOptions = this.cascaderOptionsMethod();
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch food types:", error);
|
||||
});
|
||||
},
|
||||
},
|
||||
//生成级联选择器的选项数据
|
||||
cascaderOptionsMethod() {
|
||||
if (this.typeTreeData.length==0) {
|
||||
|
|
@ -401,22 +401,27 @@ export default {
|
|||
},
|
||||
//选中营养信息类别
|
||||
handleNutritionChange(value) {
|
||||
console.log("选中营养信息类别",value)
|
||||
this.nutritionAllList(value)
|
||||
},
|
||||
console.log("选中营养信息类别",value)
|
||||
this.nutritionAllList(value)
|
||||
},
|
||||
//获取营养信息下拉
|
||||
nutritionAllList(value){
|
||||
let param = {
|
||||
categoryId:value
|
||||
}
|
||||
nutritionAllListApi(param).then((response) => {
|
||||
nutritionAllListApi(param).then((response) => {
|
||||
this.$set(this.form,"nutritionId",null)
|
||||
this.nutritionOptions = response.data;
|
||||
});
|
||||
},
|
||||
//选中营养信息
|
||||
chosenNutrition(){
|
||||
console.log("选中营养信息",this.form.nutritionId)
|
||||
console.log("选中营养信息",this.form.nutritionId)
|
||||
if (!this.form.nutritionId) {
|
||||
// 清空选择时重置为默认值
|
||||
this.resetNutritionTable();
|
||||
return;
|
||||
}
|
||||
getNutritionInfo({nutritionId: this.form.nutritionId}).then((response) => {
|
||||
if(response.data){
|
||||
this.form.menuMaterialNutritionDTO = response.data
|
||||
|
|
@ -424,12 +429,12 @@ export default {
|
|||
}else{
|
||||
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
||||
this.formTable = [this.menuMaterialNutritionDTO]
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
handleNumericInput(field, event) {
|
||||
// const value = event.target.value;
|
||||
const value = event;
|
||||
// const value = event.target.value;
|
||||
const value = event;
|
||||
// 只允许输入数字和小数点
|
||||
let newValue = value.replace(/[^\d.]/g, '');
|
||||
|
||||
|
|
@ -448,14 +453,14 @@ export default {
|
|||
if (field.includes('.')) {
|
||||
const [obj, prop] = field.split('.');
|
||||
this.form[obj][prop] = newValue;
|
||||
} else {
|
||||
} else {
|
||||
this.form[field] = newValue;
|
||||
}
|
||||
},
|
||||
},
|
||||
formatNumericValue(field) {
|
||||
let value;
|
||||
if (field.includes('.')) {
|
||||
const [obj, prop] = field.split('.');
|
||||
const [obj, prop] = field.split('.');
|
||||
value = this.form[obj][prop];
|
||||
} else {
|
||||
value = this.form[field];
|
||||
|
|
@ -494,22 +499,22 @@ export default {
|
|||
setFormData(row){
|
||||
console.log(row)
|
||||
// this.getTypeTreeData()
|
||||
// this.getDrpUnitList()
|
||||
// this.getDrpUnitList()
|
||||
this.$set(this.form,"areaId",row.areaId)
|
||||
this.$set(this.form,"areaName",row.areaName)
|
||||
this.$set(this.form,"materialTypeId",row.materialTypeId)
|
||||
this.$set(this.form,"materialTypeName",row.materialTypeName)
|
||||
this.$set(this.form,"materialCode",row.materialCode)
|
||||
this.$set(this.form,"materialId",row.materialId)
|
||||
this.$set(this.form,"materialName",row.materialName)
|
||||
this.$set(this.form,"materialName",row.materialName)
|
||||
this.$set(this.form,"salesMode",row.salesMode+'')
|
||||
this.getDrpUnitList()
|
||||
this.$set(this.form,"unitId",row.unitId)
|
||||
this.$set(this.form,"salePrice",Number((row.salePrice/100).toFixed(2)))
|
||||
this.$set(this.form,"unitPrice",Number((row.unitPrice/100).toFixed(2)))
|
||||
this.$set(this.form,"barCode",row.barCode)
|
||||
this.$set(this.form,"salePrice",Number((row.salePrice/100).toFixed(2)))
|
||||
this.$set(this.form,"unitPrice",Number((row.unitPrice/100).toFixed(2)))
|
||||
this.$set(this.form,"barCode",row.barCode)
|
||||
if(row.nutritionTypeId){
|
||||
this.$set(this.form,"nutritionTypeId",Number(row.nutritionTypeId))
|
||||
this.$set(this.form,"nutritionTypeId",Number(row.nutritionTypeId))
|
||||
this.nutritionAllList(this.form.nutritionTypeId)
|
||||
setTimeout(()=>{
|
||||
this.$set(this.form,"nutritionId",row.nutritionId)
|
||||
|
|
@ -521,7 +526,7 @@ export default {
|
|||
}else{
|
||||
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
||||
this.formTable = [this.menuMaterialNutritionDTO]
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
||||
|
|
@ -532,35 +537,35 @@ export default {
|
|||
this.$set(this.form,"nutritionType",null)
|
||||
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
||||
this.formTable = [this.menuMaterialNutritionDTO]
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
this.form.salePrice = Number(this.form.salePrice);
|
||||
this.form.unitPrice = Number(this.form.unitPrice);
|
||||
this.form.unitPrice = Number(this.form.unitPrice);
|
||||
this.$emit('submit', this.form);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
handleClose() {
|
||||
this.$emit('update:visible', false);
|
||||
this.$nextTick(() => {
|
||||
this.reset();
|
||||
});
|
||||
},
|
||||
},
|
||||
cancel() {
|
||||
this.$emit('update:visible', false);
|
||||
this.$nextTick(() => {
|
||||
this.reset();
|
||||
});
|
||||
},
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
materialName: '',//原料名称
|
||||
areaId: null,//所属区域
|
||||
materialTypeId: null,//原料类别
|
||||
salesMode: '2',//计量类型
|
||||
materialTypeId: null,//原料类别
|
||||
salesMode: '1',//计量类型
|
||||
unitId: '',//原料单位
|
||||
unitPrice: '',//原料进价(元)
|
||||
barCode: '',//条码
|
||||
|
|
|
|||
|
|
@ -387,6 +387,7 @@ export default {
|
|||
parentId: undefined,
|
||||
treeAreaOptions:[],//区域树
|
||||
batchIds:[],
|
||||
multipleSelection:[],
|
||||
openEdit:false,
|
||||
editForm:{
|
||||
materialTypeName:"",
|
||||
|
|
@ -604,19 +605,27 @@ export default {
|
|||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal
|
||||
handleDelete(row) {
|
||||
if (Number(row.hasInventory) === 1) {
|
||||
this.$modal.msgWarning("该物料仍有库存,无法删除!");
|
||||
return;
|
||||
}
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMaterialApi({"materialId":row.materialId});
|
||||
.then(() => {
|
||||
// 使用箭头函数保持 this 上下文
|
||||
return removeMaterialApi({ materialId: row.materialId });
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
// 用户取消或异常
|
||||
});
|
||||
},
|
||||
handleSelectionChange(selection){
|
||||
this.multipleSelection = selection
|
||||
this.batchIds = []
|
||||
this.batchIds = selection.map((item) => item.materialId)
|
||||
this.editForm.categoryNames = "";
|
||||
|
|
@ -626,7 +635,13 @@ export default {
|
|||
},
|
||||
// 批量删除
|
||||
handleBatchDel(){
|
||||
console.log(this.batchIds)
|
||||
// 检查是否存在仍有库存的物料
|
||||
const hasInventoryItems = this.multipleSelection.filter(item => Number(item.hasInventory) === 1);
|
||||
if (hasInventoryItems.length > 0) {
|
||||
const names = hasInventoryItems.map(item => item.materialName || item.materialId).join("、");
|
||||
this.$modal.msgWarning(`以下物料仍有库存,无法删除原料名称:${names}的数据`);
|
||||
return;
|
||||
}
|
||||
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
|
|
|
|||
|
|
@ -583,6 +583,10 @@ export default {
|
|||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
if (Number(row.hasInventory) === 1) {
|
||||
this.$modal.msgWarning("该物料仍有库存,无法删除!");
|
||||
return;
|
||||
}
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue