曹冬冬 hace 5 años
padre
commit
1da0b2f112

+ 11 - 1
src/views/testData/testData.html

@@ -114,9 +114,18 @@
         </div>
         <div class="filterResult">已为您筛选出【{{filterStr}}】共{{answerData.answerAll}}人,此条件下的用户题目答题情况如下:</div>
       </div>
+      <!-- 答题统计->表格 -->
       <div class="result" v-if="isShowTable">
         <div class="resultItem" v-for="(item, index) in answerData.questionList" :key="index">
-          <div class="resultTitle">题目{{index+1}}:{{item.content}}[{{item.chooseType == '1'? '单选':'多选'}}]</div>
+          <div class="testLable"
+            v-if="index == 0 || answerData.questionList[index-1].belongTestOrder != answerData.questionList[index].belongTestOrder">
+            测试{{item.belongTestOrder}}:{{item.lable}}</div>
+          <div class="resultTitle"><img v-if="item.isFilter" style="width: 32px;height: 17px;margin-right: 5px;"
+              src="https://dm.static.elab-plus.com/diaoyanbao/%E6%9D%A1%E4%BB%B6%E6%A0%87%E8%AE%B0@2x.png" alt="">
+            题目{{index+1}}:{{item.content}}[{{item.chooseType == '1'? '单选':'多选'}}]<span
+              v-if="item.testOrderList.length">(包含测试<span v-for="(testOrder,textIndex) in item.testOrderList"
+                :key="index">{{testOrder}}<span
+                  v-if="textIndex!=(item.testOrderList.length-1)">、</span></span>中的数据)</span></div>
           <div class="resultTable">
             <div class="tableHeader">
               <div class="option">选项</div>
@@ -141,6 +150,7 @@
           </div>
         </div>
       </div>
+      <!-- 答题统计->图形 -->
       <div class="chart" v-if="!isShowTable">
         <div class="chartItem" v-for="(item, index) in chartData" :key="index">
           <div class="chartTitle">题目{{index+1}}:{{item.content}}[{{item.chooseType == '1'? '单选':'多选'}}]<span

+ 49 - 7
src/views/testData/testData.js

@@ -133,14 +133,18 @@ export default {
       console.log("XXXxXXX", list);
       this.dataList = list;
 
+      this.answerData = [];
       this.options = []
       this.questionList = []
+      var testThemesList = [];
       for (var i = 0; i < this.dataList.length; i++) {
         var element = this.dataList[i]
         if (element.isSelected) {
           this.getCNCTestDetail(element)
+          testThemesList.push(element);
         }
       }
+      this.getCNCTestDetails(testThemesList);
 
       this.optionsX = []
       for (var i = 0; i < this.dataList.length; i++) {
@@ -176,14 +180,41 @@ export default {
         }
       });
     },
-    async getCNCTestDetail(item) {
+    async getCNCTestDetails(testThemesList) {
       this.currentDate = timeFormat.getNowFormatDate();
+      var testThemesIdList = [];
+      for (var i = 0; i < testThemesList.length; i++) {
+        var element = testThemesList[i]
+        testThemesIdList.push(element._id);
+      }
+      let data = {
+        testThemesIdList: testThemesIdList
+      }
+      api.answerData(data).then((res) => {
+        if (res.success) {
+          console.log("success", res);
+          var answerData = res.single;
+          for (var i = 0; i < answerData.questionList.length; i++) {
+            var element = answerData.questionList[i]
+            if (element.belongTestOrder <= testThemesIdList.length) {
+              element.lable = testThemesList[element.belongTestOrder - 1].title;
+            }
+          }
+          console.log("answerData", answerData);
+          this.answerData = answerData;
+          // 查询数据包列表
+          this.getCondition();
+        } else {
+          console.log("error");
+        }
+      });
+    },
+    async getCNCTestDetail(item) {
       let data = {
         testThemesIdList: [item._id]
       }
       api.answerData(data).then((res) => {
         if (res.success) {
-          this.answerData = res.single;
           console.log("success", res);
           var questionList = res.single.questionList;
           var children = []
@@ -193,8 +224,6 @@ export default {
           var element = { value: item._id, label: item.title, children: children, id: item._id };
           this.options.push(element);
           this.questionList.push(questionList);
-          // 查询数据包列表
-          this.getCondition();
         } else {
           console.log("error");
         }
@@ -206,7 +235,6 @@ export default {
       }
       api.answerData(data).then((res) => {
         if (res.success) {
-          this.answerData = res.single;
           console.log("success", res);
           var questionList = res.single.questionList;
           var children = []
@@ -226,7 +254,6 @@ export default {
       }
       api.answerData(data).then((res) => {
         if (res.success) {
-          this.answerData = res.single;
           console.log("success", res);
           var questionList = res.single.questionList;
           var children = []
@@ -482,8 +509,23 @@ export default {
       }
       api.answerData(data).then((res) => {
         if (res.success) {
-          this.answerData = res.single;
           console.log("success", res);
+          var answerData = res.single;
+          for (var i = 0; i < answerData.questionList.length; i++) {
+            var element = answerData.questionList[i]
+            const found = conditionQuestionList.find(element => element.questionId == element.questionId);
+            console.log("found", found);
+            if (element.belongTestOrder <= this.options.length) {
+              element.lable = this.options[element.belongTestOrder - 1].label;
+            }
+            if (found.questionId == element.questionId) {
+              element.isFilter = true
+            } else {
+              element.isFilter = false
+            }
+          }
+          console.log("answerData", answerData);
+          this.answerData = answerData;
         } else {
           console.log("error");
         }

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

@@ -318,6 +318,7 @@
           font-weight:500;
           color:rgba(255,255,255,1);
           line-height:28px;
+          cursor: pointer;
         }
         .saveOnLine {
           margin-left: 16px;
@@ -349,7 +350,21 @@
         margin-top: 36px;
         padding-bottom: 20px;
         border-bottom:1px dashed rgba(202,204,210,1);
+        .testLable {
+          font-size:18px;
+          font-family:PingFangSC-Medium,PingFang SC;
+          font-weight:500;
+          color:rgba(78,93,255,1);
+          line-height:25px;
+          margin-bottom: 10px;
+          padding-bottom: 10px;
+          width: 100%;
+          border-bottom: 1px dashed #E8E8E8;
+        }
         .resultTitle {
+          display: flex;
+          flex-direction: row;
+          align-items: center;
           font-size:18px;
           font-family:PingFangSC-Medium,PingFang SC;
           font-weight:500;