agg_report_new.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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. <!-- <button id="backButton" onclick="showMainReport()" style="display: none; " >返回</button>-->
  61. <h1 id="mainTitle">融合报告详情
  62. <small th:text="${aggReportId}"></small>
  63. <button id="backButton" type="button" class="btn btn-default" onclick="showAggMainReport()" style="display: none; " >返回</button>
  64. </h1>
  65. <!-- <h1>Summary for report 0-5</h1> -->
  66. <!-- <small style="font-style: italic;">at 50% report-level and 25% supplementary level</small> -->
  67. <ol class="breadcrumb">
  68. <!-- style="margin-right: 173px;" -->
  69. <li>
  70. <a href="/home">
  71. <i class="fa fa-dashboard"></i>
  72. 全部任务
  73. </a>
  74. </li>
  75. <li>
  76. <a th:href="'/agg_report_list?examId='+${examId}+'&amp;caseId='+${caseId}">
  77. 审核列表
  78. </a>
  79. </li>
  80. <li class="active" th:text="${aggReportId}">
  81. </li>
  82. </ol>
  83. </section>
  84. <section class="content container-fluid">
  85. <div style="overflow: auto;" class="row">
  86. <div class="col-md-8" id="summary" th:fragment="masterBody">
  87. <div class="box box-info detail-table">
  88. <div class="box-header with-border" style="padding: 4px;">
  89. <i class="fa fa-object-group" style="color: #00c0ef;"></i>
  90. <h3 class="box-title" th:text="${aggReportId}">
  91. </h3>
  92. <button class="btn-xs btn-primary pull-right" id="create_bug" style="margin-left: 5px;display: none" onclick="showCreateBlock()" >
  93. 创建缺陷报告
  94. </button>
  95. <button class="btn-xs btn-primary pull-right" id="review_confirm" th:unless="${reviewed}" onclick="reviewConfirm()">确认审核</button>
  96. <span th:if="${reviewed}" class="pull-right label label-success">
  97. <span class="glyphicon glyphicon-ok"></span>
  98. 已审核
  99. </span>
  100. </div>
  101. <table class="table table-reponsive">
  102. <tbody>
  103. <tr>
  104. <td class="attr-title">创建时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  105. <td class="dup-create-time" th:text="${#dates.format(createTime, 'yyyy-MM-dd')}"></td>
  106. <td class="attr-title">Bug 严重性</td>
  107. <td class="dup-severity">
  108. <span th:each="severityCount : ${severityCounts}" >
  109. <span th:text="${severityCount.key}"></span>
  110. <span class="badge" th:text="${severityCount.value}"></span>
  111. </span>
  112. <span th:if="${severityCounts.size()}==0">
  113. 该报告没有补充报告
  114. </span>
  115. </td>
  116. </tr>
  117. <tr>
  118. <td class="attr-title">Bug分类&nbsp;&nbsp;&nbsp;&nbsp;</td>
  119. <td class="dup-category" colspan="3">
  120. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  121. <span th:each="categoryCount : ${categoryCounts}">
  122. <span th:text="${categoryCount.key}"></span>
  123. <span class="badge" th:text="${categoryCount.value}"></span>
  124. </span>
  125. <span th:if="${categoryCounts.size()}==0">
  126. 该报告没有补充报告
  127. </span>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td class="attr-title">三级页面&nbsp;&nbsp;&nbsp;&nbsp;</td>
  132. <td class="dup-category" colspan="3">
  133. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  134. <span th:each="pageCount : ${pageCounts}">
  135. <span th:text="${pageCount.key}"></span>
  136. <span class="badge" th:text="${pageCount.value}"></span>
  137. </span>
  138. <span th:if="${pageCounts.size()}==0">
  139. 该报告没有补充报告
  140. </span>
  141. </td>
  142. </tr>
  143. <tr>
  144. <td class="attr-title">复现程度&nbsp;&nbsp;&nbsp;&nbsp;</td>
  145. <td class="dup-category" colspan="3">
  146. <!--<i class="fa fa-square" style="color: {{ category.category_color }};"></i>-->
  147. <span th:each="recurrentCount : ${recurrentCounts}">
  148. <span th:text="${recurrentCount.key}"></span>
  149. <span class="badge" th:text="${recurrentCount.value}"></span>
  150. </span>
  151. <span th:if="${recurrentCounts.size()}==0">
  152. 该报告没有补充报告
  153. </span>
  154. </td>
  155. </tr>
  156. <tr>
  157. <td class="attr-title">审核人</td>
  158. <td class="dup-assignee" colspan="3">
  159. <a href="#" style="margin-right: 5px;">
  160. <i class="fa fa-vcard"></i>
  161. admin
  162. </a>
  163. </td>
  164. </tr><!-- Attribute -->
  165. <!-- Start Content -->
  166. <tr>
  167. <td class="attr-title">主要点<span class="glyphicon glyphicon-star"
  168. style="margin-left: 5px;"></span></td>
  169. <td class="dup-master" colspan="3">
  170. <span th:text="${masterReport.getDescription()}"></span><br/>
  171. <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
  172. th:each="imgUrl,iterStat : ${masterReport.getImgUrls()}"
  173. th:imgUrl="${imgUrl}"
  174. th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"/>
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="attr-title">补充点</td>
  179. <td class="dup-supplementary" colspan="3">
  180. <ul id="sup-list" class="list-group"
  181. style="max-height: 450px; margin-bottom: 0px; overflow: scroll;">
  182. <li class="list-group-item" style="padding: 3px 3px;"
  183. th:each="supplement, iterStat : ${supplements}">
  184. <p style="border-bottom: 1px solid #ddd; margin: 0 0 1px;">
  185. <b><a href="#" th:text="'补充点 ' + ${iterStat.count}"> </a></b>
  186. <a th:href="'#sup-' + ${iterStat.count}"
  187. class="glyphicon glyphicon-menu-hamburger pull-right sup-collapse"
  188. data-toggle="collapse" style="color: #000;"></a>
  189. </p>
  190. <div class="sup-title">
  191. <!-- 如果有文字,则仅显示top 1的diff_sentence,并且不展示图片 -->
  192. <span th:if="${supplement.hasTxt}"
  193. th:text="'...' + ${supplement.topTxt} + '...'"></span>
  194. <img th:if="${!supplement.hasTxt}" class="my-img-thumbnail pointer to-add"
  195. th:src="${imgUrl}" th:each="imgUrl,iterStat : ${supplement.top3Img}"
  196. th:imgUrl="${imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"
  197. />
  198. </div>
  199. <div th:id="'sup-' + ${iterStat.count}" class="collapse">
  200. <ul class="list-group" style="margin-bottom: 0px;">
  201. <li class="list-group-item" style="padding: 3px 3px;"
  202. th:each="report : ${supplement.bugs}">
  203. <span class="glyphicon glyphicon-file"
  204. style="color: #3c8dbc; margin-right: 5px;"></span>
  205. <a th:href="'/report/'+${report.id}+'?examId=' + ${examId} + '&amp;caseId=' + ${caseId}" style="margin-right: 5px;" th:text="${report.id}"></a>
  206. <!--查看树状报告-->
  207. <span th:if="${single2root.get(report.id)!=null} and ${showReference}"
  208. th:treeId="${single2root.get(report.id)}"
  209. th:onclick="javascript:changeToTree(this.getAttribute('treeId'))"
  210. class="glyphicon glyphicon-tree-conifer"
  211. style="color: #07b309; margin-right: 5px;" >
  212. </span>
  213. <!-- de scription -->
  214. <th:block th:each="sent, iterStat : ${report.taggedSentences}">
  215. <span th:if="${sent.isDiff()}" th:text="${sent.sentence}"
  216. style="color: red; font-weight: bold;"></span>
  217. <span th:unless="${sent.isDiff()}"
  218. th:text="${sent.sentence}"></span>
  219. </th:block>
  220. <br/>
  221. <!-- imgs -->
  222. <th:block th:each="img, iterStat : ${report.taggedImgs}">
  223. <img class="my-img-thumbnail pointer to-add"
  224. th:style="${img.isDiff()? 'border: 2px solid red;' : ''}"
  225. th:src="${img.imgUrl}"
  226. th:imgUrl="${img.imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"
  227. />
  228. </th:block>
  229. </li>
  230. </ul>
  231. </div>
  232. </li>
  233. </ul>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. </div>
  239. </div>
  240. <div id="treePart">
  241. </div>
  242. <div class="col-md-4 pull-right" >
  243. <!--<div id="my_favorite_latin_words" class="box box-info" style="margin-bottom: 5px; min-height: 182px;"></div>-->
  244. <div th:fragment="create_reports" class="box box-danger source-table" id="new-report-create-block" style="display: none">
  245. <div class="box-header" style="border-bottom: 1px #f4f4f4 solid;">
  246. <h3 class="box-title">
  247. 编辑报告
  248. </h3>
  249. <button class="btn-xs btn-primary pull-right" style="margin-left: 5px"
  250. onclick="createOrUpdateFinalReport()">保存
  251. </button>
  252. <button class="btn-xs btn-primary pull-right" onclick="hideCreateBlock()">取消</button>
  253. </div>
  254. <div id="new-report" class="box-body"
  255. style="font-size: 12px; max-height: 340px; overflow: scroll;">
  256. <form role="form">
  257. <!-- select -->
  258. <div class="form-group">
  259. <label>Bug 复现程度</label>
  260. <select id="recurrent" name="recurrent" class="form-control">
  261. <!-- <option th:each="mapItem : ${recurrent2String}"-->
  262. <!-- th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>-->
  263. <option value="1">其他</option>
  264. <option value="2">无规律复现</option>
  265. <option value="3">小概率复现</option>
  266. <option value="4">大概率复现</option>
  267. <option value="5">必现</option>
  268. </select>
  269. </div>
  270. <!-- select -->
  271. <div class="form-group">
  272. <label>Bug 严重性</label>
  273. <select id="severity" name="severity" class="form-control">
  274. <!-- <option th:each="mapItem : ${severity2String}"-->
  275. <!-- th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>-->
  276. <option value="1">待定</option>
  277. <option value="2">较轻</option>
  278. <option value="3">一般</option>
  279. <option value="4">严重</option>
  280. <option value="5">紧急</option>
  281. </select>
  282. </div>
  283. <!-- select -->
  284. <div class="form-group">
  285. <label>Bug 分类</label>
  286. <select id="category" class="form-control">
  287. <!-- <option th:each="mapItem : ${category2String}"-->
  288. <!-- th:value="${mapItem.key}" th:text="${mapItem.value}">必现</option>-->
  289. <option value="1">安全</option>
  290. <option value="2">功能不完整</option>
  291. <option value="3">性能</option>
  292. <option value="4">页面布局缺陷</option>
  293. <option value="5">用户体验</option>
  294. <option value="6">不正常退出</option>
  295. <option value="7">其他</option>
  296. </select>
  297. </div>
  298. <!-- textarea -->
  299. <div class="form-group">
  300. <label>Bug 描述</label>
  301. <textarea id="bug-description" name="description" class="form-control" rows="3"
  302. placeholder="Enter ..."></textarea>
  303. </div>
  304. <div class="form-group">
  305. <label>Bug 截图</label>
  306. <div id="new-report-img"></div>
  307. </div>
  308. </form>
  309. </div>
  310. </div>
  311. <div class="box box-info source-table" id="new-report-list-block" >
  312. <div class="box-header">
  313. <h3 class="box-title">
  314. 已创建报告
  315. </h3>
  316. </div>
  317. <div th:fragment="ul_reports" id="new-created-reports-panel">
  318. <div id="new-created-reports" class="box-body"
  319. style="font-size: 12px; max-height: 340px; overflow: scroll;">
  320. <div th:if="${finalReports.size() == 0}" style="font-size: 20px">
  321. 暂无 <a onclick="showCreateBlock()" style="cursor: pointer">立即创建报告</a>
  322. </div>
  323. <ul class="list-group">
  324. <!-- other reports -->
  325. <th:block th:each="finalReport : ${finalReports}">
  326. <li class="list-group-item">
  327. <div style="overflow: auto;">
  328. <span th:text="${finalReport.id}"></span>
  329. <span class="pull-right">
  330. <a href="#" th:finalId="${finalReport.id}" th:onclick="editReport(this.getAttribute('finalId'))" >编辑</a>
  331. <a href="#" th:finalId="${finalReport.id}" th:onclick="deleteReport(this.getAttribute('finalId'))">删除</a>
  332. </span>
  333. </div>
  334. <div>
  335. <span>
  336. 复现程度:<span th:text="${recurrent2String.get(finalReport.recurrent)}"></span>
  337. </span>
  338. <span class="pull-right">
  339. 分类:<span th:text="${category2String.get(finalReport.category)}"></span>
  340. </span>
  341. </div>
  342. <div>
  343. 严重程度:<span th:text="${severity2String.get(finalReport.severity)}"></span>
  344. </div>
  345. <br/>
  346. <span th:text="${finalReport.description}"></span>
  347. <br/>
  348. <img class="my-img-thumbnail pointer to-add" th:src="${imgUrl}"
  349. th:each="imgUrl,iterStat : ${finalReport.getImgUrls()}"
  350. th:imgUrl="${imgUrl}" th:onclick="javascript : showimage(this.getAttribute('imgUrl'))"
  351. />
  352. </li>
  353. </th:block>
  354. </ul>
  355. </div>
  356. </div>
  357. </div>
  358. </div>
  359. </div>
  360. <div style="overflow: auto;" class="row tree-container">
  361. <div class="col-md-8 tree-wrapper">
  362. <div class="box box-info pull-left svg-div" style="background-color: rgb(247, 247, 247); ">
  363. <h4 style="padding-left: 10px;" class="pull-left" id="showPicture">聚合图</h4>
  364. <svg class="graph" id="tree" width="100%" height="420" viewBox="0 0 700 350">
  365. <g transform="translate(10,20)" id="tree-g">
  366. <g class="links"></g>
  367. <g class="nodes"></g>
  368. </g>
  369. </svg>
  370. </div>
  371. </div>
  372. <div class="col-md-4">
  373. <div class="detail-div"
  374. style="height: 459px; max-height: 459px; font-size: 10px; overflow: scroll;">
  375. </div>
  376. </div>
  377. </div>
  378. </section>
  379. </th:block>
  380. </body>
  381. </html>
  382. <div class="modal fade bs-example-modal-lg text-center" id="imgModal" tabindex="-1" role="dialog"
  383. aria-labelledby="myLargeModalLabel">
  384. <div class="modal-dialog modal-lg" style="display: inline-block; max-width: 900px; max-height: 600px">
  385. <div class="modal-content" style="background: transparent">
  386. <center>
  387. <img id="imgInModalID"
  388. class="carousel-inner img-responsive "
  389. onclick="closeImageViewer()"
  390. onmouseover="this.style.cursor='pointer';this.style.cursor='hand'"
  391. onmouseout="this.style.cursor='default'"
  392. style="max-height: 90vh;
  393. max-width: 90vw;
  394. object-fit: contain;"
  395. />
  396. </center>
  397. </div>
  398. </div>
  399. </div>
  400. <script type="text/javascript">
  401. //显示大图
  402. function showimage(source) {
  403. $("#imgModal").find("#imgInModalID").attr("src", source);
  404. $("#imgModal").modal();
  405. }
  406. //关闭
  407. function closeImageViewer() {
  408. $("#imgModal").modal('hide');
  409. }
  410. </script>
  411. <script src="https://d3js.org/d3.v4.min.js"></script>
  412. <script type="text/javascript" src="/static/js/agg_report_new.js"></script>
  413. <script type="text/javascript" src="/static/js/tree_report_new.js"></script>
  414. <script type="text/javascript" src="/static/js/jqcloud-1.0.4.min.js"></script>
  415. <!--<script type="text/javascript" src="/static/js/partload.js"></script>-->
  416. <script type="text/javascript" xmlns:th="http://www.thymeleaf.org" th:inline="javascript">
  417. /*<![CDATA[*/
  418. var word_list = /*[[${wordList}]]*/; //源代码如此
  419. var urlParams = new URLSearchParams(window.location.search);
  420. var masterId = urlParams.get('masterId');
  421. var examId = urlParams.get('examId');
  422. var caseId = urlParams.get('caseId');
  423. var finalReportId = urlParams.get('finalReportId');
  424. /*]]>*/
  425. word_list = JSON.parse(word_list)
  426. var images = [];
  427. $(function () {
  428. // $("#my_favorite_latin_words").jQCloud(word_list,
  429. // {
  430. // shape: "rectangular",
  431. // autoResize: true
  432. // });
  433. //去除掉报告详情界面的词云
  434. var urlParams = new URLSearchParams(window.location.search);
  435. if (urlParams.get("finalReportId")) {
  436. showCreateBlock()
  437. /*<![CDATA[*/
  438. var editReport = /*[[${editReport}]]*/;
  439. /*]]>*/
  440. fillNewReportBlock(editReport);
  441. }
  442. if(finalReportId == null){
  443. $('#create_bug').css('display','block');
  444. }
  445. });
  446. function createOrUpdateFinalReport() {
  447. var report = {
  448. 'description': $("#bug-description").val(),
  449. 'severity': $("#severity").val(),
  450. 'recurrent': $("#recurrent").val(),
  451. 'category': $("#category").val(),
  452. 'sourceId': masterId,
  453. 'reviewerId': 1,
  454. 'examId': examId,
  455. 'caseId': caseId,
  456. 'imgUrls': images
  457. }
  458. if (finalReportId) {
  459. report.id = finalReportId
  460. $.ajax({
  461. type: "PUT",
  462. url: '/final_report/'+finalReportId,
  463. data: JSON.stringify(report),
  464. contentType: "application/json",
  465. success: function (data) {
  466. //修改成功的情况
  467. console.log("修改报告")
  468. loadPartReports();
  469. /*<![CDATA[*/
  470. // window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
  471. /*]]>*/
  472. }
  473. });
  474. } else {
  475. // 向服务器新建一个
  476. $.ajax({
  477. type: "POST",
  478. url: '/final_report',
  479. data: JSON.stringify(report),
  480. contentType: "application/json",
  481. success: function (data) {
  482. console.log("新建报告")
  483. // location.reload()
  484. loadPartReports();
  485. }
  486. });
  487. }
  488. }
  489. //展示树状报告
  490. changeToTree = function (treeId) { //
  491. // alert(treeId);
  492. // $('#summary').hide();
  493. /*<![CDATA[*/
  494. $('#summary').hide();
  495. $("#treePart").load("/history/report_part?treeId="+treeId+"&caseId="+ caseId +"&examId="+ examId);
  496. //$('#new-report-create-block').load("/created_reports_form");
  497. $("#backButton").show();
  498. $('#treePart').show();
  499. $('#showPicture').html("树状图")
  500. //initTree(treeId);
  501. initTreeReport(treeId);
  502. }
  503. initTreeReport = function(tree){
  504. console.log("start init Tree");
  505. $('.sup-collapse').click(function () {
  506. var dupTitle = $(this).parents('li').find('.sup-title');
  507. dupTitle.toggle();
  508. });
  509. initTree(tree);
  510. console.log("---end---")
  511. }
  512. refreshPhotoDrag = function () {
  513. $(".to-add").on("dragend", function (e) {
  514. var src = $(e.target).attr("src");
  515. if (images.indexOf(src) < 0) {
  516. images.push(src);
  517. var $img = createImg(src);
  518. $img.on("dragend", function (e) {
  519. var src = $(e.target).attr("src");
  520. var idx = images.indexOf(src);
  521. if (idx >= 0) {
  522. images.splice(idx, 1);
  523. }
  524. $(e.target).remove();
  525. });
  526. $("#new-report-img").append($img)
  527. }
  528. });
  529. }
  530. //创建Img
  531. function createImg(src) {
  532. var $img = $('<img />')
  533. $img.attr("src", src);
  534. $img.attr("class", "my-img-thumbnail pointer to-delete");
  535. $img.on("click", function (){
  536. showimage(src);
  537. });
  538. return $img;
  539. }
  540. showAggMainReport = function () {
  541. $('#summary').show();
  542. $('#treePart').hide();
  543. $('#backButton').hide();
  544. initMaster(masterId);
  545. $('#showPicture').html("聚合图")
  546. }
  547. function showCreateButton() {
  548. $("#create_bug").show()
  549. }
  550. function loadPartReports() {
  551. console.log("局部刷新")
  552. /*<![CDATA[*/
  553. $('#new-created-reports-panel').load("/created_reports?masterId="+ masterId +"&caseId="+ caseId +"&examId="+ examId );
  554. //$('#new-report-create-block').load("/created_reports_form");
  555. finalReportId = null
  556. /*]]>*/
  557. showCreateButton()
  558. $("#new-report-create-block").hide()
  559. $("#new-report-list-block").show()
  560. }
  561. function showCreateBlock() {
  562. // console.log("show create block")
  563. $("#new-report-create-block").show()
  564. // console.log("show create yse")
  565. $("#new-report-list-block").hide()
  566. console.log("show create three")
  567. }
  568. function hideCreateBlock() {
  569. if (finalReportId){
  570. /*<![CDATA[*/
  571. // window.location.href='report?masterId='+masterId+'&examId='+examId+'&caseId='+caseId
  572. // loadPartReports()
  573. $("#create_bug").show()
  574. $("#bug-description").text("")
  575. finalReportId = null
  576. /*]]>*/
  577. }
  578. $("#new-report-create-block").hide()
  579. $("#new-report-list-block").show()
  580. }
  581. function fillNewReportBlock(editReport) {
  582. console.log(editReport);
  583. console.log("开始填充报告页面。")
  584. $("#recurrent").val(editReport.recurrent);
  585. $("#severity").val(editReport.severity);
  586. $("#category").val(editReport.category);
  587. $("#bug-description").val(editReport.description);
  588. var $new_report_img = $("#new-report-img");
  589. $new_report_img.empty()
  590. images = [];
  591. /*<![CDATA[*/
  592. for (var i=0;editReport.imgUrls!=null&&i<editReport.imgUrls.length;i++) {
  593. var src = editReport.imgUrls[i]
  594. images.push(src);
  595. var $img = $('<img />')
  596. $img.attr("src", src);
  597. $img.attr("class", "my-img-thumbnail pointer to-delete");
  598. $img.on("click", function (){
  599. showimage(src);
  600. });
  601. $img.on("dragend", function (e) {
  602. var src = $(e.target).attr("src");
  603. var idx = images.indexOf(src);
  604. if (idx >= 0) {
  605. images.splice(idx, 1);
  606. }
  607. $(e.target).remove();
  608. });
  609. $new_report_img.append($img)
  610. }
  611. /*]]>*/
  612. }
  613. function deleteReport(finalReportId) {
  614. $.ajax({
  615. url: '/final_report/' + finalReportId,
  616. type: 'DELETE',
  617. success: function (result) {
  618. // Do something with the result
  619. alert("删除成功");
  620. loadPartReports();
  621. }
  622. });
  623. }
  624. function editReport (finalId){
  625. //填充编辑表单页面。
  626. /*<![CDATA[*/
  627. $.ajax({
  628. url: '/editReportData?masterId='+masterId+'&finalReportId='+finalId,
  629. type: 'GET',
  630. success: function (result) {
  631. console.log(result); //
  632. finalReportId = finalId;
  633. fillNewReportBlock(result)
  634. showCreateBlock();
  635. }
  636. });
  637. /*]]>*/
  638. }
  639. function reviewConfirm() {
  640. $.ajax({
  641. url: '/single_bug_review?reportId='+masterId,
  642. type: 'PUT',
  643. success: function (result) {
  644. if(result=="success"){
  645. alert("确认审核成功,修改报告状态为已审核");
  646. location.reload();
  647. }else {
  648. alert("还有所属该报告的聚合报告或树状报告尚未审核")
  649. };
  650. }
  651. });
  652. }
  653. </script>