dusenyao 3 年之前
父節點
當前提交
0b06d94f78

+ 10 - 2
src/components/select/SelectCourse.vue

@@ -66,8 +66,14 @@ export default {
     };
   },
   watch: {
-    curBook: function () {
+    curBook() {
       this.GetBookChapterStruct();
+    },
+    dialogVisible(val) {
+      if (val && this.book_list.length === 0) {
+        this.$message.warning('当前课程未选择教材');
+        this.dialogClose();
+      }
     }
   },
   created() {
@@ -84,7 +90,9 @@ export default {
     getCourseBookListByCSItemID() {
       GetCourseBookListByCSItemID({ cs_item_id: this.id }).then(({ book_list }) => {
         this.book_list = book_list;
-        this.curBook = book_list[0];
+        if (book_list.length > 0) {
+          this.curBook = book_list[0];
+        }
       });
     },
     curCourse(val, is_courseware) {

+ 2 - 2
src/views/teacher/create_course/step_table/CreateTask.vue

@@ -507,14 +507,14 @@ export default {
         return;
       }
       this.$router.push({
-        path: `/create_course_step_table/new_task/${time_type}/${this.id}/${this.curItemID}`
+        path: `/create_course_step_table/new_task/${time_type}/${this.id}/${this.curItemID}?is_template=${this.is_template}`
       });
     },
 
     handleTask({ id, type, time_type }) {
       if (type === 'edit') {
         this.$router.push({
-          path: `/create_course_step_table/new_task/${time_type}/${this.id}/${this.curItemID}`,
+          path: `/create_course_step_table/new_task/${time_type}/${this.id}/${this.curItemID}?is_template=${this.is_template}`,
           query: {
             task_id: id
           }

+ 12 - 6
src/views/teacher/create_course/step_table/NewTask.vue

@@ -18,7 +18,7 @@
           <el-input v-model="form.name" />
         </el-form-item>
 
-        <el-form-item label="授课教师" prop="teacher_id">
+        <el-form-item v-if="!is_template" label="授课教师" prop="teacher_id">
           <el-select v-model="form.teacher_id">
             <el-option
               v-for="item in teacher_list"
@@ -230,7 +230,7 @@ export default {
   components: { SelectCourse },
   data() {
     const validateTeacher = (rule, value, callback) => {
-      if (this.form.teaching_type === 10 && !this.form.teacher_id) {
+      if (this.form.teaching_type === 10 && !this.form.teacher_id && !this.is_template) {
         callback(new Error('授课教师不能为空'));
       } else {
         callback();
@@ -242,6 +242,8 @@ export default {
       task_id: this.$route.query.task_id,
       time_type: this.$route.params.time_type,
       cs_item_id: this.$route.params.cs_item_id,
+      is_template:
+        'is_template' in this.$route.query ? JSON.parse(this.$route.query.is_template) : false,
       dialogVisible: false,
       type_list: [],
       teacher_list: [],
@@ -300,9 +302,11 @@ export default {
       GetTaskTeachingTypeList().then(({ type_list }) => {
         this.type_list = type_list;
       });
-      GetTeacherListByCourseID({ course_id: this.id }).then(({ teacher_list }) => {
-        this.teacher_list = teacher_list;
-      });
+      if (!this.is_template) {
+        GetTeacherListByCourseID({ course_id: this.id }).then(({ teacher_list }) => {
+          this.teacher_list = teacher_list;
+        });
+      }
       GetTaskModeList().then(({ mode_list }) => {
         this.mode_list = mode_list;
       });
@@ -375,7 +379,9 @@ export default {
     },
 
     goBack() {
-      this.$router.push({ path: `/create_course_step_table/create_task/${this.id}` });
+      this.$router.push({
+        path: `/create_course_step_table/create_task/${this.id}?is_template=${this.is_template}`
+      });
     },
 
     upload(file) {