|
|
|
@ -4,9 +4,13 @@ const workordertimer = setInterval(function () { |
|
|
|
url: '/'+window.location.pathname.split('/')[1]+'/workorder_notice', |
|
|
|
type: 'POST', |
|
|
|
data: {}, |
|
|
|
dataType: 'text', |
|
|
|
dataType: 'json', |
|
|
|
success: function (res) { |
|
|
|
if (res == true) { |
|
|
|
|
|
|
|
let notice = res.notice ? res.notice : ''; |
|
|
|
let badge = res.badge ? res.badge : ''; |
|
|
|
|
|
|
|
if (notice == 1) { |
|
|
|
Dcat.info("你有新的工单信息 <a href='/"+window.location.pathname.split('/')[1]+"/workorder_item' target='_blank'>[前往查看]</a>", '新消息提醒', { |
|
|
|
closeButton: true, |
|
|
|
escapeHtml: false, |
|
|
|
@ -19,21 +23,10 @@ const workordertimer = setInterval(function () { |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function (error) { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
url: '/'+window.location.pathname.split('/')[1]+'/workorder_notice', |
|
|
|
type: 'POST', |
|
|
|
data: {badge: 1}, |
|
|
|
dataType: 'text', |
|
|
|
success: function (res) { |
|
|
|
if (res > 0) { |
|
|
|
if (badge > 0) { |
|
|
|
if ($('a[href*="workorder_item"] p .workorder_badge').length > 0) { |
|
|
|
$('a[href*="workorder_item"] p .workorder_badge').text(res); |
|
|
|
$('a[href*="workorder_item"] p .workorder_badge').text(badge); |
|
|
|
} else { |
|
|
|
$('a[href*="workorder_item"] p').append('<span class="workorder_badge" style="' + |
|
|
|
'display: inline-block; ' + |
|
|
|
@ -45,11 +38,11 @@ const workordertimer = setInterval(function () { |
|
|
|
'font-size: 12px; ' + |
|
|
|
'background-color: red;' + |
|
|
|
'color: white;' + |
|
|
|
'">'+res+'</span>'); |
|
|
|
'">'+badge+'</span>'); |
|
|
|
} |
|
|
|
|
|
|
|
if ($('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').length > 0) { |
|
|
|
$('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').text(res); |
|
|
|
$('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').text(badge); |
|
|
|
} else { |
|
|
|
$('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p').append('<span class="workorder_badge" style="' + |
|
|
|
'display: inline-block; ' + |
|
|
|
@ -61,8 +54,11 @@ const workordertimer = setInterval(function () { |
|
|
|
'font-size: 12px; ' + |
|
|
|
'background-color: red;' + |
|
|
|
'color: white;' + |
|
|
|
'">' + res + '</span>'); |
|
|
|
'">' + badge + '</span>'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
$('a[href*="workorder_item"] p .workorder_badge').remove() |
|
|
|
$('a[href*="workorder_item"]').parent().parent().parent(':not(.menu-open)').find('a[href="#"] p .workorder_badge').remove() |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function (error) { |
|
|
|
@ -70,4 +66,4 @@ const workordertimer = setInterval(function () { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}, 1000); |
|
|
|
}, 5000); |