From 4d66beaa067d76b18ced5df9f8ac5d27fbc20e5c Mon Sep 17 00:00:00 2001
From: zzyuan <781948537@qq.com>
Date: Tue, 10 Jun 2025 13:08:18 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E6=A3=80=E9=A3=9F=E5=A0=82=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/canteen/foodStatistics/index.vue | 2 +-
.../pointsDistribution/canteenChange.vue | 5 +++
.../pointsDistribution/personalChange.vue | 5 +++
.../pointsSearch/canteenChangeList.vue | 2 +-
.../pointsSearch/canteenSubsidyList.vue | 2 +-
.../pointsSearch/personalChangeList.vue | 2 +-
src/views/canteen/publishMenu/index.vue | 25 ++++++++-----
src/views/canteen/publishMenu/menuList.vue | 10 ++++--
src/views/canteen/transfer/index.vue | 36 ++++++++++---------
9 files changed, 56 insertions(+), 33 deletions(-)
diff --git a/src/views/canteen/foodStatistics/index.vue b/src/views/canteen/foodStatistics/index.vue
index 929584a3..46b409fa 100644
--- a/src/views/canteen/foodStatistics/index.vue
+++ b/src/views/canteen/foodStatistics/index.vue
@@ -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() {
diff --git a/src/views/canteen/pointsDistribution/canteenChange.vue b/src/views/canteen/pointsDistribution/canteenChange.vue
index 830ca2a8..82ac1561 100644
--- a/src/views/canteen/pointsDistribution/canteenChange.vue
+++ b/src/views/canteen/pointsDistribution/canteenChange.vue
@@ -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){
diff --git a/src/views/canteen/pointsDistribution/personalChange.vue b/src/views/canteen/pointsDistribution/personalChange.vue
index 0f6e271d..d1097780 100644
--- a/src/views/canteen/pointsDistribution/personalChange.vue
+++ b/src/views/canteen/pointsDistribution/personalChange.vue
@@ -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) {
diff --git a/src/views/canteen/pointsSearch/canteenChangeList.vue b/src/views/canteen/pointsSearch/canteenChangeList.vue
index 94fd4146..61c20f71 100644
--- a/src/views/canteen/pointsSearch/canteenChangeList.vue
+++ b/src/views/canteen/pointsSearch/canteenChangeList.vue
@@ -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() {
diff --git a/src/views/canteen/pointsSearch/canteenSubsidyList.vue b/src/views/canteen/pointsSearch/canteenSubsidyList.vue
index a883b0ef..0b07635d 100644
--- a/src/views/canteen/pointsSearch/canteenSubsidyList.vue
+++ b/src/views/canteen/pointsSearch/canteenSubsidyList.vue
@@ -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() {
diff --git a/src/views/canteen/pointsSearch/personalChangeList.vue b/src/views/canteen/pointsSearch/personalChangeList.vue
index a658d578..fb8d6457 100644
--- a/src/views/canteen/pointsSearch/personalChangeList.vue
+++ b/src/views/canteen/pointsSearch/personalChangeList.vue
@@ -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() {
diff --git a/src/views/canteen/publishMenu/index.vue b/src/views/canteen/publishMenu/index.vue
index b497018d..e7d65335 100644
--- a/src/views/canteen/publishMenu/index.vue
+++ b/src/views/canteen/publishMenu/index.vue
@@ -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: [],
diff --git a/src/views/canteen/publishMenu/menuList.vue b/src/views/canteen/publishMenu/menuList.vue
index 084a8cc5..13716cc3 100644
--- a/src/views/canteen/publishMenu/menuList.vue
+++ b/src/views/canteen/publishMenu/menuList.vue
@@ -55,7 +55,7 @@
- {{scope.row.quantityRestriction === null ? '无限制':scope.row.quantityRestriction}}
+ {{ showCount(scope.row) }}
@@ -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:{
diff --git a/src/views/canteen/transfer/index.vue b/src/views/canteen/transfer/index.vue
index 272a1fc2..3bc173c1 100644
--- a/src/views/canteen/transfer/index.vue
+++ b/src/views/canteen/transfer/index.vue
@@ -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();