海南旅游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.

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