Browse Source

饼状图筛选例句

natasha 1 year ago
parent
commit
c7027cb181
1 changed files with 45 additions and 6 deletions
  1. 45 6
      src/views/corpus/Result.vue

+ 45 - 6
src/views/corpus/Result.vue

@@ -273,14 +273,14 @@
               </template>
             </div>
             <div class="page">
-              <span class="text"> 共 {{ CurrentList.length }} 条 {{patternIndex == 0?' 命中 '+scoreAHitNumber+' 次':''}} </span>
+              <span class="text"> 共 {{ selectCurrent?selectCurrent:CurrentList.length }} 条 {{patternIndex === 0 && selectLaiyuanBookIdList.length===0?' 命中 '+scoreAHitNumber+' 次':''}} </span>
               <el-pagination
                 background
                 @current-change="handleCurrentChange"
                 :current-page.sync="page"
                 :page-size="pageSize"
                 layout="prev, pager, next"
-                :total="CurrentList.length"
+                :total="selectCurrent?selectCurrent:CurrentList.length"
                 :pager-count="5"
               >
               </el-pagination>
@@ -301,10 +301,12 @@
               :key="i + 'right'"
               class="one"
               :style="{
-                borderBottom: i == rightList.length - 1 ? 'none' : '1px solid #eeeeee'
+                borderBottom: i == rightList.length - 1 ? 'none' : '1px solid #eeeeee',
+                backgroundColor: selectLaiyuanBookIdList.indexOf(item.book_id)>-1?'#F2F3F5':''
               }"
               @mouseover="gaolangbzt(i, 'shanxing_main')"
               @mouseout="closegaolangbzt(i, 'shanxing_main')"
+              @click="handleBookLiju(item.book_id)"
             >
               <div style="width: 60%">
                 <span></span>
@@ -390,7 +392,9 @@ export default {
       checkAll: false,
       isIndeterminate: true,
       allLevels: [],
-      levelList: []
+      levelList: [],
+      selectLaiyuanBookIdList: [], // 选中右侧来源书籍列表id
+      selectCurrent: 0
     };
   },
   //计算属性 类似于data概念
@@ -590,6 +594,18 @@ export default {
         }
       };
       option && myChart.setOption(option);
+      if(this.rightTopIndex === 1){
+        let number = 0
+        let _this = this
+        myChart.on('click', function(param) { //添加点击事件
+          myChart.dispatchAction({ type: 'highlight', dataIndex: param.dataIndex }); //激活点击区域高亮
+          if (param.dataIndex !== number) { // 当鼠标点击的时候 消除上一个扇区的高亮
+              myChart.dispatchAction({ type: 'downplay', dataIndex: number });
+          }
+          number = param.dataIndex //接住当前扇区的dataIndex
+          _this.handleBookLiju(param.data.book_id)
+        });
+      }
     },
     // 鼠标进入
     gaolangbzt(index, id) {
@@ -609,6 +625,17 @@ export default {
         dataIndex: index
       });
     },
+    // 计算选中教材例句
+    handleBookLiju(id){
+      if(!id) return false
+      if(this.selectLaiyuanBookIdList.indexOf(id)>-1){
+        this.selectLaiyuanBookIdList.splice(this.selectLaiyuanBookIdList.indexOf(id),1)
+      }else{
+        this.selectLaiyuanBookIdList.push(id)
+      }
+      this.padingEvetn();
+      this.page = 1;
+    },
     changehzdata() {
       this.hzData = [];
       this.jfEvent(0);
@@ -660,7 +687,7 @@ export default {
         compare_mode: this.patternIndex === 0 ? 'LENGTH' : 'KWIC',// 排序比较模式,LENGTH【例句长度】,KWIC【KWIC 模式】
         kwic_arrange_type: this.KWIC_sortIndex === 0 ? 'LEFT' : this.KWIC_sortIndex === 1 ? 'MID' : 'RIGHT',// KWIC 排列类型, LEFT【左】,MID【中】,RIGHT【右】
         kwic_compare_by: this.sortType==='pclength'?1:0,// KWIC 排序比较依据,0【字符】,1【相邻的搭配词出现的次数】
-        book_publish_status: 1, // 教材发布状态 -1【全部】, 0【下架】1【上架】
+        book_publish_status: -1, // 教材发布状态 -1【全部】, 0【下架】1【上架】
         book_id_list: this.level,  // 指定教材查询,空表示在检索范围内检索所有教材。
         sentence_fc_length_min: localStorage.getItem('seekPageData')&&JSON.parse(localStorage.getItem('seekPageData')).sentenceStart?Number(JSON.parse(localStorage.getItem('seekPageData')).sentenceStart):-1, // 例句分词长度范围(最小值),-1 表示不检测最小值
         sentence_fc_length_max: localStorage.getItem('seekPageData')&&JSON.parse(localStorage.getItem('seekPageData')).sentenceEnd?Number(JSON.parse(localStorage.getItem('seekPageData')).sentenceEnd):-1, // 例句分词长度范围(最大值),-1 表示不检测最大值
@@ -859,7 +886,19 @@ export default {
     // 处理分页
     padingEvetn() {
       let arr = JSON.parse(JSON.stringify(this.CurrentList));
-      let newarr = arr.splice((this.page - 1) * this.pageSize, this.pageSize);
+      let arrs = []
+      if(this.selectLaiyuanBookIdList.length===0){
+        arrs = arr
+      }else{
+        arr.forEach(item=>{
+          let path = item.source_courseware_id_path.split('/')
+          if(path.length>0&&this.selectLaiyuanBookIdList.indexOf(path[0])>-1){
+            arrs.push(item)
+          }
+        })
+      }
+      this.selectCurrent = arrs.length
+      let newarr = arrs.splice((this.page - 1) * this.pageSize, this.pageSize);
       this.ShowList = JSON.parse(JSON.stringify(newarr));
     },
     // 删除脏数据