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