海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. const workordertimer = setInterval(function () {
  2. $.ajax({
  3. url: '/'+window.location.pathname.split('/')[1]+'/workorder_notice',
  4. type: 'POST',
  5. data: {},
  6. dataType: 'json',
  7. success: function (res) {
  8. let notice = res.notice ? res.notice : '';
  9. let badge = res.badge ? res.badge : '';
  10. if (notice == 1) {
  11. Dcat.info("你有新的工单信息 <a href='/"+window.location.pathname.split('/')[1]+"/workorder_item' target='_blank'>[前往查看]</a>", '新消息提醒', {
  12. closeButton: true,
  13. escapeHtml: false,
  14. timeOut: 10000,
  15. extendedTimeOut: 5000,
  16. onHidden: function () {
  17. if (window.location.pathname == '/'+window.location.pathname.split('/')[1]+'/workorder_item') {
  18. location.reload()
  19. }
  20. }
  21. })
  22. }
  23. if (badge > 0) {
  24. if ($('a[href*="workorder_item"] p .workorder_badge').length > 0) {
  25. $('a[href*="workorder_item"] p .workorder_badge').text(badge);
  26. } else {
  27. $('a[href*="workorder_item"] p').append('<span class="workorder_badge" style="' +
  28. 'display: inline-block; ' +
  29. 'width: 20px; ' +
  30. 'height: 20px; ' +
  31. 'border-radius: 20px; ' +
  32. 'line-height: 20px; ' +
  33. 'text-align: center; ' +
  34. 'font-size: 12px; ' +
  35. 'background-color: red;' +
  36. 'color: white;' +
  37. '">'+badge+'</span>');
  38. }
  39. if ($('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').length > 0) {
  40. $('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').text(badge);
  41. } else {
  42. $('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p').append('<span class="workorder_badge" style="' +
  43. 'display: inline-block; ' +
  44. 'width: 20px; ' +
  45. 'height: 20px; ' +
  46. 'border-radius: 20px; ' +
  47. 'line-height: 20px; ' +
  48. 'text-align: center; ' +
  49. 'font-size: 12px; ' +
  50. 'background-color: red;' +
  51. 'color: white;' +
  52. '">' + badge + '</span>');
  53. }
  54. } else {
  55. $('a[href*="workorder_item"] p .workorder_badge').remove()
  56. $('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').remove()
  57. }
  58. },
  59. error: function (error) {
  60. }
  61. });
  62. }, 5000);