|
|
@@ -31,7 +31,7 @@
|
|
|
<el-button class="delete_button_border_no_bg">清空授课</el-button>
|
|
|
<el-button class="button_refresh">批量导出</el-button>
|
|
|
<el-button class="button_refresh">批量导入</el-button>
|
|
|
- <el-button class="button_background">完成</el-button>
|
|
|
+ <el-button class="button_background" @click="FinishTeachingRelationship">完成</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -47,7 +47,7 @@
|
|
|
</div>
|
|
|
<div class="content_right">
|
|
|
<span v-if="isConfigMode" class="config_switch_desc">
|
|
|
- {{ selectedTeacher?.id ? `当前选中的教师:${selectedTeacher.name} ${selectedTeacher.account}` : '暂无选中的教师' }}
|
|
|
+ {{ selectedTeacher?.teacherId ? `当前选中的教师:${selectedTeacher.teacherName} ${selectedTeacher.userAccount}` : '暂无选中的教师' }}
|
|
|
</span>
|
|
|
<el-switch v-model="isConfigMode"
|
|
|
style="--el-switch-on-color: #2E64FA"
|
|
|
@@ -62,26 +62,30 @@
|
|
|
|
|
|
<!-- 行政班渲染表数据 -->
|
|
|
<Table v-if="searchParmams.classType === 'xingzeng'" :currentPage="1" :pageSize="200"
|
|
|
- :tableColumns="administrativeClassTableColumns"
|
|
|
- :tableData="administrativeClassData"
|
|
|
+ :tableColumns="filterAdministrativeClassTableColumns"
|
|
|
+ :tableData="administrativeClassTableData"
|
|
|
:hidePagination="true"
|
|
|
:totalNum="0">
|
|
|
- <template v-for="column in administrativeClassTableColumns" :key="column.name" v-slot:[column.name]="{row}">
|
|
|
+
|
|
|
+ <template #className="{row}">
|
|
|
+ {{ row.className.className }}
|
|
|
+ </template>
|
|
|
+ <template v-for="column in filterAdministrativeClassTableColumns.slice(1)" :key="column.name" v-slot:[column.name]="{row}">
|
|
|
|
|
|
<div class="cell_container" @click="HandleAddTeacher(row, column.name,'administrative')">
|
|
|
<template v-if="row?.[column.name] && row?.[column.name]?.length > 0">
|
|
|
- <div v-for="(teacher, idx) in row?.[column.name]" :key="idx">
|
|
|
+ <div v-for="(teacher, idx) in row?.[column.name]" :key="teacher.teacherId">
|
|
|
<el-tooltip
|
|
|
effect="dark"
|
|
|
- :content="`${teacher.name} ${teacher.account}`"
|
|
|
+ :content="`${teacher.teacherName} ${teacher.userAccount}`"
|
|
|
placement="top-start"
|
|
|
>
|
|
|
<div v-if="isConfigMode" class="teacher_tag">
|
|
|
- <span :title="teacher.name">{{ teacher.name }}</span>
|
|
|
+ <span :title="teacher.teacherName">{{ teacher.teacherName }}</span>
|
|
|
<el-icon class="delete_icon" @click.stop="HandleRemoveTeacher(row, column.name, idx,'administrative')"><Close /></el-icon>
|
|
|
</div>
|
|
|
<div v-else class="disabled_teacher">
|
|
|
- <span :title="teacher.name">{{ teacher.name }}</span>
|
|
|
+ <span :title="teacher.teacherName">{{ teacher.teacherName }}</span>
|
|
|
</div>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
@@ -98,35 +102,35 @@
|
|
|
<!-- 教学班渲染表数据 -->
|
|
|
<Table v-else-if="searchParmams.classType === 'teach'"
|
|
|
:currentPage="1" :pageSize="200"
|
|
|
- :tableColumns="teachingClassTableColumns"
|
|
|
- :tableData="teachingClassData"
|
|
|
+ :tableColumns="filterTeachingClassTableColumns"
|
|
|
+ :tableData="teachingClassTableData"
|
|
|
:hidePagination="true"
|
|
|
:totalNum="0">
|
|
|
|
|
|
- <template v-for="column in teachingClassTableColumns" :key="column.name" v-slot:[column.name]="{row}">
|
|
|
+ <template v-for="column in filterTeachingClassTableColumns" :key="column.name" v-slot:[column.name]="{row}">
|
|
|
<div class="cell_container teaching_cell_container" @click="HandleAddTeacher(row, column.name,'teach')">
|
|
|
<div class="class_name">
|
|
|
- {{ row?.[column.name]?.name }}
|
|
|
+ {{ row?.[column.name]?.className.className }}
|
|
|
</div>
|
|
|
- <div class="teaching_teacher_list" v-if="row?.[column.name]?.name && row?.[column.name]?.teacherList?.length > 0">
|
|
|
- <div v-for="(teacher, idx) in row?.[column.name]?.teacherList" :key="idx">
|
|
|
+ <div class="teaching_teacher_list" v-if="row?.[column.name]?.className?.className && row?.[column.name]?.teacherList?.length > 0">
|
|
|
+ <div v-for="(teacher, idx) in row?.[column.name]?.teacherList" :key="teacher.teacherId">
|
|
|
<el-tooltip
|
|
|
effect="dark"
|
|
|
- :content="`${teacher.name} ${teacher.account}`"
|
|
|
+ :content="`${teacher.teacherName} ${teacher.userAccount}`"
|
|
|
placement="top-start"
|
|
|
>
|
|
|
<div v-if="isConfigMode" class="teacher_tag">
|
|
|
- <span :title="teacher.name">{{ teacher.name }}</span>
|
|
|
+ <span :title="teacher.teacherName">{{ teacher.teacherName }}</span>
|
|
|
<el-icon class="delete_icon" @click.stop="HandleRemoveTeacher(row, column.name, idx,'teach')"><Close /></el-icon>
|
|
|
</div>
|
|
|
<div v-else class="disabled_teacher">
|
|
|
- <span :title="teacher.name">{{ teacher.name }}</span>
|
|
|
+ <span :title="teacher.teacherName">{{ teacher.teacherName }}</span>
|
|
|
</div>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <template v-else-if="row?.[column.name]?.name">
|
|
|
+ <template v-else-if="row?.[column.name]?.className?.className">
|
|
|
<span v-if="isConfigMode" class="placeholder_text" >请选择教师</span>
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
@@ -157,9 +161,15 @@ import {
|
|
|
import {getEvaluationDataDetailApi} from '@/api/step1Component'
|
|
|
|
|
|
import {administrativeClassTableColumns,teacherTableColumns,teachingClassTableColumns} from './table'
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
+
|
|
|
+// 配置模式开关
|
|
|
+const isConfigMode = ref(true);
|
|
|
+
|
|
|
+
|
|
|
// 1. 查询参数 列表 配置
|
|
|
const tabList = ref([
|
|
|
{
|
|
|
@@ -183,212 +193,219 @@ const searchList = ref([
|
|
|
const searchParmams = ref({
|
|
|
gradeId:'',
|
|
|
classType:'teach',
|
|
|
- queryStr:''
|
|
|
+ searchKey:''
|
|
|
})
|
|
|
-const gradeList = ref([
|
|
|
- {
|
|
|
- label:'七年级',
|
|
|
- value:'七年级'
|
|
|
- },
|
|
|
- {
|
|
|
- label:'八年级',
|
|
|
- value:'八年级'
|
|
|
- },
|
|
|
- {
|
|
|
- label:'九年级',
|
|
|
- value:'九年级'
|
|
|
- },
|
|
|
-
|
|
|
-])
|
|
|
+// 年级列表
|
|
|
+interface GradeItm {
|
|
|
+ label:string,
|
|
|
+ key:string
|
|
|
+}
|
|
|
+const gradeList = ref<GradeItm[]>([])
|
|
|
|
|
|
-// 2. 教师列表数据
|
|
|
-const teacherList = ref([
|
|
|
- { id: '7467222312', account: '7467222312', name: '王老七' },
|
|
|
- { id: '11112', account: '11112', name: '王骞' },
|
|
|
- { id: '11113', account: '11113', name: '蔡永博' },
|
|
|
- { id: '11114', account: '11114', name: '孙永哲' },
|
|
|
- { id: 'AAA', account: 'AAA', name: '杨康' },
|
|
|
- { id: 'AAAB', account: 'AAAB', name: '赵文华' },
|
|
|
- { id: 'BUHG', account: 'BUHG', name: '赵兆' },
|
|
|
- { id: '11111', account: '11111', name: '王老七' },
|
|
|
- { id: '11112_b', account: '11112', name: '王骞' },
|
|
|
-]);
|
|
|
+interface GradeClassType {
|
|
|
+ gradeId:string,
|
|
|
+ administrativeClassStatus: number|string, // 0关闭 1开启
|
|
|
+ teachingClassStatus: number|string // 0关闭 1开启
|
|
|
+}
|
|
|
+const gradeClassTypeStatus = ref<GradeClassType[]>([]) //存储 不同年级的班级类型状态
|
|
|
+// 获取年级列表信息
|
|
|
+const GetGradeList = async()=>{
|
|
|
+ let id = route.query.id
|
|
|
+ let res = await getEvaluationDataDetailApi(id)
|
|
|
+ if(res?.code == 200){
|
|
|
+ gradeList.value = res?.data.map((item,index)=>{
|
|
|
+ gradeClassTypeStatus.value[index] = {
|
|
|
+ gradeId:item.id,
|
|
|
+ administrativeClassStatus: item.administrativeClassStatus,
|
|
|
+ teachingClassStatus: item.teachingClassStatus
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ label:item.gradeName,
|
|
|
+ key:item.id
|
|
|
+ }
|
|
|
+ }) || []
|
|
|
+ searchParmams.value.gradeId = gradeList.value[0].key
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
-// 配置模式开关
|
|
|
-const isConfigMode = ref(true);
|
|
|
+// 2. 教师列表数据
|
|
|
+interface TeacherItm {
|
|
|
+ id: null | string
|
|
|
+ teacherId: string
|
|
|
+ teacherName: string
|
|
|
+ userAccount: string
|
|
|
+}
|
|
|
+const teacherList = ref<TeacherItm[]>([]);
|
|
|
// 选中的教师ID
|
|
|
const selectedTeacher = ref()
|
|
|
-
|
|
|
+// 获取教师列表数据
|
|
|
+const GetTeacherTableData = async ()=>{
|
|
|
+ let params = {
|
|
|
+ evaluationId: route.query.id,
|
|
|
+ evaluationGradeId: searchParmams.value.gradeId,
|
|
|
+ teacherName: searchParmams.value.searchKey
|
|
|
+ }
|
|
|
+ let res = await getTeacherListDataApi(params)
|
|
|
+ if(res?.code == 200){
|
|
|
+ teacherList.value = res.data || []
|
|
|
+ }
|
|
|
+}
|
|
|
+// 行选中 选择教师
|
|
|
+const HandleSelectTeacher = (teacher) => {
|
|
|
+ selectedTeacher.value = {
|
|
|
+ teacherId:teacher.teacherId,
|
|
|
+ teacherName:teacher.teacherName,
|
|
|
+ userAccount:teacher.userAccount,
|
|
|
+ };
|
|
|
+};
|
|
|
+// 设置表行选中 样式
|
|
|
const tableRowClassName = ({row,rowIndex})=>{
|
|
|
- if(row.id == selectedTeacher.value?.id){
|
|
|
+ if(row.teacherId == selectedTeacher.value?.teacherId){
|
|
|
return 'active_row'
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+// 搜索变化处理
|
|
|
+const HandleSearchChange = async (params) => {
|
|
|
+ console.log('搜索参数', params);
|
|
|
+ searchParmams.value.searchKey = params.searchKey
|
|
|
+ // 重查教师账号信息
|
|
|
+ await GetTeacherTableData()
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
-// 生成行政班模拟数据
|
|
|
-const generateAdministrativeClassData = () => {
|
|
|
- const data = [];
|
|
|
- for (let i = 1; i <= 3; i++) {
|
|
|
- const row: any = {
|
|
|
- className: `${i}班`,
|
|
|
- headTeacher: null,
|
|
|
- chinese: null,
|
|
|
- math: null,
|
|
|
- english: null,
|
|
|
- physics: null,
|
|
|
- chemistry: null,
|
|
|
- biology: null,
|
|
|
- };
|
|
|
-
|
|
|
- // 模拟部分已分配的数据
|
|
|
- if (i === 1) {
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.physics = [{ id: 'teacher_phy', name: '物理理' }];
|
|
|
- } else if (i === 2) {
|
|
|
- row.headTeacher = [
|
|
|
- { id: 'AAA', name: '杨凯' },
|
|
|
- { id: 'AAA', name: '杨凯' },
|
|
|
- { id: 'AAA', name: '杨凯' }
|
|
|
- ];
|
|
|
- row.chinese = [
|
|
|
- { id: 'AAAB', name: '赵文华' },
|
|
|
- { id: 'AAAB', name: '赵文华' }
|
|
|
- ];
|
|
|
- row.math = [
|
|
|
- { id: 'AAAB', name: '赵文华' },
|
|
|
- { id: 'AAAB', name: '赵文华' }
|
|
|
- ];
|
|
|
- row.english = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chemistry = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.biology = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- } else if (i === 3) {
|
|
|
- row.headTeacher = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chinese = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.english = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.physics = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- } else if (i === 4) {
|
|
|
- row.math = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.physics = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chemistry = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.biology = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.math = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- } else if (i === 5) {
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.math = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.physics = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- } else if (i === 6) {
|
|
|
- row.headTeacher = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.math = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.chinese = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- row.physics = [{ id: 'AAA', name: '杨凯' }];
|
|
|
- } else if (i === 7) {
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- } else if (i === 8) {
|
|
|
- row.headTeacher = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- } else if (i === 9) {
|
|
|
- row.chinese = [{ id: 'AAAB', name: '赵文华' }];
|
|
|
- }
|
|
|
- data.push(row);
|
|
|
- }
|
|
|
- return data;
|
|
|
-};
|
|
|
+// 3. 授课关系数据
|
|
|
+// 行政班 表头
|
|
|
+const filterAdministrativeClassTableColumns = ref([...administrativeClassTableColumns.value])
|
|
|
+// 教学班 表头
|
|
|
+const filterTeachingClassTableColumns = ref([...teachingClassTableColumns.value])
|
|
|
+const administrativeClassTableData = ref([]); // 行政班授课关系数据
|
|
|
+const teachingClassTableData = ref([]) //教学班授课关系数据
|
|
|
+// 获取表格授课关系配置数据
|
|
|
+const GetTeachingRelationshipData = async ()=>{
|
|
|
+ teachingClassTableData.value = []
|
|
|
+ administrativeClassTableData.value = []
|
|
|
|
|
|
-// 生成教学班 模拟数据
|
|
|
-const generateTeachingClassData = ()=>{
|
|
|
- const data = [];
|
|
|
- for (let i = 1; i <= 8; i++) {
|
|
|
- const row: any = {
|
|
|
- chemistry: null,
|
|
|
- biology: null,
|
|
|
- };
|
|
|
- if(i=== 1){
|
|
|
- row.chemistry = {
|
|
|
- name:'教学1班',
|
|
|
- teacherList:[
|
|
|
- { id: 'AAA', name: '杨凯' },
|
|
|
- { id: 'AAA', name: '杨凯' },
|
|
|
- { id: 'AAA', name: '杨凯' }
|
|
|
- ]
|
|
|
- }
|
|
|
- }else if(i === 2){
|
|
|
- row.biology = {
|
|
|
- name:'教学1班',
|
|
|
- teacherList:[]
|
|
|
- }
|
|
|
- }
|
|
|
- data.push(row);
|
|
|
+ let res = await getTeachingRelationshipTableDataApi(searchParmams.value.gradeId)
|
|
|
+ if(res?.code == 200){
|
|
|
+ // 行政班数据 行政班科目 教学班数据 教学班科目
|
|
|
+ const {administrativeClassData,administrativeSubjectLists,
|
|
|
+ teachingClassData, teachingSubjectLists,
|
|
|
+ } = res.data
|
|
|
+
|
|
|
+ // 行政班数据渲染
|
|
|
+ let administrativeHeaderColumn = administrativeSubjectLists.map(item=>{
|
|
|
+ return {
|
|
|
+ name: item.subjectId,
|
|
|
+ label: item.name,
|
|
|
+ width: '140',
|
|
|
+ custom: true,
|
|
|
+ fixed:'',
|
|
|
+ hidden: false,
|
|
|
+ align:'center',
|
|
|
+ }
|
|
|
+ })
|
|
|
+ filterAdministrativeClassTableColumns.value = [...administrativeClassTableColumns.value,...administrativeHeaderColumn]
|
|
|
+ administrativeClassTableData.value = administrativeClassData.map(item=>{
|
|
|
+ let subjectOpt = {}
|
|
|
+ item.subjectData.map(subject=>{
|
|
|
+ subjectOpt[subject.subjectId] = subject.teacherData
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ className:{
|
|
|
+ className:item.className,
|
|
|
+ evaluationClassId:item.evaluationClassId
|
|
|
+ },
|
|
|
+ ...subjectOpt
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 教学班数据渲染
|
|
|
+ let teachingHeaderColumn = teachingSubjectLists.map(item=>{
|
|
|
+ return {
|
|
|
+ name: item.subjectId,
|
|
|
+ label: item.name,
|
|
|
+ width: '140',
|
|
|
+ custom: true,
|
|
|
+ fixed:'',
|
|
|
+ hidden: false,
|
|
|
+ align:'center',
|
|
|
+ }
|
|
|
+ })
|
|
|
+ filterTeachingClassTableColumns.value = [...teachingClassTableColumns.value,...teachingHeaderColumn];
|
|
|
+ teachingClassData.map((subjectItm:any)=>{
|
|
|
+ let subjectId = subjectItm.subjectId
|
|
|
+ subjectItm?.classData.map((classItm,idx)=>{
|
|
|
+ let subjectOpt = {
|
|
|
+ className:{
|
|
|
+ className:classItm.className,
|
|
|
+ evaluationClassId:classItm.evaluationClassId
|
|
|
+ },
|
|
|
+ teacherList:classItm.teacherData
|
|
|
+ }
|
|
|
+ if(typeof teachingClassTableData.value[Number(idx)] === 'object'){
|
|
|
+ teachingClassTableData.value[Number(idx)][subjectId] = subjectOpt
|
|
|
+ }else{
|
|
|
+ teachingClassTableData.value[Number(idx)] = {}
|
|
|
+ teachingClassTableData.value[Number(idx)][subjectId] = subjectOpt
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
}
|
|
|
- return data
|
|
|
}
|
|
|
|
|
|
-const administrativeClassData = ref(generateAdministrativeClassData());
|
|
|
-const teachingClassData = ref(generateTeachingClassData())
|
|
|
-
|
|
|
-// 搜索变化处理
|
|
|
-const HandleSearchChange = (params) => {
|
|
|
- console.log('搜索参数', params);
|
|
|
-};
|
|
|
-
|
|
|
-// 标签切换处理
|
|
|
-const HandleTabChange = async (key,type) => {
|
|
|
- console.log('当前选中的tab',key,type)
|
|
|
+// 添加教师
|
|
|
+const HandleAddTeacher = async (row, cell,type) => {
|
|
|
+ if (!isConfigMode.value) return;
|
|
|
+ if (!selectedTeacher.value) return;
|
|
|
|
|
|
- switch(type){
|
|
|
- case 'grade':{
|
|
|
- searchParmams.value.gradeId = key
|
|
|
- await reloadData()
|
|
|
- break
|
|
|
- }
|
|
|
- case 'classType':{
|
|
|
- searchParmams.value.classType = key
|
|
|
- break
|
|
|
- }
|
|
|
+ let teacherMsg = {
|
|
|
+ teacherId: selectedTeacher.value?.teacherId,
|
|
|
+ teacherName: selectedTeacher.value?.teacherName,
|
|
|
+ userAccount:selectedTeacher.value?.userAccount
|
|
|
}
|
|
|
-};
|
|
|
-
|
|
|
-// 选择教师
|
|
|
-const HandleSelectTeacher = (teacher) => {
|
|
|
- selectedTeacher.value = {
|
|
|
- id:teacher.id,
|
|
|
- name:teacher.name,
|
|
|
- account:teacher.account,
|
|
|
- };
|
|
|
|
|
|
-};
|
|
|
|
|
|
-// 添加教师
|
|
|
-const HandleAddTeacher = (row, cell,type) => {
|
|
|
switch(type){
|
|
|
case 'administrative':{
|
|
|
// 行政班
|
|
|
- if (!isConfigMode.value) return;
|
|
|
- if (!selectedTeacher.value) return;
|
|
|
if (!row[cell]) {
|
|
|
row[cell] = [];
|
|
|
}
|
|
|
- row[cell].push({ id: selectedTeacher.value?.id, name: selectedTeacher.value?.name,account:selectedTeacher.value?.account });
|
|
|
+ let res = await saveTeachingRelationshipApi({
|
|
|
+ ...teacherMsg,
|
|
|
+ evaluationId:route.query.id,
|
|
|
+ evaluationGradeId:searchParmams.value.gradeId,
|
|
|
+ evaluationSubjectId:cell,
|
|
|
+ evaluationClassId:row.className.evaluationClassId,
|
|
|
+ classType:searchParmams.value.classType == 'teach' ? 1 : 0 //班级类型,0-行政班,1-教学班
|
|
|
+ })
|
|
|
+ if(res?.code == 200){
|
|
|
+ ElMessage.success(res?.msg)
|
|
|
+ row[cell].push({...teacherMsg,id:res?.data});
|
|
|
+ }
|
|
|
break
|
|
|
}
|
|
|
case 'teach':{
|
|
|
- if (!isConfigMode.value) return;
|
|
|
- if (!selectedTeacher.value) return;
|
|
|
- if (row?.[cell]?.name && !row?.[cell]?.teacherList) {
|
|
|
+ if (row?.[cell]?.className?.className && !row?.[cell]?.teacherList) {
|
|
|
row[cell] = {
|
|
|
- name:row?.[cell]?.name,
|
|
|
+ name:row?.[cell]?.className,
|
|
|
teacherList:[]
|
|
|
}
|
|
|
- }else{
|
|
|
- row[cell].teacherList.push({ id: selectedTeacher.value?.id, name: selectedTeacher.value?.name,account:selectedTeacher.value?.account });
|
|
|
+ }
|
|
|
+
|
|
|
+ let res = await saveTeachingRelationshipApi({
|
|
|
+ ...teacherMsg,
|
|
|
+ evaluationId:route.query.id,
|
|
|
+ evaluationGradeId:searchParmams.value.gradeId,
|
|
|
+ evaluationSubjectId:cell,
|
|
|
+ evaluationClassId:row[cell].className.evaluationClassId,
|
|
|
+ classType:searchParmams.value.classType == 'teach' ? 1 : 0 //班级类型,0-行政班,1-教学班
|
|
|
+ })
|
|
|
+ if(res?.code == 200){
|
|
|
+ ElMessage.success(res?.msg)
|
|
|
+ row[cell].teacherList.push({...teacherMsg,id:res?.data});
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
@@ -396,57 +413,86 @@ const HandleAddTeacher = (row, cell,type) => {
|
|
|
};
|
|
|
|
|
|
// 移除教师
|
|
|
-const HandleRemoveTeacher = (row, cell, index,type) => {
|
|
|
+const HandleRemoveTeacher = async (row, cell, index,type) => {
|
|
|
if (!isConfigMode.value) return;
|
|
|
+ let id = null
|
|
|
+ let res = undefined
|
|
|
switch(type){
|
|
|
case 'teach':{
|
|
|
- row[cell].teacherList.splice(index, 1);
|
|
|
+ id = row[cell].teacherList[index].id
|
|
|
+ res = await deleteTeachingRelationshipApi(id)
|
|
|
+ if(res?.code == 200){
|
|
|
+ ElMessage.success(res?.msg)
|
|
|
+ row[cell].teacherList.splice(index, 1);
|
|
|
+ }
|
|
|
break
|
|
|
}
|
|
|
case 'administrative':{
|
|
|
- row[cell].splice(index, 1);
|
|
|
+ id = row[cell][index].id
|
|
|
+ res = await deleteTeachingRelationshipApi(id)
|
|
|
+ if(res?.code == 200){
|
|
|
+ ElMessage.success(res?.msg)
|
|
|
+ row[cell].splice(index, 1);
|
|
|
+ }
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 获取年级列表信息
|
|
|
-const GetGradeList = async()=>{
|
|
|
- let id = route.query.id
|
|
|
- let res = await getEvaluationDataDetailApi(id)
|
|
|
- if(res?.code == 200){
|
|
|
- gradeList.value = res?.data.map(item=>{
|
|
|
- return {
|
|
|
- label:item.gradeName,
|
|
|
- key:item.id
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// 4 综合.
|
|
|
+// 标签切换处理 年级/班级类型
|
|
|
+const HandleTabChange = async (val,type) => {
|
|
|
+ console.log('当前选中的tab',val,type)
|
|
|
+ switch(type){
|
|
|
+ case 'grade':{
|
|
|
+ let aimClassTypeStatus = gradeClassTypeStatus.value.find(item=>{
|
|
|
+ return item.gradeId == val
|
|
|
+ })
|
|
|
+ tabList.value = []
|
|
|
+ if(aimClassTypeStatus.administrativeClassStatus === 1){
|
|
|
+ searchParmams.value.classType = 'xingzeng'
|
|
|
+ tabList.value.push(
|
|
|
+ {
|
|
|
+ label:'行政班',
|
|
|
+ key:'xingzeng',
|
|
|
+ },
|
|
|
+ )
|
|
|
}
|
|
|
- }) || []
|
|
|
- searchParmams.value.gradeId = gradeList.value[0].key
|
|
|
- }
|
|
|
-}
|
|
|
-// 获取教师列表数据
|
|
|
-const GetTeacherTableData = async ()=>{
|
|
|
- let params = {
|
|
|
- evaluationId: route.query.id,
|
|
|
- evaluationGradeId: searchParmams.value.gradeId,
|
|
|
- teacherName: ""
|
|
|
+ if(aimClassTypeStatus.teachingClassStatus === 1){
|
|
|
+ if(aimClassTypeStatus.administrativeClassStatus !== 1){
|
|
|
+ searchParmams.value.classType = 'teach'
|
|
|
+ }
|
|
|
+ tabList.value.push(
|
|
|
+ {
|
|
|
+ label:'教学班',
|
|
|
+ key:'teach',
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+ searchParmams.value.gradeId = val
|
|
|
+ await reloadData()
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'classType':{
|
|
|
+ searchParmams.value.classType = val
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
- let res = await getTeacherListDataApi(params)
|
|
|
- if(res?.code == 200){
|
|
|
+};
|
|
|
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-// 获取表格授课关系配置数据
|
|
|
-const GetTeachingRelationshipData = async ()=>{
|
|
|
- let res = await getTeachingRelationshipTableDataApi(searchParmams.value.gradeId)
|
|
|
+// 5. 完成授课关系
|
|
|
+const FinishTeachingRelationship = async ()=>{
|
|
|
+ let params = gradeList.value.map(grade=>{
|
|
|
+ return grade.key
|
|
|
+ })
|
|
|
+ let res = await finishTeachingRelationshipApi(params)
|
|
|
if(res?.code == 200){
|
|
|
- const {administrativeClassData, teachingClassData} = res.data
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ ElMessage.success(res?.msg)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -459,7 +505,7 @@ const reloadData =async ()=>{
|
|
|
|
|
|
onMounted( async ()=>{
|
|
|
await GetGradeList()
|
|
|
- await reloadData()
|
|
|
+ HandleTabChange(searchParmams.value.gradeId,'grade')
|
|
|
})
|
|
|
|
|
|
</script>
|