Compare commits

..

No commits in common. "594f3807853d724f861c990e3f75075bb34b48a3" and "b317471e6652ee0323e1ee8fd65622db2908386f" have entirely different histories.

4 changed files with 32 additions and 30 deletions

View File

@ -92,7 +92,7 @@
<el-col :span="4">未选学生:</el-col> <el-col :span="4">未选学生:</el-col>
<el-col :span="20" class="studentContent"> <el-col :span="20" class="studentContent">
<div class="aItem" v-for="(stuItem,stuIndex) in avaliableStudents" :key="stuIndex"> <div class="aItem" v-for="(stuItem,stuIndex) in avaliableStudents" :key="stuIndex">
<el-button style="width: 100%" plain @click="chooseItem(stuItem,stuIndex)">{{stuItem.studentname || stuItem.name}}</el-button> <el-button style="width: 100%" plain @click="chooseItem(stuItem,stuIndex)">{{stuItem.name || stuItem.studentname}}</el-button>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -121,7 +121,7 @@ const groupForm = reactive({
groupname: '', groupname: '',
orderidx: 0, orderidx: 0,
classid: Number(props.classId), classid: Number(props.classId),
edituserid: userStore.userId, edituserid: userStore.id,
edusubject: userStore.edusubject, edusubject: userStore.edusubject,
userid : 0, userid : 0,
studentid : 0, studentid : 0,
@ -188,7 +188,7 @@ const getClassInfo = () => {
const chooseItem = (item,stuIndex) => { const chooseItem = (item,stuIndex) => {
let formdata = {} let formdata = {}
formdata.classid = props.classId; formdata.classid = props.classId;
formdata.edituserid = userStore.userId; formdata.edituserid = userStore.id;
formdata.userid = item.userid; formdata.userid = item.userid;
formdata.parentid = parentId.value; formdata.parentid = parentId.value;
formdata.studentid = item.studentid; formdata.studentid = item.studentid;

View File

@ -2,19 +2,25 @@
<el-card style="width: 100%;height: 100%"> <el-card style="width: 100%;height: 100%">
<template #header> <template #header>
<div style="text-align: left"> <div style="text-align: left">
<el-button type="danger" @click="deleteClassRoom">删除班级</el-button> <el-button v-if="classInfo.teacher.length > 0" type="danger" @click="deleteClassRoom">删除班级</el-button>
</div> </div>
</template> </template>
<template v-if="classInfo.teacher.length > 0">
<el-descriptions :column="1"> <el-descriptions :column="1">
<el-descriptions-item label="班级名称">{{ classInfo.caption }}</el-descriptions-item> <el-descriptions-item label="班级名称">{{ classInfo.className }}</el-descriptions-item>
<el-descriptions-item label="教师"> <el-descriptions-item label="教师">
<template v-if="classInfo.teacher.length > 0"> <template v-if="classInfo.teacher.length > 0">
<el-tag type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag> <el-tag type="primary" v-for="(item, index) in classInfo.teacher" :key="index">{{item.name}}</el-tag>
</template> </template>
<template v-else>{{ classInfo.teachername }}</template> <template v-else>暂无</template>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="学生人数">{{ classInfo.classstudentcount || 0 }}</el-descriptions-item> <el-descriptions-item label="学生人数">{{ classInfo.student.length }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</template>
<template v-else>
<el-empty description="暂无班级信息" style="margin: 0 auto"/>
</template>
</el-card> </el-card>
</template> </template>
@ -36,14 +42,13 @@
}) })
const isDelClass = delClassDemo() const isDelClass = delClassDemo()
const userStore = useUserStore().user const userStore = useUserStore().user
console.log(userStore,'userStore')
// //
const deleteClassRoom = () => { const deleteClassRoom = () => {
ElMessageBox.alert('确认删除该班级?', { ElMessageBox.alert('确认删除该班级?', {
confirmButtonText: '确认', confirmButtonText: '确认',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
leaveClass({ classid: props.classId, userid: userStore.userId, inrole: 'teacher' }).then(() => { leaveClass({ classid: props.classId, userid: userStore.id, inrole: 'teacher' }).then(() => {
ElMessage({ ElMessage({
message: '删除成功', message: '删除成功',
type: 'success', type: 'success',
@ -58,13 +63,12 @@
const getClassInfo = () => { const getClassInfo = () => {
if(props.classId){ if(props.classId){
getClassmain(props.classId).then(response => { getClassmain(props.classId).then(response => {
Object.assign(classInfo,response.data) classInfo.className = response.data.caption
listClassuser({classid:props.classId,pageSize:100}).then(res => { listClassuser({classid:props.classId,pageSize:100}).then(res => {
classInfo.teacher = res.rows.filter(item => item.inrole === 'teacher') classInfo.teacher = res.rows.filter(item => item.inrole === 'teacher')
classInfo.student = res.rows.filter(item => item.inrole === 'student') classInfo.student = res.rows.filter(item => item.inrole === 'student')
}) })
}) })
console.log(classInfo,'classInfo')
} }
} }
onMounted(() => { onMounted(() => {

View File

@ -145,14 +145,12 @@
// //
const getClassInfo = () => { const getClassInfo = () => {
classList.value = [] classList.value = []
listClassmain({ classuserid: userStore.userId, pageSize: 100, status: 'open' }).then(response => { listClassmain({ entpid: userStore.deptId, pageSize: 500, status: 'open' }).then(response => {
// response.rows.forEach(item => { response.rows.forEach(item => {
// if(item.teacherid && Number(item.teacherid) === userStore.userId){ if(item.classteacherids && Number(item.classteacherids) === userStore.userId){
// classList.value.push(item) classList.value.push(item)
// } }
// }) })
classList.value = [...response.rows]
console.log(classList.value,'classList')
if(classList.value.length > 0){ if(classList.value.length > 0){
classId.value = classList.value[0].id classId.value = classList.value[0].id
currentIndex.value = 0 currentIndex.value = 0
@ -192,7 +190,7 @@
classForm.entpid = userStore.deptId; classForm.entpid = userStore.deptId;
classForm.status = 'open'; classForm.status = 'open';
classForm.teachername = userStore.nickName; classForm.teachername = userStore.nickName;
classForm.teacherid = userStore.userId; classForm.teacherid = userStore.id;
classForm.teacherSubject = classForm.edusubject; classForm.teacherSubject = classForm.edusubject;
addClassmain(classForm).then(response => { addClassmain(classForm).then(response => {
if (response.code === 200) { if (response.code === 200) {

View File

@ -71,7 +71,7 @@
</el-form> </el-form>
<template #footer> <template #footer>
<el-button type="warning" v-show="studentForm.id > 0" @click="delStudent(1)">移出班级</el-button> <el-button type="warning" v-show="studentForm.id > 0" @click="delStudent(1)">移出班级</el-button>
<el-button type="danger" v-show="studentForm.id > 0 && studentForm.editoruserid == userStore.userId" @click="delStudent(2)">删除学生</el-button> <el-button type="danger" v-show="studentForm.id > 0 && studentForm.editoruserid == userStore.id" @click="delStudent(2)">删除学生</el-button>
<el-button @click="studentVisible = false"> </el-button> <el-button @click="studentVisible = false"> </el-button>
<el-button type="primary" @click="btnStudentSave"> </el-button> <el-button type="primary" @click="btnStudentSave"> </el-button>
</template> </template>
@ -201,7 +201,7 @@
studentForm.classname = classInfo.value.caption; studentForm.classname = classInfo.value.caption;
studentForm.schoolname = classInfo.value.entpname; studentForm.schoolname = classInfo.value.entpname;
studentForm.status = ''; studentForm.status = '';
studentForm.editoruserid = userStore.userId; studentForm.editoruserid = userStore.id;
addStudentmain(studentForm).then((response) => { addStudentmain(studentForm).then((response) => {
if (response.code === 200) { if (response.code === 200) {
ElMessage({ ElMessage({
@ -422,7 +422,7 @@
formdata.classname = classInfo.value.caption; formdata.classname = classInfo.value.caption;
formdata.schoolname = classInfo.value.entpname; formdata.schoolname = classInfo.value.entpname;
formdata.status = ''; formdata.status = '';
formdata.editoruserid = userStore.userId; formdata.editoruserid = userStore.id;
addStudentmainByNameArray(formdata).then(res => { addStudentmainByNameArray(formdata).then(res => {
if(res.code == 200){ if(res.code == 200){