初始化
This commit is contained in:
314
WebUI/wwwroot/js_custom/udp.js
Normal file
314
WebUI/wwwroot/js_custom/udp.js
Normal file
@@ -0,0 +1,314 @@
|
||||
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||
let start = 1;
|
||||
// ÿҳ<C3BF><D2B3><EFBFBD><EFBFBD>
|
||||
let pagelength = 15;
|
||||
//page
|
||||
let page = 1;
|
||||
// <20><>ʼʱ<CABC><CAB1>
|
||||
let startDate = null;
|
||||
let endDate = null;
|
||||
//չ<><D5B9><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> id
|
||||
let sel_id = new Array();
|
||||
let datatable = null;
|
||||
let sx_time = null;
|
||||
let last_time = new Date().getTime();
|
||||
curr = new Date().getTime(),
|
||||
out = 6 * 1000; //<2F><><EFBFBD>ó<EFBFBD>ʱʱ<CAB1>䣺6s
|
||||
// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>
|
||||
let is_sx = false;
|
||||
|
||||
$(function () {
|
||||
let udplog_data = Cookies.get('udplog_data') || null;
|
||||
udplog_data = udplog_data != null ? JSON.parse(udplog_data) : [];
|
||||
$('#CONTENT_DECRYPT').val(udplog_data['CONTENT_DECRYPT']);
|
||||
$('#DESTINATION_PORT').val(udplog_data['DESTINATION_PORT']);
|
||||
$('#DESTINATION').val(udplog_data['DESTINATION']);
|
||||
$('#SOURCE_PORT').val(udplog_data['SOURCE_PORT']);
|
||||
$('#SOURCE_IP').val(udplog_data['SOURCE_IP']);
|
||||
$('#DIRECTION').val(udplog_data['DIRECTION']);
|
||||
$('#DATA_VALID').val(udplog_data['DATA_VALID']);
|
||||
pagelength = udplog_data['pagelength'] || pagelength;
|
||||
$('#pagelength').val(pagelength);
|
||||
startDate = udplog_data.startDate || moment().startOf("days").format('YYYY-MM-DD HH:mm:ss');
|
||||
endDate = udplog_data.endDate || moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>Χѡ<CEA7><D1A1><EFBFBD><EFBFBD>
|
||||
$('#reservationtime').daterangepicker({
|
||||
startDate: startDate || "2022-3-25 01:01:01",
|
||||
endDate: endDate || new Date(),
|
||||
timePicker: true,
|
||||
maxDate: new Date(),
|
||||
minDate: "2022-3-25 01:01:01",
|
||||
timePicker24Hour: true,
|
||||
timePickerSeconds: true,
|
||||
locale: {
|
||||
cancelLabel: 'Clear',
|
||||
format: 'YYYY-MM-DD HH:mm:ss'
|
||||
}
|
||||
}).on('apply.daterangepicker', function (ev, picker) {
|
||||
startDate = picker.startDate.format('YYYY-MM-DD HH:mm:ss');
|
||||
endDate = picker.endDate.format('YYYY-MM-DD HH:mm:ss');
|
||||
}).on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
startDate = null;
|
||||
endDate = null;
|
||||
});
|
||||
loc();
|
||||
table_init();
|
||||
// <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>Զ<EFBFBD>ˢ<EFBFBD><CBA2> δʹ<CEB4><CAB9>
|
||||
$(document).mouseover(function (e) {
|
||||
last_time = new Date().getTime(); //<2F><><EFBFBD>²<EFBFBD><C2B2><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
});
|
||||
set_Timeout();
|
||||
});
|
||||
|
||||
|
||||
|
||||
//ͷ<><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
function titlehiede(that) {
|
||||
$($(that).siblings()).toggle();
|
||||
loc();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// <20><>ʼ<EFBFBD><CABC> <20>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
let footloc = 0;
|
||||
function loc() {
|
||||
if (footloc == 0) {
|
||||
footloc = $('.main-footer').offset().top;
|
||||
$('.main-footer').hide();
|
||||
}
|
||||
let STR = "calc(100vh - " + $('.table-responsive').offset().top + "px)";
|
||||
$('.table-responsive').css("height", STR)
|
||||
}
|
||||
|
||||
// ѡ<><EFBFBD>
|
||||
function lengthCHANGE(that) {
|
||||
pagelength = $(that).val();
|
||||
table_init();
|
||||
}
|
||||
|
||||
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2> <20><>ѡ<EFBFBD>˾<EFBFBD><CBBE>Զ<EFBFBD>ˢ<EFBFBD><CBA2>
|
||||
|
||||
function set_Timeout() {
|
||||
sx_time = setInterval(function () {
|
||||
curr = new Date().getTime(); //<2F><><EFBFBD>µ<EFBFBD>ǰʱ<C7B0><CAB1>
|
||||
if (
|
||||
//curr - last_time > out //<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>ʱ
|
||||
// $("#remember").prop("checked") <20>Ƿ<EFBFBD><C7B7><EFBFBD>ѡ
|
||||
//&& !is_sx &&
|
||||
|
||||
$("#remember").prop("checked")) {
|
||||
if (startDate == null) {
|
||||
startDate = moment().startOf("days").format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
endDate = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
$('#reservationtime').val(startDate + "-" + endDate)
|
||||
is_sx = true;
|
||||
table_init(function () {
|
||||
is_sx = false;
|
||||
});
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
// table<6C><65><EFBFBD>ݳ<EFBFBD>ʼ<EFBFBD><CABC>ˢ<EFBFBD><CBA2>
|
||||
|
||||
function table_init(success = null) {
|
||||
|
||||
let data = {
|
||||
DESTINATION_PORT: $('#DESTINATION_PORT').val(),
|
||||
CONTENT_DECRYPT: $('#CONTENT_DECRYPT').val(),
|
||||
DESTINATION: $('#DESTINATION').val(),
|
||||
SOURCE_PORT: $('#SOURCE_PORT').val(),
|
||||
SOURCE_IP: $('#SOURCE_IP').val(),
|
||||
DIRECTION: $('#DIRECTION').val(),
|
||||
DATA_VALID: $('#DATA_VALID').val(),
|
||||
startDate,
|
||||
endDate
|
||||
};
|
||||
if (datatable != null) {
|
||||
datatable.destroy();
|
||||
//$('#dataTable').empty();
|
||||
}
|
||||
$.fn.dataTable.ext.errMode = 'none';//<2F><><EFBFBD>ε<EFBFBD><CEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
datatable = $('#dataTable').on('error.dt', function (e, settings, techNote, message) {
|
||||
console.log(e, settings, techNote)
|
||||
console.log('An error has been reported by DataTables: ', message);
|
||||
location.reload();
|
||||
}).DataTable({
|
||||
"ordering": false,
|
||||
"paging": true,
|
||||
"serverSide": true,
|
||||
"ajax": function (datas, callback, settings) {
|
||||
data.start = datas.start;
|
||||
data.length = datas.length;
|
||||
data.draw = datas.draw
|
||||
//is_sx <20>Զ<EFBFBD>ˢ<EFBFBD>µ<EFBFBD> <20><> ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MyPost("/Server/GetUDPLog", { data, isSwal: !is_sx }, res => { callback(res) });
|
||||
},
|
||||
"columns": [{
|
||||
'sTitle': '',/*.substring(6)*/
|
||||
'render': function (data, type, row) {
|
||||
return `
|
||||
<td class=" text-gray info-box-content" style="padding: 0; margin: 0; line-height: 1; overflow: hidden;display:block;width:100%;">
|
||||
<div style='color: #D3D3D3;' class="row " `+ (sel_id.indexOf(row["UDP_ID"]) != -1 ? "ID = '" + row["UDP_ID"] + "'" : "") + ` >
|
||||
<div class="col-6">
|
||||
`+ row["UDP_ID"] + `
|
||||
<span style="background-color:`+ (row["DIRECTION"] == "TX" ? '#FFB6C1' : '#B0E0E6') + ` !important; padding-left:5px;padding-right:5px;margin-left:5px;" class=' ` + (row["DIRECTION"] == "TX" ? 'bg-danger' : 'bg-success') + ` '>
|
||||
`+ row["DIRECTION"] + `</span>
|
||||
<span style='color:gray;'> ` +
|
||||
//<2F><>Ч<EFBFBD><D0A7><EFBFBD>ݲ<EFBFBD><DDB2>ж<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
(row["DATA_VALID"] != "1" ? "" : (
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "01" ? "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" :
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "02" ? "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ" :
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "03" ? "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" :
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "04" ? "״̬<D7B4>ϱ<EFBFBD>" :
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "05" ? "<22>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>" :
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "06" ? "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" :
|
||||
(row["CONTENT_DECRYPT"].trim().substring(48, 50) == "07" ? "RCU<43><55><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>" : "<22><><EFBFBD><EFBFBD>")))))))
|
||||
+ (row["DIRECTION"] != "TX" ? "" : "ACK"))) +
|
||||
`</span>
|
||||
</div>
|
||||
<div class="col-6 ">src:
|
||||
`+ row["SOURCE_IP"] + `:
|
||||
`+ row["SOURCE_PORT"] + `
|
||||
</div>
|
||||
<div class="col-6 ">
|
||||
`+ row["DATETIME"].substring(2).replace("T", " ") + `
|
||||
</div>
|
||||
<div class="col-6 ">dst:
|
||||
`+ row["DESTINATION"] + `:
|
||||
`+ row["DESTINATION_PORT"] + `
|
||||
</div>
|
||||
<div STYLE="`+ (row["DATA_VALID"] == "0" ? "" : "color: #D3D3D3;") + `" class="col-12 ` + (row["DATA_VALID"] == "0" ? '' : 'text-success') + `">
|
||||
|
||||
<text style="color:`+ (row["DATA_VALID"] == "1" ? '#D3D3D3 !important' : ' ') + `">` + row["CONTENT_DECRYPT"].trim().substring(0, 18) + `</text>
|
||||
<text style="color:`+ (row["DATA_VALID"] == "1" ? '#000 !important' : ' ') + `">` + row["CONTENT_DECRYPT"].trim().substring(18, 24) + `</text>
|
||||
<text style="color:`+ (row["DATA_VALID"] == "1" ? '#DC143C !important' : ' ') + `">` + row["CONTENT_DECRYPT"].trim().substring(24, 27) + `</text>
|
||||
<text style="color:`+ (row["DATA_VALID"] == "1" ? '#D3D3D3 !important' : ' ') + `">` + row["CONTENT_DECRYPT"].trim().substring(27, 30) + `</text>
|
||||
<text>`+ row["CONTENT_DECRYPT"].trim().substring(30, 48) + `</text>
|
||||
|
||||
<text style="`+ (row["DATA_VALID"] == "1" ? 'color:#9932CC !important;FONT-WEIGHT: BOLD;' : ' ') + `">` + row["CONTENT_DECRYPT"].trim().substring(48, 54) + `</text>
|
||||
<text>`+ row["CONTENT_DECRYPT"].trim().substring(54) + `</text>
|
||||
</div>
|
||||
</div>
|
||||
</td>`
|
||||
}
|
||||
}],
|
||||
"fnCreatedRow": function (nRow, aData, iDataIndex) {
|
||||
$(nRow).addClass('bg-white').addClass('shadow');
|
||||
|
||||
$('thead').hide();
|
||||
$(nRow).click(
|
||||
function () {
|
||||
ShowLog(nRow, aData);
|
||||
}
|
||||
)
|
||||
},
|
||||
"searching": false,
|
||||
"autoWidth": false,
|
||||
"bDeferRender ": true,
|
||||
'iDisplayLength': pagelength,
|
||||
"bLengthChange": false,
|
||||
"initComplete": function (oSettings, json) {
|
||||
Cookies.set('udplog_data', data, { expires: 7, path: window.location.pathname });
|
||||
for (let i = 0; i < sel_id.length; i++) {
|
||||
$($("#" + sel_id[i]).closest('tr')).click();
|
||||
}
|
||||
if (success != null) {
|
||||
success();
|
||||
}
|
||||
},
|
||||
'aLengthMenu': [50, 15, 25, 35,], //<2F><><EFBFBD><EFBFBD>ÿҳ<C3BF><D2B3>ʾ<EFBFBD><CABE>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
||||
"language":
|
||||
{
|
||||
"sProcessing": "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...",
|
||||
"sLengthMenu": "<22><>ʾ _MENU_ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
||||
"sZeroRecords": "û<><C3BB>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
||||
"sInfo": "<22><>ʾ<EFBFBD><CABE> _START_ <20><> _END_ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> _TOTAL_ <20><>",
|
||||
"sInfoEmpty": "<22><>ʾ<EFBFBD><CABE> 0 <20><> 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20><>",
|
||||
"sInfoFiltered": "(<28><> _MAX_ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "<22><><EFBFBD><EFBFBD>:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>",
|
||||
"sLoadingRecords": "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "<22><>ҳ",
|
||||
"sPrevious": "<22><>ҳ",
|
||||
"sNext": "<22><>ҳ",
|
||||
"sLast": "ĩҳ"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>",
|
||||
"sSortDescending": ": <20>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
||||
function search_result() {
|
||||
table_init();
|
||||
}
|
||||
|
||||
// <20><>ʾ<EFBFBD><CABE>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>
|
||||
function ShowLog(that, data) {
|
||||
let STR =
|
||||
`
|
||||
<div onclick="javascript:event.stopPropagation();event.preventDefault();" class="text-info card-body shadow-sm" style="padding:0.5rem; background-color: rgb(255, 250, 240);">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-6">
|
||||
UDP_ID : <span class='text-gray'>`+ data.UDP_ID + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
MAC : <span class='text-gray'>`+ data.MAC + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
MSG_ID : <span class='text-gray'>`+ data.MSG_ID + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20><><EFBFBD><EFBFBD> : <span class='text-gray'>`+ data.LENGTH + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
TCP_ID : <span class='text-gray'>`+ data.TCP_ID + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <span class='text-gray'>`+ (data.RESULT == 0 ? "ʧ<><CAA7>" : "<22>ɹ<EFBFBD>") + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD> : <span class='text-gray'>`+ data.RETRY_COUNT + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20>Ƿ<EFBFBD><C7B7><EFBFBD>Ч : <span class='text-gray'>`+ (data.DATA_VALID == 0 ? "<22><>Ч" : "<22><>Ч") + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD> : <span class='text-gray'>`+ data.RCV_TIMEOUT + `ms</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
ͨѶ<CDA8><D1B6><EFBFBD><EFBFBD> : <span class='text-gray'>`+ data.UDP_CMD + `</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20><><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD> : <span class='text-gray'>`+ data.SED_TIMEOUT + `ms</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ : <span class='text-gray'>`+ data.PROCESSING_TIMESPENT + `ms</span></div>
|
||||
<div class="col-md-4 col-6">
|
||||
<20>˿<EFBFBD>ͨѶʱ<D1B6><CAB1> : <span class='text-gray'>`+ data.Prot_TimeOut + `ms</span></div>
|
||||
<div class="col-md-12 col-12 ">
|
||||
<20><>ע : <span class='text-gray'>`+ data.REMARK + `</span></div>
|
||||
`;
|
||||
// <20>Զ<EFBFBD>ˢ<EFBFBD>º<EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѿ<EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>ʾ <20><>ô<EFBFBD><C3B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (($(that).find(".card-body").length != 0)) {// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD>֮ǰ<D6AE><C7B0>չ<EFBFBD><D5B9><EFBFBD><EFBFBD> <20>еĻ<D0B5><C4BB>Ͳ<EFBFBD><CDB2><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
$($(that).find(".card-body")).toggle();// <20><>ʾ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ִ<EFBFBD><D6B4><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD>¼
|
||||
if ($($(that).find(".card-body")).attr("style").indexOf('display: none;') >= 0) {
|
||||
|
||||
sel_id = sel_id.filter((id) => {
|
||||
return id != data.UDP_ID;
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
if (sel_id.indexOf(data.UDP_ID) < 0) {
|
||||
sel_id.push(data.UDP_ID);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD> <20>еĻ<D0B5><C4BB>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
if (sel_id.indexOf(data.UDP_ID) < 0) {
|
||||
sel_id.push(data.UDP_ID);
|
||||
}
|
||||
$(that).find("td").append(STR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user