- {{ group.period }} |
+
+ {{ group.period }}
+
+
+ mdi-sync
+
+ 原节次: {{ group.originalPeriod }}
+
+ |
@@ -625,6 +642,14 @@ export default {
row => this.exportPeriods.includes(row.period)
);
+ // 创建节次映射 - 将原始节次映射到新的连续节次
+ const periodMap = {};
+ selectedRows
+ .sort((a, b) => a.period - b.period)
+ .forEach((row, index) => {
+ periodMap[row.period] = index + 1; // 重新映射为连续的1,2,3...
+ });
+
// 对每个选中的节次和每天的课程进行处理
selectedRows.forEach(row => {
for (let day = 1; day <= 7; day++) {
@@ -640,7 +665,8 @@ export default {
if (!course || !course.name) return;
timeTableData.push({
- period: row.period,
+ originalPeriod: row.period, // 保留原始节次
+ period: periodMap[row.period], // 使用重新计算的节次
subject: course.name,
day: this.dayNames[day],
startTime: course.startTime,
@@ -655,7 +681,8 @@ export default {
if (!courses.name) continue;
timeTableData.push({
- period: row.period,
+ originalPeriod: row.period, // 保留原始节次
+ period: periodMap[row.period], // 使用重新计算的节次
subject: courses.name,
day: this.dayNames[day],
startTime: courses.startTime,
@@ -981,7 +1008,7 @@ export default {
const teacher = this.settings.hideTeacherName ? "" : (item.teacher || "");
const room = this.settings.hideRoom ? "" : (item.room || "");
- // 每节课单独导出
+ // 每节课单独导出,使用重新计算的节次
csvContent += `${item.subject},${dayNumber},${item.period},${item.period},${teacher},${room},${item.weeks}\n`;
}
}
@@ -1003,7 +1030,7 @@ export default {
this.success = `导出成功!共计 ${this.totalClassHours} 课时`;
},
- // 添加导出数据预览功能
+ // 修改showExportPreview方法
showExportPreview() {
if (!this.hasExportData) {
this.error = "请先选择要导出的节次";
@@ -1015,10 +1042,18 @@ export default {
).join('\n');
if (this.timeTableData.length > 5) {
- this.success = `导出预览 (共${this.totalClassHours}课时):\n${previewContent}\n...等${this.totalClassHours - 5}节`;
+ this.success = `导出预览 (共${this.totalClassHours}课时):\n${previewContent}\n...等${this.totalClassHours - 5}节课程`;
} else {
this.success = `导出预览 (共${this.totalClassHours}课时):\n${previewContent}`;
}
+
+ // 刷新视图,确保节次重排效果显示
+ this.$nextTick(() => {
+ // 如果当前没有选中天数,自动选择第一个有课程的天数
+ if (this.daysWithSchedule.length > 0 && !this.activeDay) {
+ this.activeDay = this.daysWithSchedule[0];
+ }
+ });
},
// 添加YAML解析相关方法
@@ -1075,6 +1110,14 @@ export default {
row => this.exportPeriods.includes(row.period)
);
+ // 创建节次映射
+ const periodMap = {};
+ selectedRows
+ .sort((a, b) => a.period - b.period)
+ .forEach((row, index) => {
+ periodMap[row.period] = index + 1;
+ });
+
// 对每个选中的节次和每天的课程进行处理
selectedRows.forEach(row => {
for (let day = 1; day <= 7; day++) {
@@ -1087,7 +1130,8 @@ export default {
if (!course || !course.name) return;
timeTableData.push({
- period: row.period,
+ originalPeriod: row.period,
+ period: periodMap[row.period],
subject: course.name,
day: this.dayNames[day],
startTime: course.startTime,
@@ -1102,7 +1146,8 @@ export default {
if (!courses.name) continue;
timeTableData.push({
- period: row.period,
+ originalPeriod: row.period,
+ period: periodMap[row.period],
subject: courses.name,
day: this.dayNames[day],
startTime: courses.startTime,
@@ -1125,7 +1170,7 @@ export default {
});
},
- // 添加按节次分组的方法
+ // 修改groupByPeriod方法,添加原始节次信息
groupByPeriod(daySchedule) {
// 按节次分组
const groups = {};
@@ -1133,6 +1178,7 @@ export default {
if (!groups[item.period]) {
groups[item.period] = {
period: item.period,
+ originalPeriod: item.originalPeriod, // 保存原始节次
items: [],
timeSlots: []
};
|