build.ui.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. window.renderCell = function(result, {col, row})
  2. {
  3. if(col.name == 'path')
  4. {
  5. result[0] = '';
  6. if(row.data.pathType == 'scmPath' && row.data.scmPath)
  7. {
  8. const colorStyle = row.data.scmPath.indexOf('http') === 0 ? "style='color:#2463c7;'" : '';
  9. let scmPathHtml = '';
  10. scmPathHtml += "<div><i class='icon icon-file-code' " + colorStyle + "title='" + scmPathTip + "'></i> ";
  11. scmPathHtml += "<span title='" + row.data.scmPath + "'>";
  12. scmPathHtml += colorStyle.length ? "<a target='_blank' " + colorStyle + " href='" + row.data.scmPath + "'>" + row.data.scmPath + "</a>" : row.data.scmPath;
  13. scmPathHtml += '</span></div>';
  14. result[result.length] = {html: scmPathHtml};
  15. }
  16. if(row.data.pathType == 'filePath' && row.data.filePath)
  17. {
  18. const colorStyle = row.data.filePath.indexOf('http') === 0 ? "style='color:#2463c7;'" : '';
  19. let filePathHtml = '';
  20. filePathHtml += "<div><i class='icon icon-download' " + colorStyle + "title='" + filePathTip + "'></i> ";
  21. filePathHtml += "<span title='" + row.data.filePath + "'>";
  22. filePathHtml += colorStyle.length ? "<a target='_blank' " + colorStyle + " href='" + row.data.filePath + "'>" + row.data.filePath + "</a>" : row.data.filePath;
  23. filePathHtml += '</span></div>';
  24. result[result.length] = {html: filePathHtml};
  25. }
  26. return result;
  27. }
  28. return result;
  29. }
  30. /**
  31. * Change product.
  32. *
  33. * @access public
  34. * @return void
  35. */
  36. window.changeProduct = function()
  37. {
  38. const link = changeProductLink.replace('{productID}', $(this).find('[name="product"]').val());
  39. loadPage(link);
  40. }
  41. /**
  42. * 合并单元格。
  43. * cell span in the column.
  44. *
  45. * @param object cell
  46. * @access public
  47. * @return object
  48. */
  49. window.getCellSpan = function(cell)
  50. {
  51. if(['id', 'name', 'productName', 'branchName', 'system', 'builder', 'date', 'actions'].includes(cell.col.name) && cell.row.data.rowspan)
  52. {
  53. return {rowSpan: cell.row.data.rowspan};
  54. }
  55. }