- Platform Admin / School Admins
- 学校管理员
- 为学校分配管理员账号,账号只能绑定到指定学校,后端会固定保存为学校管理员角色。
+ Platform Admin / Teachers
+ 教师管理
+ 统一维护教师账号,超管可指定管理型老师,普通教师账号默认不具备管理权限。
@@ -25,7 +25,16 @@
{{ schoolName(row.schoolId) }}
-
+
+ {{ sexText(row.sex) }}
+
+
+
+
+ {{ row.teacherAdmin ? "是" : "否" }}
+
+
+
@@ -48,13 +57,13 @@
-
+
@@ -66,11 +75,14 @@
-
-
-
-
+
+
+
+
+
+
+
@@ -92,11 +104,11 @@
import "@/views/schoolAdmin/admin-theme.scss";
import { ElMessage, ElMessageBox } from "element-plus";
import {
- addPlatformSchoolAdmin,
- deletePlatformSchoolAdmin,
- getPlatformSchoolAdmins,
+ addPlatformTeacher,
+ deletePlatformTeacher,
getPlatformSchools,
- updatePlatformSchoolAdmin,
+ getPlatformTeachers,
+ updatePlatformTeacher,
} from "@/api/platformAdmin";
const query = reactive({ index: 1, size: 10, schoolId: "", name: "", username: "", phone: "" });
@@ -111,6 +123,12 @@ const schoolName = (schoolId) => {
return schools.value.find((school) => school.schoolId === schoolId)?.schoolName || schoolId || "-";
};
+const sexText = (sex) => {
+ if (sex === "1") return "男";
+ if (sex === "2") return "女";
+ return sex || "-";
+};
+
const loadSchools = async () => {
const res = await getPlatformSchools({ index: 1, size: 1000 });
schools.value = res.data?.list || [];
@@ -119,7 +137,7 @@ const loadSchools = async () => {
const load = async () => {
loading.value = true;
try {
- const res = await getPlatformSchoolAdmins(query);
+ const res = await getPlatformTeachers(query);
rows.value = res.data?.list || [];
total.value = res.data?.total || 0;
} finally {
@@ -142,20 +160,20 @@ const handleSizeChange = () => {
};
const openCreate = () => {
- form.value = {};
+ form.value = { teacherAdmin: false };
dialogVisible.value = true;
};
const openEdit = (row) => {
- form.value = { ...row };
+ form.value = { ...row, teacherAdmin: Boolean(row.teacherAdmin) };
dialogVisible.value = true;
};
const submit = async () => {
if (form.value.userId) {
- await updatePlatformSchoolAdmin(form.value.userId, form.value);
+ await updatePlatformTeacher(form.value.userId, form.value);
} else {
- await addPlatformSchoolAdmin(form.value);
+ await addPlatformTeacher(form.value);
}
ElMessage.success("保存成功");
dialogVisible.value = false;
@@ -163,8 +181,8 @@ const submit = async () => {
};
const remove = async (row) => {
- await ElMessageBox.confirm("确认删除该学校管理员?", "提示", { type: "warning" });
- await deletePlatformSchoolAdmin(row.userId);
+ await ElMessageBox.confirm("确认删除该教师?如果教师已创建班级,将不能删除。", "提示", { type: "warning" });
+ await deletePlatformTeacher(row.userId);
ElMessage.success("删除成功");
load();
};