|
@@ -61,6 +61,16 @@
|
|
|
rowSpan = classTimeList.filter((row) => row.timePeriod === timePeriod).length;
|
|
|
}
|
|
|
|
|
|
+ const diffName = (data, field: string) => {
|
|
|
+ const value: string[] = [];
|
|
|
+ data.forEach((item: any) => {
|
|
|
+ if (!value.includes(item[field])) {
|
|
|
+ value.push(item[field]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return value.length > 1 ? value.join('/') : value[0];
|
|
|
+ };
|
|
|
+
|
|
|
const getWeekObj = (weeks) => {
|
|
|
const weekFilter = courseList.filter(
|
|
|
(row) =>
|
|
@@ -70,16 +80,13 @@
|
|
|
);
|
|
|
if (weekFilter && weekFilter.length > 0) {
|
|
|
return {
|
|
|
- siteName: weekFilter.map((item) => item.classroomName).join('/'), //weekFilter[0].classroomName || '-',
|
|
|
- courseName: weekFilter.map((item) => item.courseName).join('/'), //weekFilter[0].courseName || '-',
|
|
|
+ siteName: diffName(weekFilter, 'classroomName'), //weekFilter[0].classroomName || '-',
|
|
|
+ courseName: diffName(weekFilter, 'courseName'), //weekFilter[0].courseName || '-',
|
|
|
name:
|
|
|
formData.courseType === 'teacher'
|
|
|
- ? weekFilter.map((item) => item.className).join('/')
|
|
|
- : weekFilter
|
|
|
- .map((item) => item.teacherName)
|
|
|
- .filter((item) => item != '')
|
|
|
- .join('/'), //weekFilter[0].teacherName || '-',
|
|
|
- adjustType: weekFilter.map((item) => item.adjustType).join('/'),
|
|
|
+ ? diffName(weekFilter, 'className')
|
|
|
+ : diffName(weekFilter, 'teacherName'), //weekFilter[0].teacherName || '-',
|
|
|
+ adjustType: diffName(weekFilter, 'adjustType'),
|
|
|
};
|
|
|
} else {
|
|
|
return {};
|