|
@@ -30,7 +30,12 @@
|
|
|
<div class="content_right">
|
|
<div class="content_right">
|
|
|
<el-button class="delete_button_border_no_bg" @click="ClearTeachingRelationship">清空授课</el-button>
|
|
<el-button class="delete_button_border_no_bg" @click="ClearTeachingRelationship">清空授课</el-button>
|
|
|
<el-button class="button_refresh" @click="HandleExportExcel">批量导出</el-button>
|
|
<el-button class="button_refresh" @click="HandleExportExcel">批量导出</el-button>
|
|
|
- <el-button class="button_refresh">批量导入</el-button>
|
|
|
|
|
|
|
+ <el-upload action="#"
|
|
|
|
|
+ :auto-upload="false"
|
|
|
|
|
+ :show-file-list="false"
|
|
|
|
|
+ @change="(file)=>HandleImportExcel(file)">
|
|
|
|
|
+ <el-button type="primary" class="button_refresh"> 批量导入</el-button>
|
|
|
|
|
+ </el-upload>
|
|
|
<el-button class="button_background" @click="FinishTeachingRelationship">完成</el-button>
|
|
<el-button class="button_background" @click="FinishTeachingRelationship">完成</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -144,7 +149,6 @@
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
import { ErrorTypes, useRoute } from 'vue-router';
|
|
import { ErrorTypes, useRoute } from 'vue-router';
|
|
|
import { useStore } from 'vuex';
|
|
import { useStore } from 'vuex';
|
|
|
-
|
|
|
|
|
import ExcelJS from 'exceljs';
|
|
import ExcelJS from 'exceljs';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -155,7 +159,8 @@ import TabSearch from '@/baseComponents/TabSearch.vue';
|
|
|
import {
|
|
import {
|
|
|
getTeachingRelationshipTableDataApi, getTeacherListDataApi,
|
|
getTeachingRelationshipTableDataApi, getTeacherListDataApi,
|
|
|
saveTeachingRelationshipApi, deleteTeachingRelationshipApi,
|
|
saveTeachingRelationshipApi, deleteTeachingRelationshipApi,
|
|
|
- finishTeachingRelationshipApi,clearTeachingRelationshipApi
|
|
|
|
|
|
|
+ finishTeachingRelationshipApi,clearTeachingRelationshipApi,
|
|
|
|
|
+ importTeachingRelationshipApi
|
|
|
} from '@/api/teachingRelationshipComponent'
|
|
} from '@/api/teachingRelationshipComponent'
|
|
|
|
|
|
|
|
import {getEvaluationDataDetailApi} from '@/api/evaluationDataComponent'
|
|
import {getEvaluationDataDetailApi} from '@/api/evaluationDataComponent'
|
|
@@ -566,7 +571,7 @@ const LoopAddSheet=(finalTableColumn, finalTableData,workbook,sheetName )=>{
|
|
|
// 添加第一层表头
|
|
// 添加第一层表头
|
|
|
headerRow = worksheet.addRow(topHeaders)
|
|
headerRow = worksheet.addRow(topHeaders)
|
|
|
// 添加第二层表头
|
|
// 添加第二层表头
|
|
|
- subHeaderRow = worksheet.addRow(bottomHeaders)
|
|
|
|
|
|
|
+ // subHeaderRow = worksheet.addRow(bottomHeaders)
|
|
|
|
|
|
|
|
// 定义第一层表头样式
|
|
// 定义第一层表头样式
|
|
|
headerRow.eachCell((cell) => {
|
|
headerRow.eachCell((cell) => {
|
|
@@ -584,19 +589,19 @@ const LoopAddSheet=(finalTableColumn, finalTableData,workbook,sheetName )=>{
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 定义第二层表头样式
|
|
// 定义第二层表头样式
|
|
|
- subHeaderRow.eachCell((cell) => {
|
|
|
|
|
- cell.style = {
|
|
|
|
|
- font: { name: 'Microsoft YaHei', size: 11, bold: true, color: { argb: 'FF333333' } },
|
|
|
|
|
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFF9FAFB' } },
|
|
|
|
|
- border: {
|
|
|
|
|
- top: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
- left: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
- bottom: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
- right: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
- },
|
|
|
|
|
- alignment: { vertical: 'middle', horizontal: 'center', wrapText: true },
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // subHeaderRow.eachCell((cell) => {
|
|
|
|
|
+ // cell.style = {
|
|
|
|
|
+ // font: { name: 'Microsoft YaHei', size: 11, bold: true, color: { argb: 'FF333333' } },
|
|
|
|
|
+ // fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFF9FAFB' } },
|
|
|
|
|
+ // border: {
|
|
|
|
|
+ // top: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
+ // left: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
+ // bottom: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
+ // right: { style: 'thin', color: { argb: 'FFD9D9D9' } },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // alignment: { vertical: 'middle', horizontal: 'center', wrapText: true },
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 4. 添加数据行
|
|
// 4. 添加数据行
|
|
@@ -608,11 +613,11 @@ const LoopAddSheet=(finalTableColumn, finalTableData,workbook,sheetName )=>{
|
|
|
}
|
|
}
|
|
|
const cellValue = row[column.name];
|
|
const cellValue = row[column.name];
|
|
|
if(sheetName == '行政班'){
|
|
if(sheetName == '行政班'){
|
|
|
- return cellValue?.map((item: any) => item.teacherName || '').join(',') || '-';
|
|
|
|
|
|
|
+ return cellValue?.map((item: any) => item.teacherName || '').join(',');
|
|
|
}else if(sheetName == '教学班'){
|
|
}else if(sheetName == '教学班'){
|
|
|
- let className = cellValue.className.className
|
|
|
|
|
- let teacherList = cellValue.teacherList
|
|
|
|
|
- let teacherName = teacherList.map((item: any) => item.teacherName || '').join(',') || '-';
|
|
|
|
|
|
|
+ let className = cellValue?.className?.className
|
|
|
|
|
+ let teacherList = cellValue?.teacherList || []
|
|
|
|
|
+ let teacherName = teacherList?.map((item: any) => item.teacherName || '').join(',');
|
|
|
return [className,teacherName]
|
|
return [className,teacherName]
|
|
|
}
|
|
}
|
|
|
}).flat();
|
|
}).flat();
|
|
@@ -647,7 +652,6 @@ const LoopAddSheet=(finalTableColumn, finalTableData,workbook,sheetName )=>{
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
const HandleExportExcel = async () => {
|
|
const HandleExportExcel = async () => {
|
|
|
// 1. 初始化sheet列表
|
|
// 1. 初始化sheet列表
|
|
|
let sheetList = [
|
|
let sheetList = [
|
|
@@ -687,6 +691,27 @@ const HandleExportExcel = async () => {
|
|
|
URL.revokeObjectURL(url);
|
|
URL.revokeObjectURL(url);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 导入Excel
|
|
|
|
|
+const HandleImportExcel = async(file)=>{
|
|
|
|
|
+ console.log('file----------',file)
|
|
|
|
|
+ if(file.name.split('.').pop() !== 'xlsx' && file.name.split('.').pop() !== 'xls' ){
|
|
|
|
|
+ ElMessage.warning('请上传以.xlsx、.xls结尾的文件')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const fomData = new FormData()
|
|
|
|
|
+ fomData.append('file',file.raw)
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ evaluationId:route.query.id,
|
|
|
|
|
+ evaluationGradeId:searchParmams.value.gradeId,
|
|
|
|
|
+ classType:searchParmams.value.classType=== 'teach' ? 1 : 0 , // 0-行政班,1-教学班
|
|
|
|
|
+ }
|
|
|
|
|
+ let res = await importTeachingRelationshipApi(fomData,params)
|
|
|
|
|
+ if(res.code == 200){
|
|
|
|
|
+ // 查询查询数据
|
|
|
|
|
+ ElMessage.success(res.msg)
|
|
|
|
|
+ await reloadData()
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 重新加载页面数据
|
|
// 重新加载页面数据
|
|
|
const reloadData =async ()=>{
|
|
const reloadData =async ()=>{
|