single_report.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  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_new.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="'/task_detail?examId=' + ${examId} + '&amp;caseId=' + ${caseId}">
  14. <i class="glyphicon glyphicon-book"></i>
  15. <span>
  16. 任务详情
  17. </span>
  18. </a>
  19. </li>
  20. <li>
  21. <a th:href="'/final_reports?examId=' + ${examId} + '&amp;caseId=' + ${caseId}">
  22. <i class="fa fa-calendar-check-o"></i>
  23. <span>预交付报告</span>
  24. </a>
  25. </li>
  26. <li>
  27. <a th:href="'/review_report?examId=' + ${examId} + '&amp;caseId=' + ${caseId}">
  28. <i class="glyphicon glyphicon-edit"></i>
  29. <span>
  30. 报告审核
  31. </span>
  32. </a>
  33. </li>
  34. <!-- <li class="treeview">-->
  35. <!-- <a href="#">-->
  36. <!-- <i class="fa fa-list"></i>-->
  37. <!-- <span>Reports</span>-->
  38. <!-- <span class="pull-right-container">-->
  39. <!-- <i class="fa fa-angle-left pull-right"></i>-->
  40. <!-- </span>-->
  41. <!-- </a>-->
  42. <!-- <ul class="treeview-menu" style="display: block;">-->
  43. <!-- <li>-->
  44. <!-- <a th:href="'/task_detail?examId='+${examId}+'&amp;caseId='+${caseId}">-->
  45. <!-- <i class="fa fa-sticky-note text-success"></i>-->
  46. <!-- <span>默认视图</span>-->
  47. <!-- </a>-->
  48. <!-- </li>-->
  49. <!-- <li>-->
  50. <!-- <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}">-->
  51. <!-- <i class="fa fa-sitemap text-warning"></i>-->
  52. <!-- <span>聚合视图</span>-->
  53. <!-- </a>-->
  54. <!-- </li>-->
  55. <!-- </ul>-->
  56. <!-- </li>-->
  57. </th:block>
  58. <th:block layout:fragment="maincontent">
  59. <section class="content-header">
  60. <h1>报告详情
  61. <small th:text="${singleReport.getId()}"></small>
  62. </h1>
  63. <!-- <h1>Summary for report 0-5</h1> -->
  64. <!-- <small style="font-style: italic;">at 50% report-level and 25% supplementary level</small> -->
  65. <ol class="breadcrumb">
  66. <!-- style="margin-right: 173px;" -->
  67. <li>
  68. <a href="/home">
  69. <i class="fa fa-dashboard"></i>
  70. 全部任务
  71. </a>
  72. </li>
  73. <li>
  74. <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}">
  75. 审核列表
  76. </a>
  77. </li>
  78. <li class="active" th:text="${singleReport.getId()}">
  79. </li>
  80. </ol>
  81. </section>
  82. <section class="content container-fluid">
  83. <div style="overflow: auto;" class="row">
  84. <div class="col-md-8" id="summary">
  85. <div class="box box-info detail-table">
  86. <div class="box-header with-border" style="padding: 4px;">
  87. <i class="fa fa-object-group" style="color: #00c0ef;"></i>
  88. <h3 class="box-title" th:text="${singleReport.getId()}">
  89. </h3>
  90. <button class="btn-xs btn-primary pull-right" id="create_bug" style="margin-left: 5px;display: none" onclick="showCreateBlock()" >
  91. 创建缺陷报告
  92. </button>
  93. <button class="btn-xs btn-primary pull-right" id="review_confirm" th:unless="${reviewed}" onclick="reviewConfirm()">确认审核</button>
  94. <span th:if="${reviewed}" class="pull-right label label-success">
  95. <span class="glyphicon glyphicon-ok"></span>
  96. 已审核
  97. </span>
  98. </div>
  99. <table class="table table-reponsive">
  100. <tbody>
  101. <tr>
  102. <td class="attr-title">创建时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  103. <td class="dup-create-time" th:text="${#dates.format(createTime, 'yyyy-MM-dd')}"></td>
  104. <td class="attr-title">Bug 严重性</td>
  105. <td class="dup-severity">
  106. <span >
  107. <span th:text="${severity2String.get(singleReport.getSeverity())}"></span>
  108. <!-- <span class="badge" th:text="${severityCount.value}"></span>-->
  109. </span>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td class="attr-title">聚合报告</td>
  114. <td class="dup-assignee" colspan="3">
  115. <a th:href="@{${masterUrl}}" th:text="${masterName}" style="margin-right: 5px;">
  116. </a>
  117. </td>
  118. </tr><!-- Attribute -->
  119. <tr>
  120. <td class="attr-title">树状报告</td>
  121. <td class="dup-assignee" colspan="3">
  122. <a th:href="@{${treeUrl}}" th:text="${treeName}" style="margin-right: 5px;">
  123. </a>
  124. </td>
  125. </tr><!-- Attribute -->
  126. <tr>
  127. <td class="attr-title">Bug分类&nbsp;&nbsp;&nbsp;&nbsp;</td>
  128. <td class="dup-category" colspan="3">
  129. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  130. <span >
  131. <span th:text="${singleReport.getBugCategory()}"></span>
  132. </span>
  133. </td>
  134. </tr>
  135. <tr>
  136. <td class="attr-title">三级页面&nbsp;&nbsp;&nbsp;&nbsp;</td>
  137. <td class="dup-category" colspan="3">
  138. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  139. <span>
  140. <span th:text="${singleReport.getBug_page()}"></span>
  141. <!-- <span class="badge" th:text="${pageCount.value}"></span>-->
  142. </span>
  143. </td>
  144. </tr>
  145. <tr>
  146. <td class="attr-title">复现程度&nbsp;&nbsp;&nbsp;&nbsp;</td>
  147. <td class="dup-category" colspan="3">
  148. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  149. <span >
  150. <span th:text="${recurrent2String.get(singleReport.getRecurrent())}"></span>
  151. <!-- <span class="badge" th:text="${recurrentCount.value}"></span>-->
  152. </span>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td class="attr-title">审核人</td>
  157. <td class="dup-assignee" colspan="3">
  158. <a href="#" style="margin-right: 5px;">
  159. <i class="fa fa-vcard"></i>
  160. admin
  161. </a>
  162. </td>
  163. </tr><!-- Attribute -->
  164. <!-- Start Content -->
  165. <tr>
  166. <td class="attr-title">报告内容<span class="glyphicon glyphicon-star"
  167. style="margin-left: 5px;"></span></td>
  168. <td class="dup-master" colspan="3">
  169. <span th:text="${singleReport.getDescription()}"></span><br/>
  170. <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
  171. th:each="imgUrl,iterStat : ${singleReport.getImgUrls()}"
  172. th:imgUrl="${imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"/>
  173. </td>
  174. </tr>
  175. </tbody>
  176. </table>
  177. </div>
  178. </div>
  179. <div class="col-md-4 pull-right" >
  180. <!--<div id="my_favorite_latin_words" class="box box-info" style="margin-bottom: 5px; min-height: 182px;"></div>-->
  181. <div th:fragment="create_reports" class="box box-danger source-table" id="new-report-create-block" style="display: none">
  182. <div class="box-header" style="border-bottom: 1px #f4f4f4 solid;">
  183. <h3 class="box-title">
  184. 编辑报告
  185. </h3>
  186. <button class="btn-xs btn-primary pull-right" style="margin-left: 5px"
  187. onclick="createOrUpdateFinalReport()">保存
  188. </button>
  189. <button class="btn-xs btn-primary pull-right" onclick="hideCreateBlock()">取消</button>
  190. </div>
  191. <div id="new-report" class="box-body"
  192. style="font-size: 12px; max-height: 340px; overflow: scroll;">
  193. <form role="form">
  194. <!-- select -->
  195. <div class="form-group">
  196. <label>Bug 复现程度</label>
  197. <select id="recurrent" name="recurrent" class="form-control">
  198. <!-- <option th:each="mapItem : ${recurrent2String}"-->
  199. <!-- th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>-->
  200. <option value="1">其他</option>
  201. <option value="2">无规律复现</option>
  202. <option value="3">小概率复现</option>
  203. <option value="4">大概率复现</option>
  204. <option value="5">必现</option>
  205. </select>
  206. </div>
  207. <!-- select -->
  208. <div class="form-group">
  209. <label>Bug 严重性</label>
  210. <select id="severity" name="severity" class="form-control">
  211. <!-- <option th:each="mapItem : ${severity2String}"-->
  212. <!-- th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>-->
  213. <option value="1">待定</option>
  214. <option value="2">较轻</option>
  215. <option value="3">一般</option>
  216. <option value="4">严重</option>
  217. <option value="5">紧急</option>
  218. </select>
  219. </div>
  220. <!-- select -->
  221. <div class="form-group">
  222. <label>Bug 分类</label>
  223. <select id="category" class="form-control">
  224. <!-- <option th:each="mapItem : ${category2String}"-->
  225. <!-- th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>-->
  226. <option value="1">安全</option>
  227. <option value="2">功能不完整</option>
  228. <option value="3">性能</option>
  229. <option value="4">页面布局缺陷</option>
  230. <option value="5">用户体验</option>
  231. <option value="6">不正常退出</option>
  232. <option value="7">其他</option>
  233. </select>
  234. </div>
  235. <!-- textarea -->
  236. <div class="form-group">
  237. <label>Bug 描述</label>
  238. <textarea id="bug-description" name="description" class="form-control" rows="3"
  239. placeholder="Enter ..."></textarea>
  240. </div>
  241. <div class="form-group">
  242. <label>Bug 截图</label>
  243. <div id="new-report-img"></div>
  244. </div>
  245. </form>
  246. </div>
  247. </div>
  248. <div class="box box-info source-table" id="new-report-list-block" >
  249. <div class="box-header">
  250. <h3 class="box-title">
  251. 已创建报告
  252. </h3>
  253. </div>
  254. <div th:fragment="ul_reports" id="new-created-reports-panel">
  255. <div id="new-created-reports" class="box-body"
  256. style="font-size: 12px; max-height: 340px; overflow: scroll;">
  257. <div th:if="${finalReports.size() == 0}" style="font-size: 20px">
  258. 暂无 <a onclick="showCreateBlock()" style="cursor: pointer">立即创建报告</a>
  259. </div>
  260. <ul class="list-group">
  261. <!-- other reports -->
  262. <th:block th:each="finalReport : ${finalReports}">
  263. <li class="list-group-item">
  264. <div style="overflow: auto;">
  265. <span th:text="${finalReport.id}"></span>
  266. <span class="pull-right">
  267. <!-- <a href="#" th:onclick="'editReport('+${finalReport.id}+')'" >编辑</a>-->
  268. <a href="#" th:onclick="'deleteReport('+ ${finalReport.id} +')'">删除</a>
  269. </span>
  270. </div>
  271. <div>
  272. <span>
  273. 复现程度:<span th:text="${recurrent2String.get(finalReport.recurrent)}"></span>
  274. </span>
  275. <span class="pull-right">
  276. 分类:<span th:text="${category2String.get(finalReport.category)}"></span>
  277. </span>
  278. </div>
  279. <div>
  280. 严重程度:<span th:text="${severity2String.get(finalReport.severity)}"></span>
  281. </div>
  282. <br/>
  283. <span th:text="${finalReport.description}"></span>
  284. <br/>
  285. <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
  286. th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
  287. th:imgUrl = "${imgUrl}"
  288. th:onclick="'javascript:showimage(this.getAttribute('imgUrl'));'"/>
  289. </li>
  290. </th:block>
  291. </ul>
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. </div>
  297. </section>
  298. </th:block>
  299. </body>
  300. </html>
  301. <div class="modal fade bs-example-modal-lg text-center" id="imgModal" tabindex="-1" role="dialog"
  302. aria-labelledby="myLargeModalLabel">
  303. <div class="modal-dialog modal-lg" style="display: inline-block; max-width: 900px; max-height: 600px">
  304. <div class="modal-content" style="background: transparent">
  305. <center>
  306. <img id="imgInModalID"
  307. class="carousel-inner img-responsive "
  308. onclick="closeImageViewer()"
  309. onmouseover="this.style.cursor='pointer';this.style.cursor='hand'"
  310. onmouseout="this.style.cursor='default'"
  311. style="max-height: 90vh;
  312. max-width: 90vw;
  313. object-fit: contain;"
  314. />
  315. </center>
  316. </div>
  317. </div>
  318. </div>
  319. <script type="text/javascript">
  320. //显示大图
  321. function showimage(source) {
  322. $("#imgModal").find("#imgInModalID").attr("src", source);
  323. $("#imgModal").modal();
  324. }
  325. //关闭
  326. function closeImageViewer() {
  327. $("#imgModal").modal('hide');
  328. }
  329. </script>
  330. <script src="https://d3js.org/d3.v4.min.js"></script>
  331. <script type="text/javascript" src="/static/js/single_report.js"></script>
  332. <script type="text/javascript" src="/static/js/jqcloud-1.0.4.min.js"></script>
  333. <!--<script type="text/javascript" src="/static/js/partload.js"></script>-->
  334. <script type="text/javascript" xmlns:th="http://www.thymeleaf.org" th:inline="javascript">
  335. /*<![CDATA[*/
  336. var urlParams = new URLSearchParams(window.location.search);
  337. var masterId = urlParams.get('masterId');
  338. var examId = urlParams.get('examId');
  339. var caseId = urlParams.get('caseId');
  340. var finalReportId = urlParams.get('finalReportId');
  341. var reportId = /*[[${reportId}]]*/;
  342. /*]]>*/
  343. var images = [];
  344. $(function () {
  345. var urlParams = new URLSearchParams(window.location.search);
  346. if (urlParams.get("finalReportId")) {
  347. showCreateBlock()
  348. /*<![CDATA[*/
  349. var editReport = /*[[${editReport}]]*/;
  350. /*]]>*/
  351. fillNewReportBlock(editReport);
  352. }
  353. if(finalReportId == null){
  354. $('#create_bug').css('display','block');
  355. }
  356. });
  357. function createOrUpdateFinalReport() {
  358. var report = {
  359. 'description': $("#bug-description").val(),
  360. 'severity': $("#severity").val(),
  361. 'recurrent': $("#recurrent").val(),
  362. 'category': $("#category").val(),
  363. 'sourceId': reportId,
  364. 'reviewerId': 1,
  365. 'examId': examId,
  366. 'caseId': caseId,
  367. 'imgUrls': images
  368. }
  369. console.log("-----")
  370. if (finalReportId) {
  371. report.id = finalReportId
  372. $.ajax({
  373. type: "PUT",
  374. url: '/final_report/'+finalReportId,
  375. data: JSON.stringify(report),
  376. contentType: "application/json",
  377. success: function (data) {
  378. //修改成功的情况
  379. console.log("修改报告")
  380. loadPartReports();
  381. /*<![CDATA[*/
  382. // window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
  383. /*]]>*/
  384. }
  385. });
  386. } else {
  387. // 向服务器新建一个
  388. $.ajax({
  389. type: "POST",
  390. url: '/final_report',
  391. data: JSON.stringify(report),
  392. contentType: "application/json",
  393. success: function (data) {
  394. console.log("新建报告")
  395. console.log(report)
  396. console.log("接下来是data")
  397. console.log(data)
  398. // location.reload()
  399. loadPartReports();
  400. }
  401. });
  402. }
  403. }
  404. function showCreateButton() {
  405. $("#create_bug").show()
  406. }
  407. function loadPartReports() {
  408. console.log("局部刷新")
  409. /*<![CDATA[*/
  410. $('#new-created-reports-panel').load("/created_reports_single?masterId="+ reportId +"&caseId="+ caseId +"&examId="+ examId );
  411. //$('#new-report-create-block').load("/created_reports_form");
  412. finalReportId = null
  413. /*]]>*/
  414. showCreateButton()
  415. $("#new-report-create-block").hide()
  416. $("#new-report-list-block").show()
  417. }
  418. // function syncCreatedReports(){
  419. // syncCreatedReportsWithParams(masterId,examId,caseId);
  420. // }
  421. function showCreateBlock() {
  422. // console.log("show create block")
  423. $("#new-report-create-block").show()
  424. // console.log("show create yse")
  425. $("#new-report-list-block").hide()
  426. console.log("show create three")
  427. }
  428. function hideCreateBlock() {
  429. if (finalReportId){
  430. /*<![CDATA[*/
  431. // window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
  432. // loadPartReports()
  433. $("#create_bug").show()
  434. $("#bug-description").text("")
  435. finalReportId = null
  436. /*]]>*/
  437. }
  438. $("#new-report-create-block").hide()
  439. $("#new-report-list-block").show()
  440. }
  441. function fillNewReportBlock(editReport) {
  442. console.log(editReport);
  443. console.log("开始填充报告页面。")
  444. $("#recurrent").val(editReport.recurrent);
  445. $("#severity").val(editReport.severity);
  446. $("#category").val(editReport.category);
  447. $("#bug-description").val(editReport.description);
  448. var $new_report_img = $("#new-report-img");
  449. $new_report_img.empty()
  450. images = [];
  451. /*<![CDATA[*/
  452. for (var i=0;editReport.imgUrls!=null&&i<editReport.imgUrls.length;i++) {
  453. var src = editReport.imgUrls[i]
  454. images.push(src);
  455. var $img = $('<img />')
  456. $img.attr("src", src);
  457. $img.attr("class", "my-img-thumbnail pointer to-delete");
  458. $img.on("click", function (){
  459. showimage(src);
  460. });
  461. $img.on("dragend", function (e) {
  462. var src = $(e.target).attr("src");
  463. var idx = images.indexOf(src);
  464. if (idx >= 0) {
  465. images.splice(idx, 1);
  466. }
  467. $(e.target).remove();
  468. });
  469. $new_report_img.append($img)
  470. }
  471. /*]]>*/
  472. }
  473. function deleteReport(finalReportId) {
  474. $.ajax({
  475. url: '/final_report/' + finalReportId,
  476. type: 'DELETE',
  477. success: function (result) {
  478. // Do something with the result
  479. alert("删除成功");
  480. loadPartReports();
  481. }
  482. });
  483. }
  484. function editReport (finalId){
  485. //填充编辑表单页面。
  486. /*<![CDATA[*/
  487. $.ajax({
  488. url: '/editReportData?masterId='+reportId+'&finalReportId='+finalId,
  489. type: 'GET',
  490. success: function (result) {
  491. console.log(result); //
  492. finalReportId = finalId;
  493. fillNewReportBlock(result)
  494. showCreateBlock();
  495. }
  496. });
  497. /*]]>*/
  498. }
  499. function reviewConfirm() {
  500. $.ajax({
  501. url: '/single_bug_review?reportId='+reportId,
  502. type: 'PUT',
  503. success: function (result) {
  504. if(result=="success"){
  505. alert("确认审核成功,修改报告状态为已审核");
  506. location.reload();
  507. }else {
  508. alert("还有所属该报告的聚合报告或树状报告尚未审核")
  509. }
  510. }
  511. });
  512. }
  513. </script>