From 53424e83366f877003ee875c886a3f634d93ea61 Mon Sep 17 00:00:00 2001
From: 梁保满
Date: Tue, 23 May 2023 15:50:23 +0800
Subject: [PATCH] 教师管理筛选条件
---
router | 1 +
src/views/standard/down/index.vue | 31 +++++++++++++++++++++++++++++--
src/views/standard/setUp/teacher.vue | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------
3 files changed, 124 insertions(+), 42 deletions(-)
diff --git a/router b/router
index d0b6f85..c099cb2 100644
--- a/router
+++ b/router
@@ -13,6 +13,7 @@
"setUpSchool",
"setUpTeacher",
"setUpStudent",
+ "setUpClazz",
"card",
"device",
"analysis",
diff --git a/src/views/standard/down/index.vue b/src/views/standard/down/index.vue
index 9f825e9..80d5d87 100644
--- a/src/views/standard/down/index.vue
+++ b/src/views/standard/down/index.vue
@@ -12,12 +12,16 @@
@@ -222,9 +230,7 @@
- {{ item.gradeName }}({{
- item.subjectName
- }})
+ {{ item.gradeName }}({{ item.subjectName }})
@@ -388,15 +394,15 @@ export default {
isAdd: false,
setTercherType: 1,
query: {
- gradeName: "",
+ gradeClassSub: [],
+ type: 0,
teacherName: "",
phone: "",
},
subjectList: [],
gradeList: [],
classList: [],
- gradeClassList: [],
- gradeSubList: [],
+ gradeClassSubList: [],
teacherList: [],
teacherRoleList: [
//角色
@@ -446,6 +452,7 @@ export default {
},
async created() {
this.code = localStorage.getItem("csCode") || "";
+ await this._QuerySubject();
await this._QueryDataGrade();
this._QueryData(1);
this._RoleList();
@@ -693,20 +700,16 @@ export default {
this.$message.error(info);
}
},
- async _QueryData(type) {
+ setQuery(type) {
let query = {};
- if (type == 1) {
- query.gradeName = this.query.gradeName;
- this.query.teacherName = "";
- this.query.phone = "";
- } else if (type == 2) {
+ if (type == 2) {
if (this.query.teacherName == "") {
this.$message.warning("请输入老师姓名");
return;
}
query.teacherName = this.query.teacherName;
- this.query.gradeName = "";
this.query.phone = "";
+ this.query.gradeClassSub = [];
} else if (type == 3) {
if (this.query.phone == "") {
this.$message.warning("请输入老师手机");
@@ -714,16 +717,47 @@ export default {
}
query.phone = this.query.phone;
this.query.teacherName = "";
- this.query.gradeName = "";
- } else if (type == 10) {
- query = { ...this.query };
- }
- if (query.gradeName == "未分配教师") {
- query.type = 1;
+ this.query.gradeClassSub = [];
} else {
- query.type = 0;
+ query = { ...this.query };
+ query.gradeNames = [];
+ query.classIds = [];
+ query.subjectNames = [];
+ this.query.gradeClassSub?.map((item) => {
+ if (item.length == 1) {
+ if (!query.gradeNames.includes(item[0])) {
+ query.gradeNames.push(item[0]);
+ }
+ } else if (item.length == 2) {
+ if (!query.classIds.includes(item[1])) {
+ query.classIds.push(item[1]);
+ }
+ query.gradeNames.includes(item[0]) &&
+ query.gradeNames.remove(item[0]);
+ } else if (item.length == 3) {
+ if (!query.subjectNames.includes(item[2])) {
+ query.subjectNames.push(item[2]);
+ }
+ query.gradeNames.includes(item[0]) &&
+ query.gradeNames.remove(item[0]);
+ query.classIds.includes(item[0]) && query.classIds.remove(item[0]);
+ }
+ });
+
+ delete query.gradeClassSub;
+ query.gradeNames.length ? "" : delete query.gradeNames;
+ query.classIds.length ? "" : delete query.classIds;
+ query.subjectNames.length ? "" : delete query.subjectNames;
+ query.teacherName.length ? "" : delete query.teacherName;
+ query.phone.length ? "" : delete query.phone;
}
+
+ return query;
+ },
+ async _QueryData(type) {
+ if (this.loading) return;
this.loading = true;
+ let query = this.setQuery();
this.teacherList = [];
const { data, status, info } = await this.$request.teacherList({
...query,
@@ -746,26 +780,46 @@ export default {
this.$message.error(info);
}
},
+ async _QuerySubject() {
+ const { data, status, info } = await this.$request.subjectList();
+ if (status === 0) {
+ this.subjectList = [...data?.subjectNames] || [];
+ } else {
+ this.$message.error(info);
+ }
+ },
async _QueryDataGrade() {
//年级数据
const { data, status, info } = await this.$request.gradeList();
if (status === 0) {
this.gradeList =
data.list?.map((item) => {
- return {
+ let subList = item.subjectNames?.map((items) => {
+ return {
+ value: items,
+ label: items,
+ };
+ });
+ this.gradeClassSubList.push({
value: item.gradeName,
label: item.gradeName,
id: item.grade,
- children: item.subjectNames?.map((items) => {
+ children: item.classList.map((clazz) => {
return {
- value: items,
- label: items,
+ value: clazz.id,
+ label: clazz.className,
+ id: clazz.id,
+ children: [...subList],
};
}),
+ });
+ return {
+ value: item.gradeName,
+ label: item.gradeName,
+ id: item.grade,
+ children: [...subList],
};
}) || [];
-
- this.query.gradeName = this.gradeList[0]?.value;
} else {
this.$message.error(info);
}
--
libgit2 0.21.4