|
|
|
|
@ -29,7 +29,7 @@
|
|
|
|
|
<el-col>
|
|
|
|
|
<div style="display: flex; gap: 10px">
|
|
|
|
|
<el-button type="primary" :icon="Plus" @click="addschool">新增</el-button>
|
|
|
|
|
<el-upload action="http://192.168.2.12:7548/api/user/uploadStudentUserInfo" :show-file-list="false" :on-success="(res, file) => handleSuccess(res, file)">
|
|
|
|
|
<el-upload action="/api/user/uploadStudentUserInfo" :data="{ userId: currentUserId }" :show-file-list="false" :on-success="(res, file) => handleSuccess(res, file)">
|
|
|
|
|
<el-button type="primary" @click="editSchool(row)">导入</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<el-button type="warning" @click="exportTeacher">导出</el-button>
|
|
|
|
|
@ -63,10 +63,13 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" width="400">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-button type="info" text @click="editSchool(row)">编辑</el-button>
|
|
|
|
|
<el-button type="danger" text @click="delSchool(row)">删除</el-button>
|
|
|
|
|
<el-button type="success" text @click="initPassword(row, 0)">密码初始化</el-button>
|
|
|
|
|
<el-button type="primary" text @click="initPassword(row, 1)">数据初始化</el-button>
|
|
|
|
|
<template v-if="canOperateStudent(row)">
|
|
|
|
|
<el-button type="info" text @click="editSchool(row)">编辑</el-button>
|
|
|
|
|
<el-button type="danger" text @click="delSchool(row)">删除</el-button>
|
|
|
|
|
<el-button type="success" text @click="initPassword(row, 0)">密码初始化</el-button>
|
|
|
|
|
<el-button type="primary" text @click="initPassword(row, 1)">数据初始化</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<el-tag v-else type="info">仅查看</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
@ -120,6 +123,7 @@ import { ElMessageBox } from "element-plus";
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const currentUserId = computed(() => userStore.userInfo.userId);
|
|
|
|
|
import * as indexApi from "@/api/teacher";
|
|
|
|
|
const dialogVisible = ref(false);
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
@ -161,7 +165,7 @@ const getList = () => {
|
|
|
|
|
};
|
|
|
|
|
// 删除院校
|
|
|
|
|
const delSchool = (id) => {
|
|
|
|
|
indexApi.deleteStudent({ userId: id.userId }).then((res) => {
|
|
|
|
|
indexApi.deleteStudent({ userId: id.userId, operatorId: currentUserId.value }).then((res) => {
|
|
|
|
|
proxy.$message.success("删除成功");
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
@ -186,6 +190,7 @@ const editSchool = (row) => {
|
|
|
|
|
const add = () => {
|
|
|
|
|
formInline.value.schoolMajorName = majorList.value?.filter((item) => item.schoolMajorId == formInline.value.schoolMajorId)[0].schoolMajorName;
|
|
|
|
|
formInline.value.schoolClassName = classList1.value?.filter((item) => item.schoolClassId == formInline.value.schoolClassId)[0].className;
|
|
|
|
|
formInline.value.userId = currentUserId.value;
|
|
|
|
|
indexApi.addStudent(formInline.value).then((res) => {
|
|
|
|
|
proxy.$message.success("添加成功");
|
|
|
|
|
dialogVisible.value = false;
|
|
|
|
|
@ -194,6 +199,7 @@ const add = () => {
|
|
|
|
|
};
|
|
|
|
|
const edit = () => {
|
|
|
|
|
formInline.value.status = true;
|
|
|
|
|
formInline.value.operatorId = currentUserId.value;
|
|
|
|
|
indexApi.updateStudent(formInline.value).then((res) => {
|
|
|
|
|
proxy.$message.success("编辑成功");
|
|
|
|
|
dialogVisible.value = false;
|
|
|
|
|
@ -267,6 +273,12 @@ const downloadTemplate = () => {
|
|
|
|
|
};
|
|
|
|
|
// 查询班级下拉
|
|
|
|
|
const classList = ref([]);
|
|
|
|
|
const classOwnerMap = computed(() => {
|
|
|
|
|
return new Map(classList.value.map((item) => [item.schoolClassId, item.createdBy]));
|
|
|
|
|
});
|
|
|
|
|
const canOperateStudent = (row) => {
|
|
|
|
|
return classOwnerMap.value.get(row.schoolClassId) === currentUserId.value;
|
|
|
|
|
};
|
|
|
|
|
const getClassList = () => {
|
|
|
|
|
indexApi.getClassListBySchoolId({ schoolId: userStore.userInfo.schoolId }).then((res) => {
|
|
|
|
|
classList.value = res.data;
|
|
|
|
|
@ -278,7 +290,7 @@ const getClassByMajor = () => {
|
|
|
|
|
if (!formInline.value.schoolMajorId) return;
|
|
|
|
|
formInline.value.schoolClassId = "";
|
|
|
|
|
indexApi.getClassListByMajorId({ schoolMajorId: formInline.value.schoolMajorId }).then((res) => {
|
|
|
|
|
classList1.value = res.data;
|
|
|
|
|
classList1.value = (res.data || []).filter((item) => item.createdBy === currentUserId.value);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
//初始化密码
|
|
|
|
|
@ -290,7 +302,7 @@ const initPassword = (row, status) => {
|
|
|
|
|
type: "warning",
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
indexApi.initStudentPassword({ userId: row.userId }).then((res) => {
|
|
|
|
|
indexApi.initStudentPassword({ userId: row.userId, operatorId: currentUserId.value }).then((res) => {
|
|
|
|
|
proxy.$message.success("密码初始化成功");
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
|