/// <summary> /// 获取视频列表 /// </summary> /// <param name="orgno"></param> /// <param name="eid"></param> /// <returns></returns> public static string getSynTree(string orgno, string eid) { JArray jObjects = new JArray(); string curUserOrg = SystemCls.getCurUserOrgNo();//获取当前登录用户的机构编码 if (string.IsNullOrEmpty(orgno) == false) { curUserOrg = orgno; } if (string.IsNullOrEmpty(orgno)) { var str = ""; if (PublicCls.OrgIsZhen(curUserOrg)) { str = PublicCls.GetOrgNameByOrgNO(curUserOrg.Substring(0, 6) + "000000000"); } else { str = PublicCls.GetOrgNameByOrgNO(curUserOrg); } JObject root = new JObject(); if (PublicCls.OrgIsShi(curUserOrg)) { root = new JObject { { "id", "1111" },//ORGNO { "text", str } }; } var resultlist = JC_MONITORCls.getListModel(new JC_MONITOR_BASICINFO_SW { BYORGNO = curUserOrg }); //获取所有有权限的监控摄像 if (resultlist.Any()) { var devOrgSXList = resultlist.Select(p => p.BYORGNO.Substring(0, 6) + "000000000").Distinct(); if (devOrgSXList.Any()) { JArray devSXArrary = new JArray(); foreach (var orgsx in devOrgSXList) { JObject rootSX = new JObject { { "id", orgsx },//ORGNO { "text", PublicCls.GetOrgNameByOrgNO(orgsx) } //{"state","closed"} }; var devOrgXZList = resultlist.Select(p => new { p.BYORGNO, p.ORGNAME }).Distinct() .Where(p => p.BYORGNO.Substring(0, 6) + "000000000" == orgsx); if (devOrgXZList.Any()) { JArray devXZArrary = new JArray(); foreach (var orgxz in devOrgXZList) { JObject rootXZ = new JObject { { "id", orgxz.BYORGNO },//ORGNO { "text", orgxz.ORGNAME } // {"state","closed"} }; var devlist = resultlist.Where(p => p.BYORGNO == orgxz.BYORGNO); if (devlist.Any()) { JArray devArrary = new JArray(); foreach (var dev in devlist) { JObject rootDevice = new JObject { { "id", dev.EMID }, { "text", dev.EMNAME }, { "objId", dev.OBJID }, { "templateId", dev.TEMPLATEDID }, { "ip", dev.IP }, { "port", dev.PORT }, { "type", dev.TYPE }, { "isVideo", true } }; devArrary.Add(rootDevice); } rootXZ.Add("children", devArrary); if (PublicCls.OrgIsZhen(curUserOrg))//乡镇级用户 { jObjects.Add(rootXZ); break; } devXZArrary.Add(rootXZ); } } rootSX.Add("children", devXZArrary); if (PublicCls.OrgIsXian(curUserOrg))//县级用户 { jObjects.Add(rootSX); break; } devSXArrary.Add(rootSX); } } if (PublicCls.OrgIsShi(curUserOrg))//市级用户 { root.Add("children", devSXArrary); } } if (PublicCls.OrgIsShi(curUserOrg)) { jObjects.Add(root); } } } else { var str = PublicCls.GetOrgNameByOrgNO(curUserOrg); JObject root = new JObject { { "id", "1111" }, //ORGNO { "text", str } }; var devlist = JC_MONITORCls.getListModel(new JC_MONITOR_BASICINFO_SW { BYORGNO = curUserOrg, EMID = eid }); //获取所有有权限的监控摄像 if (devlist.Any()) { JArray devArrary = new JArray(); foreach (var dev in devlist) { JObject rootDevice = new JObject { { "id", dev.EMID }, { "text", dev.EMNAME }, { "objId", dev.OBJID }, { "templateId", dev.TEMPLATEDID }, { "ip", dev.IP }, { "port", dev.PORT }, { "type", dev.TYPE }, { "isVideo", true } }; devArrary.Add(rootDevice); } root.Add("children", devArrary); jObjects.Add(root); } } return(JsonConvert.SerializeObject(jObjects)); }