browse.ui.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * 计算表格信息的统计。
  3. * Set summary for table footer.
  4. *
  5. * @param element element
  6. * @param array checks
  7. * @access public
  8. * @return object
  9. */
  10. window.setStatistics = function(element, checks)
  11. {
  12. var totalRiskCount = element.options.data.length;
  13. var activeRiskCount = hangupRiskCount = 0;
  14. var summary = '';
  15. if(checks.length)
  16. {
  17. summary = checkedSummary;
  18. totalRiskCount = checks.length;
  19. checks.forEach((id) => {
  20. const risk = element.getRowInfo(id).data;
  21. if(risk.status == 'active') activeRiskCount ++;
  22. if(risk.status == 'hangup') hangupRiskCount ++;
  23. });
  24. }
  25. else
  26. {
  27. summary = pageSummary;
  28. element.options.data.forEach((risk) => {
  29. if(risk.status == 'active') activeRiskCount ++;
  30. if(risk.status == 'hangup') hangupRiskCount ++;
  31. });
  32. }
  33. summary = summary.replace('%total%', totalRiskCount)
  34. .replace('%active%', activeRiskCount)
  35. .replace('%hangup%', hangupRiskCount);
  36. $('.dtable-check-info').attr('title', summary.replace(/<[^>]+>/g,""));
  37. return {html: summary};
  38. }
  39. window.getCheckedCaseIdList = function()
  40. {
  41. var riskIdList = '';
  42. const dtable = zui.DTable.query('#table-risk-browse');
  43. $.each(dtable.$.getChecks(), function(index, riskID)
  44. {
  45. if(index > 0) riskIdList += ',';
  46. riskIdList += riskID;
  47. });
  48. $('#riskIdList').val(riskIdList);
  49. }