bug.ui.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. $(document).off('click', '.batch-btn').on('click', '.batch-btn', function()
  2. {
  3. const dtable = zui.DTable.query($(this).target);
  4. const checkedList = dtable.$.getChecks();
  5. if(!checkedList.length) return;
  6. const url = $(this).data('url');
  7. const form = new FormData();
  8. checkedList.forEach((id) => form.append('bugIdList[]', id));
  9. if($(this).hasClass('ajax-btn'))
  10. {
  11. $.ajaxSubmit({url, data:form});
  12. }
  13. else
  14. {
  15. postAndLoadPage(url, form);
  16. }
  17. });
  18. /**
  19. * 标题列显示额外的内容。
  20. * Display extra content in the title column.
  21. *
  22. * @param object result
  23. * @param object info
  24. * @access public
  25. * @return object
  26. */
  27. window.onRenderCell = function(result, {row, col})
  28. {
  29. if(result && col.name == 'title')
  30. {
  31. if(row.data.color) result[0].props.style = 'color: ' + row.data.color;
  32. const module = this.options.modules[row.data.module];
  33. if(module) result.unshift({html: '<span class="label gray-pale rounded-full nowrap">' + module + '</span>'}); // 添加模块标签
  34. if(parseInt(row.data.case))
  35. {
  36. caseLink = $.createLink('testcase', 'view', "caseID=" + row.data.case + "&version=" + row.data.caseVersion);
  37. result.push({html: '<a href="' + caseLink + '"class="text-gray" title="' + row.data.case + '">[' + caseCommonLang + '#' + row.data.case + ']</a>'});
  38. }
  39. }
  40. if(col.name == 'deadline' && result[0])
  41. {
  42. const bug = row.data;
  43. if(['resolved', 'closed'].includes(bug.status)) return result;
  44. const yesterday = zui.formatDate(zui.createDate() - 24 * 60 * 60 * 1000, 'yyyy-MM-dd');
  45. if(result[0] <= yesterday) result[0] = {html: '<span class="label danger-pale rounded-full size-sm">' + result[0] + '</span>'};
  46. }
  47. return result;
  48. }