|
@@ -48,6 +48,13 @@
|
|
|
@click.stop="openDialogEdit(course)"
|
|
|
>
|
|
|
{{ course.classdetail }} 老师:({{ course.teacher_name }}) 教室:{{ course.classroom }}
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ style="font-size: 12px; top: 0; right: 0"
|
|
|
+ @click.stop="deleteCourse(course.id)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -75,11 +82,13 @@ import isoWeek from 'dayjs/plugin/isoWeek';
|
|
|
import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear';
|
|
|
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
|
|
import { computed, onMounted, ref } from 'vue';
|
|
|
-import { GetPermission,getScheduleData } from './api';
|
|
|
+import { GetPermission,getScheduleData,DelObj } from './api';
|
|
|
import { createCrudOptions } from './crud';
|
|
|
import { handleColumnPermission } from '/@/utils/columnPermission';
|
|
|
import AdditionDialog from './AdditionDialog/index.vue';
|
|
|
import { inject } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+
|
|
|
|
|
|
const isEmbedded = inject('isEmbedded', false);
|
|
|
const onCourseSelected = inject('onCourseSelected', () => {});
|
|
@@ -141,6 +150,19 @@ function editCourse(course: any) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+async function deleteCourse(courseId: number) {
|
|
|
+ try {
|
|
|
+ await DelObj(courseId);
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ await loadData(); // 重新加载数据以刷新视图
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error('删除失败,请稍后重试');
|
|
|
+ // console.error('删除课程失败:', error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
function getStartTime(time: number): string {
|
|
|
const timeMap = {
|
|
|
1: '09:00:00',
|