运检食堂代码

This commit is contained in:
zzyuan 2025-06-10 13:08:18 +08:00
parent fbc5ad1de3
commit 4d66beaa06
9 changed files with 56 additions and 33 deletions

View File

@ -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() {

View File

@ -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){

View File

@ -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) {

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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: [],

View File

@ -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:{

View File

@ -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();