agg_report_new.html 31 KB

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