Browse Source

修改报告列表界面

insomniaLee 6 years ago
parent
commit
0e861d173c

+ 1 - 0
src/main/java/com/mooctest/controller/ReportController.java

@@ -292,6 +292,7 @@ public class ReportController {
             model.addAttribute("bugMap", bugsMap);// 聚合才有de
             model.addAttribute("aggNum", masterReportService.getAggNum(examId, caseId)); // 聚合才有的
         }
+        model.addAttribute("treeNum",treeRootids.size());
         model.addAttribute("tree2BugIdsMap",tree2BugIdsMap);
         model.addAttribute("aggregated", aggregated);
         model.addAttribute("allReports", allReports);

+ 7 - 0
src/main/java/com/mooctest/service/MasterReportService.java

@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
 @Service
@@ -100,6 +101,12 @@ public class MasterReportService {
 
     }
 
+    //获得bug对masteride 的map
+    public Map<String , String > getBugIds2Master(List<String> masterIds){
+        List<MasterReport> nrs = masterReportDao.findByMasterIdIn(masterIds);
+        return nrs.stream().collect(Collectors.toMap(MasterReport::getBugId,MasterReport::getMasterId));
+    }
+
     public List<String> getAllBugIdsByMasterId(String masterId) {
         List<MasterReport> mrs = masterReportDao.findByMasterId(masterId);
         return mrs.stream().map(MasterReport::getBugId).collect(Collectors.toList());

+ 0 - 7
src/main/resources/static/js/tree_report_new.js

@@ -6,8 +6,6 @@ $(function () {
     var treeid = urlParams.get("treeId");
 
     initTree(treeid);
-
-
 });
 
 
@@ -24,12 +22,9 @@ initTree = function (treeid) {
         return $img;
     }
     $(".to-add").on("dragend", function (e) {
-
         var src = $(e.target).attr("src");
         if (images.indexOf(src) < 0) {
-
             images.push(src);
-
             var $img = createImg(src);
             $img.on("dragend", function (e) {
                 var src = $(e.target).attr("src");
@@ -40,8 +35,6 @@ initTree = function (treeid) {
 
                 $(e.target).remove();
             });
-
-
             $("#new-report-img").append($img)
         }
     });

+ 38 - 4
src/main/resources/templates/agg_report_new.html

@@ -212,8 +212,8 @@
                                                     <a th:href="'/report/'+${report.id}+'?examId=' + ${examId} + '&amp;caseId=' + ${caseId}" style="margin-right: 5px;" th:text="${report.id}"></a>
                                                     <!--查看树状报告-->
                                                     <span th:if="${single2root.get(report.id)!=null}"  th:onclick="'changeToTree('+${single2root.get(report.id)}+')'"
-                                                          th:href="'/history/report?treeId='+${single2root.get(report.id)}+'&amp;examId='+ ${examId} + '&amp;caseId=' + ${caseId}"
-                                                          class="glyphicon glyphicon-tree-conifer"
+
+                                                           class="glyphicon glyphicon-tree-conifer"
                                                            style="color: #07b309; margin-right: 5px;" >
                                                     </span>
 
@@ -522,6 +522,8 @@
         }
     }
 
+
+    //展示树状报告
     changeToTree = function (treeId) { //
         // alert(treeId);
         // $('#summary').hide();
@@ -530,12 +532,44 @@
         $("#treePart").load("/history/report_part?treeId="+treeId+"&caseId="+ caseId +"&examId="+ examId);
         //$('#new-report-create-block').load("/created_reports_form");
         $("#backButton").show();
+        $('#treePart').show();
+        initTree(treeId);
+        initTreeReport();
+    }
+
+    initTreeReport = function(){
         $('.sup-collapse').click(function () {
             var dupTitle = $(this).parents('li').find('.sup-title');
             dupTitle.toggle();
         });
-        $('#treePart').show();
-        initTree(treeId);
+        $(".to-add").on("dragend", function (e) {
+            var src = $(e.target).attr("src");
+            if (images.indexOf(src) < 0) {
+                images.push(src);
+                var $img = createImg(src);
+                $img.on("dragend", function (e) {
+                    var src = $(e.target).attr("src");
+                    var idx = images.indexOf(src);
+                    if (idx >= 0) {
+                        images.splice(idx, 1);
+                    }
+
+                    $(e.target).remove();
+                });
+                $("#new-report-img").append($img)
+            }
+        });
+    }
+
+    //创建Img
+    function createImg(src) {
+        var $img = $('<img />')
+        $img.attr("src", src);
+        $img.attr("class", "my-img-thumbnail pointer to-delete");
+        $img.on("click", function (){
+            showimage(src);
+        });
+        return $img;
     }
 
     showMainReport  = function () {

+ 9 - 19
src/main/resources/templates/test.html

@@ -101,7 +101,9 @@
                     <th:block th:each="report : ${allReports}">
 
                         <tr th:class="|row-${report.getId()}|">
-                            <td class="report-id" th:value="${report.getId()}" th:text="|ML-${report.getId().substring(10)}|"></td>
+                            <td>
+                                <a  th:href="'/report/'+${report.getId()}+'?examId=' + ${examId} + '&amp;caseId=' + ${caseId}" th:text="|ML-${report.getId().substring(10)}|" ></a>
+                            </td>
                             <td>
                                 <span th:text="${recurrent2String.get(report.recurrent)}"></span>
                             </td>
@@ -154,12 +156,7 @@
                 <div class="box">
                     <div class="box-header with-border">
                         <h3 class="box-title">聚合视图 <span class="badge badge-info" th:text="${aggNum}"></span></h3>
-                        <div class="box-tools pull-right">
-                            <a class="btn btn-sm btn-primary" th:href="'/task_detail?examId='+${examId}+'&amp;caseId='+${caseId}">
-                                <i class="fa fa-list-alt" style="margin-right: 5px;"></i>
-                                默认视图
-                            </a>
-                        </div>
+
                     </div><!-- /.box-header -->
 
                     <div class="box-body agg-report-list">
@@ -209,8 +206,6 @@
                                 </div>
                             </div>
                         </th:block>
-
-
                     </div><!-- /.box-body -->
                 </div>
             </section>
@@ -220,13 +215,8 @@
             <section class="content container-fluid">
                 <div class="box">
                     <div class="box-header with-border">
-                        <h3 class="box-title">树状视图 <span class="badge badge-info" th:text="${aggNum}"></span></h3>
-                        <div class="box-tools pull-right">
-                            <a class="btn btn-sm btn-primary" th:href="'/task_detail?examId='+${examId}+'&amp;caseId='+${caseId}">
-                                <i class="fa fa-list-alt" style="margin-right: 5px;"></i>
-                                默认视图
-                            </a>
-                        </div>
+                        <h3 class="box-title">树状视图 <span class="badge badge-info" th:text="${treeNum}"></span></h3>
+
                     </div><!-- /.box-header -->
 
                     <div class="box-body agg-report-list">
@@ -238,15 +228,15 @@
                                     <div class="box-header" id="agg-title-{{aggReport.dup_tag}}">
                                         <div style="overflow: auto;">
                                             <a th:href="@{'/report?masterId=' + ${masterBug.key} + '&amp;examId=' + ${examId} + '&amp;caseId=' + ${caseId}}"
-                                               class="pull-left agg-title" th:text="|${masterBug.key}|"></a>
+                                               class="pull-left agg-title" th:text="|ML-TR-${masterBug.key.substring(10)}|" ></a>
                                             <a th:href="'#dup-list-'+${masterBug.key}"
                                                class="glyphicon glyphicon-menu-hamburger pull-right agg-title"
                                                data-toggle="collapse"></a>
                                             <span class="pull-right" style="margin-right: 5px;">
 
                                         <label class="badge badge-success" th:if="${bugMap.get(masterBug.key).status == 1}">已审核</label>
-                                                <!--<label class="badge badge-warning" th:if="${bugMap.get(masterBug.key).status == 0}">未审核</label>-->
-                                        <label class="badge badge-little-green" th:if="${bugMap.get(masterBug.key).status == 0}">审核</label>
+                                                <label class="badge badge-warning" th:if="${bugMap.get(masterBug.key).status == 0}">未审核</label>
+<!--                                        <label class="badge badge-little-green" th:if="${bugMap.get(masterBug.key).status == 0}">审核</label>-->
                                     </span>
                                             <br/>
                                         </div>

+ 1 - 4
src/main/resources/templates/tree_report_new.html

@@ -204,7 +204,7 @@
                                                     >
                                                 <span class="glyphicon glyphicon-file"
                                                       style="color: #3c8dbc; margin-right: 5px;"></span>
-                                                    <a href="#" style="margin-right: 5px;" th:text="${supplement.getId()}"></a>
+                                                    <a th:href="'/report/'+${supplement.id}+'?examId=' + ${examId} + '&amp;caseId=' + ${caseId}" style="margin-right: 5px;" th:text="${supplement.getId()}"></a>
                                                     <!--查看树状报告-->
                                                     <span class="glyphicon glyphicon-tree-conifer"
                                                           style="color: #07b309; margin-right: 5px;" >
@@ -296,9 +296,7 @@
                                 <label>Bug 截图</label>
                                 <div id="new-report-img"></div>
                             </div>
-
                         </form>
-
                     </div>
                 </div>
 
@@ -307,7 +305,6 @@
                     <div class="box-header">
                         <h3 class="box-title">
                             已创建报告
-
                         </h3>
                     </div>
                     <div th:fragment="ul_reports" id="new-created-reports-panel">