import { layuiObj } from "./index.js";
import { skynetIpcInfo } from "./orgApi/getSkynetIpcList.js";
import { iframeVideoUrl } from "../../../public/js/url.js";
var treeData=[];
var playVideoList=[];
function createSchoolTree(){
treeData=[];
for(var i=0;i${text}`
if (node.children){
s += `(${node.children.length})`
}
return s;
},
animate:true,
checkbox:true,
onClick: function(node){//显示对应的设备总数跟在线
var id=node["id"];
if(id==4){
var pointCode=node["pointCode"];
//播放学校的视频
playStationIpc(pointCode);
}
}
})
}
//初始化快速搜索的
function initSchoolSearchSelect(){
$("#orgboxSelect").html(getSchoolOptions());
layuiObj.layuiForm.render("select","orgboxSelectForm");
$("#orgboxSelect").siblings("div.layui-form-select").find("div.layui-select-title").find("input").attr("onfocus","this.select()");
schoolSearchSelectChange();
}
//获取所有的设备
function getSchoolOptions(){
var options=""
var stationArr=[];
for(var i=0;i${name}`
}
}
return options;
}
//监听select变化
function schoolSearchSelectChange(){
layuiObj.layuiForm.on('select(orgboxSelect)', function(data){
var name=data["value"];
if(name=="000"){
$(".orgTree").css("display","block");
$(".stationIpcList").css("display","none");
}else{
$(".orgTree").css("display","none");
$(".stationIpcList").css("display","block");
showSelectIpcList(name)
}
})
}
function showSelectIpcList(selectname){
var p="";
var index=1;
for(var i=0;i${index}${skynetIpcInfo[i]["name"]}
`
index++;
}
}
$(".stationIpcList").html(p);
addshowSelectIpcListEvent();
}
function addshowSelectIpcListEvent(){
$(".stationIpcList>p").on('click',function(){
var pointCode=$(this).attr("pointCode");
var name=$(this).children("span:last-child").html();
playStationIpc(pointCode);
})
}
window.addEventListener('message', function(e) {
var data=e.data
var cmd=data["cmd"];
var deviceid=data["deviceid"]
if(cmd=="closePage"){
deletePlayVideoList(deviceid);
closeIpcVideoPage(deviceid);
}
})
function closeIpcVideoPage(token){
var vdiv=$(".videoPlay");
for(var i=0;i
`
}
function playStationIpc(token){
var div=returnIpcPlayDiv(token);
$(".statipnIpcSelect").html(div);
}
function returnIpcPlayDiv(token){
addPlayVideoList(token);
var name="";
for(var i=0;i
${getIframeUrl(token)}
${name}
`
}
function layoutResetPlayIpc(list){
playVideoList=[];
for(let i=0;idiv:nth-child(${i+1})`).html(div);
}
}
function addPlayVideoList(deviceid){
if(playVideoList.indexOf(deviceid)==-1){
playVideoList.push(deviceid);
}
}
function deletePlayVideoList(deviceid){
var index=playVideoList.indexOf(deviceid)
if(index!=-1){
playVideoList.splice(index,1);
}
}
export {createSchoolTree,layoutResetPlayIpc,playVideoList}