Преглед на файлове

树状图页面修改节点显示内容。修改D3作图的显示效果。,

insomniaLee преди 6 години
родител
ревизия
be91fffa90

+ 5 - 3
src/main/java/com/mooctest/controller/GraphController.java

@@ -20,6 +20,7 @@ import org.springframework.web.servlet.ViewResolver;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -126,9 +127,10 @@ public class GraphController {
 
         BugDTO bug = bugReportService.getBugById(treeId);
         model.addAttribute("report",bug);
-//        model.addAttribute("category2String", ReportUtil.category2String);
-//        model.addAttribute("recurrent2String", ReportUtil.recurrent2String);
-//        model.addAttribute("severity2String", ReportUtil.severity2String);
+        model.addAttribute("createTime",new Date(Long.parseLong(bug.getCreateTimeMillis())));
+        model.addAttribute("category2String", ReportUtil.category2String);
+        model.addAttribute("recurrent2String", ReportUtil.recurrent2String);
+        model.addAttribute("severity2String", ReportUtil.severity2String);
         View rawReportView = viewResolver.resolveViewName("thumbnail/tree_report", Locale.CHINESE);
         rawReportView.render(model.asMap(), req, resp);
     }

+ 7 - 1
src/main/java/com/mooctest/controller/HistoryController.java

@@ -129,6 +129,10 @@ public class HistoryController {
 		childReportIds.forEach(s->{
 				childReports.add(bugMap.get(s));
 		});
+		//按照时间排序
+		childReports.sort((l,r)->{
+			return (int) (Long.parseLong(l.getCreateTimeMillis()) - Long.parseLong(r.getCreateTimeMillis()));
+		});
 		Map<String, Long> categoryCounts = childReports.stream().collect(Collectors.groupingBy(BugDTO::getBugCategory, Collectors.counting()));
 		Map<String, Long> pageCounts =  childReports.stream().collect(Collectors.groupingBy(BugDTO::getBug_page,Collectors.counting()));
 		Map<String, Long> recurrentCounts = childReports.stream()
@@ -157,6 +161,7 @@ public class HistoryController {
         model.addAttribute("reviewed",false);
         model.addAttribute("examId", examId);
         model.addAttribute("caseId", caseId);
+		model.addAttribute("showReference",true);//是否展示其他聚合报告的参考标签
         return "tree_report_new";
     }
 
@@ -187,8 +192,8 @@ public class HistoryController {
 		List<FinalReportDTO> finalReports = new ArrayList<>();// 暂时还没有finalreport的数据
 
 
-		model.addAttribute("categoryCounts", categoryCounts);
 		model.addAttribute("severityCounts", severityCounts);
+		model.addAttribute("categoryCounts", categoryCounts);
 		model.addAttribute("pageCounts",pageCounts);
 		model.addAttribute("recurrentCounts",recurrentCounts);
 		model.addAttribute("aggReportId", "ML-TR-" + treeId.substring(10)); // 树报告的信息
@@ -202,6 +207,7 @@ public class HistoryController {
 		model.addAttribute("reviewed",false);
 		model.addAttribute("examId", examId);
 		model.addAttribute("caseId", caseId);
+		model.addAttribute("showReference",false);//是否展示其他聚合报告的参考标签
 		return "tree_report_new::treeBody";
 	}
 

+ 2 - 1
src/main/java/com/mooctest/service/GraphService.java

@@ -231,7 +231,8 @@ public class GraphService {
             JSONObject res = new JSONObject();
             res.fluentPut("id","tree_"+self.getId())
                     .fluentPut("group",group)
-                    .fluentPut("name",group!=1?(group-1)+"级子报告":"父报告")
+//                    .fluentPut("name",group!=1?(group-1)+"级子报告":"父报告")
+                    .fluentPut("name",self.getId().substring(10))
                     .fluentPut("href", "/graphDetail/treeReport?treeId=" + self.getId());
             return res;
         }

+ 6 - 3
src/main/resources/static/js/tree_report_new.js

@@ -12,6 +12,8 @@ $(function () {
 initTree = function (treeid) {
     $('.nodes').html("");
     $('.links').html("");
+    console.log("33333")
+
     function createImg(src) {
         var $img = $('<img />')
         $img.attr("src", src);
@@ -38,6 +40,7 @@ initTree = function (treeid) {
             $("#new-report-img").append($img)
         }
     });
+    console.log("444444")
 
 
 
@@ -73,12 +76,12 @@ initTree = function (treeid) {
 
                     var g = d3.select(this); // The node
                     var n = g.select('.the-node');
-                    var info = n.transition().duration(400).attr('r', 47 / d.data.group)
+                    var info = n.transition().duration(400).attr('r', 27 / 1)
                 })
                 .on('mouseout', function (d) {
                     var g = d3.select(this); // The node
                     var n = g.select('.the-node');
-                    var info = n.transition().duration(400).attr('r', 40 / d.data.group)
+                    var info = n.transition().duration(400).attr('r', 20 / 1)
                 });
         }
 
@@ -104,7 +107,7 @@ initTree = function (treeid) {
             .classed('the-node solid', true)
             .attr('cx', d => d.x)
     .attr('cy', d => d.y + 20)
-    .attr('r', d => 40 / d.data.group)
+    .attr('r', d => 20 / 1)
     .style("fill", function (d) {
             return color[d.data.group]
         });

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

@@ -212,7 +212,6 @@
                                                     <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)}+')'"
-
                                                            class="glyphicon glyphicon-tree-conifer"
                                                            style="color: #07b309; margin-right: 5px;" >
                                                     </span>
@@ -360,9 +359,7 @@
                                              th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
                                              th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
                                     </li>
-
                                 </th:block>
-
                             </ul>
                         </div>
 
@@ -374,7 +371,6 @@
 
         <div style="overflow: auto;" class="row tree-container">
             <div class="col-md-8 tree-wrapper">
-
                 <div class="box box-info pull-left svg-div" style="background-color: rgb(247, 247, 247); ">
                     <h4 style="padding-left: 10px;" class="pull-left">聚合图</h4>
                     <svg class="graph" id="tree" width="100%" height="420" viewBox="0 0 700 350">
@@ -383,22 +379,16 @@
                             <g class="nodes"></g>
                         </g>
                     </svg>
-
                 </div>
             </div>
             <div class="col-md-4">
-
                 <div class="detail-div"
                      style="height: 459px; max-height: 459px; font-size: 10px; overflow: scroll;">
-
                 </div>
             </div>
         </div>
 
 
-
-
-
     </section>
 </th:block>
 
@@ -500,7 +490,6 @@
                     //修改成功的情况
                     console.log("修改报告")
                     loadPartReports();
-
                     /*<![CDATA[*/
                     // window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
                     /*]]>*/
@@ -533,15 +522,21 @@
         //$('#new-report-create-block').load("/created_reports_form");
         $("#backButton").show();
         $('#treePart').show();
-        initTree(treeId);
-        initTreeReport();
+        //initTree(treeId);
+        initTreeReport(treeId);
     }
 
-    initTreeReport = function(){
+    initTreeReport = function(tree){
+        console.log("start init Tree");
         $('.sup-collapse').click(function () {
             var dupTitle = $(this).parents('li').find('.sup-title');
             dupTitle.toggle();
         });
+        initTree(tree);
+        console.log("---end---")
+    }
+
+    refreshPhotoDrag = function () {
         $(".to-add").on("dragend", function (e) {
             var src = $(e.target).attr("src");
             if (images.indexOf(src) < 0) {
@@ -590,7 +585,6 @@
         $('#new-created-reports-panel').load("/created_reports?masterId="+ masterId +"&caseId="+ caseId +"&examId="+ examId );
         //$('#new-report-create-block').load("/created_reports_form");
         finalReportId = null
-
         /*]]>*/
         showCreateButton()
         $("#new-report-create-block").hide()
@@ -598,10 +592,6 @@
     }
 
 
-    // function  syncCreatedReports(){
-    //     syncCreatedReportsWithParams(masterId,examId,caseId);
-    // }
-
 
     function showCreateBlock() {
         // console.log("show create block")

+ 20 - 16
src/main/resources/templates/thumbnail/tree_report.html

@@ -14,22 +14,26 @@
                 Aggregated Report
             </label>
         </li> -->
-<!--    <li class="list-group-item">-->
-<!--        <b>三级页面 </b>-->
-<!--        <span th:text="${report.bug_page}"></span><br />-->
-<!--    </li>-->
-<!--    <li class="list-group-item">-->
-<!--        <b>复现程度 </b>-->
-<!--        <span th:text="${recurrent2String.get(report.getRecurrent())}"></span><br />-->
-<!--    </li>-->
-<!--    <li class="list-group-item">-->
-<!--        <b>Bug分类 </b>-->
-<!--        <span th:text="${report.getBugCategory()}"></span><br />-->
-<!--    </li>-->
-<!--    <li class="list-group-item">-->
-<!--        <b>Bug严重性 </b>-->
-<!--        <span th:text="${severity2String.get(report.getSeverity())}"></span><br />-->
-<!--    </li>-->
+    <li class="list-group-item">
+        <b>创建时间</b>
+        <span class="dup-create-time" th:text="${#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}"></span>
+    </li>
+    <li class="list-group-item">
+        <b>三级页面 </b>
+        <span th:text="${report.bug_page}"></span><br />
+    </li>
+    <li class="list-group-item">
+        <b>复现程度 </b>
+        <span th:text="${recurrent2String.get(report.getRecurrent())}"></span><br />
+    </li>
+    <li class="list-group-item">
+        <b>Bug分类 </b>
+        <span th:text="${report.getBugCategory()}"></span><br />
+    </li>
+    <li class="list-group-item">
+        <b>Bug严重性 </b>
+        <span th:text="${severity2String.get(report.getSeverity())}"></span><br />
+    </li>
     <li class="list-group-item">
         <b>主要内容 <span class="glyphicon glyphicon-star" style="color: rgb(244, 172, 7); margin-right: 5px;"></span></b>
         <span th:text="${report.description}"></span><br />

+ 8 - 5
src/main/resources/templates/tree_report_new.html

@@ -205,11 +205,14 @@
                                                 <span class="glyphicon glyphicon-file"
                                                       style="color: #3c8dbc; margin-right: 5px;"></span>
                                                     <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;" >
+                                                    <!--查看聚合报告-->
+                                                    <span th:if="${showReference == true}" class="fa fa-sitemap text-warning"
+                                                          style="color: #8a6d3b; margin-right: 5px;" >
                                                     </span>
-
+<!--                                                    <span th:if="${single2root.get(report.id)!=null}"  th:onclick="'changeToTree('+${single2root.get(report.id)}+')'"-->
+<!--                                                          class="glyphicon glyphicon-tree-conifer"-->
+<!--                                                          style="color: #07b309; margin-right: 5px;" >-->
+<!--                                                    </span>-->
                                                     <!-- de scription -->
 
                                                     <th:block >
@@ -359,7 +362,7 @@
         <div style="overflow: auto;" class="row tree-container">
             <div class="col-md-8 tree-wrapper">
                 <div class="box box-info pull-left svg-div" style="background-color: rgb(247, 247, 247); ">
-                    <h4 style="padding-left: 10px;" class="pull-left">聚合图</h4>
+                    <h4 style="padding-left: 10px;" class="pull-left">树状图</h4>
                     <svg class="graph" id="tree" width="100%" height="420" viewBox="0 0 700 350">
                         <g transform="translate(10,20)" id="tree-g">
                             <g class="links"></g>