From 4738253d39d7d17bf2d0c81720fdf658ef76da51 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Thu, 4 Feb 2021 17:06:35 +0800 Subject: [PATCH] update Former-commit-id: 65ce645ea2afd7d6ba7a0dd9c01fecf3c096f1ea Former-commit-id: 70409ef9f436a24a109ce77b26c68ddc1ab80f63 --- .../TeacherExt/Controllers/HomeController.cs | 32 +++++++++++++++++-- labs/Teacher/TeacherExt/wwwroot/js/update.js | 6 ++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/labs/Teacher/TeacherExt/Controllers/HomeController.cs b/labs/Teacher/TeacherExt/Controllers/HomeController.cs index b4502d6b..e1e96432 100644 --- a/labs/Teacher/TeacherExt/Controllers/HomeController.cs +++ b/labs/Teacher/TeacherExt/Controllers/HomeController.cs @@ -345,20 +345,46 @@ namespace TeacherExt.Controllers } else if (User.IsInRole("学校管理员")) { - if (model.CheckStatus == "审核成功" || model.CheckStatus == "审核失败") + if(model.CheckStatus=="审核成功") { - if (entity.CheckStatus != "待审核") + var valid = false; + valid = valid || (entity.CheckStatus == "待审核" && model.RequestEditStatus == "未申请"); + valid = valid || (entity.CheckStatus == "审核成功"&&model.CheckStatus=="审核成功"&&entity.RequestEditStatus=="已申请" && model.RequestEditStatus == "未申请"); + valid = valid || (entity.CheckStatus == "审核成功" && model.CheckStatus == "未提交" && entity.RequestEditStatus == "已申请" && model.RequestEditStatus == "未申请"); + if (!valid) + { + ModelState.AddModelError(nameof(model.CheckStatus), $"无法从[{entity.CheckStatus}]状态修改为[{model.CheckStatus}]状态"); + } + } + else if(model.CheckStatus=="审核失败") + { + var valid = false; + valid = valid || (entity.CheckStatus == "待审核" && model.RequestEditStatus == "未申请"); + if (!valid) { ModelState.AddModelError(nameof(model.CheckStatus), $"无法从[{entity.CheckStatus}]状态修改为[{model.CheckStatus}]状态"); } } if (entity.RequestEditStatus != model.RequestEditStatus) { - if (entity.CheckStatus != "待审核" && entity.CheckStatus != "审核成功") + if (entity.CheckStatus != "审核成功") { ModelState.AddModelError(nameof(model.RequestEditStatus), $"无法从[{entity.RequestEditStatus}]状态修改为[{model.RequestEditStatus}]状态"); } } + else + { + if(entity.CheckStatus!=model.CheckStatus) + { + if (model.CheckStatus == "审核成功" || model.CheckStatus == "审核失败") + { + if (entity.CheckStatus != "待审核") + { + ModelState.AddModelError(nameof(model.CheckStatus), $"无法从[{entity.CheckStatus}]状态修改为[{model.CheckStatus}]状态"); + } + } + } + } } } } diff --git a/labs/Teacher/TeacherExt/wwwroot/js/update.js b/labs/Teacher/TeacherExt/wwwroot/js/update.js index 6c9eee6f..2737f0a5 100644 --- a/labs/Teacher/TeacherExt/wwwroot/js/update.js +++ b/labs/Teacher/TeacherExt/wwwroot/js/update.js @@ -57,7 +57,7 @@ $('#super').click(function () { if (form.find("input[name$='Checked']").filter(':visible').not(':checked').length === 0) { Swal.fire({ position: 'bottom', - text: '请审核全部待审核项', + text: '请标记未通过的审核项', confirmButtonText: '确定' }); return; @@ -83,7 +83,7 @@ $('#admin1').click(function () { if (form.find("input[name$='Checked']").filter(':visible').not(':checked').length > 0) { Swal.fire({ position: 'bottom', - text: '请审核全部待审核项', + text: '请标记已通过的审核项', confirmButtonText: '确定'}); return; } @@ -101,7 +101,7 @@ $('#admin2').click(function () { if (form.find("input[name$='Checked']").filter(':visible').not(':checked').length === 0) { Swal.fire({ position: 'bottom', - text: '请审核全部待审核项', + text: '请标记未通过的审核项', confirmButtonText: '确定' }); return;