Selaa lähdekoodia

fix: 课程目录新增绑定看课标签

xdd 3 viikkoa sitten
vanhempi
commit
34e5c1c156

+ 2 - 0
src/views/components/course/userCourseCatalogDetails.vue

@@ -242,6 +242,8 @@ export default {
       },
       openTagDialog(row) {
         this.currentRow = row;
+
+
         this.tagDialogVisible = true;
         this.currentVideoId = row.videoId;
       },

+ 44 - 19
src/views/components/tag/AutoTagDialog.vue

@@ -175,7 +175,7 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="完课-标签" prop="watchedTgId">
+          <el-form-item label="完课-标签" prop="watchedTagId">
             <el-select
               v-model="form.watchedTagId"
               placeholder="请选择看课标签"
@@ -287,22 +287,22 @@ export default {
         watchedTagId:null
       },
       rules: {
-        tagName: [{ required: true, message: '请输入标签名称', trigger: 'blur' }],
-        tagGroupId: [{ required: true, message: '请输入标签组ID', trigger: 'blur' }],
+        corpId: [{ required: true, message: '请选择企微公司', trigger: 'change' }],
+        videoId: [{ required: true, message: '请输入视频ID', trigger: 'blur' }],
+        watchingGroupTgId: [{ required: true, message: '请选择看课中标签组', trigger: 'change' }],
+        watchingTagId: [{ required: true, message: '请选择看课中标签', trigger: 'change' }],
+        watchedGroupTgId: [{ required: true, message: '请选择完课标签组', trigger: 'change' }],
+        watchedTagId: [{ required: true, message: '请选择完课标签', trigger: 'change' }]
       },
       tagGroups: []
     }
   },
   created() {
-    this.getList();
     getMyQwCompanyList().then(response => {
       this.myQwCompanyList = response.data;
-      if(this.myQwCompanyList!=null){
-        this.queryParams.corpId=this.myQwCompanyList[0].dictValue;
-
-        this.afreshData(this.queryParams.corpId)
+      if(this.myQwCompanyList != null && this.myQwCompanyList.length > 0){
+        this.queryParams.corpId = this.myQwCompanyList[0].dictValue;
         this.getList();
-
       }
     });
   },
@@ -312,7 +312,7 @@ export default {
       this.form.watchingTgId = find.id;
     },
     onWatchedTagChange(tagId){
-      let find = this.watchingTagsInGroup.find(e=> e.tagId === tagId);
+      let find = this.watchedTagsInGroup.find(e=> e.tagId === tagId);
       this.form.watchedTgId = find.id;
     },
     onWatchingGroupChange(groupId){
@@ -335,8 +335,6 @@ export default {
       }).then((res) => {
         if(res.code === 200) {
           this.tagGroups = res.rows;
-          let tagGroup = this.tagGroups.find(e=>e.groupId === this.currentRow.tagGroupId);
-          this.tagsInGroup = tagGroup.tag || [];
         }
       });
     },
@@ -410,19 +408,46 @@ export default {
       }).then((res) => {
         if(res.code === 200) {
           this.tagGroups = res.rows;
-          let tagGroup = this.tagGroups.find(e=>e.groupId === this.currentRow.tagGroupId);
-          this.tagsInGroup = tagGroup.tag || [];
         }
       });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const id = row.id || this.ids
-      getTag(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改视频小节看课标签关联";
+      const id = row.id || this.ids;
+
+      // 先加载标签组数据
+      listTagGroup({
+        pageNum: 1,
+        pageSize: 1000,
+        corpId: this.queryParams.corpId
+      }).then((res) => {
+        if(res.code === 200) {
+          this.tagGroups = res.rows;
+
+          // 再获取详情数据
+          getTag(id).then(response => {
+            this.form = response.data;
+
+            // 根据标签组ID加载对应的标签列表
+            if(this.form.watchingGroupTgId) {
+              let watchingGroup = this.tagGroups.find(e => e.id === this.form.watchingGroupId);
+              if(watchingGroup) {
+                this.watchingTagsInGroup = watchingGroup.tag || [];
+              }
+            }
+
+            if(this.form.watchedGroupTgId) {
+              let watchedGroup = this.tagGroups.find(e => e.id === this.form.watchedGroupId);
+              if(watchedGroup) {
+                this.watchedTagsInGroup = watchedGroup.tag || [];
+              }
+            }
+
+            this.open = true;
+            this.title = "修改视频小节看课标签关联";
+          });
+        }
       });
     },
     /** 提交按钮 */