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