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
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							76 lines
						
					
					
						
							2.4 KiB
						
					
					
				
								function workorderNotice()
							 | 
						|
								{
							 | 
						|
									$.ajax({
							 | 
						|
										url: '/'+window.location.pathname.split('/')[1]+'/workorder_notice',
							 | 
						|
										type: 'POST',
							 | 
						|
										data: {},
							 | 
						|
										dataType: 'json',
							 | 
						|
										success: function (res) {
							 | 
						|
								
							 | 
						|
											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,
							 | 
						|
													timeOut: 10000,
							 | 
						|
													extendedTimeOut: 5000,
							 | 
						|
													onHidden: function () {
							 | 
						|
														if (window.location.pathname == '/'+window.location.pathname.split('/')[1]+'/workorder_item') {
							 | 
						|
															location.reload()
							 | 
						|
														}
							 | 
						|
													}
							 | 
						|
												})
							 | 
						|
											}
							 | 
						|
								
							 | 
						|
											if (badge > 0) {
							 | 
						|
												if ($('a[href*="workorder_item"] p .workorder_badge').length > 0) {
							 | 
						|
													$('a[href*="workorder_item"] p .workorder_badge').text(badge);
							 | 
						|
												} else {
							 | 
						|
													$('a[href*="workorder_item"] p').append('<span class="workorder_badge" style="' +
							 | 
						|
														'display: inline-block; ' +
							 | 
						|
														'width: 20px; ' +
							 | 
						|
														'height: 20px; ' +
							 | 
						|
														'border-radius: 20px; ' +
							 | 
						|
														'line-height: 20px; ' +
							 | 
						|
														'text-align: center; ' +
							 | 
						|
														'font-size: 12px; ' +
							 | 
						|
														'background-color: red;' +
							 | 
						|
														'color: white;' +
							 | 
						|
														'">'+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(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; ' +
							 | 
						|
														'width: 20px; ' +
							 | 
						|
														'height: 20px; ' +
							 | 
						|
														'border-radius: 20px; ' +
							 | 
						|
														'line-height: 20px; ' +
							 | 
						|
														'text-align: center; ' +
							 | 
						|
														'font-size: 12px; ' +
							 | 
						|
														'background-color: red;' +
							 | 
						|
														'color: white;' +
							 | 
						|
														'">' + 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) {
							 | 
						|
								
							 | 
						|
										}
							 | 
						|
									});
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								$(document).ready(function () {
							 | 
						|
									workorderNotice();
							 | 
						|
								});
							 | 
						|
								
							 | 
						|
								const workordertimer = setInterval(function () {
							 | 
						|
									workorderNotice()
							 | 
						|
								}, 5000);
							 |