运检食堂代码
This commit is contained in:
parent
fbc5ad1de3
commit
4d66beaa06
|
|
@ -263,7 +263,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 菜谱类别映射
|
// 菜谱类别映射
|
||||||
carteClassFormat(row) {
|
carteClassFormat(row) {
|
||||||
return this.carteClassList.find(item => item.dictValue == row.carteType).dictLabel;
|
return this.carteClassList.find(item => item.dictValue == row.carteType)?.dictLabel || '';
|
||||||
},
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
async initData() {
|
async initData() {
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,11 @@ export default {
|
||||||
this.disabled = true
|
this.disabled = true
|
||||||
}
|
}
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
|
if(this.form.incomeNum == 0){
|
||||||
|
this.$message.error('积分额不能为0');
|
||||||
|
this.disabled = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
if (valid) {
|
if (valid) {
|
||||||
canteenIncreaseOrDecrease(this.form).then(res => {
|
canteenIncreaseOrDecrease(this.form).then(res => {
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,11 @@ export default {
|
||||||
this.disabled = true
|
this.disabled = true
|
||||||
}
|
}
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
|
if(this.form.incomeNum == 0){
|
||||||
|
this.$message.error('积分额不能为0');
|
||||||
|
this.disabled = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
if (valid) {
|
if (valid) {
|
||||||
personalIncreaseOrDecrease(this.form).then(res => {
|
personalIncreaseOrDecrease(this.form).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// 增减类型映射
|
// 增减类型映射
|
||||||
getIncomeType(value){
|
getIncomeType(value){
|
||||||
return this.incomeTypeList.find(item => item.dictValue === value).dictLabel;
|
return this.incomeTypeList.find(item => item.dictValue === value)?.dictLabel;
|
||||||
},
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
initData() {
|
initData() {
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ export default {
|
||||||
parseTime,
|
parseTime,
|
||||||
// 类型映射
|
// 类型映射
|
||||||
incomeTypeFormat(value) {
|
incomeTypeFormat(value) {
|
||||||
return this.incomeTypeList.find(item => item.value === value).label;
|
return this.incomeTypeList.find(item => item.value === value)?.label || '';
|
||||||
},
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
initData() {
|
initData() {
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 增减类型映射
|
// 增减类型映射
|
||||||
getIncomeType(value){
|
getIncomeType(value){
|
||||||
return this.incomeTypeList.find(item => item.dictValue === value).dictLabel;
|
return this.incomeTypeList.find(item => item.dictValue === value)?.dictLabel;
|
||||||
},
|
},
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
initData() {
|
initData() {
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ export default {
|
||||||
// 输入数字格式化
|
// 输入数字格式化
|
||||||
formatInportData,
|
formatInportData,
|
||||||
handleBlur(field) {
|
handleBlur(field) {
|
||||||
/*if (this.form[field] == 0) {
|
/* if (this.form[field] == 0) {
|
||||||
this.form[field] = null;
|
this.form[field] = null;
|
||||||
}*/
|
}*/
|
||||||
},
|
},
|
||||||
|
|
@ -160,17 +160,22 @@ export default {
|
||||||
this.resetForm();
|
this.resetForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSwitchTab(id) {
|
async handleSwitchTab(id) {
|
||||||
|
try {
|
||||||
this.activeTab = 'add';
|
this.activeTab = 'add';
|
||||||
this.activeLabel = '菜单修改';
|
this.activeLabel = '菜单修改';
|
||||||
getMenu(id).then(response => {
|
const menuRes = await getMenu(id);
|
||||||
this.form = response.data;
|
this.form = menuRes.data;
|
||||||
if (this.form.quantityRestriction === null) {
|
if (this.form.quantityRestriction === null) {
|
||||||
this.form.quantityRestriction = '无限制';
|
this.form.quantityRestriction = '无限制';
|
||||||
}
|
}
|
||||||
|
// 获取当前食堂厨师列表
|
||||||
|
await this.getChefList(this.form.carteenId)
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改菜单";
|
this.title = "修改菜单";
|
||||||
});
|
} catch (e) {
|
||||||
|
console.log("获取数据失败");
|
||||||
|
}
|
||||||
this.getUser()
|
this.getUser()
|
||||||
},
|
},
|
||||||
// 封装请求数据
|
// 封装请求数据
|
||||||
|
|
@ -431,6 +436,8 @@ export default {
|
||||||
carteenName:null,
|
carteenName:null,
|
||||||
...this.copyForm
|
...this.copyForm
|
||||||
};
|
};
|
||||||
|
console.log(this.form.carteenId,'carteenId')
|
||||||
|
this.getChefList(this.form.carteenId);
|
||||||
this.activeTab = 'list';
|
this.activeTab = 'list';
|
||||||
this.proceedFormCurrent = {
|
this.proceedFormCurrent = {
|
||||||
areaList: [],
|
areaList: [],
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
<el-table-column prop="cartePrice" label="价格" align="center"/>
|
<el-table-column prop="cartePrice" label="价格" align="center"/>
|
||||||
<el-table-column prop="quantityRestriction" label="数量限制" align="center">
|
<el-table-column prop="quantityRestriction" label="数量限制" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.quantityRestriction === null ? '无限制':scope.row.quantityRestriction}}
|
{{ showCount(scope.row) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="orderCount" label="下单数量" align="center"/>
|
<el-table-column prop="orderCount" label="下单数量" align="center"/>
|
||||||
|
|
@ -167,11 +167,11 @@ export default {
|
||||||
},
|
},
|
||||||
// 菜品映射
|
// 菜品映射
|
||||||
carteClassFormat(row) {
|
carteClassFormat(row) {
|
||||||
return this.carteClassList.find(item => item.dictValue === row.carteType)?.dictLabel;
|
return this.carteClassList.find(item => item.dictValue === row.carteType)?.dictLabel || '';
|
||||||
},
|
},
|
||||||
// 餐点映射
|
// 餐点映射
|
||||||
mealFormat(row) {
|
mealFormat(row) {
|
||||||
return this.mealList.find(item => item.dictValue === row.genre)?.dictLabel;
|
return this.mealList.find(item => item.dictValue === row.genre)?.dictLabel || '';
|
||||||
},
|
},
|
||||||
// 生成周日期
|
// 生成周日期
|
||||||
generateWeekDates() {
|
generateWeekDates() {
|
||||||
|
|
@ -247,6 +247,10 @@ export default {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
// 列表数量限制显示
|
||||||
|
showCount(row) {
|
||||||
|
return row.quantityRestriction === null ? '无限制' : row.quantityRestriction
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
|
|
|
||||||
|
|
@ -404,28 +404,30 @@ export default {
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (!valid) return; // 验证失败直接返回
|
||||||
this.form.balance = parseFloat(this.form.balance || 0)
|
this.form.balance = parseFloat(this.form.balance || 0);
|
||||||
if (this.form.id != null) {
|
// 统一处理成功后的逻辑
|
||||||
updateTransfer(this.form).then(response => {
|
const handleSuccess = async () => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess(this.form.id ? "修改成功" : "新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
// 顺序调用接口(建议:树结构刷新后刷新列表)
|
||||||
|
await this.initDeptUserTree(); // 先更新人员树
|
||||||
|
await this.getList(); // 再刷新列表数据
|
||||||
|
};
|
||||||
|
// 根据ID判断是新增还是修改
|
||||||
|
const request = this.form.id ? updateTransfer(this.form) : addTransfer(this.form);
|
||||||
|
request
|
||||||
|
.then(handleSuccess)
|
||||||
|
.catch(error => {
|
||||||
|
console.error("操作失败:", error);
|
||||||
|
this.$modal.msgError("操作失败,请重试");
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
addTransfer(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
this.$modal.confirm('是否确认删除该条食堂客户调岗记录').then(function () {
|
this.$modal.confirm(`是否确认删除${row.userName}该条食堂客户调岗记录`).then(function () {
|
||||||
return delTransfer(ids);
|
return delTransfer(ids);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue