equipmanage_qxz.html 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8" />
  6. <link href="{% static '/lib/bootstrap-3.3.7/css/bootstrap.css' %}" rel="stylesheet">
  7. <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}">
  8. <link rel="stylesheet" href="{% static '/lib/css/ace.min.css' %}" />
  9. <link rel="stylesheet" href="{% static '/lib/css/ace-skins.min.css' %}">
  10. <link rel="stylesheet" href="{% static '/lib/css/ace-rtl.min.css' %}">
  11. <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
  12. <link rel="stylesheet" href="{% static '/lib/css/jquery-ui.css' %}" />
  13. <style type="text/css">
  14. body {
  15. background: #fff;
  16. }
  17. .row {
  18. margin: 0;
  19. }
  20. /* 菜单 */
  21. .menu_body .nulldata {
  22. line-height: 80px;
  23. text-align: center;
  24. height: 80px;
  25. background: #eee;
  26. }
  27. .menu_list {
  28. margin-top: 10px;
  29. }
  30. .menu_head {
  31. height: 30px;
  32. line-height: 30px;
  33. padding-left: 10px;
  34. font-size: 12px;
  35. color: #313131;
  36. cursor: pointer;
  37. border: 1px solid #e1e1e1;
  38. border-top: 0px solid #e1e1e1;
  39. position: relative;
  40. background: #f1f1f1 url(../static/img/jia.png) center right 5px no-repeat;
  41. margin: 0;
  42. word-break: keep-all;
  43. white-space: nowrap;
  44. overflow: hidden;
  45. text-overflow: ellipsis;
  46. }
  47. .menu_body {
  48. height: auto;
  49. overflow: hidden;
  50. line-height: 38px;
  51. border-left: 1px solid #e1e1e1;
  52. border-right: 1px solid #e1e1e1;
  53. }
  54. .menu_body a {
  55. display: block;
  56. height: 32px;
  57. line-height: 32px;
  58. padding-left: 10px;
  59. color: #525252;
  60. background: #fff;
  61. text-decoration: none;
  62. border-bottom: 1px solid #e1e1e1;
  63. overflow: hidden;
  64. text-overflow: ellipsis;
  65. white-space: nowrap;
  66. }
  67. .menu_body a span {
  68. display: inline-block;
  69. width: 8px;
  70. height: 8px;
  71. border-radius: 50%;
  72. margin-right: 6px;
  73. }
  74. .bjred {
  75. background: red;
  76. }
  77. .bjgreen {
  78. background: green;
  79. }
  80. .menu_list .current {
  81. background: #f1f1f1 url(../static/img/jian.png) center right 5px no-repeat;
  82. font-weight: bold;
  83. color: #313131;
  84. }
  85. .menu_body .menu-active {
  86. color: #00bcd4;
  87. border-left: solid 3px #00bcd4;
  88. }
  89. .currAstive {
  90. background-color: #00bcd4;
  91. color: #fff;
  92. }
  93. /* 主题标题 */
  94. .widget-box {
  95. background: none repeat scroll 0 0 #F9F9F9;
  96. clear: both;
  97. margin-top: 16px;
  98. margin-bottom: 16px;
  99. position: relative;
  100. border: none;
  101. }
  102. .widget-title {
  103. height: 36px;
  104. line-height: 36px;
  105. border-bottom: solid 1px #e5e5e5;
  106. padding-bottom: 1px;
  107. /* text-align: center; */
  108. }
  109. .widget-title .equipInfo {
  110. float: left;
  111. }
  112. .widget-title h5 {
  113. color: #666;
  114. float: left;
  115. font-size: 12px;
  116. font-weight: bold;
  117. padding: 12px;
  118. line-height: 12px;
  119. margin: 0;
  120. margin-bottom: 3px;
  121. border-bottom: solid 2px #38b0ec;
  122. }
  123. /*状态 */
  124. .dev:HOVER {
  125. background: #2E363F;
  126. }
  127. .dev {
  128. display: flex;
  129. justify-content: space-around;
  130. /* width: 215px;
  131. height: 88px;
  132. float: left; */
  133. /* margin: 0px; */
  134. color: #f2f2f2;
  135. margin-bottom: 15px;
  136. cursor: pointer;
  137. position: relative;
  138. }
  139. .bg_lb {
  140. background:
  141. /* #27a9e3 */
  142. #4ab8e8;
  143. }
  144. .dev .left {
  145. width: 80px;
  146. padding-top: 10px;
  147. /* float: left; */
  148. }
  149. .dev .left .img-dev {
  150. width: 45px;
  151. margin-left: 12px;
  152. /* margin-top: 8px; */
  153. }
  154. .dev .right {
  155. width: 120px;
  156. padding-top: 3px;
  157. /* float: left; */
  158. font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;
  159. }
  160. .dev .right .name {
  161. font-size: 20px;
  162. line-height: 20px;
  163. text-align: left;
  164. padding-top: 10px;
  165. overflow: hidden;
  166. white-space: nowrap;
  167. text-overflow: ellipsis;
  168. }
  169. .dev .right .data {
  170. font-size: 14px;
  171. text-align: left;
  172. padding-top: 15px;
  173. }
  174. /* 项目 */
  175. .todo li {
  176. border-bottom: 1px solid #EBEBEB;
  177. margin-bottom: 0;
  178. padding: 10px 0;
  179. }
  180. .equipPage {
  181. line-height: 34px;
  182. text-align: center;
  183. }
  184. table tr td.nullData {
  185. text-align: center;
  186. line-height: 250px;
  187. }
  188. /* 状态块颜色 */
  189. .bg_lb {
  190. background:
  191. /* #27a9e3 */
  192. #4ab8e8;
  193. }
  194. .bg_ly {
  195. background:
  196. /* #ffb848 */
  197. #f5b761;
  198. }
  199. .bg_lg {
  200. background:
  201. /* #28b779 */
  202. #3eb984;
  203. }
  204. .bg_ls {
  205. background:
  206. /* #2255a4 */
  207. #4978c1;
  208. }
  209. .bg_lo {
  210. background:
  211. /* #da542e */
  212. #dc6442;
  213. }
  214. .bg_lr {
  215. background:
  216. /* #f74d4d */
  217. #f77979;
  218. }
  219. .aisle {
  220. position: absolute;
  221. left: 6px;
  222. bottom: 1px;
  223. font-size: 12px;
  224. }
  225. #uploadPhoto {
  226. display: none;
  227. }
  228. #viewPhoto {
  229. cursor: pointer;
  230. }
  231. /* 设备控制 */
  232. #ctrlBox>div {
  233. margin-bottom: 20px;
  234. }
  235. .handCtrlBox {
  236. margin-bottom: 20px;
  237. }
  238. input[type="checkbox"].ace.ace-switch.ace-switch-4+.lbl::before,
  239. input[type="checkbox"].ace.ace-switch.ace-switch-5+.lbl::before {
  240. text-indent: -39px;
  241. }
  242. .equipCtrl {
  243. border: 1px solid #cecece;
  244. padding: 15px 10px;
  245. background: #f5f5f5;
  246. box-shadow: 1px 1px 4px 1px #cecece;
  247. border-radius: 3px;
  248. cursor: pointer;
  249. }
  250. .equipCtrl:hover {
  251. border-color: #468fcd;
  252. box-shadow: 1px 2px 4px 0px #468fcd;
  253. }
  254. .equipCtrlInp {
  255. margin-top: 20px;
  256. text-align: right;
  257. }
  258. .isonlineicon {
  259. display: inline-block;
  260. width: 8px;
  261. height: 8px;
  262. border-radius: 50%;
  263. margin-right: 7px;
  264. }
  265. .isonlineicon.active {
  266. background: green;
  267. animation: 1s ease 0s infinite normal none running myfirst01;
  268. }
  269. .isonlineicon {
  270. background: #909090;
  271. animation: 1s ease 0s infinite normal none running myfirst02;
  272. }
  273. @keyframes myfirst01 {
  274. 0% {
  275. -moz-box-shadow: 0px 0px 6px 1px green;
  276. box-shadow: 0px 0px 6px 1px green;
  277. }
  278. 100% {
  279. -moz-box-shadow: 0px 0px 6px 1px green;
  280. box-shadow: 0px 0px 6px 1px green;
  281. }
  282. }
  283. @keyframes myfirst02 {
  284. 0% {
  285. -moz-box-shadow: 0px 0px 6px 1px #909090;
  286. box-shadow: 0px 0px 6px 1px #909090;
  287. }
  288. 100% {
  289. -moz-box-shadow: 0px 0px 6px 1px #909090;
  290. box-shadow: 0px 0px 6px 1px #909090;
  291. }
  292. }
  293. .ctrlLoading {
  294. position: absolute;
  295. bottom: 6px;
  296. }
  297. .equipCtrl .fa-cog {
  298. position: absolute;
  299. right: 26px;
  300. font-size: 20px;
  301. color: #3eb983;
  302. top: 11px;
  303. }
  304. .qxzDownCtrl {
  305. display: none;
  306. float: right;
  307. width: 53px;
  308. background: white;
  309. border: 1px solid #8aafce;
  310. color: #6688a6 !important;
  311. }
  312. .numName {
  313. display: inline-block;
  314. width: 70%;
  315. overflow: hidden;
  316. text-overflow: ellipsis;
  317. white-space: nowrap;
  318. vertical-align: middle;
  319. }
  320. /* 阈值控制 */
  321. #getthresholdDiv>div,
  322. #gettimingDiv>div {
  323. padding-bottom: 20px;
  324. }
  325. .thresholdCtrl {
  326. background: #4ab8e8;
  327. border-radius: 5px;
  328. color: #fff;
  329. box-shadow: 1px 1px 4px 1px #98dbf8;
  330. border: 1px solid #98dbf8;
  331. padding: 5px 10px;
  332. cursor: pointer;
  333. position: relative;
  334. }
  335. #gettimingDiv .thresholdCtrl {
  336. background: #65b83b;
  337. box-shadow: 1px 1px 4px 1px #d1ffba;
  338. border: 1px solid #65b83b;
  339. }
  340. .setthresholdBtn {
  341. position: absolute;
  342. right: 13px;
  343. top: 12px;
  344. font-size: 20px;
  345. }
  346. .setthresholdBtn:hover {
  347. color: #08ff46;
  348. }
  349. .thresholdCtrl::before {
  350. position: absolute;
  351. content: '';
  352. bottom: 0;
  353. left: 0;
  354. right: 0;
  355. height: 30%;
  356. background: rgba(255, 255, 255, 0.5);
  357. }
  358. .thresholdCtrlName {
  359. line-height: 30px;
  360. font-size: 16px;
  361. }
  362. .thresholdCtrlShowDiv {
  363. overflow: hidden;
  364. }
  365. .thresholdCtrlShowDiv>div {
  366. float: left;
  367. }
  368. .qxys img {
  369. width: 47px;
  370. }
  371. .maxminNum {
  372. font-size: 18px;
  373. line-height: 30px;
  374. margin-top: 11px;
  375. padding-left: 7%;
  376. }
  377. /* 色值阈值框 */
  378. .layui-form-item .layui-input-inline {
  379. width: 44%;
  380. }
  381. #Modal>div,
  382. #timingOnOffModal>div {
  383. margin-top: 20px;
  384. }
  385. .layui-form-mid.layui-word-aux span {
  386. color: red;
  387. }
  388. /* 定时设置 */
  389. #timingOnOffModal .layui-form-label {
  390. width: 100px;
  391. }
  392. /* .layui-body{overflow-y: scroll;} */
  393. .layui-layer-editName.layui-layer-page .layui-layer-content {
  394. overflow: hidden !important;
  395. overflow-y: scroll !important;
  396. }
  397. /* LED大屏样式 */
  398. .layui-layer-demo.layui-layer {
  399. background: transparent;
  400. box-shadow: none;
  401. color: #ff0000;
  402. }
  403. .layui-layer-demo .layui-layer-content {
  404. overflow-y: hidden !important;
  405. }
  406. .layui-layer-demo .qxzLedBj {
  407. padding-top: 115px;
  408. /* width: 684px;
  409. height: 781px; */
  410. width: 525px;
  411. height: 619px;
  412. background: url(../static/img/ledBj.png) no-repeat;
  413. background-size: 100% 100%;
  414. }
  415. .layui-layer-demo .qxzLedInfo {
  416. width: 95%;
  417. }
  418. .layui-layer-demo .qxzLedTitle {
  419. position: relative;
  420. height: 47px;
  421. /* white-space: nowrap; */
  422. overflow: hidden;
  423. width: 92%;
  424. margin: 16px auto;
  425. font-size: 36px;
  426. letter-spacing: 7px;
  427. text-shadow: 0rem 0rem 0.2rem rgba(240, 27, 27, 0.5), 0rem 0rem 0.15rem rgba(240, 27, 27, 0.5), 0rem 0rem 0.2rem rgba(240, 27, 27, 0.5), 0rem 0rem 0.2rem rgba(240, 27, 27, 0.5);
  428. box-sizing: border-box;
  429. word-break: break-all;
  430. }
  431. .layui-layer-demo .qxzLedTitle p {
  432. white-space: nowrap;
  433. /*position: absolute;
  434. left: -865px;
  435. top: 0; */
  436. /* display: inline-block; */
  437. text-align: center;
  438. }
  439. .layui-layer-demo .qxzLedTitle .qxzLedTitleLong {
  440. /* text-align: right; */
  441. padding-left: 100%;
  442. /* 从右至左开始滚动 */
  443. display: inline-block;
  444. animation: marqueeTransform 16s linear infinite;
  445. }
  446. @keyframes marqueeTransform {
  447. 0% {
  448. transform: translate(0, 0);
  449. }
  450. 100% {
  451. transform: translate(-100%, 0);
  452. }
  453. }
  454. .layui-layer-demo .eleContent {
  455. width: 82%;
  456. margin: 0 auto 0;
  457. height: 157px;
  458. overflow: hidden;
  459. }
  460. .layui-layer-demo .scrollUl {
  461. animation: scrollUlTransform 8s linear infinite;
  462. }
  463. @keyframes scrollUlTransform {
  464. 0% {
  465. transform: translate(0, 0);
  466. }
  467. 50% {
  468. transform: translate(0, 0);
  469. }
  470. 51% {
  471. transform: translate(0, -50%);
  472. }
  473. 100% {
  474. transform: translate(0, -50%);
  475. }
  476. }
  477. .layui-layer-demo .scrollUl li {
  478. line-height: 51px;
  479. font-size: 30px;
  480. text-shadow: 0rem 0rem 0.2rem rgba(240, 27, 27, 0.5), 0rem 0rem 0.15rem rgba(240, 27, 27, 0.5), 0rem 0rem 0.2rem rgba(240, 27, 27, 0.5), 0rem 0rem 0.2rem rgba(240, 27, 27, 0.5);
  481. }
  482. /* led标题更改 */
  483. .layui-layer.layui-layer-led {
  484. border-radius: 20px;
  485. overflow: hidden;
  486. }
  487. .layui-layer-led .layui-layer-content {
  488. overflow: hidden !important;
  489. box-sizing: border-box;
  490. /* padding: 10px 15px; */
  491. }
  492. .layui-layer-led .LEDTitle {
  493. line-height: 45px;
  494. background: #ececec;
  495. border-bottom: 1px solid #d1d1d1;
  496. padding: 0 15px;
  497. color: #797979;
  498. }
  499. .layui-layer-led .LEDContent {
  500. padding: 15px;
  501. }
  502. .layui-layer-led .LEDContent>div {
  503. margin-bottom: 20px;
  504. }
  505. .layui-layer-led .LEDBtns {
  506. text-align: center;
  507. }
  508. .layui-layer-led .LEDBtns button {
  509. margin: 0 20px;
  510. }
  511. textarea {
  512. resize: none;
  513. }
  514. /* 短信阈值下发 */
  515. .layui-form-switch {
  516. background-color: #00abf8;
  517. border-color: #00abf8;
  518. }
  519. .layui-form-switch em {
  520. color: #fff !important;
  521. }
  522. .layui-form-switch i {
  523. background-color: #fff;
  524. }
  525. .layui-form-onswitch {
  526. border-color: #5FB878;
  527. background-color: #5FB878;
  528. }
  529. .authInp {
  530. width: 100%;
  531. }
  532. /* 在线、所属公司筛选框 */
  533. .iptScreen {
  534. width: 75%;
  535. }
  536. .layui-input-block {
  537. margin-left: 0;
  538. }
  539. .input-group-btnA {
  540. display: inline-block;
  541. }
  542. </style>
  543. <body>
  544. <div class="content">
  545. <div class="row">
  546. <!-- 左菜单 -->
  547. <div class="col-xs-12 col-sm-3 col-md-2">
  548. <div class="input-group">
  549. <input type="text" class="form-control" id="searchImei" name="searchImei" placeholder="输入编号或名称查询">
  550. <div class="input-group-btn">
  551. <button type="button" id="searchBtn" class="btn btn-default no-border btn-sm">
  552. <i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
  553. </button>
  554. </div>
  555. </div>
  556. <!-- 下拉框 -->
  557. <!-- 在线状态 -->
  558. {% if role == "superuser" %}
  559. <div class="layui-input-block">
  560. <p class="">在线状态:</p>
  561. <select name="status" lay-verify="required" id="selectId" class="iptScreen">
  562. <option value="" selected>全部</option>
  563. <option value="0">离线</option>
  564. <option value="1">在线</option>
  565. </select>
  566. <div class="input-group-btnA">
  567. <button type="button" id="searchBtnA" class="btn btn-default no-border btn-sm">
  568. <i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
  569. </button>
  570. </div>
  571. </div>
  572. <!-- 所属公司 -->
  573. <div class="layui-input-block">
  574. <p class="">所属公司:</p>
  575. <select name="company" lay-verify="required" id="selectIdA" class="iptScreen">
  576. <option value="" selected>全部</option>
  577. <option value="15">云飞</option>
  578. <option value="8">新普惠</option>
  579. </select>
  580. <div class="input-group-btnA">
  581. <button type="button" id="searchBtnB" class="btn btn-default no-border btn-sm">
  582. <i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
  583. </button>
  584. </div>
  585. </div>
  586. {% endif %}
  587. <div id="firstpane" class="menu_list">
  588. <p class="menu_head current" id="area_322">设备列表</p>
  589. <div class="menu_body">
  590. <!-- <a href="javascript:;" title="设备15112501" class="text-overflow" id="15112501" data-pid="322">设备15112501</a> -->
  591. </div>
  592. <div class="equipPage">
  593. <!-- <button class="btn btn-minier btn-yellow"><i class="fa fa-sort-up" aria-hidden="true"></i></button> -->
  594. <input type="button" class="btn btn-minier btn-yellow" onclick="gotofirstpage()" value="首页">
  595. <button class="btn btn-minier btn-yellow" id="jianPage"
  596. onclick="changePage('jian')">上一页</button>
  597. 第
  598. <span id="currentpage">1</span>页
  599. <button class="btn btn-minier btn-yellow" id="addPage" onclick="changePage('add')">下一页</button>
  600. 共<span id="totelpage">4</span>页
  601. </div>
  602. <div class="equipPage">
  603. 跳转 <input type="text" id="jumpPage" value="1"
  604. style="width: 60px;height: 30px;text-align: center;"
  605. onkeypress="if (event.keyCode == 13) changePage('jump');"> 页
  606. <button class="btn btn-minier btn-yellow" id="jianPage" onclick="changePage('jump')">确定</button>
  607. </div>
  608. </div>
  609. <div class="">
  610. <div class="widget-box" style="margin-top: 20px;">
  611. <div class="widget-title">
  612. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  613. <h5>项目信息</h5>
  614. </div>
  615. </div>
  616. <div class="widget-content" style="padding: 0px;margin-top: 8px;">
  617. <div>
  618. <!-- <img src="www.yfzhwlw.com/qxz_photo/default.png" class="equip_photo" width="100%" height="100%" style=""> -->
  619. <form action="" method="post" id="userPhoto" class="form-horizontal"
  620. enctype="multipart/form-data">{% csrf_token %}
  621. <input type="hidden" value="" id="qxzPhotoId" name="id">
  622. <div class="personal-avatar">
  623. <div class="top-avatar" id="viewPhotoParent">
  624. <img id="viewPhoto" class="equip_photo" onclick="$('#uploadPhoto').click()"
  625. src="" width="100%" height="100%">
  626. </div>
  627. <a class="upload-avatar" href="javascript:;">
  628. <input class="upload-btn" name="upicture"
  629. onchange="previewImage(this,'viewPhotoParent','viewPhoto','uploadPhoto','100%',200)"
  630. type="file" id="uploadPhoto">
  631. </a>
  632. <!-- <input type="hidden" name="req" value="photo"> -->
  633. </div>
  634. </form>
  635. </div>
  636. <div class="todo" style="background: white;margin-top: 5px;" id="qxzInfoDiv">
  637. <ul>
  638. <li class="clearfix">
  639. <div class="txt equip_name">&nbsp;&nbsp;项目名称:设备15112501</div>
  640. </li>
  641. <li class="clearfix">
  642. <div class="txt equip_id">&nbsp;&nbsp;设备ID:15112501</div>
  643. </li>
  644. <li class="clearfix" id="isonline">
  645. <div class="txt">&nbsp;&nbsp;离线时间:15112501</div>
  646. </li>
  647. {% if role == "superuser" %}
  648. <li class="clearfix" id="dverData">
  649. <div class="txt">&nbsp;&nbsp;版本号:123456</div>
  650. </li>
  651. {% endif %}
  652. </ul>
  653. </div>
  654. </div>
  655. </div>
  656. </div>
  657. <!-- 右 -->
  658. <div class="col-xs-12 col-sm-9 col-md-10">
  659. <!-- 实时状态 -->
  660. <div class="currTimeStatus">
  661. <div class="widget-box" style="margin-top: 0px;">
  662. <div class="widget-title">
  663. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  664. <h5>实时状态</h5>
  665. <div class="equipInfo" id="equipInfo"> </div> 
  666. {% if role == "superuser"%}
  667. <button class="btn btn-white btn-primary" id="lookHistory" onclick="lookHistory()"
  668. type="button">
  669. <i class="fa fa-history" aria-hidden="true"></i>
  670. </button>
  671. {% endif %}
  672. <div class="span5" id="equipCtrlDiv" style="float: right;">
  673. <button class="btn btn-white btn-primary" id="newDataRefresh" onclick="newDataRefresh()"
  674. type="button">
  675. <i class="fa fa-refresh" aria-hidden="true"></i>
  676. </button>
  677. <button class="btn btn-white btn-primary" id="setEleName" onclick="setEleName()"
  678. type="button">
  679. <i class="fa fa-cog" aria-hidden="true"></i>
  680. </button>
  681. <button class="btn btn-white btn-primary" id="setNotewarn" onclick="setNotewarn()"
  682. type="button">
  683. <i class="fa fa-envelope-o" aria-hidden="true"></i>
  684. </button>
  685. <button class="btn btn-white btn-primary" id="updataTime" type="button">2020-03-12
  686. 13:48:15</button>
  687. </div>
  688. <div style="float: right;margin-right:5px;" id="sinCodeInquire">
  689. <!-- <button class="btn btn-white btn-primary" onclick="inquireSim('89860403101970072488')" id="" type="button">流量查询</button> -->
  690. </div>
  691. {% if role == "superuser"%}
  692. <div style="float: right;margin-right:5px;" id="sinCodeInquire">
  693. <button class="btn btn-white btn-primary" onclick="delEquip()" id=""
  694. type="button">一键删除</button>
  695. </div>
  696. <div style="float: right;margin-right:5px;" id="sinCodeInquire">
  697. <button class="btn btn-white btn-primary" onclick="changeEquip()" id=""
  698. type="button">更换IP</button>
  699. </div>
  700. <div style="float: right;margin-right:5px;" id="sinCodeInquire">
  701. <button class="btn btn-white btn-primary" onclick="upgradeEquip()" id=""
  702. type="button">升级</button>
  703. </div>
  704. {% endif %}
  705. </div>
  706. </div>
  707. </div>
  708. <div class="body-content clearfix row" id="newStatusBox">
  709. <!-- <div class="dev col-xs-4 col-md-3 col-lg-2 bg_lb">
  710. <div class="left">
  711. <img class="img-dev" src="{% static '/img/switchBtnIcon.png' %}">
  712. </div>
  713. <div class="right">
  714. <div class="name">风速</div>
  715. <div class="data">
  716. <strong>
  717. <span style="font-size: 25px;">0.0</span>
  718. </strong>m/s</div>
  719. </div>
  720. </div> -->
  721. </div>
  722. <!-- 设备手动控制 -->
  723. <div id="ctrlBoxParentDiv">
  724. <div class="currTimeStatus">
  725. <div class="widget-box">
  726. <div class="widget-title">
  727. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  728. <h5>设备手动控制</h5>
  729. <button class="btn btn-white btn-primary qxzDownCtrl" onclick="qxzDownCtrlFun()">
  730. <i class="fa fa-refresh" aria-hidden="true"></i>
  731. </button>
  732. </div>
  733. </div>
  734. </div>
  735. <div class="row handCtrlBox" id="ctrlBox">
  736. <!-- <div class="col-xs-2">
  737. <div class="equipCtrl">
  738. <input type="hidden" value="1">
  739. <div>
  740. <span class="isonlineicon active"></span>
  741. 控制1
  742. </div>
  743. <div class="equipCtrlInp">
  744. <label>
  745. <input name="switch-field-1" checked class="ace ace-switch ace-switch-4 btn-rotate" type="checkbox">
  746. <span class="lbl"></span>
  747. </label>
  748. </div>
  749. </div>
  750. </div> -->
  751. </div>
  752. </div>
  753. <!-- 设备阈值控制 -->
  754. <div id="getthresholdDivParentDiv">
  755. <div class="currTimeStatus">
  756. <div class="widget-box" style="margin-top: 0px;">
  757. <div class="widget-title">
  758. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  759. <h5>设备阈值控制</h5>
  760. <button class="btn btn-white btn-primary qxzDownCtrl" id="" onclick="" type="button">
  761. <i class="fa fa-refresh" aria-hidden="true"></i>
  762. </button>
  763. </div>
  764. </div>
  765. </div>
  766. <div class="row" id="getthresholdDiv">
  767. <!-- <div class="col-xs-2 col-sm-3">
  768. <div class="thresholdCtrl">
  769. <div class="setthresholdBtn" onclick="setthresholdFun(this)">
  770. <i class="fa fa-cog setName" aria-hidden="true"></i>
  771. </div>
  772. <input type="hidden" class="currVal" value='{"JK":1,"eKey":1,"upper":700,"lower":300,"method":1}'>
  773. <div class="thresholdCtrlName">
  774. <p>开关1(e1)</p>
  775. </div>
  776. <div class="thresholdCtrlShowDiv">
  777. <div class="qxys">
  778. <div>
  779. <img src="{% static '/img/dev/icon_110.png' %}" alt="">
  780. </div>
  781. <div>雨量累计</div>
  782. </div>
  783. <div class="maxminNum">
  784. <p>最大值:
  785. <span>30</span>
  786. </p>
  787. <p>最小值:
  788. <span>10</span>
  789. </p>
  790. </div>
  791. </div>
  792. <div class="equipCtrlInp">
  793. <label>
  794. <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">
  795. <span class="lbl"></span>
  796. </label>
  797. </div>
  798. </div>
  799. </div> -->
  800. </div>
  801. </div>
  802. <!-- 设备定时控制 -->
  803. <div id="timingDivParentDiv">
  804. <div class="currTimeStatus">
  805. <div class="widget-box" style="margin-top: 0px;">
  806. <div class="widget-title">
  807. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  808. <h5>设备定时控制</h5>
  809. <button class="btn btn-white btn-primary qxzDownCtrl" id="" onclick="" type="button">
  810. <i class="fa fa-refresh" aria-hidden="true"></i>
  811. </button>
  812. </div>
  813. </div>
  814. </div>
  815. <div class="row" id="gettimingDiv">
  816. <!-- <div class="col-xs-2 col-sm-3">
  817. <div class="thresholdCtrl">
  818. <div class="setthresholdBtn" onclick="timingOnOff(this)">
  819. <i class="fa fa-cog setName" aria-hidden="true"></i>
  820. </div>
  821. <input type="hidden" class="currVal" value='{"JK":1,"StartTime":12,"Duration":10}'>
  822. <div class="thresholdCtrlName">
  823. <p>开关1(e1)</p>
  824. </div>
  825. <div class="thresholdCtrlShowDiv">
  826. <div class="maxminNum">
  827. <p>起始时间:
  828. <span>12</span>
  829. 点
  830. </p>
  831. <p>工作时长:
  832. <span>10</span>
  833. 小时
  834. </p>
  835. </div>
  836. </div>
  837. <div class="equipCtrlInp">
  838. <label>
  839. <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">
  840. <span class="lbl"></span>
  841. </label>
  842. </div>
  843. </div>
  844. </div> -->
  845. </div>
  846. </div>
  847. <!-- 24小时数据 -->
  848. <div id="data24Div">
  849. <div class="currTimeStatus">
  850. <div class="widget-box">
  851. <div class="widget-title">
  852. <h5>24小时数据</h5>
  853. </div>
  854. </div>
  855. </div>
  856. <div class="row">
  857. <div class="col-xs-12 col-md-12 col-lg-9">
  858. <table id="newtable" class="table table-striped table-hover">
  859. <tr>
  860. <td>传感器通道</td>
  861. <td>通道名称</td>
  862. <td>最小值</td>
  863. <td>最小值时间</td>
  864. <td>最大值</td>
  865. <td>最大值时间</td>
  866. </tr>
  867. <tbody>
  868. </tbody>
  869. </table>
  870. </div>
  871. </div>
  872. </div>
  873. </div>
  874. </div>
  875. </div>
  876. <!-- Modal -->
  877. <div id="Modal" class="model" style="display:none">
  878. <div>
  879. <form class="layui-form" action="" id="modelForm" lay-filter="formModel">
  880. <input type="hidden" value="" name="JK">
  881. <input type="hidden" value="" name="eKey">
  882. <div class="layui-form-item">
  883. <label class="layui-form-label">最大值</label>
  884. <div class="layui-input-inline">
  885. <input type="text" name="upper" id="upper" required lay-verify="required" placeholder="请输入最大值"
  886. autocomplete="off" class="layui-input">
  887. </div>
  888. </div>
  889. <div class="layui-form-item">
  890. <label class="layui-form-label">最小值</label>
  891. <div class="layui-input-inline">
  892. <input type="text" name="lower" required lay-verify="required" placeholder="请输入最小值"
  893. autocomplete="off" class="layui-input">
  894. </div>
  895. </div>
  896. <div class="layui-form-item">
  897. <label class="layui-form-label">规 则</label>
  898. <div class="layui-input-inline">
  899. <input type="radio" name="method" lay-filter="radioSwitch" value="1" title="程序一" checked="">
  900. <input type="radio" name="method" lay-filter="radioSwitch" value="0" title="程序二">
  901. </div>
  902. <div class="layui-form-mid layui-word-aux" id="hintDiv">低于下限
  903. <span>开启</span>,高于上限
  904. <span>关闭</span>
  905. </div>
  906. </div>
  907. </form>
  908. </div>
  909. </div>
  910. <!-- Modal2 -->
  911. <div id="timingOnOffModal" class="model" style="display:none">
  912. <div>
  913. <form class="layui-form" action="" id="modelForm" lay-filter="formModel">
  914. <input type="hidden" value="" name="JK">
  915. <div class="layui-form-item">
  916. <label class="layui-form-label">起始时间:</label>
  917. <div class="layui-input-inline">
  918. <input type="number" name="StartTime" id="starttime" required
  919. lay-verify="required|starttimeRegex" placeholder="请输入起始时间" autocomplete="off"
  920. class="layui-input">
  921. <!-- <select name="city" lay-verify="">
  922. <option value="">请选择一个城市</option>
  923. <option value="010">北京</option>
  924. <option value="021">上海</option>
  925. <option value="0571">杭州</option>
  926. </select>
  927. <select name="city" lay-verify="required">
  928. <option value=""></option>
  929. <option value="0">北京</option>
  930. <option value="1">上海</option>
  931. <option value="2">广州</option>
  932. <option value="3">深圳</option>
  933. <option value="4">杭州</option>
  934. </select> -->
  935. </div>
  936. <div class="layui-form-mid layui-word-aux">时间范围(0-23)</div>
  937. </div>
  938. <div class="layui-form-item">
  939. <label class="layui-form-label">工作时长:</label>
  940. <div class="layui-input-inline">
  941. <input type="number" name="Duration" id="Duration" required lay-verify="required|durationRegex"
  942. placeholder="请输入工作时长" autocomplete="off" class="layui-input">
  943. </div>
  944. <div class="layui-form-mid layui-word-aux">工作时长(1-24)</div>
  945. </div>
  946. </form>
  947. </div>
  948. </div>
  949. <!-- setEleName -->
  950. <div id="eleName" style="width:800px;display:none">
  951. <div style="width:95%;margin:0 auto;">
  952. <table class="layui-hide" id="eleTable" lay-filter="eleTable"></table>
  953. </div>
  954. </div>
  955. <!-- setNotewarn -->
  956. <div id="Notewarn" style="width:800px;display:none">
  957. <div style="width:95%;margin:10px auto;">
  958. <div>
  959. <span>预警手机号:<input type="text" name="" id="alarmPhone"></span>
  960. <button class="btn btn-sm btn-primary" onclick="sendNoteMsg()">确定</button>
  961. </div>
  962. <table class="layui-hide" id="NotewarnTable" lay-filter="NotewarnTable"></table>
  963. </div>
  964. </div>
  965. <!-- 管理员查看设备电压历史记录 -->
  966. <div id="record" style="display: none;">
  967. <div style="padding: 20px;width: 500px;">
  968. <table id="recordTable" lay-filter="recordTableFilter"></table>
  969. <div id="recordPage"></div>
  970. </div>
  971. </div>
  972. {% verbatim %}
  973. <script type="text/html" id="switchTpl">
  974. <!-- 这里的 checked 的状态只是演示 -->
  975. <input type="checkbox" name="equipType" value="{{d.type}}" lay-skin="switch" lay-text="大于|小于"
  976. lay-filter="equipTypeDemo" {{ d.type == 1 ? 'checked' : '' }}>
  977. </script>
  978. {% endverbatim %}
  979. <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
  980. <script src="{% static '/lib/bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  981. <script src="{% static '/lib/layui/layui.all.js' %}"></script>
  982. <script src="{% static '/js/common.js' %}?versions=0.5.0"></script>
  983. <script type="text/javascript"
  984. src="http://api.map.baidu.com/api?v=2.0&ak=TcRPmrsiZUqdUBWoELrUArRkCRC36KMx"></script>
  985. <script type="text/javascript">
  986. $.ajaxSetup({
  987. data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
  988. });
  989. </script>
  990. <script>
  991. //默认加载设备列表
  992. getEquipList(1, '');
  993. // 搜索
  994. $('#searchBtn').on('click', function () {
  995. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  996. });
  997. $('#searchImei').on('keyup', function (event) {
  998. if (event.keyCode == 13) {
  999. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1000. }
  1001. })
  1002. function getEquipList(page, filter, is_online, etype) {
  1003. if (etype == undefined && is_online == undefined) {
  1004. var etype = ''
  1005. var is_online = ''
  1006. }
  1007. $.ajax({
  1008. url: 'qxz_page',
  1009. type: 'get',
  1010. dataType: 'json',
  1011. data: {
  1012. page: page,
  1013. f_id: filter,
  1014. etype: etype, //所属公司
  1015. is_online: is_online, //设备状态
  1016. },
  1017. beforeSend: function (XMLHttpRequest) {
  1018. loadingFlag = layer.load();
  1019. },
  1020. success: function (data) {
  1021. layer.close(loadingFlag);
  1022. if (data.nums) {
  1023. var html = '';
  1024. var msg = data.ids
  1025. var pagecount = Math.ceil(data.nums / 10);
  1026. for (var i = 0; i < msg.length; i++) {
  1027. if (msg[i].equip_name) {
  1028. var equip_name = '设备:' + msg[i].equip_name;
  1029. } else if (msg[i].equip_id.length == 15) {
  1030. var equip_name = '设备:' + msg[i].equip_id.substring(msg[i].equip_id.length - 8);
  1031. } else {
  1032. var equip_name = '设备:' + msg[i].equip_id;
  1033. }
  1034. var offTime = msg[i].off_time || '';
  1035. if (msg[i].is_online == 1) {
  1036. var classStatic = 'bjgreen';
  1037. } else if (msg[i].is_online == 0) {
  1038. var classStatic = 'bjred';
  1039. } else {
  1040. var classStatic = '';
  1041. }
  1042. // var equip_name = msg[i].equip_name?'---设备名:'+msg[i].equip_name:'';
  1043. html += '<a href="javascript:;" isonline="' + msg[i].is_online + '" offTime="' + offTime + '" title="设备' + msg[i].equip_id + '" class="text-overflow" id="' + msg[i].equip_id + '" name="' + msg[i].equip_name + '" data-pid="322"><span class="' + classStatic + '"></span>' + equip_name + '</a>'
  1044. }
  1045. $('#firstpane .menu_body').html(html);
  1046. $('.equipPage').show();
  1047. $('#totelpage').html(pagecount)
  1048. // 菜单栏
  1049. $("#firstpane .menu_body:eq(0) a:eq(0)").addClass('menu-active');
  1050. $('.widget-content .equip_id').html('设备ID:' + msg[0].equip_id);
  1051. $('.widget-content .equip_name').html('项目名称:' + (msg[0].equip_name || '设备' + msg[0].equip_id));
  1052. $(".menu_body a").click(function () {
  1053. $(".menu_head").removeClass("currAstive");
  1054. $(".menu_body a").removeClass("menu-active");
  1055. $(this).addClass("menu-active");
  1056. $(this).parent().prev().addClass('currAstive');
  1057. // 名称切换
  1058. $('.widget-content .equip_id').html('设备ID:' + $(this).attr('id'));
  1059. $('.widget-content .equip_name').html('项目名称:' + ($(this).attr('name') || '设备' + $(this).attr('id')));
  1060. var facId = $(this).attr("id");
  1061. var currisonline = $(this).attr("isonline");
  1062. var curroffTime = $(this).attr("offTime");
  1063. if (currisonline == 0) {
  1064. $('#isonline').show();
  1065. $('#isonline div').html('离线时间:' + curroffTime);
  1066. } else {
  1067. $('#isonline').hide();
  1068. }
  1069. if (facId && facId != null && facId != "") {
  1070. loadProject(facId);
  1071. loadQxzInfo(facId)
  1072. // loadLEDScreen(facId);
  1073. $('#qxzPhotoId').val(facId);
  1074. }
  1075. });
  1076. loadProject(msg[0].equip_id);
  1077. loadQxzInfo(msg[0].equip_id);
  1078. if (msg[0].is_online == 0) {
  1079. $('#isonline').show();
  1080. $('#isonline div').html('离线时间:' + (msg[0].off_time || ''));
  1081. } else {
  1082. $('#isonline').hide();
  1083. }
  1084. // loadLEDScreen(msg[0].equip_id);
  1085. $('#qxzPhotoId').val(msg[0].equip_id)
  1086. } else {
  1087. $('.equipPage').hide();
  1088. var html = '<a href="javascript:;" class="text-overflow nulldata" data-pid="322">暂未设备</a>'
  1089. $('#firstpane .menu_body').html(html);
  1090. scrollBar()
  1091. }
  1092. },
  1093. error: function (type) {
  1094. layer.close(loadingFlag);
  1095. }
  1096. })
  1097. }
  1098. var nowledinfo;
  1099. // 设备信息
  1100. function loadQxzInfo(facId) {
  1101. $.ajax({
  1102. url: 'qxz_base_view',
  1103. type: 'post',
  1104. dataType: 'json',
  1105. data: {
  1106. imei: facId,
  1107. },
  1108. beforeSend: function (XMLHttpRequest) {
  1109. loadingFlag = layer.load();
  1110. },
  1111. success: function (data) {
  1112. layer.close(loadingFlag);
  1113. if (data != "null") {
  1114. renderQxzInfo(data);
  1115. } else {
  1116. $('#equipInfo').html("");
  1117. $('#sinCodeInquire').html("");
  1118. }
  1119. if (data.dver == null) {
  1120. $('#dverData').html('版本号: 暂无版本号')
  1121. } else {
  1122. $('#dverData').html(data.dver)
  1123. }
  1124. },
  1125. error: function (type) {
  1126. layer.close(loadingFlag);
  1127. }
  1128. })
  1129. }
  1130. // 获取位置
  1131. var geoc = new BMap.Geocoder();
  1132. function renderQxzInfo(data) {
  1133. var pt = new BMap.Point(data.lng, data.lat);
  1134. geoc.getLocation(pt, function (rs) {
  1135. var addComp = rs.addressComponents;
  1136. var area = '';
  1137. if (addComp.province) {
  1138. area += addComp.province;
  1139. }
  1140. if (addComp.city) {
  1141. area += ',' + addComp.city;
  1142. }
  1143. if (addComp.district) {
  1144. area += ',' + addComp.district;
  1145. }
  1146. if (addComp.street) {
  1147. area += ',' + addComp.street;
  1148. }
  1149. if (addComp.streetNumber) {
  1150. area += ',' + addComp.streetNumber;
  1151. }
  1152. $('#qxzArea').html(area);
  1153. var html = "电压:" + data.volt + " 信号强度:" + data.rssi + " 地址:" + area;
  1154. $('#equipInfo').html(html);
  1155. $('#sinCodeInquire').html("");
  1156. var btn = '<button class="btn btn-white btn-primary" onclick="inquireSim(\'' + data.iccid + '\')" id="" type="button">流量查询</button>';
  1157. $('#sinCodeInquire').html(btn);
  1158. });
  1159. }
  1160. // 查询SIM卡
  1161. function inquireSim(iccid) {
  1162. $.ajax({
  1163. url: 'siminfo',
  1164. type: 'post',
  1165. dataType: 'json',
  1166. data: {
  1167. simid: iccid,
  1168. },
  1169. beforeSend: function (XMLHttpRequest) {
  1170. //注意,layer.msg默认3秒自动关闭,如果数据加载耗时比较长,需要设置time
  1171. loadingFlag = layer.msg('请求中,请稍候……', { icon: 16, shade: 0.01, shadeClose: false, time: 60000 });
  1172. },
  1173. success: function (data) {
  1174. var dat = data.data;
  1175. if (data.code == 0) {
  1176. var status;
  1177. if (dat.account_status == "0") {
  1178. status = "未知";
  1179. } else if (dat.account_status == "1") {
  1180. status = "测试期";
  1181. } else if (dat.account_status == "2") {
  1182. status = "沉默期";
  1183. } else if (dat.account_status == "3") {
  1184. status = "使用中";
  1185. } else if (dat.account_status == "4") {
  1186. status = "停机";
  1187. } else if (dat.account_status == "5") {
  1188. status = "停机保号";
  1189. } else if (dat.account_status == "6") {
  1190. status = "预销号";
  1191. } else if (dat.account_status == "7") {
  1192. status = "销号";
  1193. }
  1194. var usage;
  1195. if (dat.iccid) {
  1196. usage = dat.data_usage;
  1197. } else {
  1198. usage.innerHTML = '--';
  1199. }
  1200. var balance;
  1201. if (dat.iccid) {
  1202. balance = dat.data_balance;
  1203. } else {
  1204. balance = '--';
  1205. }
  1206. var time;
  1207. if (dat.iccid) {
  1208. var timestamp4 = new Date(dat.expiry_date * 1000);//直接用 new Date(时间戳) 格式转化获得当前时间
  1209. time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8);
  1210. } else {
  1211. time = '--';
  1212. }
  1213. layer.close(loadingFlag);
  1214. layer.open({
  1215. type: 1
  1216. , title: false //不显示标题栏
  1217. , skin: 'layui-layer-simCode' //样式类名
  1218. , closeBtn: false
  1219. , area: '300px;'
  1220. , shade: 0.8
  1221. , id: 'simCode' //设定一个id,防止重复弹出
  1222. , btn: ['我知道了']
  1223. , btnAlign: 'c'
  1224. , moveType: 1 //拖拽模式,0或者1
  1225. , content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">SIM卡查询结果<br>ICCID:' + iccid + '<br><br>状态:' + status + '<br>套餐:' + dat.data_plan + 'Mb<br>已用流量:' + usage + 'Mb<br>剩余流量:' + balance + 'Mb<br>到期时间:' + time + '</div>'
  1226. , success: function (layero) {
  1227. }
  1228. });
  1229. } else {
  1230. layer.msg(data.msg);
  1231. }
  1232. }
  1233. })
  1234. }
  1235. //删除设备
  1236. function delEquip() {
  1237. var id = $('#firstpane .menu-active').attr('id');
  1238. layer.confirm('<strong style="color:red">是否删除此设备?<span style="font-size:18px">此操作不可逆</span></strong>', { icon: 3, title: '警告' }, function (index) {
  1239. $.ajax({
  1240. url: 'qxz_delete',
  1241. type: 'post',
  1242. data: {
  1243. imei: id
  1244. },
  1245. dataType: 'json',
  1246. success: function (data) {
  1247. if (data == 0) {
  1248. layer.msg('删除成功', { icon: 1 })
  1249. window.location.reload();
  1250. } else {
  1251. } layer.msg('删除失败', { icon: 2 })
  1252. }
  1253. })
  1254. layer.close(index);
  1255. });
  1256. }
  1257. //更换设备IP
  1258. function changeEquip() {
  1259. var _this = this
  1260. var id = $('#firstpane .menu-active').attr('id');
  1261. layer.confirm('<span>IP更换: </span> <input id="authInp" class="authInp" type="text" placeholder="必填"> <span>端口更换: </span> <input id="authInpA" class="authInp" type="text" placeholder="1883">', { title: '更换设备IP' }, function (index) {
  1262. var data = $('#authInp').val() //IP值
  1263. var dataA = $('#authInpA').val() //端口值
  1264. if (data == '') {
  1265. layer.msg('不能为空')
  1266. } else {
  1267. //port
  1268. if (dataA == '') {
  1269. var port = '1883'
  1270. } else {
  1271. var port = dataA
  1272. }
  1273. loadingFlag = layer.msg('请求中,请稍候……', { icon: 16, shade: 0.01, shadeClose: false, time: 15000 });
  1274. var url = data
  1275. $.ajax({
  1276. url: 'qxz_switch',
  1277. type: 'post',
  1278. data: {
  1279. 'req': 'ip',
  1280. 'imei': id,
  1281. 'url': url,
  1282. 'port': port
  1283. },
  1284. success: function (data) {
  1285. setTimeout(function () {
  1286. layer.close(loadingFlag);
  1287. layer.msg('更改成功')
  1288. }, 3000)
  1289. layer.close(index);
  1290. },
  1291. error: function (type) {
  1292. layer.close(loadingFlag);
  1293. $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1294. $(_this).attr('disabled', false);
  1295. }
  1296. })
  1297. }
  1298. });
  1299. }
  1300. //升级
  1301. function upgradeEquip() {
  1302. var _this = this
  1303. var id = $('#firstpane .menu-active').attr('id');
  1304. loadingFlag = layer.msg('请求中,请稍候……', { icon: 16, shade: 0.01, shadeClose: false, time: 15000 });
  1305. $.ajax({
  1306. url: 'qxz_switch',
  1307. type: 'post',
  1308. data: {
  1309. 'req': 'update',
  1310. 'imei': id,
  1311. },
  1312. success: function (data) {
  1313. if (data == 0) {
  1314. //成功
  1315. layer.msg('升级成功', { icon: 1, shade: 0.01, shadeClose: false, time: 5000 })
  1316. } else if (data == 1) {
  1317. //失败
  1318. layer.msg('升级失败', { icon: 2, shade: 0.01, shadeClose: false, time: 5000 })
  1319. }
  1320. },
  1321. error: function (type) {
  1322. layer.msg('升级失败', { icon: 2, shade: 0.01, shadeClose: false, time: 5000 })
  1323. }
  1324. })
  1325. }
  1326. //在线状态筛选
  1327. $('#searchBtnA').on('click', function () {
  1328. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1329. })
  1330. $('#status').on('keyup', function (event) {
  1331. if (event.keyCode == 13) {
  1332. getEquipList(1, 1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1333. }
  1334. })
  1335. //设备所属公司筛选
  1336. $('#searchBtnB').on('click', function () {
  1337. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1338. })
  1339. $('#status').on('keyup', function (event) {
  1340. if (event.keyCode == 13) {
  1341. getEquipList(1, 1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1342. }
  1343. })
  1344. // 查看历史状态信息
  1345. function lookHistory(page) {
  1346. var id = $('#firstpane .menu-active').attr('id');
  1347. $.ajax({
  1348. url: 'qxz_record',
  1349. type: 'post',
  1350. data: {
  1351. 'imei': $('#qxzPhotoId').val(),
  1352. 'page': 1,
  1353. },
  1354. dataType: "json",
  1355. beforeSend: function () {
  1356. loadFlage = layer.load();
  1357. },
  1358. complete: function () {
  1359. // setTimeout(function () {
  1360. layer.close(loadFlage);
  1361. // }, 5000)
  1362. },
  1363. success: function (data) {
  1364. layui.use(['laypage', 'layer', 'table'], function () {
  1365. var laypage = layui.laypage;
  1366. var layer = layui.layer;
  1367. var table = layui.table;
  1368. layer.open({
  1369. title: '历史状态'
  1370. , type: 1
  1371. , offset: '100px'
  1372. , area: "500px"
  1373. , content: $('#record')
  1374. , success: function (layero, index) {
  1375. table.render({
  1376. elem: '#recordTable'
  1377. // ,height: 312
  1378. , skin: 'line' //行边框风格
  1379. , data: data.dat //数据接口
  1380. , page: false //开启分页
  1381. , cols: [[ //表头
  1382. { field: 'volt', align: 'center', title: '电压' }
  1383. , { field: 'rssi', align: 'center', title: '信号强度' }
  1384. , { field: 'upl_time', align: 'center', title: '上报时间', minWidth: 200 }
  1385. ]]
  1386. });
  1387. //执行一个laypage实例
  1388. laypage.render({
  1389. elem: 'recordPage' //注意,这里的 test1 是 ID,不用加 # 号
  1390. , layout: ['prev', 'page', 'next', 'count', 'skip']
  1391. , count: data.nums //数据总数,从服务端得到
  1392. , jump: function (obj, first) {
  1393. if (!first) {
  1394. $.ajax({
  1395. url: 'qxz_record',
  1396. type: 'post',
  1397. data: {
  1398. 'imei': $('#qxzPhotoId').val(),
  1399. 'page': obj.curr,
  1400. },
  1401. dataType: "json",
  1402. beforeSend: function () {
  1403. loadFlage = layer.load();
  1404. },
  1405. complete: function () {
  1406. // setTimeout(function () {
  1407. layer.close(loadFlage);
  1408. // }, 5000)
  1409. },
  1410. success: function (data) {
  1411. //首次不执行
  1412. table.render({
  1413. elem: '#recordTable'
  1414. // ,height: 312
  1415. , skin: 'line' //行边框风格
  1416. , data: data.dat //数据接口
  1417. , page: false //开启分页
  1418. , cols: [[ //表头
  1419. { field: 'volt', align: 'center', title: '电压' }
  1420. , { field: 'rssi', align: 'center', title: '信号强度' }
  1421. , { field: 'upl_time', align: 'center', title: '上报时间', minWidth: 200 }
  1422. ]]
  1423. });
  1424. }
  1425. })
  1426. }
  1427. }
  1428. });
  1429. }
  1430. });
  1431. });
  1432. }
  1433. })
  1434. }
  1435. //设备状态
  1436. function loadProject(facId) {
  1437. $.ajax({
  1438. url: 'qxz_status',
  1439. type: 'post',
  1440. dataType: 'json',
  1441. data: {
  1442. e_id: facId,
  1443. },
  1444. beforeSend: function (XMLHttpRequest) {
  1445. loadingFlag = layer.load();
  1446. },
  1447. success: function (data) {
  1448. layer.close(loadingFlag);
  1449. loadLEDScreen(data.led);
  1450. nowledinfo = data.ledinfo
  1451. // 实时状态
  1452. newStatus('newStatusBox', data, facId);
  1453. $('#updataTime').html(data.base.upl_time || '暂无上传数据');
  1454. if (data.base.qxz_picture) {
  1455. $('#viewPhoto').attr('src', 'http://120.27.222.26/' + data.base.qxz_picture);
  1456. } else {
  1457. $('#viewPhoto').attr('src', 'http://120.27.222.26/' + 'qxz_photo/default.jpg');
  1458. }
  1459. addCtrlBtn(data.qxz_switch, data.switch_name);
  1460. if (data.qxz_switch && (data.qxz_switch.length != 2)) {
  1461. $('#ctrlBoxParentDiv').show();
  1462. $('#getthresholdDivParentDiv').show();
  1463. $('#timingDivParentDiv').show();
  1464. $('#data24Div').hide();
  1465. gettimimgFun(data);
  1466. getthresholdFun(data);
  1467. scrollBar()
  1468. } else { // 无开关显示24小时数据
  1469. $('#ctrlBoxParentDiv').hide();
  1470. $('#getthresholdDivParentDiv').hide();
  1471. $('#timingDivParentDiv').hide();
  1472. $('#data24Div').show();
  1473. get24Data(facId)
  1474. scrollBar()
  1475. }
  1476. },
  1477. error: function (type) {
  1478. layer.close(loadingFlag);
  1479. }
  1480. })
  1481. }
  1482. // 阈值请求
  1483. function getthresholdFun(data) {
  1484. if (data.auto_list.length > 2) {
  1485. var switchData = eval('(' + data.auto_list + ')');
  1486. var qxz_switch = eval('(' + data.qxz_switch + ')');
  1487. // var qxz_list = data.new_data;
  1488. if (data.switch_name.length > 2) {
  1489. var switch_name = eval('(' + data.switch_name + ')');
  1490. } else {
  1491. var switch_name = [];
  1492. }
  1493. } else {
  1494. var switchData = [];
  1495. // var qxz_list = [];
  1496. var switch_name = [];
  1497. }
  1498. if (switchData.length) {
  1499. var html = '';
  1500. for (var i = 0; i < switchData.length; i++) {
  1501. if (switchData[i].JK != 255) {
  1502. if (switchData[i].upper == 32767 || switchData[i].lower == 32767) {
  1503. var check = false;
  1504. } else {
  1505. var check = true;
  1506. }
  1507. // 判断通道号
  1508. if (!isNaN(switchData[i].eKey)) {
  1509. var eknum = switchData[i].eKey + 1;
  1510. var ek = 'e' + eknum;
  1511. } else {
  1512. var ek = switchData[i].eKey;
  1513. }
  1514. // 开关名
  1515. if (switchData[i].JK == qxz_switch[i].JK) {
  1516. if (switch_name.length > 2) {
  1517. if (switch_name[i].name) {
  1518. var name = switch_name[i].name;
  1519. } else {
  1520. var name = '开关' + qxz_switch[i].JK;
  1521. }
  1522. } else {
  1523. var name = '开关' + qxz_switch[i].JK;
  1524. }
  1525. } else {
  1526. var name = timingData[i].JK;
  1527. }
  1528. if (data.dat[ek]) {
  1529. var eNum = data.dat[ek].split('#')[1];
  1530. var txt = data.conf[ek].split('#')[0];
  1531. html += '<div class="col-xs-6 col-sm-4"><div class="thresholdCtrl">' +
  1532. '<div class="setthresholdBtn" onclick="setthresholdFun(this)">' +
  1533. '<i class="fa fa-cog setName" aria-hidden="true"></i></div>' +
  1534. '<input type="hidden" class="currVal" value=\'' + JSON.stringify(switchData[i]) + '\'>' +
  1535. '<div class="thresholdCtrlName"><p>' + name + '(通道' + switchData[i].eKey + ')</p></div>' +
  1536. '<div class="thresholdCtrlShowDiv"><div class="qxys"><div>' +
  1537. '<img src="http://www.yfzhwlw.com/static/img/dev/icon_' + eNum + '.png" alt=""></div>' +
  1538. '<div>' + txt + data.conf[ek].split('#')[1] + '</div></div><div class="maxminNum"><p>最大值:<span>' + switchData[i].upper + '</span></p>' +
  1539. '<p>最小值:<span>' + switchData[i].lower + '</span></p></div></div><div class="equipCtrlInp">';
  1540. if (check) {
  1541. html += '<label><input name="switch-field-1" class="ace ace-switch ace-switch-6" checked="checked" type="checkbox">' +
  1542. '<span class="lbl"></span></label></div></div></div>';
  1543. } else {
  1544. html += '<label><input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">' +
  1545. '<span class="lbl"></span></label></div></div></div>';
  1546. }
  1547. }
  1548. }
  1549. if (i == switchData.length - 1) {
  1550. if (html) {
  1551. $('#getthresholdDiv').html(html)
  1552. } else {
  1553. $('#getthresholdDiv').html('<div style="text-align:center">空</div>')
  1554. }
  1555. }
  1556. }
  1557. } else {
  1558. $('#getthresholdDiv').html('<div style="text-align:center">空</div>')
  1559. }
  1560. }
  1561. // 定时请求
  1562. function gettimimgFun(data) {
  1563. var switch_name = data.switch_name;
  1564. var qxz_switch = data.qxz_switch;
  1565. if (data.timing_list.length) {
  1566. var timingData = eval('(' + data.timing_list + ')');
  1567. var qxz_switch = eval('(' + data.qxz_switch + ')');
  1568. var qxz_list = data.qxz_list;
  1569. if (switch_name.length > 2) {
  1570. var switch_name = eval('(' + switch_name + ')');
  1571. } else {
  1572. var switch_name = [];
  1573. }
  1574. } else {
  1575. var timingData = [];
  1576. var qxz_list = [];
  1577. var switch_name = [];
  1578. }
  1579. if (timingData.length) {
  1580. var html = '';
  1581. for (var i = 0; i < timingData.length; i++) {
  1582. if (timingData[i].JK != 255) {
  1583. if (timingData[i].Duration == 32767 || timingData[i].StartTime == 32767) {
  1584. var check = false;
  1585. var curCheckedVal = {
  1586. JK: timingData[i].JK,
  1587. StartTime: '--',
  1588. Duration: '--'
  1589. }
  1590. var startTime = '--';
  1591. var duration = '--';
  1592. } else {
  1593. var check = true;
  1594. var curCheckedVal = {
  1595. JK: timingData[i].JK,
  1596. StartTime: timingData[i].StartTime,
  1597. Duration: timingData[i].Duration
  1598. }
  1599. var startTime = timingData[i].StartTime;
  1600. var duration = timingData[i].Duration;
  1601. }
  1602. if (timingData[i].JK == qxz_switch[i].JK) {
  1603. if (switch_name.length > 2) {
  1604. if (switch_name[i].name) {
  1605. var name = switch_name[i].name;
  1606. } else {
  1607. var name = '开关' + qxz_switch[i].JK;
  1608. }
  1609. } else {
  1610. var name = '开关' + qxz_switch[i].JK;
  1611. }
  1612. } else {
  1613. var name = timingData[i].JK;
  1614. }
  1615. html += '<div class="col-xs-6 col-sm-4"><div class="thresholdCtrl">' +
  1616. '<div class="setthresholdBtn" onclick="timingOnOff(this)">' +
  1617. '<i class="fa fa-cog setName" aria-hidden="true"></i></div>' +
  1618. '<input type="hidden" class="currVal" value=\'' + JSON.stringify(curCheckedVal) + '\'>' +
  1619. '<div class="thresholdCtrlName"><p>' + name + '</p></div>' +
  1620. '<div class="thresholdCtrlShowDiv"><div class="maxminNum">' +
  1621. '<p>起始时间:<span>' + startTime + '</span>点</p><p>工作时长:<span>' + duration + '</span>小时</p>' +
  1622. '</div></div><div class="equipCtrlInp"><label>';
  1623. if (check) {
  1624. html += '<input name="switch-field-1" checked class="ace ace-switch ace-switch-6" type="checkbox">' +
  1625. '<span class="lbl"></span></label></div></div></div>';
  1626. } else {
  1627. html += '<input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">' +
  1628. '<span class="lbl"></span></label></div></div></div>';
  1629. }
  1630. }
  1631. if (i == timingData.length - 1) {
  1632. if (html) {
  1633. $('#gettimingDiv').html(html)
  1634. } else {
  1635. $('#gettimingDiv').html('<div style="text-align:center">空</div>')
  1636. }
  1637. }
  1638. }
  1639. } else {
  1640. $('#gettimingDiv').html('<div style="text-align:center">空</div>')
  1641. }
  1642. }
  1643. // 控制按钮
  1644. function addCtrlBtn(data, switch_name) {
  1645. if (data && switch_name.length > 2) {
  1646. var data = eval('(' + data + ')');
  1647. var ctrl_name = eval('(' + switch_name + ')');
  1648. $('.qxzDownCtrl').show();
  1649. } else if (data) {
  1650. var data = eval('(' + data + ')');
  1651. var ctrl_name = [];
  1652. } else {
  1653. var data = []
  1654. $('.qxzDownCtrl').hide();
  1655. }
  1656. if (data.length) {
  1657. var html = '';
  1658. for (var i = 0; i < data.length; i++) {
  1659. if (data[i].status == 0) {
  1660. var curClass = '';
  1661. } else {
  1662. var curClass = 'active';
  1663. }
  1664. if (data[i].status == 0) {
  1665. var curChecked = ''; //关
  1666. } else {
  1667. var curChecked = 'checked';
  1668. }
  1669. if (ctrl_name.length) {
  1670. if (ctrl_name[i].name != '') {
  1671. var switch_name = ctrl_name[i].name;
  1672. } else {
  1673. var switch_name = '开关' + ctrl_name[i].JK;
  1674. }
  1675. } else {
  1676. var switch_name = '开关' + data[i].JK;
  1677. }
  1678. html += '<div class="col-xs-2"><div class="equipCtrl"><input type="hidden" class="currStutas" value="' + data[i].JK + '">' +
  1679. '<i class="fa fa-cog setName" aria-hidden="true"></i><div><span class="isonlineicon ' + curClass + '"></span><span class="numName">' + switch_name + '</span></div><div class="equipCtrlInp">' +
  1680. '<label><input name="switch-field-1" ' + curChecked + ' class="ace ace-switch ace-switch-4 btn-rotate" type="checkbox">' +
  1681. '<span class="lbl"></span></label></div></div></div>';
  1682. if (i == data.length - 1) {
  1683. $('#ctrlBox').html(html);
  1684. }
  1685. }
  1686. } else {
  1687. $('#ctrlBox').html('<div style="text-align:center">空</div>');
  1688. }
  1689. }
  1690. $('#ctrlBox').on('click', '.btn-rotate', function () {
  1691. var _this = this;
  1692. $(this).parents('.equipCtrl').find('.ctrlLoading').remove()
  1693. $(this).attr('disabled', true);
  1694. $(this).parents('.equipCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  1695. var currWay = $(this).parents('.equipCtrl').find('.currStutas').val();
  1696. var imei = $('#qxzPhotoId').val();
  1697. if ($(this).is(":checked")) {
  1698. var oldStatus = 0;
  1699. var currStutas = 1;
  1700. } else {
  1701. var oldStatus = 1;
  1702. var currStutas = 0;
  1703. }
  1704. $.ajax({
  1705. url: 'qxz_switch',
  1706. type: 'post',
  1707. data: {
  1708. 'req': 'set',
  1709. 'imei': imei,
  1710. 'way': currWay,
  1711. 'switch': currStutas
  1712. },
  1713. success: function (data) {
  1714. setTimeout(function () {
  1715. var id = $('#firstpane .menu-active').attr('id')
  1716. loadProject(id);
  1717. }, 5000)
  1718. // $(_this).attr('disabled', false);
  1719. // $(_this).parents('.equipCtrl').find('.ctrlLoading').html('');
  1720. // if (currStutas) {
  1721. // $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
  1722. // } else {
  1723. // $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
  1724. // }
  1725. },
  1726. error: function (type) {
  1727. layer.close(loadingFlag);
  1728. $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1729. $(_this).attr('disabled', false);
  1730. if (oldStatus) {
  1731. $(_this).prop('checked', true);
  1732. $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
  1733. } else {
  1734. $(_this).prop('checked', '');
  1735. $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
  1736. }
  1737. }
  1738. })
  1739. })
  1740. // 下发控制名称
  1741. $('#ctrlBox').on('click', '.setName', function () {
  1742. var _this = this;
  1743. var ele = $(this).parents('.equipCtrl').find('.numName');
  1744. var currWay = $(this).parents('.equipCtrl').find('.currStutas').val();
  1745. layui.use('layer', function () {
  1746. var layer = layui.layer;
  1747. layer.prompt({ title: '自定义名称', offset: '300px', formType: 0, value: ele.html(), maxlength: 10 }, function (text, index) {
  1748. if (text == ele.html()) {
  1749. return false;
  1750. layer.close(index);
  1751. layer.msg('演示完毕!您的口令:' + text);
  1752. ele.html(text)
  1753. }
  1754. $.ajax({
  1755. url: 'qxz_switch_name',
  1756. type: 'post',
  1757. data: {
  1758. 'imei': $('#qxzPhotoId').val(),
  1759. 'way': currWay,
  1760. 'sw_name': text
  1761. },
  1762. success: function (data) {
  1763. if (data == 0) {
  1764. ele.html(text)
  1765. }
  1766. layer.close(index);
  1767. },
  1768. error: function (type) {
  1769. $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1770. $(_this).attr('disabled', false);
  1771. if (oldStatus) {
  1772. $(_this).prop('checked', true);
  1773. $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
  1774. } else {
  1775. $(_this).prop('checked', '');
  1776. $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
  1777. }
  1778. }
  1779. })
  1780. });
  1781. });
  1782. })
  1783. // 获取最新控制按钮状态
  1784. function qxzDownCtrlFun() {
  1785. $.ajax({
  1786. url: 'qxz_switch',
  1787. type: 'post',
  1788. data: {
  1789. 'req': 'conf', //
  1790. 'imei': $('#qxzPhotoId').val(),
  1791. },
  1792. beforeSend: function () {
  1793. loadFlage = layer.load();
  1794. },
  1795. complete: function () {
  1796. setTimeout(function () {
  1797. layer.close(loadFlage);
  1798. }, 5000)
  1799. },
  1800. success: function (data) {
  1801. setTimeout(function () {
  1802. loadProject($('#qxzPhotoId').val())
  1803. }, 5000)
  1804. }
  1805. })
  1806. }
  1807. // 获取最新数据
  1808. function newDataRefresh() {
  1809. $.ajax({
  1810. url: 'qxz_switch',
  1811. type: 'post',
  1812. data: {
  1813. 'req': 'read',
  1814. 'imei': $('#qxzPhotoId').val(),
  1815. },
  1816. beforeSend: function () {
  1817. loadFlage = layer.load();
  1818. },
  1819. complete: function () {
  1820. setTimeout(function () {
  1821. layer.close(loadFlage);
  1822. }, 5000)
  1823. },
  1824. success: function (data) {
  1825. setTimeout(function () {
  1826. loadProject($('#qxzPhotoId').val())
  1827. }, 5000)
  1828. }
  1829. })
  1830. }
  1831. // 设备列表
  1832. var currpage = 1;
  1833. function changePage(symbol) {
  1834. var totelpage = Number($('#totelpage').html());
  1835. if (symbol == 'add') {
  1836. if (currpage < totelpage) {
  1837. currpage++;
  1838. $('#currentpage').html(currpage);
  1839. $('#jumpPage').val(currpage);
  1840. $('addPage').attr('disable', 'false')
  1841. } else {
  1842. $('addPage').attr('disable', 'true')
  1843. return false;
  1844. }
  1845. } else if (symbol == 'jian') {
  1846. if (currpage > 1) {
  1847. currpage--;
  1848. $('#currentpage').html(currpage);
  1849. $('#jumpPage').val(currpage);
  1850. $('jianPage').attr('disable', 'false')
  1851. } else {
  1852. $('jianPage').attr('disable', 'true')
  1853. return false;
  1854. }
  1855. } else if (symbol == 'jump') {
  1856. var jumpPage = $('#jumpPage').val();
  1857. if (jumpPage <= totelpage && jumpPage > 0) {
  1858. currpage = jumpPage;
  1859. } else if (jumpPage > totelpage) {
  1860. currpage = totelpage;
  1861. } else if (jumpPage < 0) {
  1862. currpage = 1;
  1863. }
  1864. $('#jumpPage').val(currpage);
  1865. $('#currentpage').html(currpage);
  1866. }
  1867. getEquipList(currpage, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1868. }
  1869. // 首页
  1870. function gotofirstpage() {
  1871. currpage = 1;
  1872. $('#currentpage').html(1);
  1873. $('#jumpPage').val(1);
  1874. getEquipList(1, $('#searchImei').val())
  1875. }
  1876. // 定时刷新
  1877. // msgInterval = setInterval(function () {
  1878. // var currid = $('#firstpane .menu-active').attr('id');
  1879. // loadProject(currid);
  1880. // }, 60000);
  1881. var waterTempId = [16062009, 16062010, 16062011, 16062012, 16062013, 16062014, 16062015, 16062016, 16062017, 16062018, 16062019, 16062020, 16062021, 16062022, 16062023, 16062024, 16062025];
  1882. // 实时状态
  1883. function newStatus(statusBox, data, facId) {
  1884. var dat = data.dat;
  1885. var html = '';
  1886. $(document.getElementById(statusBox)).html('');
  1887. var random = ['bg_lb', 'bg_ly', 'bg_ls', 'bg_lg', 'bg_lo', 'bg_lr']; //颜色随机
  1888. if (Object.keys(dat).length) {
  1889. for (var i = 1; i < 31; i++) {
  1890. var ekeyNum = 'e' + i;
  1891. if (dat[ekeyNum] != '' && (parseInt(dat[ekeyNum].split('#')[1]) != 163)) {
  1892. if (dat[ekeyNum].split('#')[0] == -99.99) {
  1893. var eVal = 'N/A';
  1894. } else {
  1895. var eVal = dat[ekeyNum].split('#')[0];
  1896. }
  1897. var eNum = dat[ekeyNum].split('#')[1];
  1898. var ekey = dat[ekeyNum].split('#')[2];
  1899. var colorClass = eNum % 4;
  1900. // if(Object.keys(data.conf).length){
  1901. var eTxtUnit = data.conf[ekeyNum].split('#')[0];
  1902. var eUnit = data.conf[ekeyNum].split('#')[1];
  1903. // }
  1904. html += '<div class=" col-xs-4 col-md-3 col-lg-2"><div class="dev ' + random[colorClass] + '"><div class="left">' +
  1905. '<img class="img-dev" src="/static/img/dev/icon_' + eNum + '.png">' +
  1906. '</div><div class="right"><div class="name">' + eTxtUnit + '</div>' +
  1907. '<div class="data"><strong><span style="font-size: 25px;">' + eVal + '</span>' +
  1908. '</strong>' + eUnit + '</div></div><div class="aisle">通道' + ekey.substr(1) + '</div></div></div>';
  1909. }
  1910. }
  1911. }
  1912. if (html) {
  1913. $(document.getElementById(statusBox)).append(html);
  1914. } else {
  1915. html = '<div style="text-align:center">空</div>';
  1916. $(document.getElementById(statusBox)).append(html);
  1917. // $('.widget-content .equip_name').html('');
  1918. // var id = $('#firstpane .menu-active').attr('id')
  1919. // $('.widget-content .equip_id').html('设备ID:' + id);
  1920. // $('#viewPhoto').attr('src', 'qxz_photo/default.jpg');
  1921. // scrollBar()
  1922. }
  1923. scrollBar()
  1924. }
  1925. // 24小时数据
  1926. function get24Data(facId) {
  1927. $.ajax({
  1928. url: 'qxz_day_data',
  1929. type: 'post',
  1930. dataType: 'json',
  1931. data: {
  1932. e_id: facId,
  1933. },
  1934. beforeSend: function (XMLHttpRequest) {
  1935. loadingFlag = layer.load();
  1936. },
  1937. success: function (data) {
  1938. layer.close(loadingFlag);
  1939. $("#newtable tr:not(:first)").remove();
  1940. if (data.data.length) {
  1941. Fill_Table('newtable', data, facId)
  1942. } else {
  1943. Fill_null_Table('newtable', data, facId)
  1944. }
  1945. },
  1946. error: function (type) {
  1947. layer.close(loadingFlag);
  1948. layer.msg('请求失败');
  1949. $("#newtable tr:not(:first)").remove();
  1950. }
  1951. })
  1952. }
  1953. function Fill_Table(table_id, data, facId) {
  1954. var dat = data.data;
  1955. //js循环读取json数据
  1956. var table = document.getElementById(table_id).children[1];
  1957. for (var i = 0; i < dat.length; i++) {
  1958. var row = table.insertRow(table.rows.length);
  1959. var c1 = row.insertCell(0);
  1960. c1.innerHTML = dat[i].ekey;
  1961. var c2 = row.insertCell(1);
  1962. var eNum = dat[i].enum
  1963. var elementName = data.conf[dat[i].ekey].split('#');
  1964. c2.innerHTML = elementName[0] + '(' + elementName[1] + ')';
  1965. var c3 = row.insertCell(2);
  1966. if (dat[i].min == -99.99) {
  1967. c3.innerHTML = 'N/A';
  1968. } else {
  1969. c3.innerHTML = dat[i].min;
  1970. }
  1971. var c4 = row.insertCell(3);
  1972. var min_time = dat[i].mintime;
  1973. c4.innerHTML = min_time;
  1974. var c5 = row.insertCell(4);
  1975. if (dat[i].max == -99.99) {
  1976. c5.innerHTML = 'N/A';
  1977. } else {
  1978. c5.innerHTML = dat[i].max;
  1979. }
  1980. var c6 = row.insertCell(5);
  1981. var max_time = dat[i].maxtime;
  1982. c6.innerHTML = max_time;
  1983. if (i == dat.length - 1) {
  1984. scrollBar()
  1985. }
  1986. }
  1987. }
  1988. function Fill_null_Table(table_id) {
  1989. var table = document.getElementById(table_id).children[1];
  1990. var row = table.insertRow(table.rows.length);
  1991. var c1 = row.insertCell(0);
  1992. c1.setAttribute('colspan', '16');
  1993. c1.setAttribute('class', 'nullData');
  1994. c1.innerHTML = "暂无数据";
  1995. scrollBar()
  1996. }
  1997. window.onresize = function () {
  1998. scrollBar()
  1999. }
  2000. // file 文件
  2001. // divId div id
  2002. // imgId 图片id
  2003. // fileId 文件id
  2004. // width 图片宽
  2005. // height 图片高
  2006. function previewImage(file, divId, imgId, fileId, width, height) {
  2007. width = $('#viewPhotoParent').width();
  2008. var div = document.getElementById(divId);
  2009. if (file.files && file.files[0]) {
  2010. if (file.files[0].size / 1024 / 1024 < 4) {
  2011. sendUserPhoto();
  2012. div.innerHTML = '<img id=' + imgId + ' onclick=$("#' + fileId + '").click()>';
  2013. var img = document.getElementById(imgId);
  2014. img.onload = function () {
  2015. // var rect = clacImgZoomParam(width, height, img.offsetWidth, img.offsetHeight);
  2016. img.width = width;
  2017. img.height = height;
  2018. // img.style.marginTop = rect.top+'px';
  2019. }
  2020. var reader = new FileReader();
  2021. reader.onload = function (evt) {
  2022. img.src = evt.target.result;
  2023. // $(window.parent.document).find('.nav-user-photo').attr('src',evt.target.result);
  2024. }
  2025. reader.readAsDataURL(file.files[0]);
  2026. // $('#userPhoto').submit();
  2027. } else {
  2028. $(file).val('');
  2029. layer.alert("图片过大!");
  2030. }
  2031. } else {//兼容IE
  2032. var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
  2033. file.select();
  2034. if (document.selection != undefined) {
  2035. var src = document.selection.createRange().text;
  2036. div.innerHTML = '<img id=' + imgId + '>';
  2037. var img = document.getElementById(imgId);
  2038. img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
  2039. var rect = clacImgZoomParam(width, height, img.offsetWidth, img.offsetHeight);
  2040. status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height);
  2041. div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;" + sFilter + src + "\"'></div>";
  2042. }
  2043. }
  2044. }
  2045. function clacImgZoomParam(maxWidth, maxHeight, width, height) {
  2046. var param = { top: 0, left: 0, width: width, height: height };
  2047. if (width > maxWidth || height > maxHeight) {
  2048. var rateWidth = width / maxWidth;
  2049. var rateHeight = height / maxHeight;
  2050. if (rateWidth > rateHeight) {
  2051. param.width = maxWidth;
  2052. param.height = Math.round(height / rateWidth);
  2053. } else {
  2054. param.width = Math.round(width / rateHeight);
  2055. param.height = maxHeight;
  2056. }
  2057. }
  2058. param.left = Math.round((maxWidth - param.width) / 2);
  2059. param.top = Math.round((maxHeight - param.height) / 2);
  2060. return param;
  2061. }
  2062. // 上传图片
  2063. function sendUserPhoto() {
  2064. var formData = new FormData($("#userPhoto")[0]);
  2065. $.ajax({
  2066. url: 'qxz_photo',
  2067. type: 'POST',
  2068. data: formData,
  2069. contentType: false,
  2070. processData: false,
  2071. success: function (data) {
  2072. if (data == 0) {
  2073. $(window.parent.document).find('.nav-user-photo').attr('src', $('#viewPhoto').prop('src'));
  2074. $('#uploadPhoto').val('');
  2075. }
  2076. else { layer.msg("上传失败!"); return false; }
  2077. }
  2078. });
  2079. }
  2080. // 设置阈值
  2081. function setthresholdFun(ele) {
  2082. var obj = $(ele);
  2083. var currValstr = obj.next().val();
  2084. var currVal = eval('(' + currValstr + ')');
  2085. layui.use(['layer', 'form'], function () {
  2086. var rule0 = "低于下限<span>开启</span>,高于上限<span>关闭</span>";
  2087. var rule1 = "低于下限<span>关闭</span>,高于上限<span>开启</span>";
  2088. var layer = layui.layer;
  2089. var form = layui.form;
  2090. //给表单赋值
  2091. form.val("formModel", {
  2092. "JK": currVal.JK
  2093. , "eKey": currVal.eKey
  2094. , "upper": currVal.upper
  2095. , "lower": currVal.lower
  2096. , "method": currVal.method
  2097. });
  2098. if (currVal.method == 1) {
  2099. $('#hintDiv').html(rule1)
  2100. } else {
  2101. $('#hintDiv').html(rule0)
  2102. }
  2103. form.on('radio(radioSwitch)', function (data) {
  2104. if (data.value == 1) {
  2105. $('#hintDiv').html(rule1)
  2106. } else {
  2107. $('#hintDiv').html(rule0)
  2108. }
  2109. });
  2110. layer.open({
  2111. type: 1,
  2112. title: '阈值设置',
  2113. offset: '380px',
  2114. btn: ['确定', '取消'],
  2115. area: ['600px', '300px'], //宽高
  2116. content: $('#Modal'),
  2117. success: function (layero, index) { // 成功弹出后回调
  2118. // 添加form标识
  2119. layero.addClass('layui-form');
  2120. // 将保存按钮改变成提交按钮
  2121. layero.find('.layui-layer-btn0').attr({
  2122. 'lay-filter': 'setYuzhi',
  2123. 'lay-submit': ''
  2124. });
  2125. },
  2126. yes: function (index, layero) {
  2127. form.on('submit(setYuzhi)', function (data) {
  2128. var dat = data.field;
  2129. if (parseInt(data.field.upper) < parseInt(data.field.lower)) {
  2130. layer.tips('最大值不能小于最小值!', $('#upper'));
  2131. return false;
  2132. }
  2133. var hideVal = JSON.stringify(data.field)
  2134. var id = $('#firstpane .menu-active').attr('id')
  2135. data.field.equip_id = id;
  2136. var curinputBtn = obj.parent().find('.ace-switch');
  2137. if (curinputBtn.is(":checked")) {
  2138. var oldStatus = 0;
  2139. var currStutas = 1;
  2140. } else {
  2141. var oldStatus = 1;
  2142. var currStutas = 0;
  2143. }
  2144. obj.parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  2145. $.ajax({
  2146. url: 'qxz_value_mqtt',
  2147. type: 'post',
  2148. data: data.field,
  2149. success: function (data) {
  2150. setTimeout(function () {
  2151. curinputBtn.attr('disabled', false);
  2152. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('');
  2153. obj.parent().find('.maxminNum').find('p').eq(0).find('span').html(dat.upper)//最大值
  2154. obj.parent().find('.maxminNum').find('p').eq(1).find('span').html(dat.lower)//最小值
  2155. obj.parents('.thresholdCtrl').find('.ace-switch').prop('checked', 'checked');//开启阈值
  2156. var id = $('#firstpane .menu-active').attr('id')
  2157. loadProject(id);
  2158. }, 5000)
  2159. },
  2160. error: function (type) {
  2161. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  2162. curinputBtn.attr('disabled', false);
  2163. }
  2164. })
  2165. // $('.maxminNum')
  2166. layer.closeAll(); //疯狂模式,关闭所有层
  2167. return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
  2168. });
  2169. }
  2170. , btn2: function (index, layero) {
  2171. $('#Modal').hide()
  2172. //return false 开启该代码可禁止点击该按钮关闭
  2173. }
  2174. });
  2175. });
  2176. }
  2177. // 下发阈值控制
  2178. $('#getthresholdDiv').on('click', '.ace-switch', function () {
  2179. var _this = this;
  2180. $(this).parents('.thresholdCtrl').find('.ctrlLoading').remove()
  2181. $(this).attr('disabled', true);
  2182. $(this).parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  2183. var currVal = $(this).parents('.thresholdCtrl').find('.currVal').val();
  2184. var currWayjson = JSON.parse(currVal);
  2185. var id = $('#firstpane .menu-active').attr('id')
  2186. currWayjson.equip_id = id;
  2187. if ($(this).is(":checked")) { //开启
  2188. var oldStatus = 0;
  2189. var currStutas = 1;
  2190. } else { //关闭
  2191. var oldStatus = 1;
  2192. var currStutas = 0;
  2193. currWayjson.upper = '32767';
  2194. currWayjson.lower = '32767';
  2195. }
  2196. $.ajax({
  2197. url: 'qxz_value_mqtt',
  2198. type: 'post',
  2199. data: currWayjson,
  2200. success: function (data) {
  2201. setTimeout(function () {
  2202. $(_this).attr('disabled', false);
  2203. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('');
  2204. var id = $('#firstpane .menu-active').attr('id')
  2205. loadProject(id);
  2206. }, 5000)
  2207. },
  2208. error: function (type) {
  2209. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  2210. $(_this).attr('disabled', false);
  2211. if (oldStatus) {
  2212. $(_this).prop('checked', true);
  2213. } else {
  2214. $(_this).prop('checked', '');
  2215. }
  2216. }
  2217. })
  2218. })
  2219. // 定时开关
  2220. function timingOnOff(ele) {
  2221. var obj = $(ele);
  2222. var currValstr = obj.next().val();
  2223. var currVal = eval('(' + currValstr + ')');
  2224. layui.use(['layer', 'form'], function () {
  2225. var layer = layui.layer;
  2226. var form = layui.form;
  2227. form.verify({
  2228. starttimeRegex: function (value, item) { //value:表单的值、item:表单的DOM对象
  2229. if (value < 0 || value > 23) {
  2230. return '请输入范围内数值';
  2231. }
  2232. },
  2233. durationRegex: function (value, item) { //value:表单的值、item:表单的DOM对象
  2234. if (value < 1 || value > 24) {
  2235. return '请输入范围内数值';
  2236. }
  2237. }
  2238. });
  2239. //给表单赋值
  2240. form.val("formModel", {
  2241. "JK": currVal.JK
  2242. , "StartTime": currVal.StartTime
  2243. , "Duration": currVal.Duration
  2244. });
  2245. layer.open({
  2246. type: 1,
  2247. title: '阈值设置',
  2248. offset: '380px',
  2249. btn: ['确定', '取消'],
  2250. area: ['600px', '300px'], //宽高
  2251. content: $('#timingOnOffModal'),
  2252. success: function (layero, index) { // 成功弹出后回调
  2253. // 添加form标识
  2254. layero.addClass('layui-form');
  2255. // 将保存按钮改变成提交按钮
  2256. layero.find('.layui-layer-btn0').attr({
  2257. 'lay-filter': 'setdingshi',
  2258. 'lay-submit': ''
  2259. });
  2260. },
  2261. yes: function (index, layero) {
  2262. form.on('submit(setdingshi)', function (data) {
  2263. var hideVal = JSON.stringify(data.field)
  2264. var dat = data.field;
  2265. var curinputBtn = obj.parent().find('.ace-switch');
  2266. if (curinputBtn.is(":checked")) {
  2267. var oldStatus = 0;
  2268. var currStutas = 1;
  2269. } else {
  2270. var oldStatus = 1;
  2271. var currStutas = 0;
  2272. }
  2273. var id = $('#firstpane .menu-active').attr('id')
  2274. dat.equip_id = id;
  2275. obj.parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  2276. $.ajax({
  2277. url: 'qxz_timing_mqtt',
  2278. type: 'post',
  2279. data: dat,
  2280. success: function (data) {
  2281. setTimeout(function () {
  2282. obj.next().val(hideVal)
  2283. curinputBtn.attr('disabled', false);
  2284. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('');
  2285. obj.parent().find('.maxminNum').find('p').eq(0).find('span').html(dat.StartTime)//最大值
  2286. obj.parent().find('.maxminNum').find('p').eq(1).find('span').html(dat.Duration)//最小值
  2287. obj.parents('.thresholdCtrl').find('.ace-switch').prop('checked', 'checked');//开启阈值
  2288. var id = $('#firstpane .menu-active').attr('id')
  2289. loadProject(id);
  2290. }, 5000)
  2291. },
  2292. error: function (type) {
  2293. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  2294. curinputBtn.attr('disabled', false);
  2295. }
  2296. })
  2297. // $('.maxminNum')
  2298. layer.closeAll(); //疯狂模式,关闭所有层
  2299. return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
  2300. });
  2301. }
  2302. , btn2: function (index, layero) {
  2303. $('#Modal').hide()
  2304. //return false 开启该代码可禁止点击该按钮关闭
  2305. }
  2306. });
  2307. });
  2308. }
  2309. $('#starttime').on('blur', function () {
  2310. $(this).val(parseInt($(this).val()))
  2311. })
  2312. $('#Duration').on('blur', function () {
  2313. $(this).val(parseInt($(this).val()))
  2314. })
  2315. // 下发定时开关
  2316. $('#gettimingDiv').on('click', '.ace-switch', function () {
  2317. var _this = this;
  2318. var currVal = $(this).parents('.thresholdCtrl').find('.currVal').val();
  2319. var currWayjson = JSON.parse(currVal);
  2320. var id = $('#firstpane .menu-active').attr('id')
  2321. currWayjson.equip_id = id;
  2322. if (currWayjson.StartTime == '--' || currWayjson.Duration == '--') {
  2323. $(this).parents('.thresholdCtrl').find('.setthresholdBtn').click();
  2324. layer.msg('请先设置定时时间', { icon: 2 })
  2325. return false;
  2326. }
  2327. $(this).parents('.thresholdCtrl').find('.ctrlLoading').remove()
  2328. $(this).attr('disabled', true);
  2329. $(this).parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  2330. if ($(this).is(":checked")) { //开启
  2331. var oldStatus = 0;
  2332. var currStutas = 1;
  2333. } else { //关闭
  2334. var oldStatus = 1;
  2335. var currStutas = 0;
  2336. currWayjson.StartTime = '255';
  2337. currWayjson.Duration = '32767';
  2338. }
  2339. $.ajax({
  2340. url: 'qxz_timing_mqtt',
  2341. type: 'post',
  2342. data: currWayjson,
  2343. success: function (data) {
  2344. setTimeout(function () {
  2345. $(_this).attr('disabled', false);
  2346. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('');
  2347. var id = $('#firstpane .menu-active').attr('id')
  2348. loadProject(id);
  2349. }, 5000)
  2350. },
  2351. error: function (type) {
  2352. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  2353. $(_this).attr('disabled', false);
  2354. if (oldStatus) {
  2355. $(_this).prop('checked', true);
  2356. } else {
  2357. $(_this).prop('checked', '');
  2358. }
  2359. }
  2360. })
  2361. })
  2362. // 设置要素名称
  2363. function setEleName() {
  2364. var e_id = $('#firstpane .menu-active').attr('id')
  2365. $.ajax({
  2366. url: 'qxz_title_conf',
  2367. type: 'get',
  2368. data: {
  2369. e_id: e_id
  2370. },
  2371. dataType: 'json',
  2372. success: function (data) {
  2373. var dataa = [];
  2374. var len = Object.keys(data.default).length;
  2375. for (var i = 1; i <= len; i++) {
  2376. var key = 'e' + i;
  2377. if (data.default[key]) {
  2378. var detxt = data.default[key].split('#')[0];
  2379. var deunit = data.default[key].split('#')[1];
  2380. if (data.conf[key]) {
  2381. var conftxt = data.conf[key].split('#')[0];
  2382. } else {
  2383. var conftxt = '-';
  2384. }
  2385. dataa.push({
  2386. "ekey": key,
  2387. "name": conftxt,
  2388. "elementName": detxt,
  2389. "unit": deunit
  2390. })
  2391. }
  2392. if (i == len) {
  2393. // console.log(dataa)
  2394. //页面层
  2395. layer.open({
  2396. type: 1,
  2397. title: '修改要素名称',
  2398. area: ['800px', '540px'], //宽高
  2399. content: $('#eleName'),
  2400. skin: 'layui-layer-editName', //样式类名
  2401. success: function (layero, index) {
  2402. layui.use('table', function () {
  2403. var table = layui.table;
  2404. table.render({
  2405. elem: '#eleTable'
  2406. , data: dataa
  2407. , done: function (res, curr, count) {
  2408. $("table").css("width", "100%");
  2409. }
  2410. , limit: 30
  2411. , cols: [[
  2412. { field: 'ekey', width: '25%', align: 'center', title: '通道号' }
  2413. , { field: 'name', width: '35%', align: 'center', title: '<i class="layui-icon">&#xe642;</i>名称', event: 'cellClick' }
  2414. , { field: 'elementName', width: '40%', align: 'center', title: '要素' }
  2415. ]]
  2416. });
  2417. table.on('tool(eleTable)', function (obj) {
  2418. switch (obj.event) {
  2419. case 'cellClick':
  2420. CellClick(this, obj, e_id);
  2421. break;
  2422. };
  2423. });
  2424. });
  2425. },
  2426. cancel: function (index, layero) {
  2427. loadProject(e_id);
  2428. }
  2429. });
  2430. }
  2431. }
  2432. },
  2433. error: function (type) {
  2434. layer.msg('请求失败');
  2435. }
  2436. })
  2437. }
  2438. // 设置要素短信预警
  2439. var datMsg, editNum = 0;
  2440. function setNotewarn() {
  2441. var e_id = $('#firstpane .menu-active').attr('id')
  2442. $.ajax({
  2443. url: 'qxz_alarm',
  2444. type: 'post',
  2445. data: {
  2446. imei: e_id
  2447. },
  2448. dataType: 'json',
  2449. success: function (data) {
  2450. var dataa = [];
  2451. var len = Object.keys(data.conf).length;
  2452. if (data.alarm) {
  2453. var alarmJson = eval('(' + data.alarm + ')');
  2454. $('#alarmPhone').val(alarmJson.tel)
  2455. } else {
  2456. var alarmJson = {}
  2457. $('#alarmPhone').val('')
  2458. }
  2459. for (var i = 1; i <= len; i++) {
  2460. var key = 'e' + i;
  2461. if (data.conf[key]) {
  2462. var conftxt = data.conf[key].split('#')[0];
  2463. if (alarmJson.dat) {
  2464. if (alarmJson.dat[key]) {
  2465. var type = alarmJson.dat[key].split('#')[0];
  2466. var alarmVal = alarmJson.dat[key].split('#')[1];
  2467. } else {
  2468. var type = 0;
  2469. var alarmVal = '';
  2470. }
  2471. }
  2472. dataa.push({
  2473. "ekey": key,
  2474. "name": conftxt,
  2475. "type": type,
  2476. "alarmVal": alarmVal
  2477. })
  2478. }
  2479. if (i == len) {
  2480. // console.log(dataa)
  2481. //页面层
  2482. layer.open({
  2483. type: 1,
  2484. title: '修改要素名称',
  2485. area: ['800px', '540px'], //宽高
  2486. content: $('#Notewarn'),
  2487. skin: 'layui-layer-editName', //样式类名
  2488. success: function (layero, index) {
  2489. layui.use(['table', 'form'], function () {
  2490. var table = layui.table;
  2491. var form = layui.form;
  2492. datMsg = dataa;
  2493. table.render({
  2494. elem: '#NotewarnTable'
  2495. , data: dataa
  2496. , done: function (res, curr, count) {
  2497. $("table").css("width", "100%");
  2498. }
  2499. , limit: 30
  2500. , cols: [[
  2501. { field: 'ekey', width: '15%', align: 'center', title: '通道号' }
  2502. , { field: 'name', width: '30%', align: 'center', title: '要素' }
  2503. , { field: 'type', title: '类型', width: '20%', align: 'center', templet: '#switchTpl', unresize: true }
  2504. , { field: 'alarmVal', width: '35%', align: 'center', title: '<i class="layui-icon">&#xe642;</i>阈值', event: 'cellClick' }
  2505. ]]
  2506. });
  2507. table.on('tool(NotewarnTable)', function (obj) {
  2508. switch (obj.event) {
  2509. case 'cellClick':
  2510. thresholdClick(this, obj, e_id, form);
  2511. break;
  2512. };
  2513. });
  2514. });
  2515. },
  2516. cancel: function (index, layero) {
  2517. loadProject(e_id);
  2518. }
  2519. });
  2520. }
  2521. }
  2522. },
  2523. error: function (type) {
  2524. layer.msg('请求失败');
  2525. }
  2526. })
  2527. }
  2528. layui.use(['form'], function () {
  2529. var form = layui.form;
  2530. form.on('switch(equipTypeDemo)', function (obj) {
  2531. var state = obj.elem.checked ? 1 : 0;
  2532. //方法二取数据 (根据索引table.cache里面的行数据)
  2533. var index = obj.othis.parents('tr').attr("data-index");
  2534. datMsg[index].type = state;
  2535. });
  2536. })
  2537. function CellClick(that, obj, e_id) {
  2538. //当前点击字段
  2539. var field = $(that).data("field");
  2540. //判断是否需要添加编辑框
  2541. if (field == "edit") return true;
  2542. //当前行数据
  2543. var data = obj.data;
  2544. //当前单元格的值
  2545. var value = data[field];
  2546. //当前点击td的宽高
  2547. var height = $(that)[0].offsetHeight, width = $(that)[0].offsetWidth;
  2548. //当前点击td的坐标
  2549. var top = $(that).offset().top, left = $(that).offset().left;
  2550. //输入框 这里可以自定义表单内容
  2551. var input = '<input type="text" maxlength=10 class="layui-input" id="' + field + '_input" data-field="' + field + '" style="width:' + width + 'px;height:' + height + 'px">';
  2552. //弹出层
  2553. layer.open({
  2554. type: 1
  2555. , title: false
  2556. , page: true
  2557. , limit: 1
  2558. , closeBtn: 0
  2559. , area: [width + "px", height + "px"]
  2560. , shade: [0.01, '#fff']
  2561. , shadeClose: true
  2562. , content: input //这里content是一个普通的String
  2563. , offset: [top, left]
  2564. , success: function () {
  2565. //使弹出层相对定位
  2566. $(".layui-layer-page").css("position", "absolute")
  2567. //设置输入框的值
  2568. $("#" + field + "_input").val(value);
  2569. $("#" + field + "_input").blur(function () {
  2570. var dat = data;
  2571. var ekey = dat.ekey;
  2572. var conf = $(this).val();
  2573. var unit = data.unit;
  2574. $.ajax({
  2575. url: 'qxz_title_conf',
  2576. type: 'post',
  2577. data: {
  2578. e_id: e_id,
  2579. ekey: ekey,
  2580. conf: conf + '#' + unit
  2581. },
  2582. dataType: 'json',
  2583. success: function (data) {
  2584. if (data == 0) {
  2585. //同步更新缓存对应的值
  2586. dat[field] = conf;
  2587. obj.update(dat);
  2588. layer.msg('修改成功')
  2589. }
  2590. },
  2591. error: function (type) {
  2592. layer.msg('修改失败')
  2593. }
  2594. })
  2595. })
  2596. }
  2597. });
  2598. }
  2599. function thresholdClick(that, obj, e_id, form) {
  2600. //当前点击字段
  2601. var field = $(that).data("field");
  2602. // console.log(obj)
  2603. //判断是否需要添加编辑框
  2604. if (field == "edit") return true;
  2605. //当前行数据
  2606. var data = obj.data;
  2607. //当前单元格的值
  2608. var value = data[field];
  2609. //当前点击td的宽高
  2610. var height = $(that)[0].offsetHeight, width = $(that)[0].offsetWidth;
  2611. //当前点击td的坐标
  2612. var top = $(that).offset().top, left = $(that).offset().left;
  2613. //输入框 这里可以自定义表单内容
  2614. var input = '<input type="number" maxlength=10 autofocus="autofocus" class="layui-input" id="' + field + '_input" data-field="' + field + '" style="width:' + width + 'px;height:' + height + 'px">';
  2615. //弹出层
  2616. layer.open({
  2617. type: 1
  2618. , title: false
  2619. , page: true
  2620. , limit: 1
  2621. , closeBtn: 0
  2622. , area: [width + "px", height + "px"]
  2623. , shade: [0.01, '#fff']
  2624. , shadeClose: true
  2625. , content: input //这里content是一个普通的String
  2626. , offset: [top, left]
  2627. , success: function () {
  2628. //使弹出层相对定位
  2629. $(".layui-layer-page").css("position", "absolute")
  2630. //设置输入框的值
  2631. $("#" + field + "_input").val(value);
  2632. $("#" + field + "_input").focus()
  2633. $("#" + field + "_input").blur(function () {
  2634. var dat = data;
  2635. var ekey = dat.ekey;
  2636. var conf = $(this).val();
  2637. var unit = data.unit;
  2638. dat[field] = conf || "";
  2639. obj.update(dat);
  2640. form.render()
  2641. })
  2642. }
  2643. });
  2644. }
  2645. // 下发要素短信预警
  2646. function sendNoteMsg() {
  2647. var tel = $('#alarmPhone').val();
  2648. var e_id = $('#firstpane .menu-active').attr('id')
  2649. if (tel) {
  2650. if (!(/^1(3|4|5|7|8)\d{9}$/.test(tel))) {
  2651. $('#alarmPhone').focus();
  2652. return false;
  2653. }
  2654. }
  2655. // if(!(/^1(3|4|5|7|8)\d{9}$/.test(tel))){
  2656. // $('#alarmPhone').focus();
  2657. // }else{
  2658. var val = {
  2659. "dat": {},
  2660. "tel": tel,
  2661. "equip_id": e_id
  2662. }
  2663. for (var i = 0; i < datMsg.length; i++) {
  2664. var key = 'e' + (i + 1);
  2665. var type = datMsg[i].type || 0;
  2666. var alarmVal = datMsg[i].alarmVal || "";
  2667. val.dat[key] = type + '#' + alarmVal;
  2668. if (i == datMsg.length - 1) {
  2669. $.ajax({
  2670. url: 'qxz_alarm_recv',
  2671. type: 'post',
  2672. data: {
  2673. alarm: JSON.stringify(val)
  2674. },
  2675. dataType: 'json',
  2676. success: function (data) {
  2677. if (data == 0) {
  2678. layer.msg('修改成功')
  2679. }
  2680. },
  2681. error: function (type) {
  2682. layer.msg('修改失败')
  2683. }
  2684. })
  2685. }
  2686. }
  2687. // }
  2688. }
  2689. // 请求LED大屏功能
  2690. function loadLEDScreen(falg) {
  2691. if ($('#LEDBtn').length) {
  2692. $('#LEDBtn').remove();
  2693. }
  2694. // 判断是否为云飞气象站
  2695. if (falg == 1) {
  2696. var html = '<li class="clearfix" id="LEDBtn">' +
  2697. '<button class="btn btn-sm btn-primary" onclick="setLedTitle(id)">显示屏设置</button> &nbsp;&nbsp;' +
  2698. '<button class="btn btn-sm btn-primary" onclick="ledPreview(id)"> 预览 </button></li>';
  2699. $('#qxzInfoDiv ul').append(html)
  2700. }
  2701. }
  2702. // 设置大屏标题
  2703. function setLedTitle() {
  2704. var html = '<div class="LEDTitle">LED滚动屏设置</div><div class="LEDContent">' +
  2705. '<div>标题文字设置:<textarea maxlength="30" id="ledtitleInp" type="text" style="vertical-align: top; margin: 0px; width: 181px; height: 64px;">' + nowledinfo + '</textarea>(30字符)</div>' +
  2706. '<div>显示时间设置:<input id="ledScrollTime" type="number"/><span>(小时)</span></div>' +
  2707. '<div class="LEDBtns"><button onclick="sendLedTitle()" class="btn btn-sm btn-primary"> 确定 </button>' +
  2708. '<button onclick="cancelLedBox()" class="btn btn-sm"> 取消 </button></div></div>'
  2709. layer.open({
  2710. type: 1,
  2711. // title:'LED滚动屏设置',
  2712. title: '',
  2713. skin: 'layui-layer-led', //样式类名
  2714. closeBtn: 0,
  2715. area: ['420px', '280px'], //宽高
  2716. content: html
  2717. });
  2718. }
  2719. function cancelLedBox() {
  2720. layer.closeAll();
  2721. }
  2722. function sendLedTitle() {
  2723. var e_id = $('#firstpane .menu-active').attr('id')
  2724. var cont = $('#ledtitleInp').val();
  2725. var tim = $('#ledScrollTime').val();
  2726. if (!cont) {
  2727. layer.tips('请输入展示标题', '#ledtitleInp');
  2728. return false;
  2729. }
  2730. if (!tim) {
  2731. layer.tips('请输入展示时间', '#ledScrollTime');
  2732. return false;
  2733. }
  2734. $.ajax({
  2735. url: 'qxz_led',
  2736. type: 'post',
  2737. data: {
  2738. equip_id: e_id,
  2739. cont: cont,
  2740. tim: tim
  2741. },
  2742. dataType: 'json',
  2743. success: function (data) {
  2744. if (data == 0) {
  2745. layer.closeAll();
  2746. layer.msg('修改成功')
  2747. nowledinfo = cont;
  2748. }
  2749. },
  2750. error: function (type) {
  2751. layer.msg('修改失败')
  2752. }
  2753. })
  2754. }
  2755. // 预览大屏
  2756. function ledPreview() {
  2757. var qxzTtile = nowledinfo || '环境监测基地欢迎您';
  2758. if (qxzTtile.length > 9) {
  2759. var titleCalss = 'qxzLedTitleLong';
  2760. } else {
  2761. var titleCalss = ''
  2762. }
  2763. var html = '<div class="qxzLedBj">' +
  2764. '<div class="qxzLedInfo">' +
  2765. '<div class="qxzLedTitle"><p class="' + titleCalss + '">' + qxzTtile + '</p></div>' +
  2766. '<div class="eleContent"><ul class="scrollUl">' +
  2767. '<li>大气温度:16.5 °C</li><li>大气温度:16.5 °C</li><li>二氧化碳:800 PPM</li><li>照度:600 LUX</li><li>模拟气压:1005.9 hpa</li><li>光合有效辐射:9 W/m2</li>' +
  2768. '</ul></div>' +
  2769. '</div>' +
  2770. '</div>'
  2771. layer.open({
  2772. type: 1,
  2773. title: '',
  2774. skin: 'layui-layer-demo', //样式类名
  2775. closeBtn: 0, //不显示关闭按钮
  2776. anim: 2,
  2777. // area:['684px','770px'],
  2778. area: ['525px', '619px'],
  2779. offset: 'b',
  2780. resize: false,
  2781. shadeClose: true, //开启遮罩关闭
  2782. content: html
  2783. });
  2784. }
  2785. </script>
  2786. </body>
  2787. </html>