fix:解决个人中心班级限制问题;

This commit is contained in:
yangws 2024-09-11 14:42:48 +08:00
parent 471d73a224
commit 6c60cd4442
3 changed files with 21 additions and 8 deletions

View File

@ -198,9 +198,14 @@
} }
}); });
listClassmain({entpid: userStore.deptId, status: 'open', pageSize: 100}).then(response => { listClassmain({entpid: userStore.deptId, status: 'open', pageSize: 100}).then(response => {
//
let arr = [...response.rows]
classList.value.forEach(item => {
const currentIndex = arr.findIndex(items => items.id === item.id)
if(currentIndex) arr.splice(currentIndex, 1)
})
// //
gradeTree.value = groupByCondition(response.rows, item => item.agekey); gradeTree.value = groupByCondition(arr, item => item.agekey);
console.log(gradeTree.value,'gradeTree.value')
}) })
} }
// //
@ -293,13 +298,15 @@
// } // }
// //
const btnSave = () => { const btnSave = () => {
addClasses({classIds:classids.value.join(','),regId:userStore.userId}).then(res => { addClasses({classIds:classids.value.join(','),userId:userStore.userId}).then(res => {
if (res.code === 200) { if (res.code === 200) {
dialogVisible.value = false dialogVisible.value = false
ElMessage({ ElMessage({
message: res.msg, message: res.msg,
type: 'success', type: 'success',
}) })
//
classids.value = []
}else{ }else{
ElMessage({ ElMessage({
message: res.msg, message: res.msg,

View File

@ -40,7 +40,7 @@
</template> </template>
<script setup> <script setup>
import { ref, getCurrentInstance } from 'vue' import { ref, getCurrentInstance,onMounted } from 'vue'
import {updateUserInfo } from '@/api/system/user' import {updateUserInfo } from '@/api/system/user'
import { listEvaluation } from '@/api/subject/index' import { listEvaluation } from '@/api/subject/index'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
@ -90,9 +90,12 @@ const rules = ref({
const subjectList = ref([]) const subjectList = ref([])
// //
listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => { const getSubject = () => {
subjectList.value = res.rows listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => {
}) const arr = userStore.user.subject.split(',')
subjectList.value = res.rows.filter(item => arr.includes(String(item.id))).map(items => items)
})
}
setTimeout(() => { setTimeout(() => {
if (props.user.edudegree != '') { if (props.user.edudegree != '') {
@ -150,4 +153,7 @@ const semeterChange = (item) => {
props.user.edusubject = '' props.user.edusubject = ''
} }
} }
onMounted(() => {
getSubject()
})
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div v-loading="sourceStore.loading" class="resource-list"> <div class="resource-list">
<el-scrollbar> <el-scrollbar>
<el-empty v-if="!sourceStore.thirdResult.list.length" description="暂无数据" /> <el-empty v-if="!sourceStore.thirdResult.list.length" description="暂无数据" />
<ul> <ul>