company.js 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365
  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('');
  1113. if ((devicesStore != null) && (devicesStore.length > idx)) {
  1114. $("#device_count_label").html('[ ' + devicesStore.length + '-' + (idx + 1) + ' ]');
  1115. var status_list_bar = document.getElementById('status_list_bar');
  1116. status_list_bar.setAttribute('status', '');
  1117. status_list_bar.innerHTML = '';
  1118. var title = document.createElement('div');
  1119. title.id = 'device_list_status_title';
  1120. title.style.textAlign = 'center';
  1121. title.style.fontSize = '16px';
  1122. title.style.fontWeight = 'bold';
  1123. title.innerHTML = devicesStore[idx].device_name;
  1124. status_list_bar.appendChild(title);
  1125. var sta = document.createElement('table');
  1126. sta.style.marginTop = '10px';
  1127. sta.width = '100%';
  1128. sta.idx = i;
  1129. status_list_bar.appendChild(sta);
  1130. var v_reset = document.getElementById('v_reset');
  1131. if (v_reset != undefined) {
  1132. document.body.removeChild(v_reset);
  1133. }
  1134. var big_view = document.getElementById('big_view');
  1135. if (big_view != undefined) {
  1136. document.body.removeChild(big_view);
  1137. }
  1138. $("#status_list_bar").removeClass('status_list_bar_video');
  1139. if (devicesStore[idx].dwtype == 'YTVA') {
  1140. online_video = false;
  1141. if (onair_video) {
  1142. onair_video = false;
  1143. chk_cideo();
  1144. }
  1145. v_reset = document.createElement('div');
  1146. v_reset.id = 'v_reset';
  1147. v_reset.owner_code = devicesStore[idx].owner_code;
  1148. v_reset.setAttribute('class', 'v_reset');
  1149. v_reset.setAttribute('onclick', 'reset_video(this)');
  1150. v_reset.title = '视频重载';
  1151. document.body.appendChild(v_reset);
  1152. $("#v_reset").css('display', 'none');
  1153. big_view = document.createElement('div');
  1154. big_view.id = 'big_view';
  1155. big_view.owner_code = devicesStore[idx].owner_code;
  1156. big_view.setAttribute('class', 'big_view');
  1157. big_view.setAttribute('onclick', 'big_view_win(this)');
  1158. big_view.title = '视频放大';
  1159. document.body.appendChild(big_view);
  1160. $("#big_view").css('display', 'none');
  1161. $("#status_list_bar").addClass('status_list_bar_video');
  1162. $("#status_list_bar").html('<div style="margin-top:120px;">连接中,请稍候...</div>');
  1163. } else if (devicesStore[idx].dwtype == 'YTFC') {
  1164. var tr = document.createElement('tr');
  1165. sta.appendChild(tr);
  1166. var td = document.createElement('td');
  1167. td.width = '30%';
  1168. td.setAttribute('class', 'point_label project_label');
  1169. td.style.paddingTop = '14px';
  1170. td.id = 'PowerAlarmLabel';
  1171. td.innerHTML = '电源故障状态';
  1172. tr.appendChild(td);
  1173. td = document.createElement('td');
  1174. td.id = 'PowerAlarm';
  1175. td.width = '20%';
  1176. td.setAttribute('class', 'project_info');
  1177. td.style.paddingTop = '12px';
  1178. tr.appendChild(td);
  1179. var td = document.createElement('td');
  1180. td.setAttribute('class', 'point_label project_label');
  1181. td.style.paddingTop = '14px';
  1182. td.width = '30%';
  1183. td.id = 'ManualActLabel';
  1184. td.innerHTML = '手自动状态';
  1185. tr.appendChild(td);
  1186. td = document.createElement('td');
  1187. td.width = '20%';
  1188. td.id = 'ManualAct';
  1189. td.setAttribute('class', 'project_info');
  1190. td.style.paddingTop = '12px';
  1191. tr.appendChild(td);
  1192. tr = document.createElement('tr');
  1193. sta.appendChild(tr);
  1194. var td = document.createElement('td');
  1195. td.setAttribute('class', 'point_label project_label');
  1196. td.style.paddingTop = '14px';
  1197. td.id = 'DevWorking01Label';
  1198. td.innerHTML = '1#设备运行状态';
  1199. tr.appendChild(td);
  1200. td = document.createElement('td');
  1201. td.id = 'DevWorking01';
  1202. td.setAttribute('class', 'project_info');
  1203. td.style.paddingTop = '12px';
  1204. tr.appendChild(td);
  1205. var td = document.createElement('td');
  1206. td.setAttribute('class', 'point_label project_label');
  1207. td.style.paddingTop = '14px';
  1208. td.id = 'DevWorking02Label';
  1209. td.innerHTML = '2#设备运行状态';
  1210. tr.appendChild(td);
  1211. td = document.createElement('td');
  1212. td.id = 'DevWorking02';
  1213. td.setAttribute('class', 'project_info');
  1214. td.style.paddingTop = '12px';
  1215. tr.appendChild(td);
  1216. tr = document.createElement('tr');
  1217. sta.appendChild(tr);
  1218. var td = document.createElement('td');
  1219. td.setAttribute('class', 'point_label project_label');
  1220. td.style.paddingTop = '14px';
  1221. td.id = 'DevAlarm01Label';
  1222. td.innerHTML = '1#设备故障状态';
  1223. tr.appendChild(td);
  1224. td = document.createElement('td');
  1225. td.id = 'DevAlarm01';
  1226. td.setAttribute('class', 'project_info');
  1227. td.style.paddingTop = '12px';
  1228. tr.appendChild(td);
  1229. var td = document.createElement('td');
  1230. td.setAttribute('class', 'point_label project_label');
  1231. td.style.paddingTop = '14px';
  1232. td.id = 'DevAlarm02Label';
  1233. td.innerHTML = '2#设备故障状态';
  1234. tr.appendChild(td);
  1235. td = document.createElement('td');
  1236. td.id = 'DevAlarm02';
  1237. td.setAttribute('class', 'project_info');
  1238. td.style.paddingTop = '12px';
  1239. tr.appendChild(td);
  1240. tr = document.createElement('tr');
  1241. sta.appendChild(tr);
  1242. var td = document.createElement('td');
  1243. td.setAttribute('class', 'point_label project_label');
  1244. td.style.paddingTop = '14px';
  1245. td.id = 'FireAutoActLabel';
  1246. td.innerHTML = '消防联动状态';
  1247. tr.appendChild(td);
  1248. td = document.createElement('td');
  1249. td.id = 'FireAutoAct';
  1250. td.setAttribute('class', 'project_info');
  1251. td.style.paddingTop = '12px';
  1252. tr.appendChild(td);
  1253. var status_list = devicesStore[idx].status_list;
  1254. status_list.sort(staSortBypoint);
  1255. for (var i = 0; i < status_list.length; i++) {
  1256. var words = status_list[i].content.split(" ");
  1257. if (words.length > 0) {
  1258. if (status_list[i].point_code == 1) {
  1259. $("#PowerAlarmLabel").html(status_list[i].point_name);
  1260. $("#PowerAlarm").html(words[0]);
  1261. } else if (status_list[i].point_code == 2) {
  1262. $("#ManualActLabel").html(status_list[i].point_name);
  1263. $("#ManualAct").html(words[0]);
  1264. } else if (status_list[i].point_code == 3) {
  1265. $("#DevWorking01Label").html(status_list[i].point_name);
  1266. $("#DevWorking01").html(words[0]);
  1267. } else if (status_list[i].point_code == 4) {
  1268. $("#DevWorking02Label").html(status_list[i].point_name);
  1269. $("#DevWorking02").html(words[0]);
  1270. } else if (status_list[i].point_code == 5) {
  1271. $("#DevAlarm01Label").html(status_list[i].point_name);
  1272. $("#DevAlarm01").html(words[0]);
  1273. } else if (status_list[i].point_code == 6) {
  1274. $("#DevAlarm02Label").html(status_list[i].point_name);
  1275. $("#DevAlarm02").html(words[0]);
  1276. } else if (status_list[i].point_code == 7) {
  1277. $("#FireAutoActLabel").html(status_list[i].point_name);
  1278. $("#FireAutoAct").html(words[0]);
  1279. }
  1280. }
  1281. }
  1282. } else if (devicesStore[idx].dwtype == 'YTWC') {
  1283. var status_list = devicesStore[idx].status_list;
  1284. status_list.sort(staSortBypoint);
  1285. for (var i = 0; i < status_list.length; i++) {
  1286. var tr = document.createElement('tr');
  1287. sta.appendChild(tr);
  1288. var td = document.createElement('td');
  1289. td.width = '30%';
  1290. td.setAttribute('class', 'point_label project_label');
  1291. td.style.paddingTop = '14px';
  1292. td.innerHTML = status_list[i].point_name;
  1293. tr.appendChild(td);
  1294. td = document.createElement('td');
  1295. td.innerHTML = (status_list[i].content).substring(0, 2);
  1296. td.width = '20%';
  1297. td.setAttribute('class', 'project_info');
  1298. td.style.paddingTop = '12px';
  1299. tr.appendChild(td);
  1300. }
  1301. } else if (devicesStore[idx].dwtype == 'YTEF') {
  1302. var tr = document.createElement('tr');
  1303. sta.appendChild(tr);
  1304. var td = document.createElement('td');
  1305. td.setAttribute('class', 'project_label');
  1306. td.innerHTML = '供电过压状态';
  1307. tr.appendChild(td);
  1308. td = document.createElement('td');
  1309. td.setAttribute('class', 'project_label');
  1310. td.innerHTML = '供电低压状态';
  1311. tr.appendChild(td);
  1312. td = document.createElement('td');
  1313. td.setAttribute('class', 'project_label');
  1314. td.innerHTML = '供电过流状态';
  1315. tr.appendChild(td);
  1316. tr = document.createElement('tr');
  1317. sta.appendChild(tr);
  1318. td = document.createElement('td');
  1319. td.id = 'HighVoltageAlarm'
  1320. td.setAttribute('class', 'project_info');
  1321. tr.appendChild(td);
  1322. td = document.createElement('td');
  1323. td.id = 'LowVoltageAlarm'
  1324. td.setAttribute('class', 'project_info');
  1325. tr.appendChild(td);
  1326. td = document.createElement('td');
  1327. td.id = 'HighCurrentAlarm'
  1328. td.setAttribute('class', 'project_info');
  1329. tr.appendChild(td);
  1330. tr = document.createElement('tr');
  1331. sta.appendChild(tr);
  1332. td = document.createElement('td');
  1333. td.setAttribute('class', 'project_label');
  1334. td.innerHTML = '漏电报警状态';
  1335. tr.appendChild(td);
  1336. tr = document.createElement('tr');
  1337. sta.appendChild(tr);
  1338. td = document.createElement('td');
  1339. td.id = 'ElectricityLeakage'
  1340. td.setAttribute('class', 'project_info');
  1341. tr.appendChild(td);
  1342. tr = document.createElement('tr');
  1343. sta.appendChild(tr);
  1344. td = document.createElement('td');
  1345. td.setAttribute('class', 'project_label');
  1346. td.innerHTML = 'A相线缆高温状态';
  1347. tr.appendChild(td);
  1348. td = document.createElement('td');
  1349. td.setAttribute('class', 'project_label');
  1350. td.innerHTML = 'B相线缆高温状态';
  1351. tr.appendChild(td);
  1352. td = document.createElement('td');
  1353. td.setAttribute('class', 'project_label');
  1354. td.innerHTML = 'C相线缆高温状态';
  1355. tr.appendChild(td);
  1356. tr = document.createElement('tr');
  1357. sta.appendChild(tr);
  1358. td = document.createElement('td');
  1359. td.setAttribute('class', 'project_info');
  1360. td.id = 'HighTemperatureA';
  1361. tr.appendChild(td);
  1362. td = document.createElement('td');
  1363. td.setAttribute('class', 'project_info');
  1364. td.id = 'HighTemperatureB';
  1365. tr.appendChild(td);
  1366. td = document.createElement('td');
  1367. td.setAttribute('class', 'project_info');
  1368. td.id = 'HighTemperatureC';
  1369. tr.appendChild(td);
  1370. tr = document.createElement('tr');
  1371. sta.appendChild(tr);
  1372. td = document.createElement('td');
  1373. td.setAttribute('class', 'project_label');
  1374. td.innerHTML = 'A相电压';
  1375. tr.appendChild(td);
  1376. td = document.createElement('td');
  1377. td.setAttribute('class', 'project_label');
  1378. td.innerHTML = 'B相电压';
  1379. tr.appendChild(td);
  1380. td = document.createElement('td');
  1381. td.setAttribute('class', 'project_label');
  1382. td.innerHTML = 'C相电压';
  1383. tr.appendChild(td);
  1384. tr = document.createElement('tr');
  1385. sta.appendChild(tr);
  1386. td = document.createElement('td');
  1387. td.setAttribute('class', 'project_info');
  1388. td.id = 'VoltageA';
  1389. tr.appendChild(td);
  1390. td = document.createElement('td');
  1391. td.setAttribute('class', 'project_info');
  1392. td.id = 'VoltageB';
  1393. tr.appendChild(td);
  1394. td = document.createElement('td');
  1395. td.setAttribute('class', 'project_info');
  1396. td.id = 'VoltageC';
  1397. tr.appendChild(td);
  1398. tr = document.createElement('tr');
  1399. sta.appendChild(tr);
  1400. td = document.createElement('td');
  1401. td.setAttribute('class', 'project_label');
  1402. td.innerHTML = 'A相电流';
  1403. tr.appendChild(td);
  1404. td = document.createElement('td');
  1405. td.setAttribute('class', 'project_label');
  1406. td.innerHTML = 'B相电流';
  1407. tr.appendChild(td);
  1408. td = document.createElement('td');
  1409. td.setAttribute('class', 'project_label');
  1410. td.innerHTML = 'C相电流';
  1411. tr.appendChild(td);
  1412. tr = document.createElement('tr');
  1413. sta.appendChild(tr);
  1414. td = document.createElement('td');
  1415. td.setAttribute('class', 'project_info');
  1416. td.id = 'CurrentA';
  1417. tr.appendChild(td);
  1418. td = document.createElement('td');
  1419. td.setAttribute('class', 'project_info');
  1420. td.id = 'CurrentB';
  1421. tr.appendChild(td);
  1422. td = document.createElement('td');
  1423. td.setAttribute('class', 'project_info');
  1424. td.id = 'CurrentC';
  1425. tr.appendChild(td);
  1426. tr = document.createElement('tr');
  1427. sta.appendChild(tr);
  1428. td = document.createElement('td');
  1429. td.setAttribute('class', 'project_label');
  1430. td.innerHTML = 'A相温度';
  1431. tr.appendChild(td);
  1432. td = document.createElement('td');
  1433. td.setAttribute('class', 'project_label');
  1434. td.innerHTML = 'B相温度';
  1435. tr.appendChild(td);
  1436. td = document.createElement('td');
  1437. td.setAttribute('class', 'project_label');
  1438. td.innerHTML = 'C相温度';
  1439. tr.appendChild(td);
  1440. tr = document.createElement('tr');
  1441. sta.appendChild(tr);
  1442. td = document.createElement('td');
  1443. td.setAttribute('class', 'project_info');
  1444. td.id = 'TemperatureA';
  1445. tr.appendChild(td);
  1446. td = document.createElement('td');
  1447. td.setAttribute('class', 'project_info');
  1448. td.id = 'TemperatureB';
  1449. tr.appendChild(td);
  1450. td = document.createElement('td');
  1451. td.setAttribute('class', 'project_info');
  1452. td.id = 'TemperatureC';
  1453. tr.appendChild(td);
  1454. var status_list = devicesStore[idx].status_list;
  1455. status_list.sort(staSortBypoint);
  1456. for (var i = 0; i < status_list.length; i++) {
  1457. if (status_list[i].point_code == 1) {
  1458. $("#HighVoltageAlarm").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1459. } else if (status_list[i].point_code == 2) {
  1460. $("#LowVoltageAlarm").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1461. } else if (status_list[i].point_code == 3) {
  1462. $("#HighCurrentAlarm").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1463. } else if (status_list[i].point_code == 4) {
  1464. $("#ElectricityLeakage").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1465. } else if (status_list[i].point_code == 5) {
  1466. $("#HighTemperatureA").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1467. } else if (status_list[i].point_code == 6) {
  1468. $("#HighTemperatureB").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1469. } else if (status_list[i].point_code == 7) {
  1470. $("#HighTemperatureC").html((status_list[i].point_data == '0') ? '正常' : '告警');
  1471. } else if (status_list[i].point_code == 65) {
  1472. if (status_list[i].point_data.length > 0)
  1473. $("#VoltageA").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1474. } else if (status_list[i].point_code == 66) {
  1475. if (status_list[i].point_data.length > 0)
  1476. $("#VoltageB").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1477. } else if (status_list[i].point_code == 67) {
  1478. if (status_list[i].point_data.length > 0)
  1479. $("#VoltageC").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1480. } else if (status_list[i].point_code == 68) {
  1481. if (status_list[i].point_data.length > 0)
  1482. $("#CurrentA").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1483. } else if (status_list[i].point_code == 69) {
  1484. if (status_list[i].point_data.length > 0)
  1485. $("#CurrentB").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1486. } else if (status_list[i].point_code == 70) {
  1487. if (status_list[i].point_data.length > 0)
  1488. $("#CurrentC").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1489. } else if (status_list[i].point_code == 71) {
  1490. if (status_list[i].point_data.length > 0)
  1491. $("#TemperatureA").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1492. } else if (status_list[i].point_code == 72) {
  1493. if (status_list[i].point_data.length > 0)
  1494. $("#TemperatureB").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1495. } else if (status_list[i].point_code == 73) {
  1496. if (status_list[i].point_data.length > 0)
  1497. $("#TemperatureC").html(status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + status_list[i].point_code + ',\'' + status_list[i].point_name + '\')"/>');
  1498. }
  1499. }
  1500. } else if (devicesStore[idx].dwtype == 'YTSM') {
  1501. var status_list = devicesStore[idx].status_list;
  1502. status_list.sort(staSortBypoint);
  1503. for (var i = 0; i < status_list.length; i++) {
  1504. if (((status_list[i].point_code > 0) && (status_list[i].point_code < 5) && (status_list[i].point_name != '') && (status_list[i].point_code != 3)) ||
  1505. ((status_list[i].point_code == 3) && (status_list[i].point_data != 0))) {
  1506. var tr = document.createElement('tr');
  1507. sta.appendChild(tr);
  1508. var sta_name = document.createElement('td');
  1509. sta_name.width = "40%";
  1510. sta_name.setAttribute('class', 'point_label project_label');
  1511. sta_name.style.paddingTop = '14px';
  1512. sta_name.innerHTML = status_list[i].point_name;
  1513. tr.appendChild(sta_name);
  1514. var sta_value = document.createElement('td');
  1515. sta_value.setAttribute('class', 'project_info');
  1516. sta_value.style.paddingTop = '12px';
  1517. if (status_list[i].point_code == 1)
  1518. sta_value.innerHTML = status_list[i].content;
  1519. else
  1520. sta_value.innerHTML = status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + (status_list[i].point_code + ((devicesStore[idx].start_port > 0) ? (devicesStore[idx].start_port + 63) : 0)) + ',\'' + status_list[i].point_name + '\')"/>';
  1521. tr.appendChild(sta_value);
  1522. }
  1523. }
  1524. } else {
  1525. var status_list = devicesStore[idx].status_list;
  1526. status_list.sort(staSortBypoint);
  1527. for (var i = 0; i < status_list.length; i++) {
  1528. if (status_list[i].point_code > 0) {
  1529. var tr = document.createElement('tr');
  1530. sta.appendChild(tr);
  1531. var sta_name = document.createElement('td');
  1532. sta_name.width = "40%";
  1533. sta_name.setAttribute('class', 'point_label project_label');
  1534. sta_name.style.paddingTop = '14px';
  1535. sta_name.innerHTML = status_list[i].point_name;
  1536. tr.appendChild(sta_name);
  1537. var sta_value = document.createElement('td');
  1538. sta_value.setAttribute('class', 'project_info');
  1539. sta_value.style.paddingTop = '12px';
  1540. // sta_value.style.paddingBottom='12px';
  1541. if (devicesStore[idx].dwtype == 'YTUI') {
  1542. if (V_LOGINNAME == 'admin')
  1543. sta_value.innerHTML = status_list[i].content + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_userinfo_detail(' + devicesStore[idx].owner_code + ')"/>';
  1544. else
  1545. sta_value.innerHTML = status_list[i].content;
  1546. } else if ((devicesStore[idx].dwtype == 'YTWP') || (devicesStore[idx].dwtype == 'YTLL')) {
  1547. if (status_list[i].point_name.indexOf('状态') >= 0) {
  1548. if ((status_list[i].point_data == 0) || (status_list[i].point_data == '00'))
  1549. sta_value.innerHTML = '正常';
  1550. else
  1551. sta_value.innerHTML = '--';
  1552. } else if (status_list[i].point_data.length > 0)
  1553. sta_value.innerHTML = status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + (status_list[i].point_code + ((devicesStore[idx].start_port > 0) ? (devicesStore[idx].start_port + 63) : 0)) + ',\'' + status_list[i].point_name + '\')"/>';
  1554. } else if (status_list[i].point_data.length > 0)
  1555. sta_value.innerHTML = status_list[i].point_data + '<img class="detail_data_btn" src="' + basePath + 'res/img/common/famicons/chart_curve.png" onclick="show_detail_data(' + devicesStore[idx].owner_code + ',' + (status_list[i].point_code + ((devicesStore[idx].start_port > 0) ? (devicesStore[idx].start_port + 63) : 0)) + ',\'' + status_list[i].point_name + '\')"/>';
  1556. tr.appendChild(sta_value);
  1557. }
  1558. }
  1559. }
  1560. }
  1561. }
  1562. var fill_uiwin = function(json) {
  1563. fillvalue = true;
  1564. Ext.getCmp('userinfo_pushalarm').setValue(json.PUSH_WX == 1);
  1565. Ext.getCmp('userinfo_pushtts').setValue(json.PUSH_TTS == 1);
  1566. fillvalue = false;
  1567. var data = new Array();
  1568. for (var i = 0; i < json.LIST.length; i++) {
  1569. var obj = new Array();
  1570. if (json.LIST[i].id == 1)
  1571. obj.push('故障');
  1572. else if (json.LIST[i].id == 2)
  1573. obj.push('告警');
  1574. else if (json.LIST[i].id == 3)
  1575. obj.push('反馈');
  1576. else if (json.LIST[i].id == 4)
  1577. obj.push('监管');
  1578. else if (json.LIST[i].id == 5)
  1579. obj.push('启动');
  1580. else if (json.LIST[i].id == 6)
  1581. obj.push('自检');
  1582. else if (json.LIST[i].id == 7)
  1583. obj.push('屏蔽');
  1584. else if (json.LIST[i].id == 8)
  1585. obj.push('复位');
  1586. else if (json.LIST[i].id == 9)
  1587. obj.push('消音');
  1588. obj.push(json.LIST[i].count);
  1589. data.push(obj);
  1590. }
  1591. var themecolor = ((theme == '') || (theme == 'access')) ? '#ffffff' : '#000000';
  1592. Highcharts.chart('detail_area', {
  1593. chart: {
  1594. type: 'column',
  1595. backgroundColor: 'rgba(0,0,0,0)'
  1596. },
  1597. title: {
  1598. text: '用户传输装置报告类型统计',
  1599. style: { fontSize: '14px', color: themecolor, fontWeight: 'bold' },
  1600. },
  1601. xAxis: {
  1602. type: 'category',
  1603. labels: {
  1604. style: { fontSize: '12px', color: themecolor, fontWeight: 'bold' }
  1605. }
  1606. },
  1607. yAxis: {
  1608. title: {
  1609. text: '报告计次',
  1610. style: { fontSize: '14px', color: themecolor, fontWeight: 'bold' }
  1611. },
  1612. labels: {
  1613. style: { fontSize: '12px', color: themecolor, fontWeight: 'bold' }
  1614. }
  1615. },
  1616. legend: {
  1617. enabled: false
  1618. },
  1619. exporting: {
  1620. enabled: false
  1621. },
  1622. credits: {
  1623. enabled: false
  1624. },
  1625. series: [{
  1626. name: '报告计次',
  1627. data: data,
  1628. dataLabels: {
  1629. enabled: true,
  1630. rotation: -90,
  1631. align: 'right',
  1632. format: '{point.y}',
  1633. style: { fontSize: '14px', color: themecolor, fontWeight: 'bold' },
  1634. y: 10
  1635. },
  1636. colorByPoint: true
  1637. }]
  1638. });
  1639. }
  1640. var show_userinfo_detail = function(devId) {
  1641. var device_id = devId;
  1642. Ext.create('Ext.window.Window', {
  1643. id: 'detail_userinfo_win',
  1644. title: '<div id="detail_userinfo_title">用户传输装置信息</div>',
  1645. bodyStyle: 'background-color:rgba(0,0,0,0.0);',
  1646. height: 400,
  1647. width: 1110,
  1648. modal: true,
  1649. layout: {
  1650. type: 'table',
  1651. columns: 6,
  1652. tableAttrs: {
  1653. style: {
  1654. width: '100%'
  1655. }
  1656. }
  1657. },
  1658. buttons: [{
  1659. text: '查岗',
  1660. handler: function() {
  1661. var query = new Object();
  1662. query.V_LOGINNAME = V_LOGINNAME;
  1663. query.V_PASSWORD = V_PASSWORD;
  1664. query.DEVICE_ID = devId;
  1665. query.CMD = 91;
  1666. query.LIMIT = 10;
  1667. var qjson = Ext.JSON.encode(query);
  1668. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1669. $.ajax({
  1670. type: 'POST',
  1671. url: url,
  1672. data: qjson,
  1673. success: function(result) {
  1674. var json = eval('(' + result + ')');
  1675. if (json.RESULT == '1') {
  1676. Ext.Msg.alert('操作信息', '命令已下发');
  1677. }
  1678. }
  1679. });
  1680. }
  1681. }, {
  1682. text: '清空',
  1683. handler: function() {
  1684. var query = new Object();
  1685. query.V_LOGINNAME = V_LOGINNAME;
  1686. query.V_PASSWORD = V_PASSWORD;
  1687. query.DEVICE_ID = devId;
  1688. query.CMD = 92;
  1689. query.LIMIT = 0;
  1690. var qjson = Ext.JSON.encode(query);
  1691. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1692. $.ajax({
  1693. type: 'POST',
  1694. url: url,
  1695. data: qjson,
  1696. success: function(result) {
  1697. var json = eval('(' + result + ')');
  1698. if (json.RESULT == '1') {
  1699. Ext.Msg.alert('操作信息', '命令已下发');
  1700. fill_uiwin(json);
  1701. }
  1702. }
  1703. });
  1704. }
  1705. }, {
  1706. text: '查询',
  1707. handler: function() {
  1708. var query = new Object();
  1709. query.V_LOGINNAME = V_LOGINNAME;
  1710. query.V_PASSWORD = V_PASSWORD;
  1711. query.DEVICE_ID = devId;
  1712. query.CMD = 93;
  1713. query.PARAM = 0;
  1714. var qjson = Ext.JSON.encode(query);
  1715. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1716. $.ajax({
  1717. type: 'POST',
  1718. url: url,
  1719. data: qjson,
  1720. success: function(result) {
  1721. var json = eval('(' + result + ')');
  1722. if (json.RESULT == '1') {
  1723. fill_uiwin(json);
  1724. }
  1725. }
  1726. });
  1727. }
  1728. }, {
  1729. text: '关闭',
  1730. handler: function() {
  1731. Ext.getCmp('detail_userinfo_win').destroy();
  1732. }
  1733. }],
  1734. tbar: ['->', {
  1735. xtype: 'checkbox',
  1736. boxLabel: '语音推送',
  1737. id: 'userinfo_pushtts',
  1738. checked: true,
  1739. hidden: true,
  1740. handler: function() {
  1741. if (!fillvalue) {
  1742. var pushtts = Ext.getCmp('userinfo_pushtts').getValue();
  1743. Ext.create('Ext.window.Window', {
  1744. id: 'detail_userinfo_pushset_win',
  1745. title: '请验证身份',
  1746. width: 320,
  1747. height: 240,
  1748. modal: true,
  1749. closable: false,
  1750. items: [{
  1751. xtype: 'textfield',
  1752. name: 'v_loginname',
  1753. fieldLabel: '登录名',
  1754. id: 'v_loginname',
  1755. allowBlank: false
  1756. }, {
  1757. xtype: 'textfield',
  1758. name: 'v_password',
  1759. fieldLabel: '密 码',
  1760. id: 'v_password',
  1761. inputType: 'password',
  1762. allowBlank: false
  1763. }],
  1764. bbar: ['->', {
  1765. xtype: 'button',
  1766. text: '提交',
  1767. handler: function() {
  1768. var query = new Object();
  1769. query.V_LOGINNAME = V_LOGINNAME;
  1770. query.V_PASSWORD = V_PASSWORD;
  1771. query.DEVICE_ID = devId;
  1772. query.CMD = 95;
  1773. query.PARAM = pushtts ? 1 : 0;
  1774. var qjson = Ext.JSON.encode(query);
  1775. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1776. $.ajax({
  1777. type: 'POST',
  1778. url: url,
  1779. data: qjson,
  1780. success: function(result) {
  1781. var json = eval('(' + result + ')');
  1782. if (json.RESULT == '1') {
  1783. Ext.Msg.alert('操作信息', '命令已下发');
  1784. }
  1785. }
  1786. });
  1787. this.up("window").close();
  1788. }
  1789. }, {
  1790. xtype: 'button',
  1791. text: '关闭',
  1792. handler: function() {
  1793. this.up("window").close();
  1794. }
  1795. }],
  1796. closeAction: 'destroy',
  1797. listeners: {
  1798. close: function() {
  1799. var query = new Object();
  1800. query.V_LOGINNAME = V_LOGINNAME;
  1801. query.V_PASSWORD = V_PASSWORD;
  1802. query.DEVICE_ID = devId;
  1803. query.CMD = 93;
  1804. query.PARAM = 0;
  1805. var qjson = Ext.JSON.encode(query);
  1806. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1807. $.ajax({
  1808. type: 'POST',
  1809. url: url,
  1810. data: qjson,
  1811. success: function(result) {
  1812. var json = eval('(' + result + ')');
  1813. if (json.RESULT == '1') {
  1814. fill_uiwin(json);
  1815. }
  1816. }
  1817. });
  1818. }
  1819. }
  1820. }).show();
  1821. }
  1822. }
  1823. }, '-', {
  1824. xtype: 'checkbox',
  1825. boxLabel: '微信推送',
  1826. id: 'userinfo_pushalarm',
  1827. checked: true,
  1828. handler: function() {
  1829. if (!fillvalue) {
  1830. var pushalarm = Ext.getCmp('userinfo_pushalarm').getValue();
  1831. Ext.create('Ext.window.Window', {
  1832. id: 'detail_userinfo_pushset_win',
  1833. title: '请验证身份',
  1834. width: 320,
  1835. height: 240,
  1836. modal: true,
  1837. closable: false,
  1838. items: [{
  1839. xtype: 'textfield',
  1840. name: 'v_loginname',
  1841. fieldLabel: '登录名',
  1842. id: 'v_loginname',
  1843. allowBlank: false
  1844. }, {
  1845. xtype: 'textfield',
  1846. name: 'v_password',
  1847. fieldLabel: '密 码',
  1848. id: 'v_password',
  1849. inputType: 'password',
  1850. allowBlank: false
  1851. }],
  1852. bbar: ['->', {
  1853. xtype: 'button',
  1854. text: '提交',
  1855. handler: function() {
  1856. var query = new Object();
  1857. query.V_LOGINNAME = V_LOGINNAME;
  1858. query.V_PASSWORD = V_PASSWORD;
  1859. query.DEVICE_ID = devId;
  1860. query.CMD = 94;
  1861. query.PARAM = pushalarm ? 1 : 0;
  1862. var qjson = Ext.JSON.encode(query);
  1863. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1864. $.ajax({
  1865. type: 'POST',
  1866. url: url,
  1867. data: qjson,
  1868. success: function(result) {
  1869. var json = eval('(' + result + ')');
  1870. if (json.RESULT == '1') {
  1871. Ext.Msg.alert('操作信息', '命令已下发');
  1872. }
  1873. }
  1874. });
  1875. this.up("window").close();
  1876. }
  1877. }, {
  1878. xtype: 'button',
  1879. text: '关闭',
  1880. handler: function() {
  1881. this.up("window").close();
  1882. }
  1883. }],
  1884. closeAction: 'destroy',
  1885. listeners: {
  1886. close: function() {
  1887. var query = new Object();
  1888. query.V_LOGINNAME = V_LOGINNAME;
  1889. query.V_PASSWORD = V_PASSWORD;
  1890. query.DEVICE_ID = devId;
  1891. query.CMD = 93;
  1892. query.PARAM = 0;
  1893. var qjson = Ext.JSON.encode(query);
  1894. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1895. $.ajax({
  1896. type: 'POST',
  1897. url: url,
  1898. data: qjson,
  1899. success: function(result) {
  1900. var json = eval('(' + result + ')');
  1901. if (json.RESULT == '1') {
  1902. fill_uiwin(json);
  1903. }
  1904. }
  1905. });
  1906. }
  1907. }
  1908. }).show();
  1909. }
  1910. }
  1911. }],
  1912. closeAction: 'destroy',
  1913. html: '<div id="detail_background" class="detail_background"><div id="detail_area" class="detail_area" style="height:304px;"></div></div>'
  1914. }).show();
  1915. var query = new Object();
  1916. query.V_LOGINNAME = V_LOGINNAME;
  1917. query.V_PASSWORD = V_PASSWORD;
  1918. query.DEVICE_ID = devId;
  1919. query.CMD = 93;
  1920. query.PARAM = 0;
  1921. var qjson = Ext.JSON.encode(query);
  1922. var url = ((company_code == "10012") ? "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction2.cgi?t=" : "http://47.103.74.123:8080/YtIoT/cgi-bin/DPAction.cgi?t=") + (new Date().getTime());
  1923. $.ajax({
  1924. type: 'POST',
  1925. url: url,
  1926. data: qjson,
  1927. success: function(result) {
  1928. var json = eval('(' + result + ')');
  1929. if (json.RESULT == '1') {
  1930. fill_uiwin(json);
  1931. }
  1932. }
  1933. });
  1934. }
  1935. var show_detail_data = function(devId, ponitId, name) {
  1936. var device_id = devId;
  1937. var point_code = ponitId;
  1938. Ext.create('Ext.window.Window', {
  1939. id: 'detail_data_win',
  1940. title: '<div id="detail_win_title">详细数据</div>',
  1941. height: 400,
  1942. width: 1110,
  1943. layout: 'fit',
  1944. modal: true,
  1945. buttons: [{
  1946. text: '导出',
  1947. handler: function exportbtn_click(device_id, point_code) {
  1948. var fields = '';
  1949. var array = ['id', 'device_id', 'name', 'point_code', 'point_data', 'company', 'data_time'];
  1950. var name = ['编号', '设备编号', '设备名称', '端口号', '数据值', '公司名称', '添加时间'];
  1951. for (var i = 0; i < 7; i++) {
  1952. if (i > 0)
  1953. fields += ',';
  1954. fields += '{id:"' + array[i] + '",title:"' + name[i] + '",shown:"' + true + '"}';
  1955. }
  1956. var query = new Object();
  1957. query.device_id = devId;
  1958. query.point_code = ponitId;
  1959. query.EXPORT_FILE = '折线图数据监控列表';
  1960. query.fields = '[' + fields + ']';
  1961. $.ajax({
  1962. type: 'POST',
  1963. url: basePath + "iot/excel/view/Exportexl",
  1964. data: {
  1965. queryJson: Ext.JSON.encode(query)
  1966. },
  1967. success: function(result) {
  1968. var json = eval('(' + result + ')');
  1969. if (json.action == 'dormExport') {
  1970. ConfirmStore = json.RESULT;
  1971. var elemIF = document.createElement("iframe");
  1972. elemIF.src = basePath + json.filename;
  1973. elemIF.style.display = "none";
  1974. document.body.appendChild(elemIF);
  1975. }
  1976. }
  1977. });
  1978. }
  1979. }, {
  1980. text: '关闭',
  1981. handler: function() {
  1982. Ext.getCmp('detail_data_win').destroy();
  1983. }
  1984. }],
  1985. closeAction: 'destroy',
  1986. html: '<div id="detail_background" class="detail_background"><div id="detail_area" class="detail_area"></div></div>'
  1987. }).show();
  1988. var query = new Object();
  1989. query.V_LOGINNAME = V_LOGINNAME;
  1990. query.V_PASSWORD = V_PASSWORD;
  1991. query.device_id = devId;
  1992. query.point_code = ponitId;
  1993. $.ajax({
  1994. type: 'POST',
  1995. url: basePath + "iot/data/view/getSyncDataQList",
  1996. data: {
  1997. queryJson: Ext.JSON.encode(query)
  1998. },
  1999. success: function(result) {
  2000. var json = eval('(' + result + ')');
  2001. if (json.action == 'getSyncDataVList') {
  2002. ConfirmStore = json.RESULT;
  2003. draw_confirm(name);
  2004. }
  2005. }
  2006. });
  2007. }
  2008. var draw_confirm = function(name) {
  2009. if ((ConfirmStore != undefined) && (ConfirmStore.length > 0)) {
  2010. var themecolor = ((theme == '') || (theme == 'access')) ? '#ffffff' : '#000000';
  2011. if ((V_LOGINNAME == 'guest') && (ConfirmStore[0].device_id == '865462043119730')) {
  2012. ConfirmStore[0].company = '博华广场';
  2013. ConfirmStore[0].name = '独立烟感';
  2014. }
  2015. $("#detail_win_title").html(ConfirmStore[0].company + '_' + ConfirmStore[0].name + '_' + name + ' 一周数据');
  2016. var data_0 = new Array();
  2017. var d_time = new Array();
  2018. var max = 0,
  2019. min = 0;;
  2020. for (var i = 0; i < ConfirmStore.length; i++) {
  2021. var rec = ConfirmStore[i];
  2022. var tmp = parseFloat(rec.point_data);
  2023. var tmp_t = rec.data_time;
  2024. if (i == 0) {
  2025. max = tmp;
  2026. min = tmp;
  2027. } else {
  2028. if (max < tmp)
  2029. max = tmp;
  2030. if (min > tmp)
  2031. min = tmp;
  2032. }
  2033. data_0.push(tmp);
  2034. d_time.push(tmp_t);
  2035. }
  2036. Highcharts.chart('detail_area', {
  2037. chart: {
  2038. type: 'area',
  2039. zoomType: 'xy',
  2040. backgroundColor: 'rgba(0,0,0,0)'
  2041. },
  2042. title: {
  2043. text: ConfirmStore[0].company + '_' + ConfirmStore[0].name + '_' + name + ' 一周数据',
  2044. float: true,
  2045. style: { fontSize: '14px', color: themecolor, fontWeight: 'bold' },
  2046. enabled: false
  2047. },
  2048. legend: {
  2049. floating: true,
  2050. x: 410,
  2051. y: -280,
  2052. itemStyle: { fontSize: '12px', color: themecolor, fontWeight: 'bold' }
  2053. },
  2054. exporting: {
  2055. enabled: false
  2056. },
  2057. credits: {
  2058. enabled: false
  2059. },
  2060. xAxis: [{
  2061. categories: d_time,
  2062. labels: {
  2063. enabled: false
  2064. },
  2065. crosshair: true
  2066. }],
  2067. yAxis: [{
  2068. title: {
  2069. text: name,
  2070. style: { fontSize: '10px', color: themecolor, fontWeight: 'bold' }
  2071. },
  2072. gridLineColor: 'rgba(0,0,0,0.2)',
  2073. labels: {
  2074. format: '{value}',
  2075. style: { fontSize: '10px', color: themecolor, fontWeight: 'bold' }
  2076. },
  2077. max: max + max * 0.3,
  2078. min: 0
  2079. }],
  2080. tooltip: {
  2081. shared: true
  2082. },
  2083. plotOptions: {
  2084. area: {
  2085. stackiung: 'normal',
  2086. marker: {
  2087. lineWidth: 0,
  2088. enabled: false,
  2089. radius: 0
  2090. }
  2091. }
  2092. },
  2093. series: [{
  2094. name: name,
  2095. type: 'area',
  2096. data: data_0,
  2097. lineWidth: 1,
  2098. tooltip: {
  2099. valueSuffix: ' '
  2100. },
  2101. fillColor: {
  2102. linearGradient: {
  2103. x1: 0,
  2104. y1: 0,
  2105. x2: 0,
  2106. y2: 1
  2107. },
  2108. stops: [
  2109. [0, '#34abf5'],
  2110. [1, Highcharts.Color('#34abf5').setOpacity(0.0).get('rgba')]
  2111. ]
  2112. }
  2113. }]
  2114. });
  2115. }
  2116. }
  2117. var show_alarm_pic = function(url) {
  2118. var status_list_bar = document.getElementById('status_list_bar');
  2119. status_list_bar.setAttribute('status', '');
  2120. status_list_bar.innerHTML = '';
  2121. var pic = document.createElement('div');
  2122. pic.style.width = '360px';
  2123. pic.style.height = '270px';
  2124. status_list_bar.appendChild(pic);
  2125. var img = document.createElement('img');
  2126. img.width = 360;
  2127. img.height = 270;
  2128. img.src = url;
  2129. pic.appendChild(img);
  2130. }
  2131. var show_alarm_info = function(dwtype, status, id, name, device_code, company_code, company_name, fullname, time, data, data2, clzt, clwb, clr_name, clnr, clsj) {
  2132. vAlarmInfoWin.show();
  2133. if ((dwtype == 'YTVA') || (dwtype == '16')) {
  2134. vAlarmInfoWin.setWidth(780);
  2135. Ext.getCmp('picPanel').setWidth(360);
  2136. Ext.getCmp('picPanel').setHeight(270);
  2137. var img = document.createElement('img');
  2138. img.width = 360;
  2139. img.height = 270;
  2140. img.src = data2;
  2141. var alarm_pic = document.getElementById('alarm_pic');
  2142. alarm_pic.innerHTML = '';
  2143. alarm_pic.appendChild(img);
  2144. } else {
  2145. vAlarmInfoWin.setWidth(400);
  2146. Ext.getCmp('picPanel').setWidth(0);
  2147. Ext.getCmp('picPanel').setHeight(0);
  2148. }
  2149. $("#VInfoWin_Title").html(data);
  2150. Ext.getCmp('uf_company_name').setValue(company_name);
  2151. Ext.getCmp('uf_name').setValue(name);
  2152. Ext.getCmp('uf_device_code').setValue(device_code);
  2153. Ext.getCmp('uf_fullname').setValue(fullname);
  2154. Ext.getCmp('uf_clr').setValue(clr_name);
  2155. Ext.getCmp('uf_clsj').setValue(clsj);
  2156. Ext.getCmp('uf_clnr').setValue(clnr);
  2157. Ext.getCmp('uf_id').setValue(id);
  2158. Ext.getCmp('uf_clwb').setValue(clwb == '1' ? '误报' : '告警');
  2159. Ext.getCmp('uf_status').setValue(status);
  2160. Ext.getCmp('uf_dwtype').setValue(dwtype);
  2161. if (clzt == '已处理') {
  2162. vAlarmInfoWin.setHeight(460);
  2163. Ext.getCmp('uf_clwb').setVisible(true);
  2164. Ext.getCmp('uf_r_clwb').setVisible(false);
  2165. Ext.getCmp('uf_r_clfw').setVisible(false);
  2166. Ext.getCmp('confirmBtn').setVisible(false);
  2167. Ext.getCmp('uf_clr').setVisible(true);
  2168. Ext.getCmp('uf_clsj').setVisible(true);
  2169. if (dwtype == 'YTVA')
  2170. vAlarmInfoWin.setPosition(
  2171. ($(document).innerWidth() - 780) / 2,
  2172. ($(document).innerHeight() - 460) / 2);
  2173. else
  2174. vAlarmInfoWin.setPosition(
  2175. ($(document).innerWidth() - 400) / 2,
  2176. ($(document).innerHeight() - 460) / 2);
  2177. } else {
  2178. vAlarmInfoWin.setHeight(400);
  2179. Ext.getCmp('uf_clwb').setVisible(false);
  2180. Ext.getCmp('uf_r_clwb').setVisible(true);
  2181. Ext.getCmp('uf_r_clfw').setVisible(true);
  2182. Ext.getCmp('confirmBtn').setVisible(true);
  2183. Ext.getCmp('uf_clr').setVisible(false);
  2184. Ext.getCmp('uf_clsj').setVisible(false);
  2185. if ((dwtype == 'YTVA') || (dwtype == '16'))
  2186. vAlarmInfoWin.setPosition(
  2187. ($(document).innerWidth() - 780) / 2,
  2188. ($(document).innerHeight() - 400) / 2);
  2189. else
  2190. vAlarmInfoWin.setPosition(
  2191. ($(document).innerWidth() - 400) / 2,
  2192. ($(document).innerHeight() - 400) / 2);
  2193. }
  2194. }
  2195. var getCompanyInfo = function() {
  2196. var query = new Object();
  2197. query.V_LOGINNAME = V_LOGINNAME;
  2198. query.V_PASSWORD = V_PASSWORD;
  2199. query.COMPANY_CODE = company_code;
  2200. query.COMMSTATUS = "NO";
  2201. var qdata = 'queryJson=' + Ext.JSON.encode(query);
  2202. myMask.show();
  2203. $.ajax({
  2204. type: 'POST',
  2205. url: basePath + "iot/frontpage/getCurrentObjectListByCompanyId",
  2206. data: qdata,
  2207. success: function(result) {
  2208. var json = eval('(' + result + ')');
  2209. if (json.action == 'getCurrentObjectListByCompanyId') {
  2210. if (json.check == true) {
  2211. if (json.LIST != undefined) {
  2212. max_level = json.max_level;
  2213. min_level = json.min_level;
  2214. top_level = json.top_level;
  2215. building_name = json.buinding;
  2216. companyStore = json.COMPANY;
  2217. buildingStore = json.LIST;
  2218. }
  2219. draw_buinding();
  2220. } else {
  2221. Ext.Msg.alert('错误信息', '访问权限错误,请重新登录', function() {
  2222. window.parent.document.location = basePath;
  2223. });
  2224. }
  2225. }
  2226. myMask.hide();
  2227. }
  2228. });
  2229. // setTimeout(getCompanyInfo,storeTime);
  2230. }
  2231. Ext.onReady(function() {
  2232. basePath = $("#basePath").val();
  2233. $("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
  2234. $("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
  2235. V_LOGINNAME = $("#V_LOGINNAME").val();
  2236. V_PASSWORD = $("#V_PASSWORD").val();
  2237. company_code = $("#company_code").val();
  2238. theme = $("#theme").val();
  2239. parent.window.keep_menu();
  2240. myMask = new Ext.LoadMask(Ext.getBody(), {
  2241. msg: '查询中,请稍后!',
  2242. cls: 'toplevel',
  2243. removeMask: true //完成后移除
  2244. });
  2245. Ext.define('CompanyComboStore1', {
  2246. extend: 'Ext.data.Model',
  2247. fields: [
  2248. { name: 'owner_name', type: 'string' },
  2249. { name: 'owner_id', type: 'string' }
  2250. ]
  2251. });
  2252. var qobj = new Object();
  2253. qobj.V_LOGINNAME = $("#V_LOGINNAME").val();
  2254. qobj.V_PASSWORD = $("#V_PASSWORD").val();
  2255. var CompanyStory = Ext.create('Ext.data.Store', {
  2256. model: 'CompanyComboStore1',
  2257. proxy: {
  2258. type: 'ajax',
  2259. actionMethods: {
  2260. create: 'POST',
  2261. read: 'POST', // by default GET
  2262. update: 'POST',
  2263. destroy: 'POST'
  2264. },
  2265. url: basePath + 'iot/company/view/getNameList',
  2266. reader: {
  2267. type: 'json',
  2268. root: 'RESULT',
  2269. totalProperty: 'totalCount'
  2270. },
  2271. extraParams: {
  2272. queryJson: Ext.JSON.encode(qobj)
  2273. }
  2274. }
  2275. });
  2276. var ModifyForm = Ext.create('Ext.form.Panel', {
  2277. id: 'CompanyFactoryUpdateForm',
  2278. labelWidth: 55,
  2279. // url: basePath+'devicemodel/updateDeviceModel',
  2280. defaultType: 'textfield',
  2281. bodyPadding: 15,
  2282. items: [{
  2283. xtype: 'combo',
  2284. fieldLabel: '单位',
  2285. id: 'fa_company_code',
  2286. name: 'company_code',
  2287. displayField: 'owner_name',
  2288. valueField: 'owner_id',
  2289. editable: false,
  2290. anchor: '85%',
  2291. store: CompanyStory
  2292. }, {
  2293. xtype: 'textfield',
  2294. fieldLabel: '文件上传',
  2295. name: 'file',
  2296. id: 'fa_userfile',
  2297. inputType: 'file',
  2298. blankText: 'File can\'t not empty.',
  2299. anchor: '100%' // anchor width by percentage
  2300. }, {
  2301. xtype: 'textfield',
  2302. id: 'fa_factory_queryJson',