aggr_report.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <!DOCTYPE html>
  2. <html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
  4. layout:decorator="main">
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="/static/css/main.css"/>
  7. <link rel="stylesheet" type="text/css" href="/static/css/agg_report.css"/>
  8. <link rel="stylesheet" type="text/css" href="/static/css/word_cloud.css"/>
  9. </head>
  10. <body>
  11. <th:block layout:fragment="sidebar">
  12. <li>
  13. <a th:href="'/final_reports?examId=' + ${examId} + '&amp;caseId=' + ${caseId}">
  14. <i class="fa fa-calendar-check-o"></i>
  15. <span>预交付报告</span>
  16. </a>
  17. </li>
  18. <li class="treeview">
  19. <a href="#">
  20. <i class="fa fa-list"></i>
  21. <span>Reports</span>
  22. <span class="pull-right-container">
  23. <i class="fa fa-angle-left pull-right"></i>
  24. </span>
  25. </a>
  26. <ul class="treeview-menu" style="display: block;">
  27. <li>
  28. <a th:href="'/task_detail?examId='+${examId}+'&amp;caseId='+${caseId}">
  29. <i class="fa fa-sticky-note text-success"></i>
  30. <span>默认视图</span>
  31. </a>
  32. </li>
  33. <li>
  34. <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}">
  35. <i class="fa fa-sitemap text-warning"></i>
  36. <span>聚合视图</span>
  37. </a>
  38. </li>
  39. </ul>
  40. </li>
  41. </th:block>
  42. <th:block layout:fragment="maincontent">
  43. <section class="content-header">
  44. <h1>融合报告详情
  45. <small th:text="${aggReportId}"></small>
  46. </h1>
  47. <!-- <h1>Summary for report 0-5</h1> -->
  48. <!-- <small style="font-style: italic;">at 50% report-level and 25% supplementary level</small> -->
  49. <ol class="breadcrumb">
  50. <!-- style="margin-right: 173px;" -->
  51. <li>
  52. <a href="/home">
  53. <i class="fa fa-dashboard"></i>
  54. 全部任务
  55. </a>
  56. </li>
  57. <li>
  58. <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}">
  59. 审核列表
  60. </a>
  61. </li>
  62. <li class="active" th:text="${aggReportId}">
  63. </li>
  64. </ol>
  65. </section>
  66. <section class="content container-fluid">
  67. <div style="overflow: auto;" class="row">
  68. <div class="col-md-8" id="summary">
  69. <div class="box box-info detail-table">
  70. <div class="box-header with-border" style="padding: 4px;">
  71. <i class="fa fa-object-group" style="color: #00c0ef;"></i>
  72. <h3 class="box-title" th:text="${aggReportId}">
  73. </h3>
  74. <button class="btn-xs btn-primary pull-right" id="create_bug" style="margin-left: 5px;" onclick="showCreateBlock()" th:if="${finalReportId == null}">创建缺陷报告
  75. </button>
  76. <button class="btn-xs btn-primary pull-right" id="review_confirm" th:unless="${reviewed}" onclick="reviewConfirm()">确认审核</button>
  77. <span th:if="${reviewed}" class="pull-right label label-success">
  78. <span class="glyphicon glyphicon-ok"></span>
  79. 已审核
  80. </span>
  81. </div>
  82. <table class="table table-reponsive">
  83. <tbody>
  84. <tr>
  85. <td class="attr-title">创建时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  86. <td class="dup-create-time">2017-12-01 ~ 2017-12-05</td>
  87. <td class="attr-title">Bug 严重性</td>
  88. <td class="dup-severity">一般 ~ 严重
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="attr-title">Bug分类&nbsp;&nbsp;&nbsp;&nbsp;</td>
  93. <td class="dup-category" colspan="3">
  94. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  95. <span style="margin-right: 10px;" th:if="${categories == null}">暂无</span>
  96. <span style="margin-right: 10px;" th:if="${categories != null}" th:each="ca : ${categories}" th:text="${ca}"></span>
  97. </td>
  98. </tr>
  99. <tr>
  100. <td class="attr-title">审核人</td>
  101. <td class="dup-assignee" colspan="3">
  102. <a href="#" style="margin-right: 5px;">
  103. <i class="fa fa-vcard"></i>
  104. admin
  105. </a>
  106. </td>
  107. </tr><!-- Attribute -->
  108. <!-- Start Content -->
  109. <tr>
  110. <td class="attr-title">主要点<span class="glyphicon glyphicon-star"
  111. style="margin-left: 5px;"></span></td>
  112. <td class="dup-master" colspan="3">
  113. <span th:text="${masterReport.getDescription()}"></span><br/>
  114. <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
  115. th:each="imgUrl,iterStat : ${masterReport.getImgUrls()}"
  116. th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
  117. </td>
  118. </tr>
  119. <tr>
  120. <td class="attr-title">补充点</td>
  121. <td class="dup-supplementary" colspan="3">
  122. <ul id="sup-list" class="list-group"
  123. style="max-height: 450px; margin-bottom: 0px; overflow: scroll;">
  124. <li class="list-group-item" style="padding: 3px 3px;"
  125. th:each="supplement, iterStat : ${supplements}">
  126. <p style="border-bottom: 1px solid #ddd; margin: 0 0 1px;">
  127. <b><a href="#" th:text="'Supplementary ' + ${iterStat.count}"> </a></b>
  128. <a th:href="'#sup-' + ${iterStat.count}"
  129. class="glyphicon glyphicon-menu-hamburger pull-right sup-collapse"
  130. data-toggle="collapse" style="color: #000;"></a>
  131. </p>
  132. <div class="sup-title">
  133. <!-- 如果有文字,则仅显示top 1的diff_sentence,并且不展示图片 -->
  134. <span th:if="${supplement.hasTxt}"
  135. th:text="'...' + ${supplement.topTxt} + '...'"></span>
  136. <img th:if="${!supplement.hasTxt}" class="my-img-thumbnail pointer to-add"
  137. th:src="${imgUrl}" th:each="imgUrl,iterStat : ${supplement.top3Img}"
  138. th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
  139. </div>
  140. <div th:id="'sup-' + ${iterStat.count}" class="collapse">
  141. <ul class="list-group" style="margin-bottom: 0px;">
  142. <li class="list-group-item" style="padding: 3px 3px;"
  143. th:each="report : ${supplement.bugs}">
  144. <span class="glyphicon glyphicon-file"
  145. style="color: #3c8dbc; margin-right: 5px;"></span>
  146. <a href="#" style="margin-right: 5px;" th:text="${report.id}"></a>
  147. <!-- description -->
  148. <th:block th:each="sent, iterStat : ${report.taggedSentences}">
  149. <span th:if="${sent.isDiff()}" th:text="${sent.sentence}"
  150. style="color: red; font-weight: bold;"></span>
  151. <span th:unless="${sent.isDiff()}"
  152. th:text="${sent.sentence}"></span>
  153. </th:block>
  154. <br/>
  155. <!-- imgs -->
  156. <th:block th:each="img, iterStat : ${report.taggedImgs}">
  157. <img class="my-img-thumbnail pointer to-add"
  158. th:style="${img.isDiff()? 'border: 2px solid red;' : ''}"
  159. th:src="${img.imgUrl}"
  160. th:onclick="'javascript:showimage(\''+${img.imgUrl}+'\');'"/>
  161. </th:block>
  162. </li>
  163. </ul>
  164. </div>
  165. </li>
  166. </ul>
  167. </td>
  168. </tr>
  169. </tbody>
  170. </table>
  171. </div>
  172. </div>
  173. <div class="col-md-4 pull-right">
  174. <div id="my_favorite_latin_words" class="box box-info" style="margin-bottom: 5px; min-height: 182px;"></div>
  175. <div class="box box-danger source-table" id="new-report-create-block" style="display: none">
  176. <div class="box-header" style="border-bottom: 1px #f4f4f4 solid;">
  177. <h3 class="box-title">
  178. 编辑报告
  179. </h3>
  180. <button class="btn-xs btn-primary pull-right" style="margin-left: 5px"
  181. onclick="createOrUpdateFinalReport()">保存
  182. </button>
  183. <button class="btn-xs btn-primary pull-right" onclick="hideCreateBlock()">取消</button>
  184. </div>
  185. <div id="new-report" class="box-body"
  186. style="font-size: 12px; max-height: 340px; overflow: scroll;">
  187. <form role="form">
  188. <!-- select -->
  189. <div class="form-group">
  190. <label>Bug 复现程度</label>
  191. <select id="recurrent" name="recurrent" class="form-control">
  192. <option th:each="mapItem : ${recurrent2String}"
  193. th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>
  194. </select>
  195. </div>
  196. <!-- select -->
  197. <div class="form-group">
  198. <label>Bug 严重性</label>
  199. <select id="severity" name="severity" class="form-control">
  200. <option th:each="mapItem : ${severity2String}"
  201. th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>
  202. </select>
  203. </div>
  204. <!-- select -->
  205. <div class="form-group">
  206. <label>Bug 分类</label>
  207. <select id="category" class="form-control">
  208. <option th:each="mapItem : ${category2String}"
  209. th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>
  210. </select>
  211. </div>
  212. <!-- textarea -->
  213. <div class="form-group">
  214. <label>Bug 描述</label>
  215. <textarea id="bug-description" name="description" class="form-control" rows="3"
  216. placeholder="Enter ..."></textarea>
  217. </div>
  218. <div class="form-group">
  219. <label>Bug 截图</label>
  220. <div id="new-report-img"></div>
  221. </div>
  222. </form>
  223. </div>
  224. </div>
  225. <div class="box box-info source-table" id="new-report-list-block">
  226. <div class="box-header">
  227. <h3 class="box-title">
  228. 已创建报告
  229. </h3>
  230. </div>
  231. <div id="new-created-reports" class="box-body"
  232. style="font-size: 12px; max-height: 340px; overflow: scroll;">
  233. <div th:if="${finalReports.size() == 0}" style="font-size: 20px">
  234. 暂无 <a onclick="showCreateBlock()" style="cursor: pointer">立即创建报告</a>
  235. </div>
  236. <ul class="list-group">
  237. <!-- other reports -->
  238. <th:block th:each="finalReport : ${finalReports}">
  239. <li class="list-group-item">
  240. <div style="overflow: auto;">
  241. <a href="#" th:text="${finalReport.id}"></a>
  242. <span class="pull-right">
  243. <a th:href="'report?masterId='+${finalReport.sourceId}+'&amp;examId='+${examId}+'&amp;caseId='+${caseId}+'&amp;finalReportId='+${finalReport.id}">编辑</a>
  244. <a href="#" th:onclick="'deleteReport('+ ${finalReport.id} +')'">删除</a>
  245. </span>
  246. </div>
  247. <div>
  248. <span>
  249. 复现程度:<span th:text="${recurrent2String.get(finalReport.recurrent)}"></span>
  250. </span>
  251. <span class="pull-right">
  252. 分类:<span th:text="${category2String.get(finalReport.category)}"></span>
  253. </span>
  254. </div>
  255. <div>
  256. 严重程度:<span th:text="${severity2String.get(finalReport.severity)}"></span>
  257. </div>
  258. <br/>
  259. <span th:text="${finalReport.description}"></span>
  260. <br/>
  261. <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
  262. th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
  263. th:onclick="'javascript:showimage(\''+${imgUrl}+'\');'"/>
  264. </li>
  265. </th:block>
  266. </ul>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <div style="overflow: auto;" class="row">
  272. <div class="col-md-8">
  273. <div class="box box-info pull-left svg-div"
  274. style="background-image: url('static/images/link/dark_opt.jpg'); background-size: cover;">
  275. <h4 style="color: #fff; padding-left: 10px;" class="pull-left">聚合图</h4>
  276. <svg width="660" height="450" style="margin-top: -40px;"></svg>
  277. </div>
  278. </div>
  279. <div class="col-md-4">
  280. <div class="detail-div"
  281. style="height: 459px; max-height: 459px; font-size: 10px; overflow: scroll;">
  282. </div>
  283. </div>
  284. </div>
  285. </section>
  286. </th:block>
  287. </body>
  288. </html>
  289. <div class="modal fade bs-example-modal-lg text-center" id="imgModal" tabindex="-1" role="dialog"
  290. aria-labelledby="myLargeModalLabel">
  291. <div class="modal-dialog modal-lg" style="display: inline-block; width: 300px;">
  292. <div class="modal-content">
  293. <img id="imgInModalID"
  294. class="carousel-inner img-responsive img-rounded"
  295. onclick="closeImageViewer()"
  296. onmouseover="this.style.cursor='pointer';this.style.cursor='hand'"
  297. onmouseout="this.style.cursor='default'"
  298. />
  299. </div>
  300. </div>
  301. </div>
  302. <script type="text/javascript">
  303. //显示大图
  304. function showimage(source) {
  305. $("#imgModal").find("#imgInModalID").attr("src", source);
  306. $("#imgModal").modal();
  307. }
  308. //关闭
  309. function closeImageViewer() {
  310. $("#imgModal").modal('hide');
  311. }
  312. </script>
  313. <script src="https://d3js.org/d3.v4.min.js"></script>
  314. <script type="text/javascript" src="/static/js/agg_report.js"></script>
  315. <script type="text/javascript" src="/static/js/jqcloud-1.0.4.min.js"></script>
  316. <script type="text/javascript" xmlns:th="http://www.thymeleaf.org" th:inline="javascript">
  317. /*<![CDATA[*/
  318. var word_list = /*[[${wordList}]]*/;
  319. var urlParams = new URLSearchParams(window.location.search);
  320. var masterId = urlParams.get('masterId');
  321. var examId = urlParams.get('examId');
  322. var caseId = urlParams.get('caseId');
  323. var finalReportId = urlParams.get('finalReportId');
  324. /*]]>*/
  325. word_list = JSON.parse(word_list)
  326. var images = [];
  327. $(function () {
  328. $("#my_favorite_latin_words").jQCloud(word_list,
  329. {
  330. shape: "rectangular",
  331. autoResize: true
  332. });
  333. var urlParams = new URLSearchParams(window.location.search);
  334. if (urlParams.get("finalReportId")) {
  335. showCreateBlock()
  336. /*<![CDATA[*/
  337. var editReport = /*[[${editReport}]]*/;
  338. /*]]>*/
  339. fillNewReportBlock(editReport);
  340. }
  341. });
  342. function createOrUpdateFinalReport() {
  343. var report = {
  344. 'description': $("#bug-description").val(),
  345. 'severity': $("#severity").val(),
  346. 'recurrent': $("#recurrent").val(),
  347. 'category': $("#category").val(),
  348. 'sourceId': masterId,
  349. 'reviewerId': 1,
  350. 'examId': examId,
  351. 'caseId': caseId,
  352. 'imgUrls': images
  353. }
  354. if (finalReportId) {
  355. report.id = finalReportId
  356. $.ajax({
  357. type: "PUT",
  358. url: '/final_report/'+finalReportId,
  359. data: JSON.stringify(report),
  360. contentType: "application/json",
  361. success: function (data) {
  362. /*<![CDATA[*/
  363. window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
  364. /*]]>*/ }
  365. });
  366. } else {
  367. $.ajax({
  368. type: "POST",
  369. url: '/final_report',
  370. data: JSON.stringify(report),
  371. contentType: "application/json",
  372. success: function (data) {
  373. location.reload()
  374. }
  375. });
  376. }
  377. }
  378. function showCreateBlock() {
  379. $("#new-report-create-block").show()
  380. $("#new-report-list-block").hide()
  381. }
  382. function hideCreateBlock() {
  383. if (finalReportId){
  384. /*<![CDATA[*/
  385. window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
  386. /*]]>*/
  387. }
  388. $("#new-report-create-block").hide()
  389. $("#new-report-list-block").show()
  390. }
  391. function fillNewReportBlock(editReport) {
  392. console.log(editReport)
  393. $("#recurrent").val(editReport.recurrent);
  394. $("#severity").val(editReport.severity);
  395. $("#category").val(editReport.category);
  396. $("#bug-description").val(editReport.description);
  397. var $new_report_img = $("#new-report-img");
  398. /*<![CDATA[*/
  399. for (var i=0;i<editReport.imgUrls.length;i++) {
  400. var src = editReport.imgUrls[i]
  401. var $img = $('<img />')
  402. $img.attr("src", src);
  403. $img.attr("class", "my-img-thumbnail pointer to-delete");
  404. $img.on("click", function (){
  405. showimage(src);
  406. });
  407. $img.on("dragend", function (e) {
  408. var src = $(e.target).attr("src");
  409. var idx = images.indexOf(src);
  410. if (idx >= 0) {
  411. images.splice(idx, 1);
  412. }
  413. $(e.target).remove();
  414. });
  415. $new_report_img.append($img)
  416. }
  417. /*]]>*/
  418. $("#new-report-img").val(editReport.description);
  419. }
  420. function deleteReport(finalReportId) {
  421. $.ajax({
  422. url: '/final_report/' + finalReportId,
  423. type: 'DELETE',
  424. success: function (result) {
  425. // Do something with the result
  426. alert("删除成功");
  427. location.reload();
  428. }
  429. });
  430. }
  431. function reviewConfirm() {
  432. $.ajax({
  433. url: '/bug_review?masterId='+masterId,
  434. type: 'PUT',
  435. success: function (result) {
  436. alert("确认审核成功,修改报告状态为已审核");
  437. location.reload();
  438. }
  439. });
  440. }
  441. </script>