defendCtrl.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. 'use strict';
  2. angular.module('app.additionalHome').controller('defendCtrl', function ($rootScope,$scope,$state,$filter,$compile,$http,
  3. safeProduceNotifyService,safeproduceService,liangspzService,alarmService,APP_CONFIG) {
  4. //库区缩略图
  5. $scope.birdsEyeUrl = $rootScope.orgInfo.birdsEye;
  6. $scope.pageInfo = {pageNum : 1, pageSize : 5};
  7. $scope.loadData = function() {
  8. //公告
  9. safeProduceNotifyService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, null)
  10. .then(function(data) {
  11. $scope.qualityPageInfo = data;
  12. $scope.safeProduceNumber = data.total;
  13. if(data.list.length < 1){
  14. $(".list").html("<img src='styles/img/qualityCheck/timg.jpg' style='width:100%;height:100%;'>");
  15. }
  16. }, function(data) {
  17. console.log(data);
  18. });
  19. //公共文档
  20. safeproduceService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, 1, null)
  21. .then(function(data) {
  22. $scope.documentsNumber = data.total;
  23. }, function(data) {
  24. console.log(data);
  25. });
  26. //报警记录信息(全部)
  27. alarmService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, null, null)
  28. .then(function(data){
  29. $scope.alarmMessageTotal = data.total;
  30. },function(data){
  31. console.log();
  32. });
  33. //报警记录信息(本月)
  34. alarmService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize, null, "currentMonth")
  35. .then(function(data){
  36. $scope.monthMessageTotal = data.total;
  37. },function(data){
  38. console.log();
  39. });
  40. };
  41. // 查看页面
  42. $scope.showViewNotify = function(id) {
  43. $scope.switchTopMenu(19);
  44. $state.go('app.storage.safeproduce.notifyAdd', {id:id,isNotEdit:true});
  45. };
  46. // 发布通知公告
  47. $scope.showAddNotify=function () {
  48. $scope.switchTopMenu(19);
  49. $state.go('app.storage.safeproduce.notifyAdd', {id:0,isNotEdit:false,topRow:$rootScope.orgInfo.orgName+"通告:\n"});
  50. };
  51. // 安全生产通知
  52. $scope.safeProduceNotifyTodo=function() {
  53. $scope.switchTopMenu(19);
  54. $state.go("app.storage.safeproduce.notifyList");
  55. }
  56. //跳转报警信息列表
  57. $scope.queryAlarmMessage=function(type){
  58. $scope.switchTopMenu(19);
  59. if(type == "all"){
  60. $state.go("app.alarm.list");
  61. }else{
  62. $state.go("app.alarm.list",{queryCriteria:"currentMonth"});
  63. }
  64. }
  65. // 安全生产管理制度
  66. $scope.safeProduceTodo=function(layerType) {
  67. $scope.switchTopMenu(19);
  68. if("publish" == layerType){//跳转文档发布页面
  69. $state.go('app.storage.safeproduce.list', {type:1,layerType:'publish'});
  70. }else if("list" == layerType) {//跳转文档列表页面
  71. $state.go('app.storage.safeproduce.list', {type:1});
  72. }
  73. }
  74. $scope.switchTopMenu = function(funcId) {
  75. if (!$("#menu-"+funcId).hasClass('open')) {
  76. $("#menu-"+funcId).smartCollapseToggle();
  77. }
  78. if (funcId==18) {
  79. $('body').addClass("minified");
  80. } else {
  81. $('body').removeClass("minified");
  82. }
  83. $rootScope.childSysId = funcId;
  84. sessionStorage.setItem("childSysId", funcId);
  85. }
  86. //获取摄像头信息
  87. var cameraVal=[];
  88. $scope.cameraFun = function () {
  89. $.ajax({
  90. type: "GET",
  91. dataType: "json",
  92. url: APP_CONFIG.monitorUrl + "/depotStyle/getAllPointChart",
  93. data: {
  94. type : "1",
  95. orgId : $rootScope.orgInfo.orgId
  96. },
  97. success: function (msg) {
  98. var iconDiv = $("#iconDiv");
  99. iconDiv.html("");
  100. for(var i=0;i<msg.length;i++){
  101. var obj = msg[i];
  102. cameraVal[i] = obj;
  103. var img = "styles/img/camera.png";
  104. if(obj.cameraType == "1"){
  105. img = "styles/img/camera_qiu.png";
  106. }
  107. iconDiv.append($compile("<img ng-click='playCamera("+i+")' src=\""+img+"\" style=\""+obj.styles+";cursor: pointer;\" class=\"ng-scope\">")($scope));
  108. }
  109. }
  110. });
  111. };
  112. //初始化摄像头
  113. $scope.playCamera = function (index) {
  114. $("#cameraPlayModal").modal("show");
  115. setTimeout(function(){
  116. var OBJ = "<OBJECT ID=\"cameraocx\" width=100% height=250px classid=\"CLSID:A9A5DEC8-62AB-4444-9024-874FF35D3FD1\">" +
  117. "<PARAM NAME=\"vmode\" VALUE=\"transparent\">" +
  118. "<PARAM NAME=\"_Version\" VALUE=\"65536\">" +
  119. "<PARAM NAME=\"_ExtentX\" VALUE=\"12806\">" +
  120. "<PARAM NAME=\"_ExtentY\" VALUE=\"1747\">" +
  121. "<PARAM NAME=\"_StockProps\" VALUE=\"0\">" +
  122. "</OBJECT>";
  123. $("#ocxDiv").html(OBJ);
  124. var playocx = document.getElementById('cameraocx');//加载控件,给控件赋值用
  125. playocx.SetLiveLayout(1);
  126. var tdh = 0;//通道号
  127. var zm = "";//字幕
  128. var winIndex = -1;//窗口索引
  129. var err = playocx.DeviceLogin_NOPOINT(cameraVal[index].nvrIp,cameraVal[index].nvrPort*1,cameraVal[index].nvrName,cameraVal[index].nvrPassword,cameraVal[index].factory*1);
  130. err = playocx.VideoPlay_NOPOINT(cameraVal[index].nvrIp,cameraVal[index].nvrPort*1,cameraVal[index].nvrName,cameraVal[index].nvrPassword,cameraVal[index].factory*1,cameraVal[index].channelNumber ,zm ,winIndex);
  131. $scope.alias = cameraVal[index].alias;
  132. },500)
  133. };
  134. //粮食品种柱形图
  135. $scope.loadFoodstuff = function(){
  136. liangspzService.getDate().then(function(data){
  137. var xiaomai=data.xiaomai;
  138. var yumi=data.yumi;
  139. var daogu=data.daogu;
  140. var dadou=data.dadou;
  141. // 基于准备好的dom,初始化echarts实例
  142. var myChart = echarts.init(document.getElementById("foodstuff"));
  143. var labelOption = {
  144. normal: {
  145. show: false,
  146. formatter: '{c} {name|{a}}',
  147. fontSize: 16,
  148. rich: {
  149. name: {
  150. textBorderColor: '#fff'
  151. }
  152. }
  153. }
  154. };
  155. // 指定图表的配置项和数据
  156. var option = {
  157. color: ['#003366', '#006699', '#4cabce', '#e5323e'],
  158. tooltip: {
  159. trigger: 'axis'
  160. },
  161. legend: {
  162. data: ['大豆', '玉米', '小麦', '稻谷'],
  163. itemGap: 20,
  164. right: '4%'
  165. },
  166. //控制边距 
  167. grid: {
  168. left: '3%',
  169. right: '4%',
  170. bottom: '3%',
  171. containLabel: true
  172. },
  173. calculable: true,
  174. xAxis: [
  175. {
  176. type: 'category',
  177. data: data.years,
  178. splitLine: {
  179. show: true,
  180. lineStyle:{
  181. color: ['#eee'],
  182. width: 1,
  183. type: 'solid'
  184. }
  185. },
  186. axisLabel:{
  187. show: true,
  188. textStyle:{
  189. color:"#000"
  190. }
  191. },
  192. axisLine: {
  193. lineStyle: {
  194. color:'#000',
  195. width:'1'
  196. }
  197. }
  198. }
  199. ],
  200. yAxis: [
  201. {
  202. type: 'value',
  203. splitLine: {
  204. show: true,
  205. lineStyle:{
  206. color: ['#eee'],
  207. width: 1,
  208. type: 'solid'
  209. }
  210. },
  211. axisLine: {
  212. lineStyle: {
  213. color:'#000',
  214. width:'1'
  215. }
  216. },
  217. axisLabel: {
  218. show: true,
  219. textStyle: {
  220. color: '#928f8f'
  221. }
  222. }
  223. }
  224. ],
  225. series: [
  226. {
  227. name: '大豆',
  228. type: 'bar',
  229. barGap: '5%', // 柱间隔
  230. label: labelOption,
  231. barWidth : 10,
  232. data: dadou
  233. },
  234. {
  235. name: '玉米',
  236. type: 'bar',
  237. label: labelOption,
  238. barWidth : 10,
  239. data: yumi
  240. },
  241. {
  242. name: '小麦',
  243. type: 'bar',
  244. label: labelOption,
  245. barWidth : 10,
  246. data: xiaomai
  247. },
  248. {
  249. name: '稻谷',
  250. type: 'bar',
  251. label: labelOption,
  252. barWidth : 10,
  253. data: daogu
  254. }
  255. ]
  256. };
  257. myChart.setOption(option);
  258. },function(data){
  259. console.log(data);
  260. });
  261. }
  262. $scope.loadData();
  263. $scope.cameraFun();//初始化摄像头信息
  264. $scope.loadFoodstuff();
  265. });