Ver código fonte

更换统计级别分布接口

natasha 1 ano atrás
pai
commit
36f79a799c
2 arquivos alterados com 111 adições e 102 exclusões
  1. 103 94
      src/views/Textanalysis/index.vue
  2. 8 8
      src/views/teacher-dev/TextAnalysis.vue

+ 103 - 94
src/views/Textanalysis/index.vue

@@ -84,7 +84,7 @@
                   <span class="type">{{ item.name }}</span>
                   <span class="type">{{ item.name }}</span>
                 </div>
                 </div>
                 <div class="rightCount">
                 <div class="rightCount">
-                  <span class="count">{{ item.value }}</span>
+                  <span class="count">{{ item.count }}</span>
                   <span class="precent">{{ item.ratio }}%</span>
                   <span class="precent">{{ item.ratio }}%</span>
                 </div>
                 </div>
               </div>
               </div>
@@ -386,7 +386,7 @@ import * as echarts from 'echarts';
 import 'echarts/lib/chart/bar';
 import 'echarts/lib/chart/bar';
 import 'echarts/lib/component/legend';
 import 'echarts/lib/component/legend';
 import 'echarts/lib/component/title';
 import 'echarts/lib/component/title';
-import { postapi } from '@/api/api';
+import { postapi, publicMethods } from '@/api/api';
 import { levelMap } from '../../common/data';
 import { levelMap } from '../../common/data';
 import { json2excel } from '@/utils/setMethods';
 import { json2excel } from '@/utils/setMethods';
 
 
@@ -460,6 +460,7 @@ export default {
       difficulty: {},
       difficulty: {},
       textContent: '',
       textContent: '',
       routerData: null,
       routerData: null,
+      id: null
     };
     };
   },
   },
   created() {
   created() {
@@ -476,6 +477,7 @@ export default {
     this.difficulty.pinyinDifficulty = this.routerData.pinyin_difficulty;
     this.difficulty.pinyinDifficulty = this.routerData.pinyin_difficulty;
     this.difficulty.vocabularyDifficulty = this.routerData.vocabulary_difficulty;
     this.difficulty.vocabularyDifficulty = this.routerData.vocabulary_difficulty;
     this.difficulty.wordDifficulty = this.routerData.word_difficulty;
     this.difficulty.wordDifficulty = this.routerData.word_difficulty;
+    this.id = this.routerData.id
     this.getstatistics();
     this.getstatistics();
   },
   },
   methods: {
   methods: {
@@ -999,7 +1001,6 @@ export default {
             tooltip: {
             tooltip: {
               trigger: 'axis',
               trigger: 'axis',
               formatter(params) {
               formatter(params) {
-                console.log(this.ratioShow);
                 if (this.ratioShow) {
                 if (this.ratioShow) {
                   return `${params[0].name}    ${params[0].value}%`;
                   return `${params[0].name}    ${params[0].value}%`;
                 }
                 }
@@ -1162,38 +1163,45 @@ export default {
         this.loading = true;
         this.loading = true;
       }
       }
       let base = null;
       let base = null;
-      if (this.leftNavIndex === 0) {
-        base = this.headerText === 'wordCount' ? this.base.pinyinCount : this.base.pinyinTextCount;
-      } else if (this.leftNavIndex === 1) {
-        base = this.headerText === 'wordCount' ? this.base.wordCount : this.base.wordTextCount;
-      } else {
-        base = this.headerText === 'wordCount' ? this.base.vocabularyCount : this.base.vocabularyTextCount;
-      }
-      postapi({
-        url: '/GCLSTCServer/tools/TS/statistics',
-        data: {
-          searchType: this.leftNavIndex,
-          partitionKey: this.partitionKey,
-          statisticsType: this.xifen ? 0 : 1,
-          base: base || null,
-          textType: this.headerText === 'wordCount' ? 0 : 1,
-        },
+      publicMethods('/TeachingServer/TextAnalyser/StatLevelDist',{
+        analyse_record_id: this.id,
+        type: this.leftNavIndex,
+        level_type: this.xifen ? 1 : 0,
+        count_type: this.headerText === 'wordCount' ? 0 : 1
       })
       })
+    //   if (this.leftNavIndex === 0) {
+    //     base = this.headerText === 'wordCount' ? this.base.pinyinCount : this.base.pinyinTextCount;
+    //   } else if (this.leftNavIndex === 1) {
+    //     base = this.headerText === 'wordCount' ? this.base.wordCount : this.base.wordTextCount;
+    //   } else {
+    //     base = this.headerText === 'wordCount' ? this.base.vocabularyCount : this.base.vocabularyTextCount;
+    //   }
+    //   postapi({
+    //     url: '/GCLSTCServer/tools/TS/statistics',
+    //     data: {
+    //       searchType: this.leftNavIndex,
+    //       partitionKey: this.partitionKey,
+    //       statisticsType: this.xifen ? 0 : 1,
+    //       base: base || null,
+    //       textType: this.headerText === 'wordCount' ? 0 : 1,
+    //     },
+    //   })
         .then((res) => {
         .then((res) => {
           this.allRatio = 0;
           this.allRatio = 0;
           this.allValue = 0;
           this.allValue = 0;
-          res.data.result.forEach((item) => {
+          res.data_list.forEach((item) => {
             this.allRatio += Number(item.ratio);
             this.allRatio += Number(item.ratio);
-            this.allValue += item.value;
+            this.allValue += item.count;
+            item.value = item.count
           });
           });
-          res.data.result.forEach((item) => {
-            if (item.value !== 0) {
-              item.ratio = ((item.value / this.allValue) * 100).toFixed(2);
+          res.data_list.forEach((item) => {
+            if (item.count !== 0) {
+              item.ratio = ((item.count / this.allValue) * 100).toFixed(2);
             }
             }
           });
           });
 
 
           this.allRatio = this.allRatio.toFixed(2);
           this.allRatio = this.allRatio.toFixed(2);
-          this.leftList = res.data.result;
+          this.leftList = res.data_list;
 
 
           this.createEcharts('main_echarts', '柱状图', this.leftList, 0);
           this.createEcharts('main_echarts', '柱状图', this.leftList, 0);
 
 
@@ -1211,79 +1219,80 @@ export default {
     // 获取分析结果
     // 获取分析结果
     getArticleData() {
     getArticleData() {
       this.loading = true;
       this.loading = true;
-      postapi({
-        url: '/GCLSTCServer/tools/TS/analysis/parsed/text',
-        data: {
-          partitionKey: this.partitionKey,
-        },
-      })
+      publicMethods('/TeachingServer/TextAnalyser/GetParsedTextInfo',{
+          analyse_record_id: this.id,
+        }
+      )
         .then((res) => {
         .then((res) => {
-          let newdata = [];
-          res.data.result.forEach((item) => {
-            if (item.length !== 0) {
-              newdata.push(item);
-            }
-          });
-          this.ArticelData = newdata;
-          let str = '';
-          // 合并标点
-          this.ArticelData.forEach((item) => {
-            item.forEach((items) => {
-              items.forEach((itemss, index) => {
-                itemss.text.forEach((itemsss) => {
-                  if (this.chsFhList.indexOf(itemsss.word) === -1) {
-                    itemsss.isShow = true;
-                  } else {
-                    let obj = JSON.parse(JSON.stringify(itemsss));
-                    obj.isShow = true;
-                    if (index > 0) {
-                      if (items[index - 1].text[items[index - 1].text.length - 1].isShow) {
-                        items[index - 1].text.push(obj);
-                        itemsss.isShow = false;
-                      } else {
-                        items[index - 2].text.push(obj);
-                        itemsss.isShow = false;
-                      }
-                    } else {
-                      itemsss.isShow = true;
+            if(res.status===1){
+                let newdata = [];
+                res.parsed_text.paragraph_list.forEach((item) => {
+                    if (item.length !== 0) {
+                        newdata.push(item);
                     }
                     }
-                  }
-                  str += itemsss.word;
                 });
                 });
-              });
-            });
-          });
-          let index = 0;
-          // 添加索引
-          this.ArticelData.forEach((item) => {
-            item.forEach((items) => {
-              items.forEach((itemss) => {
-                itemss.text.forEach((itemsss) => {
-                  if (itemsss.isShow) {
-                    itemsss.index = index;
-                    index += 1;
-                  }
+                this.ArticelData = newdata;
+                let str = '';
+                // 合并标点
+                this.ArticelData.forEach((item) => {
+                    item.forEach((items) => {
+                    items.forEach((itemss, index) => {
+                        itemss.text.forEach((itemsss) => {
+                        if (this.chsFhList.indexOf(itemsss.word) === -1) {
+                            itemsss.isShow = true;
+                        } else {
+                            let obj = JSON.parse(JSON.stringify(itemsss));
+                            obj.isShow = true;
+                            if (index > 0) {
+                            if (items[index - 1].text[items[index - 1].text.length - 1].isShow) {
+                                items[index - 1].text.push(obj);
+                                itemsss.isShow = false;
+                            } else {
+                                items[index - 2].text.push(obj);
+                                itemsss.isShow = false;
+                            }
+                            } else {
+                            itemsss.isShow = true;
+                            }
+                        }
+                        str += itemsss.word;
+                        });
+                    });
+                    });
                 });
                 });
-              });
-            });
-          });
-          let arr = [];
-          this.ArticelData.forEach((item, i) => {
-            arr.push([]);
-            item.forEach((items) => {
-              items.forEach((itemss) => {
-                arr[i].push(itemss);
-              });
-            });
-          });
-          this.ArticelData = arr;
-          this.textContent = str;
-          let flag = sessionStorage.getItem('tablehighlight');
-          if (this.$route.query.remarks && flag === 'true') {
-            this.cutNav(Number(this.$route.query.leftNavIndex));
-            this.wordTablehighlight(JSON.parse(this.$route.query.remarks), this.$route.query.color);
-          }
-          this.loading = false;
+                let index = 0;
+                // 添加索引
+                this.ArticelData.forEach((item) => {
+                    item.forEach((items) => {
+                    items.forEach((itemss) => {
+                        itemss.text.forEach((itemsss) => {
+                        if (itemsss.isShow) {
+                            itemsss.index = index;
+                            index += 1;
+                        }
+                        });
+                    });
+                    });
+                });
+                let arr = [];
+                this.ArticelData.forEach((item, i) => {
+                    arr.push([]);
+                    item.forEach((items) => {
+                    items.forEach((itemss) => {
+                        arr[i].push(itemss);
+                    });
+                    });
+                });
+                this.ArticelData = arr;
+                this.textContent = str;
+                let flag = sessionStorage.getItem('tablehighlight');
+                if (this.$route.query.remarks && flag === 'true') {
+                    this.cutNav(Number(this.$route.query.leftNavIndex));
+                    this.wordTablehighlight(JSON.parse(this.$route.query.remarks), this.$route.query.color);
+                }
+                this.loading = false;
+            }
+          
         })
         })
         .catch(() => {
         .catch(() => {
           this.loading = false;
           this.loading = false;

+ 8 - 8
src/views/teacher-dev/TextAnalysis.vue

@@ -29,7 +29,7 @@
         <div class="title">
         <div class="title">
           <span style="margin-right: 16px">文本列表:</span>
           <span style="margin-right: 16px">文本列表:</span>
         </div>
         </div>
-        <div class="list">
+        <div class="list" v-loading="recordLoading">
           <div v-for="(item, i) in data.record_list" :key="`${i}one`">
           <div v-for="(item, i) in data.record_list" :key="`${i}one`">
             <div class="number">{{ i + 1 }}</div>
             <div class="number">{{ i + 1 }}</div>
             <div class="txt" @click="handleJump(item)">
             <div class="txt" @click="handleJump(item)">
@@ -52,7 +52,7 @@
         <el-pagination
         <el-pagination
           :current-page.sync="data.cur_page"
           :current-page.sync="data.cur_page"
           :page-size="20"
           :page-size="20"
-          layout="prev, pager, next, jumper"
+          layout="total, prev, pager, next, jumper"
           :total="data.total_count"
           :total="data.total_count"
           @current-change="handleCurrentChange"
           @current-change="handleCurrentChange"
         />
         />
@@ -94,6 +94,7 @@ export default {
         2: '解析成功',
         2: '解析成功',
         3: '解析失败',
         3: '解析失败',
       },
       },
+      recordLoading: false,
     };
     };
   },
   },
   computed: {
   computed: {
@@ -176,6 +177,7 @@ export default {
             word_difficulty: item.word_difficulty,
             word_difficulty: item.word_difficulty,
             vocabulary_difficulty: item.vocabulary_difficulty,
             vocabulary_difficulty: item.vocabulary_difficulty,
             type: '文本分析',
             type: '文本分析',
+            id: item.id
           },
           },
         }).href,
         }).href,
         '_blank',
         '_blank',
@@ -186,15 +188,13 @@ export default {
      * @param {string} id
      * @param {string} id
      */
      */
     deleteTextAnalyseRecord(id) {
     deleteTextAnalyseRecord(id) {
-      this.loading = true;
+      this.recordLoading = true;
       DeleteTextAnalyseRecord({ id })
       DeleteTextAnalyseRecord({ id })
         .then(() => {
         .then(() => {
           this.pageQueryMyTextAnalyseRecordList();
           this.pageQueryMyTextAnalyseRecordList();
           this.$message.success('删除成功');
           this.$message.success('删除成功');
-          this.loading = false;
         })
         })
         .finally(() => {
         .finally(() => {
-          this.loading = false;
         });
         });
     },
     },
     /**
     /**
@@ -227,7 +227,7 @@ export default {
         text: this.txt,
         text: this.txt,
       })
       })
         .then(({ record }) => {
         .then(({ record }) => {
-          this.txt = '';
+        //   this.txt = '';
           this.jumpResult(record);
           this.jumpResult(record);
           this.pageQueryMyTextAnalyseRecordList(true);
           this.pageQueryMyTextAnalyseRecordList(true);
         })
         })
@@ -251,7 +251,7 @@ export default {
      * @param {boolean} bol 是否提示
      * @param {boolean} bol 是否提示
      */
      */
     pageQueryMyTextAnalyseRecordList(bol) {
     pageQueryMyTextAnalyseRecordList(bol) {
-      this.loading = true;
+      this.recordLoading = true;
       PageQueryMyTextAnalyseRecordList({ page_capacity: this.pageSize, cur_page: this.data?.cur_page ?? 1 })
       PageQueryMyTextAnalyseRecordList({ page_capacity: this.pageSize, cur_page: this.data?.cur_page ?? 1 })
         .then((data) => {
         .then((data) => {
           this.data = data;
           this.data = data;
@@ -260,7 +260,7 @@ export default {
           }
           }
         })
         })
         .finally(() => {
         .finally(() => {
-          this.loading = false;
+          this.recordLoading = false;
         });
         });
     },
     },
     handleCurrentChange(val) {
     handleCurrentChange(val) {