Browse Source

bug修复

曹冬冬 5 năm trước cách đây
mục cha
commit
d54ac99105

+ 3 - 2
src/views/previewPage/previewPage.html

@@ -2,7 +2,7 @@
   <div @click="xxxxx" class="dowload"> 下载到本地 </div>
   <div id="pdfDom" class="pdfContent">
     <div class="pHeader">
-      <div class="projectTitle">项目答题数据</div>
+      <div class="projectTitle">{{projectName}}项目答题数据</div>
       <div class="testList"> <span v-for="(item, index) in options" :key="index">【{{item.label}}】</span></div>
       <div class="tip">截止到{{currentDate}},问卷共{{answerData.answerJoin || 0}}人参与,完成全部题目的有{{answerData.answerAll || 0}}人。
       </div>
@@ -65,7 +65,7 @@
     </div>
     <div v-if="isCrossAnalyse" class="crossAnalyse">
       <div class="crossAnalyseTable" v-for="(item, index) in crossAnalyse" :key="index">
-        <div class="crossAnalyseTitle">题目{{index+1}}:{{item.name}}</div>
+        <div class="crossAnalyseTitle">题目{{index+1}}:{{item.subName == "" ? item.name : item.subName}}</span></div>
         <div class="crossAnalyseChart">
           <HistogramHorizontals :id="'c2'" :chartId="'caaaaa'+index" :chart-data="item.data">
           </HistogramHorizontals>
@@ -85,6 +85,7 @@
             <div class="tabkeRow" style="width: 100px;">{{items.value[0]}}</div>
           </div>
         </div>
+        <div class="analyseDesc" v-if="item.desc">洞察描述:{{item.desc}}</div>
       </div>
     </div>
   </div>

+ 23 - 11
src/views/previewPage/previewPage.js

@@ -16,21 +16,33 @@ export default {
       isShowTable: null,
       isCrossAnalyse: null,
       crossAnalyse: null,
+      projectName: ""
     }
   },
   created() {
-    this.chartData = this.$route.params.chartData
-    this.currentDate = this.$route.params.currentDate
-    this.answerData = this.$route.params.answerData
-    this.options = this.$route.params.options
-    this.filterStr = this.$route.params.filterStr
-    this.isShowTable = this.$route.params.isShowTable
-    this.isCrossAnalyse = this.$route.params.isCrossAnalyse
-    this.crossAnalyse = this.$route.params.crossAnalyse
-    console.log("xXXXX", this.$route.params);
 
-    const routerParams = this.$route.query.filterStr;
-    console.log("接受的pdf的值:", routerParams);
+
+    const routerParams = window.localStorage.getItem('PreviewPagePDF')
+    let params = JSON.parse(decodeURIComponent(routerParams))
+    console.log("接受的pdf的值:", params)
+    this.chartData = params.chartData
+    this.currentDate = params.currentDate
+    this.answerData = params.answerData
+    this.options = params.options
+    this.filterStr = params.filterStr
+    this.isShowTable = params.isShowTable
+    this.isCrossAnalyse = params.isCrossAnalyse
+    this.crossAnalyse = params.crossAnalyse
+
+    var projectName = ""
+    for (let index = 0; index < this.options.length; index++) {
+      const element = this.options[index];
+      for (let j = 0; j < element.houseNameList.length; j++) {
+        const houseName = element.houseNameList[j];
+        projectName += houseName + "、"
+      }
+    }
+    this.projectName = projectName.substr(0, projectName.length - 1)
   },
   methods: {
     xxxxx() {

+ 10 - 0
src/views/previewPage/previewPage.scss

@@ -305,6 +305,7 @@
       }
     }
     .crossAnalyseTable {
+      border-bottom: 1px dashed #E8E8E8;
       .crossAnalyseTitle {
         font-size:18px;
         font-family:PingFangSC-Medium,PingFang SC;
@@ -356,6 +357,15 @@
         }
         
       }
+      .analyseDesc {
+        font-size:16px;
+        font-family:PingFangSC-Regular,PingFang SC;
+        font-weight:400;
+        color:rgba(51,51,51,1);
+        line-height:24px;
+        margin-top: 20px;
+        margin-bottom: 20px;
+      }
     }
   }
 }

+ 8 - 0
src/views/testData/testData.html

@@ -203,6 +203,10 @@
       </div>
       <div class="crossAnalyseTable" v-for="(item, index) in crossAnalyse" :key="index">
         <div class="crossAnalyseTitle">题目{{index+1}}:{{item.name}}</div>
+        <div class="crossAnalyseSubTitle">
+          <el-input v-model="item.subName" v-lable="index" placeholder="点击添加图表名称">
+          </el-input>
+        </div>
         <div class="crossAnalyseChart">
           <HistogramHorizontals :id="'c2'" :chartId="'caaaaa'+index" :chart-data="item.data">
           </HistogramHorizontals>
@@ -222,6 +226,10 @@
             <div class="tabkeRow" style="width: 100px;">{{items.value[0]}}</div>
           </div>
         </div>
+        <div class="crossAnalyseDesc">
+          <el-input type="textarea" :rows="2" placeholder="点击添加洞察描述" v-model="item.desc">
+          </el-input>
+        </div>
       </div>
     </div>
   </div>

+ 40 - 22
src/views/testData/testData.js

@@ -5,6 +5,7 @@ import api from '../../api/test'
 import editorApi from '../../api/editor'
 import timeFormat from '../../util/time'
 import { format } from "util";
+import { json } from "body-parser";
 export default {
   components: {
     HeaderData, HistogramHorizontal, HistogramHorizontals
@@ -234,7 +235,7 @@ export default {
             }
             children.push({ value: question.questionId, label: question.content, disabled: disabled })
           }
-          var element = { value: item._id, label: item.title, children: children, id: item._id };
+          var element = { value: item._id, label: item.title, children: children, id: item._id, houseNameList: item.houseNameList };
           this.options.push(element);
           this.questionList.push(questionList);
         } else {
@@ -324,13 +325,20 @@ export default {
       this.questionChilds.splice(index, 1, []);
     },
     handleChangeX(value, index) {
-      console.log("handleChangeX", value, index, this.optionsXOldValue);
+      console.log("handleChangeX-0", value, index, this.optionsXOldValue);
+
       for (var i = 0; i < this.questionList.length; i++) {
-        if (value[1] == this.questionList[i].questionId) {
-          if (this.optionsXOldValue.length >= index + 1) {
-            console.log("XXXXXXXXXXXXX");
-            this.setOptionsDisabledXY(this.optionsXOldValue[index], false, 0);
-            this.setOptionsDisabledXY(this.optionsYOldValue[index], false, 1);
+        var questionList = this.questionList[i];
+        console.log("handleChangeXOld-1", questionList, value[1]);
+        for (var j = 0; j < questionList.length; j++) {
+
+          if (value[1] == questionList[j].questionId) {
+            console.log("handleChangeXOld-2", this.optionsXOldValue.length, index + 1);
+            if (this.optionsXOldValue.length >= index + 1) {
+              console.log("handleChangeXOld", this.optionsXOldValue[index]);
+              this.setOptionsDisabledXY(this.optionsXOldValue[index], false, 0);
+              this.setOptionsDisabledXY(this.optionsXOldValue[index], false, 1);
+            }
           }
         }
       }
@@ -371,8 +379,9 @@ export default {
       this.getCrossAnalyse();
     },
     setOptionsDisabledXY(value, disabled, type = 0) {
+      if (value === undefined) { return }
       var newOptions = [];
-      // console.log("setOptionsDisabledXY--0", value, disabled, type);
+      console.log("setOptionsDisabledXY--0", value, disabled, type);
       var options = type == 0 ? this.optionsX : this.optionsY;
       for (var i = 0; i < options.length; i++) {
         var item = options[i];
@@ -693,7 +702,7 @@ export default {
             for (var q = 0; q < qqq.length; q++) {
               sss.push({ name: rowArr[q], title: qqq[q].name, value: qqq[q].value })
             }
-            this.crossAnalyse.push({ table: sss, data: [], question: null, name: null });
+            this.crossAnalyse.push({ table: sss, data: [], question: null, name: null, subName: "", desc: "" });
           }
           // console.log("SSSSS", this.crossAnalyse);
 
@@ -737,20 +746,29 @@ export default {
       });
     },
     goToPreviewPage() {
-
-      this.$router.push({
-        name: 'previewPage',
-        params: {
-          chartData: this.chartData,
-          answerData: this.answerData,
-          currentDate: this.currentDate,
-          options: this.options,
-          filterStr: this.filterStr,
-          isShowTable: this.isShowTable,
-          isCrossAnalyse: this.isCrossAnalyse,
-          crossAnalyse: this.crossAnalyse
-        }
+      let params = {
+        chartData: this.chartData,
+        answerData: this.answerData,
+        currentDate: this.currentDate,
+        options: this.options,
+        filterStr: this.filterStr,
+        isShowTable: this.isShowTable,
+        isCrossAnalyse: this.isCrossAnalyse,
+        crossAnalyse: this.crossAnalyse
+      }
+      let ed = encodeURIComponent(JSON.stringify(params))
+      window.localStorage.setItem('PreviewPagePDF', ed)
+      const { href } = this.$router.resolve({
+        path: '/previewPage',
       })
+      window.open(href, '_blank')
+
+    },
+    analyseInput(value, index) {
+      console.log("analyseInput", value, index);
+    },
+    analyseTextarea(value) {
+      console.log("analyseTextarea", value);
     }
 
 

+ 33 - 0
src/views/testData/testData.scss

@@ -574,6 +574,39 @@
         line-height:25px;
         margin-top: 32px;
       }
+      .crossAnalyseSubTitle {
+        margin: 8px 0px;
+        .el-input {
+          width:244px;
+          height:30px;
+          .el-input__inner {
+            height: 30px;
+            line-height: 30px;
+            font-size:14px;
+            font-family:PingFangSC-Regular,PingFang SC;
+            font-weight:400;
+            color:rgba(100,107,129,1);
+            line-height:20px;
+            background:rgba(241,241,241,1);
+            border:1px solid rgba(227,227,227,1);
+          }
+        }
+      }
+      .crossAnalyseDesc {
+        margin: 8px 0px;
+        .el-textarea {
+          width:100%;
+          .el-textarea__inner {
+            font-size:14px;
+            font-family:PingFangSC-Regular,PingFang SC;
+            font-weight:400;
+            color:rgba(100,107,129,1);
+            line-height:20px;
+            background:rgba(241,241,241,1);
+            border:1px solid rgba(227,227,227,1);
+          }
+        }
+      }
       .crossAnalyseChart {
         width: 100%;
         margin: 8px 0px;