company.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. /**
  2. * company.js
  3. */
  4. var basePath;
  5. var company_code;
  6. var V_LOGINNAME;
  7. var V_PASSWORD;
  8. var storeTime = 60000;
  9. var buildingStore = null,
  10. companyStore = null,
  11. devicesStore = null;
  12. var building_name;
  13. var max_level = 0;
  14. var min_level = 0;
  15. var top_level = 0;
  16. var default_check = 65535;
  17. var myMask;
  18. var show_project_info = true;
  19. var start = 0;
  20. var end = 360;
  21. var theme;
  22. var vAlarmInfoWin;
  23. var online_video = false;
  24. var onair_video = false;
  25. var ConfirmStore;
  26. var modifywin;
  27. var had_play = false;
  28. var fillvalue = false;
  29. Ext.Loader.setConfig({
  30. enabled: true
  31. });
  32. Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');
  33. Ext.require([
  34. 'Ext.grid.*',
  35. 'Ext.data.*',
  36. 'Ext.ux.RowExpander',
  37. 'Ext.selection.CheckboxModel'
  38. ]);
  39. var bak_to_front = function() {
  40. location.href = basePath + 'view/frontpage/map.jsp?company_code=' + company_code;
  41. }
  42. var staSortBypoint = function(a, b) {
  43. return a.point_code - b.point_code;;
  44. }
  45. var body_resize = function() {
  46. $("#company_bg_mm").css('display', 'none');
  47. if ($(document).innerWidth() >= 1820) {
  48. $("#company_bg_tm").css('display', 'block');
  49. $("#company_bg_tm").css('width', ($(document).innerWidth() - 1820) + 'px');
  50. $("#company_bg_bm").css('display', 'block');
  51. $("#company_bg_bm").css('width', ($(document).innerWidth() - 1820) + 'px');
  52. } else {
  53. $("#company_bg_tm").css('display', 'none');
  54. $("#company_bg_bm").css('display', 'none');
  55. }
  56. if ($(document).innerHeight() >= 932) {
  57. $("#company_bg_ml").css('display', 'block');
  58. $("#company_bg_mr").css('display', 'block');
  59. $("#company_bg_ml").css('height', ($(document).innerHeight() - 932) + 'px');
  60. $("#company_bg_mr").css('height', ($(document).innerHeight() - 932) + 'px');
  61. if ($(document).innerWidth() >= 1820) {
  62. $("#company_bg_mm").css('display', 'block');
  63. $("#company_bg_mm").css('height', ($(document).innerHeight() - 932) + 'px');
  64. $("#company_bg_mm").css('width', ($(document).innerWidth() - 1820) + 'px');
  65. }
  66. } else {
  67. $("#company_bg_ml").css('display', 'none');
  68. $("#company_bg_mr").css('display', 'none');
  69. }
  70. $("#company_building").css('height', ($(document).innerHeight() - 328) + 'px');
  71. $("#history_alarm_list").css('width', ($(document).innerWidth() - 975) + 'px');
  72. $("#history_alarm_list").css('height', ($(document).innerHeight() - 616) + 'px');
  73. $("#project_info_bar").css('width', ($(document).innerWidth() - 975) + 'px');
  74. }
  75. var chk_click_big = function(obj) {
  76. location.href = basePath + 'view/3dBig/index.jsp?theme=' + theme + '&company_code=' + ($("#company_code").val());
  77. }
  78. var chk_click = function(obj) {
  79. if ((obj.id == 'dev_all_checkbox') || (obj.id == 'dev_all_checklabel')) {
  80. if (default_check != 65535)
  81. default_check = 65535;
  82. else
  83. default_check = 0;
  84. } else if ((obj.id == 'dev_ui_checkbox') || (obj.id == 'dev_ui_checklabel')) {
  85. if ((default_check & 1) == 1)
  86. default_check = (default_check & 65534);
  87. else
  88. default_check = (default_check | 1);
  89. } else if ((obj.id == 'dev_fc_checkbox') || (obj.id == 'dev_fc_checklabel')) {
  90. if ((default_check & 2) == 2)
  91. default_check = (default_check & 65533);
  92. else
  93. default_check = (default_check | 2);
  94. } else if ((obj.id == 'dev_ef_checkbox') || (obj.id == 'dev_ef_checklabel')) {
  95. if ((default_check & 4) == 4)
  96. default_check = (default_check & 65531);
  97. else
  98. default_check = (default_check | 4);
  99. } else if ((obj.id == 'dev_wp_checkbox') || (obj.id == 'dev_wp_checklabel')) {
  100. if ((default_check & 8) == 8)
  101. default_check = (default_check & 65527);
  102. else
  103. default_check = (default_check | 8);
  104. } else if ((obj.id == 'dev_ll_checkbox') || (obj.id == 'dev_ll_checklabel')) {
  105. if ((default_check & 16) == 16)
  106. default_check = (default_check & 65519);
  107. else
  108. default_check = (default_check | 16);
  109. } else if ((obj.id == 'dev_ci_checkbox') || (obj.id == 'dev_ci_checklabel')) {
  110. if ((default_check & 32) == 32)
  111. default_check = (default_check & 65503);
  112. else
  113. default_check = (default_check | 32);
  114. } else if ((obj.id == 'dev_va_checkbox') || (obj.id == 'dev_va_checklabel')) {
  115. if ((default_check & 64) == 64)
  116. default_check = (default_check & 65471);
  117. else
  118. default_check = (default_check | 64);
  119. } else if ((obj.id == 'dev_ot_checkbox') || (obj.id == 'dev_ot_checklabel')) {
  120. if ((default_check & 128) == 128)
  121. default_check = (default_check & 65407);
  122. else
  123. default_check = (default_check | 128);
  124. } else if ((obj.id == 'dev_sm_checkbox') || (obj.id == 'dev_sm_checklabel')) {
  125. if ((default_check & 256) == 256)
  126. default_check = (default_check & 65279);
  127. else
  128. default_check = (default_check | 256);
  129. }
  130. if (default_check == 0) {
  131. $("#dev_all_checkbox").removeClass('dev_checkbox');
  132. $("#dev_all_checkbox").removeClass('dev_few_checkbox');
  133. $("#dev_all_checkbox").addClass('dev_uncheckbox');
  134. } else if (default_check == 65535) {
  135. $("#dev_all_checkbox").removeClass('dev_uncheckbox');
  136. $("#dev_all_checkbox").removeClass('dev_few_checkbox');
  137. $("#dev_all_checkbox").addClass('dev_checkbox');
  138. } else {
  139. $("#dev_all_checkbox").removeClass('dev_uncheckbox');
  140. $("#dev_all_checkbox").removeClass('dev_checkbox');
  141. $("#dev_all_checkbox").addClass('dev_few_checkbox');
  142. }
  143. if ((default_check & 1) == 1) {
  144. $("#dev_ui_checkbox").removeClass('dev_uncheckbox');
  145. $("#dev_ui_checkbox").addClass('dev_checkbox');
  146. } else {
  147. $("#dev_ui_checkbox").removeClass('dev_checkbox');
  148. $("#dev_ui_checkbox").addClass('dev_uncheckbox');
  149. }
  150. if ((default_check & 2) == 2) {
  151. $("#dev_fc_checkbox").removeClass('dev_uncheckbox');
  152. $("#dev_fc_checkbox").addClass('dev_checkbox');
  153. } else {
  154. $("#dev_fc_checkbox").removeClass('dev_checkbox');
  155. $("#dev_fc_checkbox").addClass('dev_uncheckbox');
  156. }
  157. if ((default_check & 4) == 4) {
  158. $("#dev_ef_checkbox").removeClass('dev_uncheckbox');
  159. $("#dev_ef_checkbox").addClass('dev_checkbox');
  160. } else {
  161. $("#dev_ef_checkbox").removeClass('dev_checkbox');
  162. $("#dev_ef_checkbox").addClass('dev_uncheckbox');
  163. }
  164. if ((default_check & 8) == 8) {
  165. $("#dev_wp_checkbox").removeClass('dev_uncheckbox');
  166. $("#dev_wp_checkbox").addClass('dev_checkbox');
  167. } else {
  168. $("#dev_wp_checkbox").removeClass('dev_checkbox');
  169. $("#dev_wp_checkbox").addClass('dev_uncheckbox');
  170. }
  171. if ((default_check & 16) == 16) {
  172. $("#dev_ll_checkbox").removeClass('dev_uncheckbox');
  173. $("#dev_ll_checkbox").addClass('dev_checkbox');
  174. } else {
  175. $("#dev_ll_checkbox").removeClass('dev_checkbox');
  176. $("#dev_ll_checkbox").addClass('dev_uncheckbox');
  177. }
  178. if ((default_check & 32) == 32) {
  179. $("#dev_ci_checkbox").removeClass('dev_uncheckbox');
  180. $("#dev_ci_checkbox").addClass('dev_checkbox');
  181. } else {
  182. $("#dev_ci_checkbox").removeClass('dev_checkbox');
  183. $("#dev_ci_checkbox").addClass('dev_uncheckbox');
  184. }
  185. if ((default_check & 64) == 64) {
  186. $("#dev_va_checkbox").removeClass('dev_uncheckbox');
  187. $("#dev_va_checkbox").addClass('dev_checkbox');
  188. } else {
  189. $("#dev_va_checkbox").removeClass('dev_checkbox');
  190. $("#dev_va_checkbox").addClass('dev_uncheckbox');
  191. }
  192. if ((default_check & 128) == 128) {
  193. $("#dev_ot_checkbox").removeClass('dev_uncheckbox');
  194. $("#dev_ot_checkbox").addClass('dev_checkbox');
  195. } else {
  196. $("#dev_ot_checkbox").removeClass('dev_checkbox');
  197. $("#dev_ot_checkbox").addClass('dev_uncheckbox');
  198. }
  199. if ((default_check & 256) == 256) {
  200. $("#dev_sm_checkbox").removeClass('dev_uncheckbox');
  201. $("#dev_sm_checkbox").addClass('dev_checkbox');
  202. } else {
  203. $("#dev_sm_checkbox").removeClass('dev_checkbox');
  204. $("#dev_sm_checkbox").addClass('dev_uncheckbox');
  205. }
  206. bak_reset();
  207. }
  208. var clear_append_form = function() {
  209. Ext.getCmp('fa_company_code').setValue("");
  210. Ext.getCmp('fa_userfile').setValue("");
  211. Ext.getCmp('FactoryListPageToolbar').moveFirst();
  212. }
  213. var sc = function() {
  214. modifywin();
  215. }
  216. var chk_empty_level = function(level) {
  217. for (var i = 0; i < buildingStore.length; i++) {
  218. if (buildingStore[i].min_level == level) {
  219. if (((default_check & 1) == 1) && (buildingStore[i].dwtype == 'YTUI'))
  220. return false;
  221. else if (((default_check & 2) == 2) && (buildingStore[i].dwtype == 'YTFC'))
  222. return false;
  223. else if (((default_check & 4) == 4) && (buildingStore[i].dwtype == 'YTEF'))
  224. return false;
  225. else if (((default_check & 8) == 8) && (buildingStore[i].dwtype == 'YTWP'))
  226. return false;
  227. else if (((default_check & 16) == 16) && (buildingStore[i].dwtype == 'YTLL'))
  228. return false;
  229. else if (((default_check & 32) == 32) && (buildingStore[i].dwtype == 'YTCI'))
  230. return false;
  231. else if (((default_check & 64) == 64) && (buildingStore[i].dwtype == 'YTVA'))
  232. return false;
  233. else if (((default_check & 128) == 128) && (buildingStore[i].dwtype == 'YTWC'))
  234. return false;
  235. else if (((default_check & 256) == 256) && (buildingStore[i].dwtype == 'YTSM'))
  236. return false;
  237. }
  238. }
  239. return true;
  240. }
  241. var draw_buinding = function() {
  242. var building_icon_height = 0;
  243. $("#building_level_count").html(max_level);
  244. let array = ["10309", "10308", "10307", "10306", "10305", "10304", "10303", "10302", "10301", "10300", "10299", "10298", "10297", "10296", "10295", "10294", "10293", "10292", "10291", "10290", "10289", "10288", "10287", "10286", "10285", "10284", "10283", "10282", "10281", "10280", "10279", "10278", "10277", "10276", "10275", "10274", "10273", "10272", "10271", "10270", "10269", "10268", "10267", "10266", "10265", "10264", "10263", "10262", "10261", "10260", "10259", "10258", "10257", "10256", "10255", "10254", "10253", "10252", "10251", "10250", "10249", "10248", "10246", "10245", "10244", "10243", "10242", "10241", "10240", "10239", "10238", "10237", "10236", "10234"]
  245. // 10244,10243,10242,10238 16层
  246. // if (company_code == '10182') {
  247. if (array.includes(company_code)) {
  248. // $("#dev_big_checklabel").addClass('dev_big_checklabel');
  249. // var dev_big_checklabel = document.getElementById('dev_big_checklabel');
  250. // dev_big_checklabel.innerHTML = '最大化';
  251. $("#company_bg_tl").removeClass('company_bg_tl');
  252. $("#company_bg_tl").addClass('company_bg_YP');
  253. $("#dev_all_checkbox").hide();
  254. $("#dev_all_checklabel").hide();
  255. $("#dev_ui_checkbox").hide();
  256. $("#dev_ui_checklabel").hide();
  257. $("#dev_sm_checkbox").hide();
  258. $("#dev_sm_checklabel").hide();
  259. $("#dev_fc_checkbox").hide();
  260. $("#dev_fc_checklabel").hide();
  261. $("#dev_ef_checkbox").hide();
  262. $("#dev_ef_checklabel").hide();
  263. $("#dev_wp_checkbox").hide();
  264. $("#dev_wp_checklabel").hide();
  265. $("#dev_ll_checkbox").hide();
  266. $("#dev_ll_checklabel").hide();
  267. $("#dev_ci_checkbox").hide();
  268. $("#dev_ci_checklabel").hide();
  269. $("#dev_va_checkbox").hide();
  270. $("#dev_va_checklabel").hide();
  271. $("#dev_ot_checkbox").hide();
  272. $("#dev_ot_checklabel").hide();
  273. $("#company_building").removeClass('company_building');
  274. $("#company_building").addClass('company_building_on');
  275. var company_building = document.getElementById('company_building');
  276. company_building.innerHTML = '<iframe id="myIframe" name="thingjs" src="https://www.thingjs.com/s/b11227d4fd5505106989737c?params=105b0f77fd24654d4eebc434e9" style="width:146%;height:123%;border:1px solid #0082ff;"></iframe>';
  277. var t1 = window.setTimeout(function() {
  278. // console.log(buildingStore);
  279. // debugger;
  280. callFuncInThingJS("userListener", buildingStore, top_level,company_code);
  281. window.clearTimeout(t1);
  282. }, 10000)
  283. } else {
  284. var company_building = document.getElementById('company_building');
  285. company_building.innerHTML = '';
  286. var currett_build = document.createElement('div');
  287. company_building.appendChild(currett_build)
  288. var building_top = document.createElement('div');
  289. building_top.setAttribute('class', 'building_top');
  290. building_top.style.top = '0px';
  291. currett_build.appendChild(building_top);
  292. building_icon_height += 120;
  293. var top_info = document.createElement('div');
  294. top_info.id = "building_top_info";
  295. top_info.setAttribute('class', 'building_top_label');
  296. top_info.innerHTML = 'RF';
  297. building_top.appendChild(top_info);
  298. var top_icon = document.createElement('div');
  299. top_icon.setAttribute('class', 'building_top_icon');
  300. building_top.appendChild(top_icon);
  301. if (max_level > 0) {
  302. var last_empty = max_level + 2;
  303. var first_empty = max_level + 2;
  304. for (var i = max_level; i > 0; i--) {
  305. if (chk_empty_level(i)) {
  306. if (last_empty != (i + 1)) {
  307. first_empty = i;
  308. last_empty = i;
  309. var build_level = document.createElement('div');
  310. build_level.setAttribute('class', 'building_level');
  311. build_level.style.top = (building_icon_height - 60) + 'px';
  312. currett_build.appendChild(build_level);
  313. building_icon_height += 48;
  314. var level_info = document.createElement('div');
  315. level_info.id = "building_empty_level_info_" + i;
  316. level_info.setAttribute('class', 'building_level_info')
  317. level_info.innerHTML = i + 'F';
  318. build_level.appendChild(level_info);
  319. var level_icon = document.createElement('div');
  320. level_icon.setAttribute('class', 'building_empty_level_icon');
  321. build_level.appendChild(level_icon);
  322. } else {
  323. var level_info = document.getElementById('building_empty_level_info_' + first_empty);
  324. if (level_info != undefined)
  325. level_info.innerHTML = i + 'F~' + first_empty + 'F';
  326. last_empty = i;
  327. }
  328. } else {
  329. var build_level = document.createElement('div');
  330. build_level.setAttribute('class', 'building_level');
  331. build_level.style.top = (building_icon_height - 60) + 'px';
  332. currett_build.appendChild(build_level);
  333. building_icon_height += 48;
  334. var level_info = document.createElement('div');
  335. level_info.id = "building_level_info_" + i;
  336. level_info.setAttribute('class', 'building_level_info')
  337. level_info.innerHTML = i + 'F';
  338. build_level.appendChild(level_info);
  339. var level_icon = document.createElement('div');
  340. level_icon.setAttribute('class', 'building_level_icon');
  341. build_level.appendChild(level_icon);
  342. }
  343. }
  344. }
  345. if (min_level < 0) {
  346. for (var i = -1; i >= min_level; i--) {
  347. var base_level = document.createElement('div');
  348. base_level.setAttribute('class', 'building_base');
  349. base_level.style.top = (building_icon_height - 60) + 'px';
  350. currett_build.appendChild(base_level);
  351. building_icon_height += 48;
  352. var base_info = document.createElement('div');
  353. base_info.id = 'building_base_info_' + (0 - i);
  354. base_info.setAttribute('class', 'building_base_info');
  355. base_info.innerHTML = 'B' + (0 - i) + 'F';
  356. base_level.appendChild(base_info);
  357. var base_icon = document.createElement('div');
  358. base_icon.setAttribute('class', 'building_base_icon');
  359. base_level.appendChild(base_icon);
  360. }
  361. }
  362. $("#company_building").css('height', ($(document).innerHeight() - 402) + 'px');
  363. building_icon_height += 60;
  364. currett_build.style.marginLeft = '59px';
  365. currett_build.style.marginRight = '59px';
  366. currett_build.style.width = '536px';
  367. if ((buildingStore != null) && (buildingStore.length > 0)) {
  368. for (var i = 0; i < buildingStore.length; i++) {
  369. var iconid = buildingStore[i].dwtype + '_' + buildingStore[i].min_level;
  370. var icon = document.getElementById(iconid);
  371. if (icon == undefined) {
  372. icon = document.createElement('div');
  373. icon.id = buildingStore[i].dwtype + '_' + buildingStore[i].min_level;
  374. icon.dwtype = buildingStore[i].dwtype;
  375. icon.level = buildingStore[i].min_level;
  376. icon.owner_code = buildingStore[i].owner_code;
  377. icon.style.position = 'absolute';
  378. icon.style.width = '62px';
  379. icon.style.height = '62px';
  380. icon.style.cursor = 'pointer';
  381. icon.setAttribute('onclick', 'icon_click(this)');
  382. currett_build.appendChild(icon);
  383. var this_min_level = buildingStore[i].min_level;
  384. var level_label = document.getElementById("building_level_info_" + this_min_level);
  385. if (this_min_level == top_level) {
  386. level_label = document.getElementById('building_top_info');
  387. } else if (this_min_level < 0) {
  388. level_label = document.getElementById('building_base_info_' + (0 - this_min_level));
  389. }
  390. if (level_label != null) {
  391. if (buildingStore[i].dwtype == 'YTUI') {
  392. if ((default_check & 1) == 1) {
  393. icon.title = '用户传输装置';
  394. icon.style.top = (level_label.offsetParent.offsetTop + 1) + 'px'
  395. icon.style.left = (level_label.offsetParent.offsetLeft + 28) + 'px';
  396. icon.style.backgroundImage = 'url(../../res/img/icons/ui_icon.png)';
  397. }
  398. } else if (buildingStore[i].dwtype == 'YTFC') {
  399. if ((default_check & 2) == 2) {
  400. icon.title = '消防控制柜';
  401. icon.style.top = (level_label.offsetParent.offsetTop + 15) + 'px'
  402. icon.style.left = (level_label.offsetParent.offsetLeft + 68) + 'px';
  403. icon.style.backgroundImage = 'url(../../res/img/icons/fc_icon.png)';
  404. }
  405. } else if (buildingStore[i].dwtype == 'YTEF') {
  406. if ((default_check & 4) == 4) {
  407. icon.title = '电气火灾';
  408. icon.style.top = (level_label.offsetParent.offsetTop + 29) + 'px'
  409. icon.style.left = (level_label.offsetParent.offsetLeft + 108) + 'px';
  410. icon.style.backgroundImage = 'url(../../res/img/icons/ef_icon.png)';
  411. }
  412. } else if (buildingStore[i].dwtype == 'YTWP') {
  413. if ((default_check & 8) == 8) {
  414. icon.title = '水压';
  415. icon.style.top = (level_label.offsetParent.offsetTop + 43) + 'px'
  416. icon.style.left = (level_label.offsetParent.offsetLeft + 148) + 'px';
  417. icon.style.backgroundImage = 'url(../../res/img/icons/wp0_icon.png)';
  418. }
  419. } else if (buildingStore[i].dwtype == 'YTLL') {
  420. if ((default_check & 16) == 16) {
  421. icon.title = '液位';
  422. icon.style.top = (level_label.offsetParent.offsetTop + 48) + 'px'
  423. icon.style.left = (level_label.offsetParent.offsetLeft + 188) + 'px';
  424. icon.style.backgroundImage = 'url(../../res/img/icons/ll_icon.png)';
  425. }
  426. } else if (buildingStore[i].dwtype == 'YTCI') {
  427. if ((default_check & 32) == 32) {
  428. icon.title = '环境监测';
  429. icon.style.top = (level_label.offsetParent.offsetTop + 43) + 'px'
  430. icon.style.left = (level_label.offsetParent.offsetLeft + 228) + 'px';
  431. icon.style.backgroundImage = 'url(../../res/img/icons/ci_icon.png)';
  432. }
  433. } else if (buildingStore[i].dwtype == 'YTVA') {
  434. if ((default_check & 64) == 64) {
  435. icon.title = '视频监控';
  436. icon.style.top = (level_label.offsetParent.offsetTop + 29) + 'px'
  437. icon.style.left = (level_label.offsetParent.offsetLeft + 268) + 'px';
  438. icon.style.backgroundImage = 'url(../../res/img/icons/va_icon.png)';
  439. }
  440. } else if (buildingStore[i].dwtype == 'YTWC') {
  441. if ((default_check & 128) == 128) {
  442. icon.title = '风机控制柜';
  443. icon.style.top = (level_label.offsetParent.offsetTop + 15) + 'px'
  444. icon.style.left = (level_label.offsetParent.offsetLeft + 308) + 'px';
  445. icon.style.backgroundImage = 'url(../../res/img/icons/wc_icon.png)';
  446. }
  447. } else if (buildingStore[i].dwtype == 'YTSM') {
  448. if ((default_check & 256) == 256) {
  449. icon.title = '烟感';
  450. icon.style.top = (level_label.offsetParent.offsetTop + 1) + 'px';
  451. icon.style.left = (level_label.offsetParent.offsetLeft + 348) + 'px';
  452. icon.style.backgroundImage = 'url(../../res/img/icons/sm_icon.png)';
  453. }
  454. }
  455. }
  456. } else
  457. icon.owner_code = "";
  458. }
  459. }
  460. }
  461. if (show_project_info) {
  462. var project_info_bar = document.getElementById('project_info_bar');
  463. project_info_bar.innerHTML = '';
  464. var project_label = document.createElement('div');
  465. project_label.setAttribute('class', 'project_label');
  466. project_label.style.position = 'absolute';
  467. project_label.style.top = '30px';
  468. project_label.style.left = '50px';
  469. project_label.innerHTML = '项目名称';
  470. project_info_bar.appendChild(project_label);
  471. var project_info = document.createElement('div');
  472. // ;
  473. project_info.setAttribute('class', 'project_info');
  474. project_info.style.position = 'absolute';
  475. project_info.style.top = '60px';
  476. project_info.style.left = '50px';
  477. project_info.innerHTML = companyStore.company_name;
  478. project_info_bar.appendChild(project_info);
  479. project_label = document.createElement('div');
  480. project_label.setAttribute('class', 'project_label');
  481. project_label.style.position = 'absolute';
  482. project_label.style.top = '110px';
  483. project_label.style.left = '50px';
  484. project_label.innerHTML = '项目地址';
  485. project_info_bar.appendChild(project_label);
  486. project_info = document.createElement('div');;
  487. project_info.setAttribute('class', 'project_info');
  488. project_info.style.position = 'absolute';
  489. project_info.style.top = '140px';
  490. project_info.style.left = '50px';
  491. project_info.innerHTML = companyStore.address;
  492. project_info_bar.appendChild(project_info);
  493. project_label = document.createElement('div');
  494. project_label.setAttribute('class', 'project_label');
  495. project_label.style.position = 'absolute';
  496. project_label.style.top = '190px';
  497. project_label.style.left = '50px';
  498. project_label.innerHTML = '项目坐标';
  499. project_info_bar.appendChild(project_label);
  500. project_info = document.createElement('div');;
  501. project_info.setAttribute('class', 'project_info');
  502. project_info.style.position = 'absolute';
  503. project_info.style.top = '220px';
  504. project_info.style.left = '50px';
  505. project_info.innerHTML = companyStore.lng + ',' + companyStore.lat;
  506. project_info_bar.appendChild(project_info);
  507. project_label = document.createElement('div');
  508. project_label.setAttribute('class', 'project_label');
  509. project_label.style.position = 'absolute';
  510. project_label.style.top = '30px';
  511. project_label.style.left = '480px';
  512. project_label.innerHTML = '联系人';
  513. project_info_bar.appendChild(project_label);
  514. project_info = document.createElement('div');;
  515. project_info.setAttribute('class', 'project_info');
  516. project_info.style.position = 'absolute';
  517. project_info.style.top = '60px';
  518. project_info.style.left = '480px';
  519. project_info.innerHTML = companyStore.username;
  520. project_info_bar.appendChild(project_info);
  521. project_label = document.createElement('div');
  522. project_label.setAttribute('class', 'project_label');
  523. project_label.style.position = 'absolute';
  524. project_label.style.top = '110px';
  525. project_label.style.left = '480px';
  526. project_label.innerHTML = '联系电话';
  527. project_info_bar.appendChild(project_label);
  528. project_info = document.createElement('div');;
  529. project_info.setAttribute('class', 'project_info');
  530. project_info.style.position = 'absolute';
  531. project_info.style.top = '140px';
  532. project_info.style.left = '480px';
  533. project_info.innerHTML = companyStore.phone;
  534. project_info_bar.appendChild(project_info);
  535. var history_alarm_list = document.getElementById('history_alarm_list');
  536. history_alarm_list.innerHTML = '';
  537. var table = document.createElement('table');
  538. table.width = '100%';
  539. history_alarm_list.appendChild(table);
  540. var tr = document.createElement('tr');
  541. table.appendChild(tr);
  542. var dwtypelist = [1, 7, 2, 6, 16, 17];
  543. for (var i = 0; i < 6; i++) {
  544. var td = document.createElement('td');
  545. td.setAttribute('colspan', '2');
  546. td.setAttribute('style', 'width:128px;');
  547. td.setAttribute('class', 'data_bar_title');
  548. td.style.textAlign = 'center';
  549. td.style.paddingTop = '15px';
  550. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  551. if (i == 0)
  552. td.innerHTML = '火灾监控';
  553. else if (i == 1)
  554. td.innerHTML = '电气火灾监控';
  555. else if (i == 2)
  556. td.innerHTML = '水系统监控';
  557. else if (i == 3)
  558. td.innerHTML = 'RTU监控';
  559. else if (i == 4)
  560. td.innerHTML = '视频告警监控'
  561. else
  562. td.innerHTML = '电梯告警监控'
  563. tr.appendChild(td);
  564. }
  565. tr = document.createElement('tr');
  566. table.appendChild(tr);
  567. for (var i = 0; i < 6; i++) {
  568. var td = document.createElement('td');
  569. td.setAttribute('class', 'data_bar_total_label');
  570. td.style.textAlign = 'right';
  571. td.width = '10%';
  572. td.innerHTML = '设备总数';
  573. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  574. tr.appendChild(td);
  575. td = document.createElement('td');
  576. td.setAttribute('class', 'data_bar_total_number');
  577. td.style.textAlign = 'left';
  578. td.style.paddingLeft = '10px';
  579. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  580. if (i == 0)
  581. td.innerHTML = companyStore.d1;
  582. else if (i == 1)
  583. td.innerHTML = companyStore.d7;
  584. else if (i == 2)
  585. td.innerHTML = companyStore.d2;
  586. else if (i == 3)
  587. td.innerHTML = companyStore.d6;
  588. else if (i == 4)
  589. td.innerHTML = companyStore.d16;
  590. else
  591. //td.innerHTML=companyStore.d17;
  592. td.innerHTML = 0;
  593. tr.appendChild(td);
  594. }
  595. tr = document.createElement('tr');
  596. table.appendChild(tr);
  597. for (var i = 0; i < 6; i++) {
  598. var td = document.createElement('td');
  599. td.setAttribute('class', 'data_bar_total_label');
  600. td.style.textAlign = 'right';
  601. td.width = '10%';
  602. td.innerHTML = '已处理';
  603. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  604. tr.appendChild(td);
  605. td = document.createElement('td');
  606. td.setAttribute('class', 'device_confirm_num1');
  607. td.style.textAlign = 'left';
  608. td.style.paddingLeft = '10px';
  609. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  610. if (i == 0)
  611. td.innerHTML = companyStore.d1ac;
  612. else if (i == 1)
  613. td.innerHTML = companyStore.d7ac;
  614. else if (i == 2)
  615. td.innerHTML = companyStore.d2ac;
  616. else if (i == 3)
  617. td.innerHTML = companyStore.d6ac;
  618. else if (i == 4)
  619. td.innerHTML = companyStore.d16ac;
  620. else
  621. //td.innerHTML=companyStore.d17ac;
  622. td.innerHTML = 0;
  623. tr.appendChild(td);
  624. }
  625. tr = document.createElement('tr');
  626. table.appendChild(tr);
  627. for (var i = 0; i < 6; i++) {
  628. var td = document.createElement('td');
  629. td.setAttribute('class', 'data_bar_total_label');
  630. td.style.textAlign = 'right';
  631. td.width = '10%';
  632. td.innerHTML = '待处理';
  633. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  634. tr.appendChild(td);
  635. td = document.createElement('td');
  636. td.setAttribute('class', 'device_confirm_num2');
  637. td.style.textAlign = 'left';
  638. td.style.paddingLeft = '10px';
  639. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  640. if (i == 0)
  641. td.innerHTML = companyStore.d1a - companyStore.d1ac;
  642. else if (i == 1)
  643. td.innerHTML = companyStore.d7a - companyStore.d7ac;
  644. else if (i == 2)
  645. td.innerHTML = companyStore.d2a - companyStore.d2ac;
  646. else if (i == 3)
  647. td.innerHTML = companyStore.d6a - companyStore.d6ac;
  648. else if (i == 4)
  649. td.innerHTML = companyStore.d16a - companyStore.d16ac;
  650. else
  651. //td.innerHTML=companyStore.d17a-companyStore.d17ac;
  652. td.innerHTML = 0;
  653. tr.appendChild(td);
  654. }
  655. tr = document.createElement('tr');
  656. table.appendChild(tr);
  657. for (var i = 0; i < 6; i++) {
  658. var td = document.createElement('td');
  659. td.setAttribute('colspan', '2');
  660. tr.appendChild(td);
  661. var div = document.createElement('div');
  662. div.id = 'alarm_pie_' + i;
  663. div.style.margin = '10px auto 10px auto';
  664. div.style.width = '110px';
  665. td.setAttribute('onclick', 'show_alarm_list("' + company_code + '","' + dwtypelist[i] + '")');
  666. td.appendChild(div);
  667. }
  668. draw_pie('alarm_pie_0', companyStore.d1a, companyStore.d1ac);
  669. draw_pie('alarm_pie_1', companyStore.d7a, companyStore.d7ac);
  670. draw_pie('alarm_pie_2', companyStore.d2a, companyStore.d2ac);
  671. draw_pie('alarm_pie_3', companyStore.d6a, companyStore.d6ac);
  672. draw_pie('alarm_pie_4', companyStore.d16a, companyStore.d16ac);
  673. //draw_pie('alarm_pie_5',companyStore.d17a,companyStore.d17ac);
  674. draw_pie('alarm_pie_5', 0);
  675. } else {
  676. var project_info_bar = document.getElementById('project_info_bar');
  677. project_info_bar.innerHTML = '';
  678. var history_alarm_list = document.getElementById('history_alarm_list');
  679. history_alarm_list.innerHTML = '';
  680. }
  681. }
  682. function callFuncInThingJS(funcName, data, top_level,company_code) {
  683. var iframe = $('#myIframe')[0];
  684. var msg = { data, top_level,company_code }
  685. var message = {
  686. 'funcName': funcName,
  687. 'param': msg
  688. }
  689. iframe.contentWindow.postMessage(message, '*');
  690. }
  691. function myaleart() {
  692. alert("wwwwwwwwwwwwwwwwwww");
  693. }
  694. window.addEventListener('message', function(e) {
  695. var data = e.data;
  696. var funcName = data.funcName;
  697. var param = data.param;
  698. if (window[funcName]) window[funcName](param);
  699. });
  700. var show_alarm_list = function(company_code, dwtype) {
  701. $("#company_detail_title").removeClass('device_status_title_icon');
  702. $("#company_detail_title").addClass('history_alarm_title_icon');
  703. $("#bak_reset2").removeClass('hiden');
  704. $("#bak_reset2").addClass('shown');
  705. var history_alarm_list = document.getElementById('history_alarm_list');
  706. history_alarm_list.innerHTML = '<iframe name="queryPage" src="' + basePath + 'view/frontpage/query.jsp?theme=' + theme + '&dwtype=' + dwtype + '&company_code=' + company_code + '" style="width:100%;height:100%;" frameborder="0"></iframe>';
  707. // alert(company_code+','+dwtype);
  708. }
  709. var bak_reset = function() {
  710. $("#company_detail_title").removeClass('history_alarm_title_icon');
  711. $("#company_detail_title").addClass('device_status_title_icon');
  712. $("#company_page_title").removeClass('realtime_title_icon');
  713. $("#company_page_title").addClass('project_title_icon');
  714. $("#bak_reset").removeClass('shown');
  715. $("#bak_reset").addClass('hiden');
  716. $("#bak_reset2").removeClass('shown');
  717. $("#bak_reset2").addClass('hiden');
  718. // $("#history_alarm_list").css('overflow-y','auto');
  719. var v_reset = document.getElementById('v_reset');
  720. if (v_reset != undefined) {
  721. document.body.removeChild(v_reset);
  722. }
  723. var big_view = document.getElementById('big_view');
  724. if (big_view != undefined) {
  725. document.body.removeChild(big_view);
  726. }
  727. show_project_info = true;
  728. draw_buinding();
  729. }
  730. var dev_click = function(obj) {
  731. var dwtype = obj.dwtype;
  732. var level = obj.level;
  733. var id = obj.owner_code;
  734. var idx = obj.idx;
  735. show_project_info = false;
  736. // var history_alarm_list = document.getElementById('history_alarm_list');
  737. // history_alarm_list.innerHTML='<iframe name="queryPage" src="'+basePath+'view/frontpage/query.jsp?theme='+theme+'&dwtype='+dwtype+'&level='+level+'&objid='+id+'" style="width:100%;height:100%;" frameborder="0"></iframe>';
  738. show_realtime_status(idx);
  739. if (dwtype == 'YTVA') {
  740. onair_video = false;
  741. chk_cideo();
  742. }
  743. }
  744. var icon_click = function(obj) {
  745. debugger;
  746. var dwtype = obj.dwtype;
  747. var level = obj.level;
  748. var id = obj.owner_code;
  749. show_project_info = false;
  750. // $("#company_detail_title").removeClass('device_status_title_icon');
  751. // $("#company_detail_title").addClass('history_alarm_title_icon');
  752. $("#company_page_title").removeClass('project_title_icon');
  753. $("#company_page_title").addClass('realtime_title_icon');
  754. $("#bak_reset").removeClass('hiden');
  755. $("#bak_reset").addClass('shown');
  756. var project_info_bar = document.getElementById('project_info_bar');
  757. project_info_bar.innerHTML = '';
  758. var query = new Object();
  759. query.dwtype = dwtype;
  760. query.level = level;
  761. query.V_LOGINNAME = V_LOGINNAME;
  762. query.COMPANY_CODE = company_code;
  763. $.ajax({
  764. type: 'POST',
  765. url: basePath + "iot/frontpage/getCurrentStatus",
  766. data: {
  767. queryJson: Ext.JSON.encode(query)
  768. },
  769. success: function(result) {
  770. var json = eval('(' + result + ')');
  771. if (json.action == 'getCurrentStatus') {
  772. if (json.check == true) {
  773. if (json.devices != undefined) {
  774. devicesStore = json.devices;
  775. drawCurrentStatus();
  776. }
  777. } else {
  778. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function() {
  779. window.parent.document.location = basePath;
  780. });
  781. }
  782. }
  783. myMask.hide();
  784. }
  785. });
  786. // var history_alarm_list = document.getElementById('history_alarm_list');
  787. // history_alarm_list.style.overflowY='hidden';
  788. // history_alarm_list.innerHTML='<iframe name="queryPage" src="'+basePath+'view/frontpage/query.jsp?theme='+theme+'&dwtype='+dwtype+'&level='+level+'&objid='+id+'&company_code='+company_code+'" style="width:100%;height:100%;" frameborder="0"></iframe>';
  789. if (dwtype == 'YTVA') {
  790. onair_video = false;
  791. chk_cideo();
  792. }
  793. }
  794. var draw_pie = function(id, total, num) {
  795. var mColor = '#34abf5';
  796. var percent = 100;
  797. if (total > 0)
  798. percent = Number(((num * 100) / total).toString().match(/^\d+(?:\.\d{0,2})?/));
  799. if (percent < 60)
  800. mColor = '#f66167';
  801. else if (percent < 80)
  802. mColor = '#DDDF0D';
  803. Highcharts.getOptions().colors = Highcharts.map(['#f66167', '#34abf5', '#DDDF0D', '#ff2e95', '#39b54a', '#ffb163', '#c233ac', '#9dffad', '#c77051'], function(color) {
  804. return {
  805. radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
  806. stops: [
  807. [0, color],
  808. [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
  809. ]
  810. };
  811. });
  812. Highcharts.chart(id, {
  813. chart: {
  814. type: 'pie',
  815. backgroundColor: 'rgba(0,0,0,0)',
  816. height: '100%',
  817. options3d: {
  818. enabled: true,
  819. alpha: 45,
  820. beta: 0
  821. }
  822. },
  823. title: {
  824. text: '处置率:' + percent + '%',
  825. floating: true,
  826. y: 95,
  827. style: { fontSize: '12px', color: '#ffffff' }
  828. },
  829. exporting: {
  830. enabled: false
  831. },
  832. credits: {
  833. enabled: false
  834. },
  835. tooltip: {
  836. // enabled: false
  837. pointFormat: '{point.percentage:.2f}%'
  838. },
  839. plotOptions: {
  840. pie: {
  841. allowPointSelect: true,
  842. cursor: 'pointer',
  843. depth: 15,
  844. dataLabels: {
  845. enabled: false,
  846. format: '{point.name}'
  847. }
  848. }
  849. },
  850. series: [{
  851. type: 'pie',
  852. name: '处置率',
  853. startAngle: 90,
  854. data: [{
  855. name: '待处理',
  856. y: 100 - percent,
  857. sliced: true,
  858. selected: true
  859. },
  860. ['已处理', percent]
  861. ]
  862. }]
  863. });
  864. }
  865. var drawCurrentStatus = function() {
  866. if ((devicesStore != null) && (devicesStore.length > 0)) {
  867. if (onair_video) {
  868. onair_video = false;
  869. chk_cideo();
  870. }
  871. var project_info_bar = document.getElementById('project_info_bar');
  872. var device_icon = document.createElement('img');
  873. if (devicesStore[0].dwtype == 'YTUI') {
  874. device_icon.setAttribute('class', 'device_large_icon');
  875. device_icon.src = basePath + 'res/img/icons/ui_large_icon.gif';
  876. } else if (devicesStore[0].dwtype == 'YTFC') {
  877. device_icon.setAttribute('class', 'device_large_icon');
  878. device_icon.src = basePath + 'res/img/icons/fc_large_icon.gif';
  879. } else if (devicesStore[0].dwtype == 'YTCI') {
  880. device_icon.setAttribute('class', 'device_large_icon');
  881. device_icon.src = basePath + 'res/img/icons/ci_large_icon.gif';
  882. } else if (devicesStore[0].dwtype == 'YTWP') {
  883. device_icon.setAttribute('class', 'device_large_icon');
  884. device_icon.src = basePath + 'res/img/icons/wp1_large_icon.gif';
  885. } else if (devicesStore[0].dwtype == 'YTLL') {
  886. device_icon.setAttribute('class', 'device_large_icon');
  887. device_icon.src = basePath + 'res/img/icons/ll_large_icon.gif';
  888. } else if (devicesStore[0].dwtype == 'YTVA') {
  889. device_icon.setAttribute('class', 'device_large_icon');
  890. device_icon.src = basePath + 'res/img/icons/va_large_icon.gif';
  891. } else if (devicesStore[0].dwtype == 'YTEF') {
  892. device_icon.setAttribute('class', 'device_large_icon');
  893. device_icon.src = basePath + 'res/img/icons/ef_large_icon.gif';
  894. } else if (devicesStore[0].dwtype == 'YTWC') {
  895. device_icon.setAttribute('class', 'device_large_icon');
  896. device_icon.src = basePath + 'res/img/icons/wc_large_icon.gif';
  897. } else if (devicesStore[0].dwtype == 'YTSM') {
  898. device_icon.setAttribute('class', 'device_large_icon');
  899. device_icon.src = basePath + 'res/img/icons/sm_large_icon.gif';
  900. }
  901. // var device_icon = document.createElement('div');
  902. // if(devicesStore[0].dwtype=='YTUI'){
  903. // device_icon.setAttribute('class','device_large_icon ui_large_icon');
  904. // }else if(devicesStore[0].dwtype=='YTFC'){
  905. // device_icon.setAttribute('class','device_large_icon fc_large_icon');
  906. // }else if(devicesStore[0].dwtype=='YTCI'){
  907. // device_icon.setAttribute('class','device_large_icon ci_large_icon');
  908. // }else if(devicesStore[0].dwtype=='YTWP'){
  909. // device_icon.setAttribute('class','device_large_icon wp1_large_icon');
  910. // }else if(devicesStore[0].dwtype=='YTLL'){
  911. // device_icon.setAttribute('class','device_large_icon ll_large_icon');
  912. // }else if(devicesStore[0].dwtype=='YTVA'){
  913. // device_icon.setAttribute('class','device_large_icon va_large_icon');
  914. // }else if(devicesStore[0].dwtype=='YTEF'){
  915. // device_icon.setAttribute('class','device_large_icon ef_large_icon');
  916. // }
  917. project_info_bar.appendChild(device_icon);
  918. var device_count_label = document.createElement('div');
  919. device_count_label.id = 'device_count_label';
  920. device_count_label.setAttribute('class', 'device_count_label');
  921. project_info_bar.appendChild(device_count_label);
  922. var device_list_bar = document.createElement('div');
  923. device_list_bar.setAttribute('class', 'device_list_bar');
  924. project_info_bar.appendChild(device_list_bar);
  925. var status_list_bar = document.createElement('div');
  926. status_list_bar.id = 'status_list_bar';
  927. status_list_bar.setAttribute('status', '');
  928. status_list_bar.setAttribute('class', 'status_list_bar');
  929. status_list_bar.style.width = ($(document).innerWidth() - 1528) + 'px';
  930. project_info_bar.appendChild(status_list_bar);
  931. for (var i = 0; i < devicesStore.length; i++) {
  932. var dev = document.createElement('div');
  933. dev.owner_code = devicesStore[i].owner_code;
  934. dev.id = "device_list_bar_sub_" + i;
  935. dev.dwtype = devicesStore[i].dwtype;
  936. dev.level = devicesStore[i].level;
  937. dev.style.margin = '10px';
  938. dev.style.padding = '10px';
  939. dev.style.width = '300px';
  940. dev.style.cursor = 'pointer';
  941. dev.idx = i;
  942. dev.setAttribute('onclick', 'dev_click(this)');
  943. device_list_bar.appendChild(dev);
  944. $("#device_list_bar_sub_" + i).mouseover(function() {
  945. $(this).css('background', 'rgba(64,85,98,0.7)');
  946. });
  947. $("#device_list_bar_sub_" + i).mouseout(function() {
  948. $(this).css('background', 'rgba(0,0,0,0)');
  949. });
  950. var dev_name_label = document.createElement('div');
  951. dev_name_label.setAttribute('class', 'project_label');
  952. dev_name_label.style.marginTop = '6px';
  953. dev_name_label.innerHTML = '设备名称';
  954. dev.appendChild(dev_name_label);
  955. var dev_name_info = document.createElement('div');
  956. dev_name_info.setAttribute('class', 'project_info');
  957. dev_name_info.style.marginTop = '12px';
  958. dev_name_info.innerHTML = devicesStore[i].device_name;
  959. dev.appendChild(dev_name_info);
  960. var dev_code_label = document.createElement('div');
  961. dev_code_label.setAttribute('class', 'project_label');
  962. dev_code_label.style.marginTop = '14px';
  963. dev_code_label.innerHTML = '设备编号';
  964. dev.appendChild(dev_code_label);
  965. var dev_code_info = document.createElement('div');
  966. dev_code_info.setAttribute('class', 'project_info');
  967. dev_code_info.style.marginTop = '12px';
  968. dev_code_info.innerHTML = devicesStore[i].owner_code;
  969. dev.appendChild(dev_code_info);
  970. var dev_OBJ_label = document.createElement('div');
  971. dev_OBJ_label.setAttribute('class', 'project_label');
  972. dev_OBJ_label.style.marginTop = '14px';
  973. dev_OBJ_label.innerHTML = '监测对象';
  974. dev.appendChild(dev_OBJ_label);
  975. var dev_OBJ_info = document.createElement('div');
  976. dev_OBJ_info.setAttribute('class', 'project_info');
  977. dev_OBJ_info.style.marginTop = '12px';
  978. dev_OBJ_info.innerHTML = devicesStore[i].object_name;
  979. dev.appendChild(dev_OBJ_info);
  980. var dev_time_label = document.createElement('div');
  981. dev_time_label.setAttribute('class', 'project_label');
  982. dev_time_label.style.marginTop = '14px';
  983. dev_time_label.innerHTML = '数据更新时间';
  984. dev.appendChild(dev_time_label);
  985. var dev_time_info = document.createElement('div');
  986. dev_time_info.setAttribute('class', 'project_info');
  987. dev_time_info.style.marginTop = '12px';
  988. dev_time_info.style.marginBottom = '12px';
  989. dev_time_info.innerHTML = (devicesStore[i].status_time == '1970-01-01 08:00:00') ? '-' : devicesStore[i].status_time;
  990. dev.appendChild(dev_time_info);
  991. }
  992. }
  993. show_realtime_status(0);
  994. }
  995. var big_view_win = function(obj) {
  996. Ext.create('Ext.window.Window', {
  997. id: 'big_view_win',
  998. title: '监控视频',
  999. height: 680,
  1000. width: 800,
  1001. layout: 'fit',
  1002. modal: true,
  1003. maximizable: true,
  1004. buttons: [{
  1005. text: '关闭',
  1006. handler: function() {
  1007. Ext.getCmp('big_view_win').destroy();
  1008. }
  1009. }],
  1010. closeAction: 'destroy',
  1011. html: '<iframe width="99%" height="99%" frameborder=0 allowtransparency="true" scrolling=auto src="' + basePath + 'view/frontpage/video.jsp?videoId=' + obj.owner_code + '"></iframe>'
  1012. }).show();
  1013. }
  1014. var reset_video = function(obj) {
  1015. var query = {
  1016. CMD: 3,
  1017. BODY: {
  1018. DEVICE: obj.owner_code,
  1019. ACTION: 0,
  1020. IDX: 0
  1021. }
  1022. }
  1023. var status_list_bar = document.getElementById('status_list_bar');
  1024. status_list_bar.setAttribute('status', 'connecting');
  1025. status_list_bar.innerHTML = '<div style="margin-top:120px;">连接中,请稍候...</div>';
  1026. $.ajax({
  1027. type: 'POST',
  1028. url: 'https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi',
  1029. data: 'queryJson:' + JSON.stringify(query),
  1030. success: function(result) {}
  1031. });
  1032. onair_video = false;
  1033. setTimeout(chk_cideo, 5000);
  1034. }
  1035. var open_video = function(obj) {
  1036. var query = {
  1037. CMD: 3,
  1038. BODY: {
  1039. DEVICE: obj.getAttribute('owner_code'),
  1040. ACTION: 1,
  1041. IDX: 7
  1042. }
  1043. }
  1044. var status_list_bar = document.getElementById('status_list_bar');
  1045. status_list_bar.setAttribute('status', 'connecting');
  1046. status_list_bar.innerHTML = '<div style="margin-top:120px;">连接中,请稍候...</div>';
  1047. $.ajax({
  1048. type: 'POST',
  1049. url: 'https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi',
  1050. data: 'queryJson:' + JSON.stringify(query),
  1051. success: function(result) {}
  1052. });
  1053. onair_video = false;
  1054. // setTimeout(chk_cideo,5000);
  1055. }
  1056. var chk_cideo = function() {
  1057. if (onair_video)
  1058. return;
  1059. var query = {
  1060. CMD: 1
  1061. }
  1062. $.ajax({
  1063. type: 'POST',
  1064. url: 'https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi',
  1065. data: 'queryJson:' + JSON.stringify(query),
  1066. success: function(result) {
  1067. var json = eval('(' + result + ')');
  1068. var v_reset = document.getElementById('v_reset');
  1069. if (v_reset != undefined) {
  1070. var found = false;
  1071. if (json.RESULT.LIST != undefined) {
  1072. if (json.RESULT.LIST.length > 0) {
  1073. for (var i = 0; i < json.RESULT.LIST.length; i++) {
  1074. if (json.RESULT.LIST[i].DEVICE == v_reset.owner_code) {
  1075. found = true;
  1076. online_video = json.RESULT.LIST[i].LIVEONLINE;
  1077. if ((json.RESULT.LIST[i].ONAIR) && (!onair_video)) {
  1078. $("#v_reset").css('display', 'block');
  1079. $("#big_view").css('display', 'block');
  1080. onair_video = true;
  1081. var status_list_bar = document.getElementById('status_list_bar');
  1082. status_list_bar.setAttribute('status', '');
  1083. status_list_bar.innerHTML = '<iframe width="99%" height="99%" frameborder=0 allowtransparency="true" scrolling=auto src="' + basePath + 'view/frontpage/video.jsp?videoId=' + json.RESULT.LIST[i].DEVICE + '"></iframe>';
  1084. } else if (!json.RESULT.LIST[i].ONAIR) {
  1085. if (json.RESULT.LIST[i].ALIVEVALUE == 3) {
  1086. onair_video = false;
  1087. var status_list_bar = document.getElementById('status_list_bar');
  1088. if (status_list_bar.getAttribute('status') == '')
  1089. status_list_bar.innerHTML = '<div style="margin-top:120px;cursor:pointer;" owner_code="' + json.RESULT.LIST[i].DEVICE + '" onclick="open_video(this)">设备在线,点击加载视频</div>';
  1090. } else if (json.RESULT.LIST[i].ALIVEVALUE == 2) {
  1091. onair_video = false;
  1092. var status_list_bar = document.getElementById('status_list_bar');
  1093. status_list_bar.setAttribute('status', '');
  1094. status_list_bar.innerHTML = '<div style="margin-top:120px;">设备重连中,请稍候...</div>';
  1095. } else {
  1096. onair_video = false;
  1097. var status_list_bar = document.getElementById('status_list_bar');
  1098. status_list_bar.setAttribute('status', '');
  1099. status_list_bar.innerHTML = '<div style="margin-top:120px;">设备未连线,尝试连接。请稍候...</div>';
  1100. }
  1101. }
  1102. }
  1103. }
  1104. }
  1105. }
  1106. }
  1107. }
  1108. });
  1109. setTimeout(chk_cideo, 5000);
  1110. }
  1111. var show_realtime_status = function(idx) {
  1112. $("#device_count_label").html('');