From 5a55d74a867a9716a8a75efe727f67c84f8c1006 Mon Sep 17 00:00:00 2001 From: zhaichao Date: Tue, 25 Aug 2026 15:11:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E6=9C=9F=E4=BF=A1=E6=81=AF=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=87=8D=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/teachBusiness/semester/index.vue | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/teachBusiness/semester/index.vue b/frontend/src/views/teachBusiness/semester/index.vue index c36a3dff..27f79207 100644 --- a/frontend/src/views/teachBusiness/semester/index.vue +++ b/frontend/src/views/teachBusiness/semester/index.vue @@ -84,26 +84,30 @@ + - - + - + @@ -305,6 +309,17 @@ export default { const s = String(nd) return { xn: s.slice(0, 4), xq: s.slice(4) } }, + /** 新增时校验学期名称(年份+学期类型拼接)是否已存在于表格 */ + isSemesterNameDuplicated() { + if (!this.isAdd) return false + const nd = this.buildNd(this.form.xn, this.form.xq) + if (!nd) return false + return this.semesterList.some(item => String(item.nd) === String(nd)) + }, + /** 年份/学期类型切换时实时刷新顶部重复提示 */ + checkSemesterNameUnique() { + this.$forceUpdate() + }, /** 课时系数方案编号 -> 名称 */ getCoefficientLabel(value) { if (!value && value !== 0) return '-' @@ -430,6 +445,10 @@ export default { }, /** 提交表单 */ submitForm() { + if (this.isSemesterNameDuplicated()) { + this.$modal.msgWarning("该学期已存在,不能重复添加") + return + } this.$refs["form"].validate(valid => { if (valid) { const payload = this.buildPayload(this.form) @@ -507,6 +526,11 @@ export default { display: block; } + /* 顶部学期重复提示与表单间距 */ + .semester-dup-alert { + margin-bottom: 16px; + } + .semester-form-col { padding-right: 4px; }