فهرست منبع

前端数据缓存

yjwang 1 روز پیش
والد
کامیت
713ac3bc35
1فایلهای تغییر یافته به همراه28 افزوده شده و 0 حذف شده
  1. 28 0
      src/views/course/videoResource/index.vue

+ 28 - 0
src/views/course/videoResource/index.vue

@@ -648,6 +648,7 @@
             <el-input
               placeholder="请输入分类名称"
               v-model="categoryFilterText"
+              @input="monitorClassification()"
               size="small"
               clearable
               prefix-icon="el-icon-search">
@@ -663,6 +664,7 @@
               :props="{ label: 'cateName', children: 'children' }"
               @node-click="handleCategoryClick"
               :expand-on-click-node="false"
+              :current-node-key="monitorCateId"
               default-expand-all>
               <span class="custom-tree-node" slot-scope="{ node, data }">
                 <span>{{ node.label }}</span>
@@ -924,6 +926,10 @@ export default {
       currentRow: null,
       // 分类树相关数据
       categoryFilterText: '',
+      monitorClassificationValue:'',
+      monitorCateId:null,
+      monitorData:{},
+      monitorNode:null,
       categoryTreeData: [],
       add: false,
       // 题目列表
@@ -2079,6 +2085,20 @@ export default {
           cateName: '全部',
           children: treeDate
         }];
+
+        this.$nextTick(() => {
+          if (this.monitorClassificationValue) {
+            this.categoryFilterText = this.monitorClassificationValue;
+            //触发分类树筛选
+            if (this.$refs.categoryTree) {
+              this.$refs.categoryTree.filter(this.monitorClassificationValue);
+            }
+          }
+          if (this.$refs.categoryTree && this.monitorCateId !== null && this.monitorCateId !== undefined) {
+            this.$refs.categoryTree.setCurrentKey(this.monitorCateId);
+            this.handleCategoryClick(this.monitorData,this.monitorNode);
+          }
+        });
       });
     },
     filterNode(value, data) {
@@ -2087,6 +2107,11 @@ export default {
     },
     /** 处理分类点击 */
     handleCategoryClick(data, node) {
+      this.monitorCateId = data.cateId;
+      this.monitorData = data;
+      this.monitorNode = node;
+      console.log("打印数据----------》", data);
+
       // 更新查询参数
       this.projectQueryParams.pageNum = 1;
 
@@ -2495,6 +2520,9 @@ export default {
         this.projectSelectionCache[type] = [];
       }
       this.$message.success('已清空题目选择缓存');
+    },
+    monitorClassification(){
+      this.monitorClassificationValue = this.categoryFilterText;
     }
   }
 }