运检食堂代码

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -151,26 +151,31 @@ 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;
}*/ }*/
}, },
listClick(tab) { listClick(tab) {
if (tab.name === 'list') { if (tab.name === 'list') {
this.resetForm(); this.resetForm();
} }
}, },
handleSwitchTab(id) { async handleSwitchTab(id) {
this.activeTab = 'add'; try {
this.activeLabel = '菜单修改'; this.activeTab = 'add';
getMenu(id).then(response => { this.activeLabel = '菜单修改';
this.form = response.data; const menuRes = await getMenu(id);
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: [],

View File

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

View File

@ -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(); //
} else { await this.getList(); //
addTransfer(this.form).then(response => { };
this.$modal.msgSuccess("新增成功"); // ID
this.open = false; const request = this.form.id ? updateTransfer(this.form) : addTransfer(this.form);
this.getList(); request
}); .then(handleSuccess)
} .catch(error => {
} console.error("操作失败:", error);
this.$modal.msgError("操作失败,请重试");
});
}); });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
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();