hb_zhgd_screen/js/pages/video/videoAjax.js

52 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 球机树 */
function loadVideoTree() {
const bidCode = parent.$('#bidPro').val();
const keyWord = $('#keyWord').val();
const paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId + '&param=' + keyWord;
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
const url = commonUrl + 'screen/largeScreen/video/getVideoTree?params=' + montageParam;
ajaxRequestGet(url, "GET", true, function () {
}, function (result) {
if (result.code === 200) {
setData(result.data);
} else if (result.code === 500) {
console.error('视频树' + result.msg);
} else if (result.code === 401) {
loginout(1);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, aqEnnable);
function setData(data) {
let totalNum = 0, onlineNum = 0, offLineNum = 0;
$.each(data, function (index, item) {
if (item.id !== '0') {
totalNum++;
let titleName = item.title;
if(item.title.length>20){
titleName = item.title.substr(0, 20) + '...';
}
if (item.onLine === '1') {
onlineNum++;
item.title = '<img src="../../img/video/ball_online.png"><span data-mtpis="'+item.title+'">' + titleName + '</span>'
} else {
offLineNum++;
item.title = '<img src="../../img/video/ball_offline.png"><span data-mtpis="'+item.title+'">' + titleName + '</span>'
}
}
})
videoTree = dtree.render({
elem: "#video-tree",
width: "96%", // 指定树的宽度
data: data,
dataFormat: "list",
skin: "laySimple",
line: false, // 显示树线
});
// 设备在线情况
$('.device-status').eq(0).html('全部(' + totalNum + '')
$('.device-status').eq(1).html('在线(' + onlineNum + '')
$('.device-status').eq(2).html('离线(' + offLineNum + '')
}
}