equipmanage_qxz气象站.html 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469
  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. <div class="layui-input-block">
  559. <p class="">在线状态:</p>
  560. <select name="status" lay-verify="required" id="selectId" class="iptScreen">
  561. <option value="" selected>全部</option>
  562. <option value="0">离线</option>
  563. <option value="1">在线</option>
  564. </select>
  565. </div>
  566. <div id="firstpane" class="menu_list">
  567. <p class="menu_head current" id="area_322">设备列表</p>
  568. <div class="menu_body">
  569. <!-- <a href="javascript:;" title="设备15112501" class="text-overflow" id="15112501" data-pid="322">设备15112501</a> -->
  570. </div>
  571. <div class="equipPage">
  572. <!-- <button class="btn btn-minier btn-yellow"><i class="fa fa-sort-up" aria-hidden="true"></i></button> -->
  573. <input type="button" class="btn btn-minier btn-yellow" onclick="gotofirstpage()" value="首页">
  574. <button class="btn btn-minier btn-yellow" id="jianPage"
  575. onclick="changePage('jian')">上一页</button>
  576. <span id="currentpage">1</span>页
  577. <button class="btn btn-minier btn-yellow" id="addPage" onclick="changePage('add')">下一页</button>
  578. 共<span id="totelpage">4</span>页
  579. </div>
  580. <div class="equipPage">
  581. 跳转 <input type="text" id="jumpPage" value="1"
  582. style="width: 60px;height: 30px;text-align: center;"
  583. onkeypress="if (event.keyCode == 13) changePage('jump');"> 页
  584. <button class="btn btn-minier btn-yellow" id="jianPage" onclick="changePage('jump')">确定</button>
  585. </div>
  586. </div>
  587. <div class="">
  588. <div class="widget-box" style="margin-top: 20px;">
  589. <div class="widget-title">
  590. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  591. <h5>项目信息</h5>
  592. </div>
  593. </div>
  594. <div class="widget-content" style="padding: 0px;margin-top: 8px;">
  595. <div>
  596. <!-- <img src="www.yfzhwlw.com/qxz_photo/default.png" class="equip_photo" width="100%" height="100%" style=""> -->
  597. <form action="" method="post" id="userPhoto" class="form-horizontal"
  598. enctype="multipart/form-data">{% csrf_token %}
  599. <input type="hidden" value="" id="qxzPhotoId" name="id">
  600. <div class="personal-avatar">
  601. <div class="top-avatar" id="viewPhotoParent">
  602. <img id="viewPhoto" class="equip_photo" onclick="$('#uploadPhoto').click()"
  603. src="" width="100%" height="100%">
  604. </div>
  605. <a class="upload-avatar" href="javascript:;">
  606. <input class="upload-btn" name="upicture"
  607. onchange="previewImage(this,'viewPhotoParent','viewPhoto','uploadPhoto','100%',200)"
  608. type="file" id="uploadPhoto">
  609. </a>
  610. <!-- <input type="hidden" name="req" value="photo"> -->
  611. </div>
  612. </form>
  613. </div>
  614. <div class="todo" style="background: white;margin-top: 5px;" id="qxzInfoDiv">
  615. <ul>
  616. <li class="clearfix">
  617. <div class="txt equip_name">&nbsp;&nbsp;</div>
  618. </li>
  619. <li class="clearfix">
  620. <div class="txt equip_id">&nbsp;&nbsp;</div>
  621. </li>
  622. <li class="clearfix" id="isonline">
  623. <div class="txt">&nbsp;&nbsp;</div>
  624. </li>
  625. </ul>
  626. </div>
  627. </div>
  628. </div>
  629. </div>
  630. <!-- 右 -->
  631. <div class="col-xs-12 col-sm-9 col-md-10">
  632. <!-- 实时状态 -->
  633. <div class="currTimeStatus">
  634. <div class="widget-box" style="margin-top: 0px;">
  635. <div class="widget-title">
  636. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  637. <h5>实时状态</h5>
  638. <div class="equipInfo" id="equipInfo"> </div>
  639. <div class="span5" id="equipCtrlDiv" style="float: right;">
  640. <button class="btn btn-white btn-primary" id="newDataRefresh" onclick="newDataRefresh()"
  641. type="button">
  642. <i class="fa fa-refresh" aria-hidden="true"></i>
  643. </button>
  644. <button class="btn btn-white btn-primary" id="setEleName" onclick="setEleName()"
  645. type="button">
  646. <i class="fa fa-cog" aria-hidden="true"></i>
  647. </button>
  648. <button class="btn btn-white btn-primary" id="updataTime" type="button">2020-03-12
  649. 13:48:15</button>
  650. </div>
  651. <div style="float: right;margin-right:5px;" id="sinCodeInquire">
  652. <!-- <button class="btn btn-white btn-primary" onclick="inquireSim('89860403101970072488')" id="" type="button">流量查询</button> -->
  653. </div>
  654. </div>
  655. </div>
  656. </div>
  657. <div class="body-content clearfix row" id="newStatusBox">
  658. <!-- <div class="dev col-xs-4 col-md-3 col-lg-2 bg_lb">
  659. <div class="left">
  660. <img class="img-dev" src="{% static '/img/switchBtnIcon.png' %}">
  661. </div>
  662. <div class="right">
  663. <div class="name">风速</div>
  664. <div class="data">
  665. <strong>
  666. <span style="font-size: 25px;">0.0</span>
  667. </strong>m/s</div>
  668. </div>
  669. </div> -->
  670. </div>
  671. <!-- 设备手动控制 -->
  672. <div id="ctrlBoxParentDiv">
  673. <div class="currTimeStatus">
  674. <div class="widget-box">
  675. <div class="widget-title">
  676. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  677. <h5>设备手动控制</h5>
  678. <button class="btn btn-white btn-primary qxzDownCtrl" onclick="qxzDownCtrlFun()">
  679. <i class="fa fa-refresh" aria-hidden="true"></i>
  680. </button>
  681. </div>
  682. </div>
  683. </div>
  684. <div class="row handCtrlBox" id="ctrlBox">
  685. <!-- <div class="col-xs-2">
  686. <div class="equipCtrl">
  687. <input type="hidden" value="1">
  688. <div>
  689. <span class="isonlineicon active"></span>
  690. 控制1
  691. </div>
  692. <div class="equipCtrlInp">
  693. <label>
  694. <input name="switch-field-1" checked class="ace ace-switch ace-switch-4 btn-rotate" type="checkbox">
  695. <span class="lbl"></span>
  696. </label>
  697. </div>
  698. </div>
  699. </div> -->
  700. </div>
  701. </div>
  702. <!-- 设备阈值控制 -->
  703. <div id="getthresholdDivParentDiv">
  704. <div class="currTimeStatus">
  705. <div class="widget-box" style="margin-top: 0px;">
  706. <div class="widget-title">
  707. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  708. <h5>设备阈值控制</h5>
  709. <button class="btn btn-white btn-primary qxzDownCtrl" id="" onclick="" type="button">
  710. <i class="fa fa-refresh" aria-hidden="true"></i>
  711. </button>
  712. </div>
  713. </div>
  714. </div>
  715. <div class="row" id="getthresholdDiv">
  716. <!-- <div class="col-xs-2 col-sm-3">
  717. <div class="thresholdCtrl">
  718. <div class="setthresholdBtn" onclick="setthresholdFun(this)">
  719. <i class="fa fa-cog setName" aria-hidden="true"></i>
  720. </div>
  721. <input type="hidden" class="currVal" value='{"JK":1,"eKey":1,"upper":700,"lower":300,"method":1}'>
  722. <div class="thresholdCtrlName">
  723. <p>开关1(e1)</p>
  724. </div>
  725. <div class="thresholdCtrlShowDiv">
  726. <div class="qxys">
  727. <div>
  728. <img src="{% static '/img/dev/icon_110.png' %}" alt="">
  729. </div>
  730. <div>雨量累计</div>
  731. </div>
  732. <div class="maxminNum">
  733. <p>最大值:
  734. <span>30</span>
  735. </p>
  736. <p>最小值:
  737. <span>10</span>
  738. </p>
  739. </div>
  740. </div>
  741. <div class="equipCtrlInp">
  742. <label>
  743. <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">
  744. <span class="lbl"></span>
  745. </label>
  746. </div>
  747. </div>
  748. </div> -->
  749. </div>
  750. </div>
  751. <!-- 设备定时控制 -->
  752. <div id="timingDivParentDiv">
  753. <div class="currTimeStatus">
  754. <div class="widget-box" style="margin-top: 0px;">
  755. <div class="widget-title">
  756. <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
  757. <h5>设备定时控制</h5>
  758. <button class="btn btn-white btn-primary qxzDownCtrl" id="" onclick="" type="button">
  759. <i class="fa fa-refresh" aria-hidden="true"></i>
  760. </button>
  761. </div>
  762. </div>
  763. </div>
  764. <div class="row" id="gettimingDiv">
  765. <!-- <div class="col-xs-2 col-sm-3">
  766. <div class="thresholdCtrl">
  767. <div class="setthresholdBtn" onclick="timingOnOff(this)">
  768. <i class="fa fa-cog setName" aria-hidden="true"></i>
  769. </div>
  770. <input type="hidden" class="currVal" value='{"JK":1,"StartTime":12,"Duration":10}'>
  771. <div class="thresholdCtrlName">
  772. <p>开关1(e1)</p>
  773. </div>
  774. <div class="thresholdCtrlShowDiv">
  775. <div class="maxminNum">
  776. <p>起始时间:
  777. <span>12</span>
  778. </p>
  779. <p>工作时长:
  780. <span>10</span>
  781. 小时
  782. </p>
  783. </div>
  784. </div>
  785. <div class="equipCtrlInp">
  786. <label>
  787. <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">
  788. <span class="lbl"></span>
  789. </label>
  790. </div>
  791. </div>
  792. </div> -->
  793. </div>
  794. </div>
  795. <!-- 24小时数据 -->
  796. <div id="data24Div">
  797. <div class="currTimeStatus">
  798. <div class="widget-box">
  799. <div class="widget-title">
  800. <h5>24小时数据</h5>
  801. <div class="span5" id="equipCtrlDiv" style="float: right;">
  802. <button class="btn btn-white btn-primary" onclick="historyData()">历史数据 >></button>
  803. </div>
  804. </div>
  805. </div>
  806. </div>
  807. <div class="row">
  808. <div class="col-xs-12 col-md-12 col-lg-9">
  809. <table id="newtable" class="table table-striped table-hover">
  810. <tr>
  811. <td>传感器通道</td>
  812. <td>通道名称</td>
  813. <td>最小值</td>
  814. <td>最小值时间</td>
  815. <td>最大值</td>
  816. <td>最大值时间</td>
  817. </tr>
  818. <tbody>
  819. </tbody>
  820. </table>
  821. </div>
  822. </div>
  823. </div>
  824. </div>
  825. </div>
  826. </div>
  827. <!-- Modal -->
  828. <div id="Modal" class="model" style="display:none">
  829. <div>
  830. <form class="layui-form" action="" id="modelForm" lay-filter="formModel">
  831. <input type="hidden" value="" name="JK">
  832. <input type="hidden" value="" name="eKey">
  833. <div class="layui-form-item">
  834. <label class="layui-form-label">最大值</label>
  835. <div class="layui-input-inline">
  836. <input type="text" name="upper" id="upper" required lay-verify="required" placeholder="请输入最大值"
  837. autocomplete="off" class="layui-input">
  838. </div>
  839. </div>
  840. <div class="layui-form-item">
  841. <label class="layui-form-label">最小值</label>
  842. <div class="layui-input-inline">
  843. <input type="text" name="lower" required lay-verify="required" placeholder="请输入最小值"
  844. autocomplete="off" class="layui-input">
  845. </div>
  846. </div>
  847. <div class="layui-form-item">
  848. <label class="layui-form-label">规 则</label>
  849. <div class="layui-input-inline">
  850. <input type="radio" name="method" lay-filter="radioSwitch" value="1" title="程序一" checked="">
  851. <input type="radio" name="method" lay-filter="radioSwitch" value="0" title="程序二">
  852. </div>
  853. <div class="layui-form-mid layui-word-aux" id="hintDiv">低于下限
  854. <span>开启</span>,高于上限
  855. <span>关闭</span>
  856. </div>
  857. </div>
  858. </form>
  859. </div>
  860. </div>
  861. <!-- Modal2 -->
  862. <div id="timingOnOffModal" class="model" style="display:none">
  863. <div>
  864. <form class="layui-form" action="" id="modelForm" lay-filter="formModel">
  865. <input type="hidden" value="" name="JK">
  866. <div class="layui-form-item">
  867. <label class="layui-form-label">起始时间:</label>
  868. <div class="layui-input-inline">
  869. <input type="number" name="StartTime" id="starttime" required
  870. lay-verify="required|starttimeRegex" placeholder="请输入起始时间" autocomplete="off"
  871. class="layui-input">
  872. <!-- <select name="city" lay-verify="">
  873. <option value="">请选择一个城市</option>
  874. <option value="010">北京</option>
  875. <option value="021">上海</option>
  876. <option value="0571">杭州</option>
  877. </select>
  878. <select name="city" lay-verify="required">
  879. <option value=""></option>
  880. <option value="0">北京</option>
  881. <option value="1">上海</option>
  882. <option value="2">广州</option>
  883. <option value="3">深圳</option>
  884. <option value="4">杭州</option>
  885. </select> -->
  886. </div>
  887. <div class="layui-form-mid layui-word-aux">时间范围(0-23)</div>
  888. </div>
  889. <div class="layui-form-item">
  890. <label class="layui-form-label">工作时长:</label>
  891. <div class="layui-input-inline">
  892. <input type="number" name="Duration" id="Duration" required lay-verify="required|durationRegex"
  893. placeholder="请输入工作时长" autocomplete="off" class="layui-input">
  894. </div>
  895. <div class="layui-form-mid layui-word-aux">工作时长(1-24)</div>
  896. </div>
  897. </form>
  898. </div>
  899. </div>
  900. <!-- setEleName -->
  901. <div id="eleName" style="width:800px;display:none">
  902. <div style="width:95%;margin:0 auto;">
  903. <table class="layui-hide" id="eleTable" lay-filter="eleTable"></table>
  904. </div>
  905. </div>
  906. <!-- 管理员查看设备电压历史记录 -->
  907. <div id="record" style="display: none;">
  908. <div style="padding: 20px;width: 500px;float: left;">
  909. <table id="recordTable" lay-filter="recordTableFilter"></table>
  910. <div id="recordPage"></div>
  911. </div>
  912. <div style="margin-left: 480px;padding: 20px;">
  913. <div id="recordEcharts" style="height: 450px;width: 500px;"></div>
  914. </div>
  915. </div>
  916. {% verbatim %}
  917. <script type="text/html" id="switchTpl">
  918. <!-- 这里的 checked 的状态只是演示 -->
  919. <input type="checkbox" name="equipType" value="{{d.type}}" lay-skin="switch" lay-text="大于|小于"
  920. lay-filter="equipTypeDemo" {{ d.type == 1 ? 'checked' : '' }}>
  921. </script>
  922. {% endverbatim %}
  923. <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
  924. <script src="{% static '/lib/bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  925. <script src="{% static '/lib/layui/layui.all.js' %}"></script>
  926. <script src="{% static '/js/common.js' %}?versions=0.5.4"></script>
  927. <script type="text/javascript"
  928. src="http://api.map.baidu.com/api?v=2.0&ak=TcRPmrsiZUqdUBWoELrUArRkCRC36KMx"></script>
  929. <script src="{% static '/lib/js/echarts.min.js' %}"></script>
  930. <script type="text/javascript">
  931. $.ajaxSetup({
  932. data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
  933. });
  934. </script>
  935. <script>
  936. //默认加载设备列表
  937. getEquipList(1, '');
  938. // 搜索
  939. $('#searchBtn').on('click', function () {
  940. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  941. });
  942. $('#searchImei').on('keyup', function (event) {
  943. if (event.keyCode == 13) {
  944. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  945. }
  946. })
  947. function getEquipList(page, filter, is_online, etype) {
  948. if (etype == undefined && is_online == undefined) {
  949. var etype = ''
  950. var is_online = ''
  951. }
  952. $.ajax({
  953. url: 'qxz_page',
  954. type: 'get',
  955. dataType: 'json',
  956. data: {
  957. page: page,
  958. f_id: filter,
  959. etype: etype, //所属公司
  960. is_online: is_online, //设备状态
  961. },
  962. beforeSend: function (XMLHttpRequest) {
  963. loadingFlag = layer.load();
  964. },
  965. success: function (data) {
  966. layer.close(loadingFlag);
  967. if (data.nums) {
  968. var html = '';
  969. var msg = data.ids
  970. var pagecount = Math.ceil(data.nums / 10);
  971. for (var i = 0; i < msg.length; i++) {
  972. if (msg[i].equip_name) {
  973. var equip_name = '设备:' + msg[i].equip_name;
  974. } else if (msg[i].equip_id.length == 15) {
  975. var equip_name = '设备:' + msg[i].equip_id.substring(msg[i].equip_id.length - 8);
  976. } else {
  977. var equip_name = '设备:' + msg[i].equip_id;
  978. }
  979. var offTime = msg[i].off_time || '';
  980. if (msg[i].is_online == 1) {
  981. var classStatic = 'bjgreen';
  982. } else if (msg[i].is_online == 0) {
  983. var classStatic = 'bjred';
  984. } else {
  985. var classStatic = '';
  986. }
  987. // var equip_name = msg[i].equip_name?'---设备名:'+msg[i].equip_name:'';
  988. 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>'
  989. }
  990. $('#firstpane .menu_body').html(html);
  991. $('.equipPage').show();
  992. $('#totelpage').html(pagecount)
  993. // 菜单栏
  994. $("#firstpane .menu_body:eq(0) a:eq(0)").addClass('menu-active');
  995. $('.widget-content .equip_id').html('设备ID:' + msg[0].equip_id);
  996. $('.widget-content .equip_name').html('项目名称:' + (msg[0].equip_name || '设备' + msg[0].equip_id));
  997. $(".menu_body a").click(function () {
  998. $(".menu_head").removeClass("currAstive");
  999. $(".menu_body a").removeClass("menu-active");
  1000. $(this).addClass("menu-active");
  1001. $(this).parent().prev().addClass('currAstive');
  1002. // 名称切换
  1003. $('.widget-content .equip_id').html('设备ID:' + $(this).attr('id'));
  1004. $('.widget-content .equip_name').html('项目名称:' + ($(this).attr('name') || '设备' + $(this).attr('id')));
  1005. var facId = $(this).attr("id");
  1006. var currisonline = $(this).attr("isonline");
  1007. var curroffTime = $(this).attr("offTime");
  1008. if (currisonline == 0) {
  1009. $('#isonline').show();
  1010. $('#isonline div').html('离线时间:' + curroffTime);
  1011. } else {
  1012. $('#isonline').hide();
  1013. }
  1014. if (facId && facId != null && facId != "") {
  1015. loadProject(facId);
  1016. $('#qxzPhotoId').val(facId);
  1017. }
  1018. });
  1019. loadProject(msg[0].equip_id);
  1020. if (msg[0].is_online == 0) {
  1021. $('#isonline').show();
  1022. $('#isonline div').html('离线时间:' + (msg[0].off_time || ''));
  1023. } else {
  1024. $('#isonline').hide();
  1025. }
  1026. $('#qxzPhotoId').val(msg[0].equip_id)
  1027. } else {
  1028. $('.equipPage').hide();
  1029. var html = '<a href="javascript:;" class="text-overflow nulldata" data-pid="322">暂未设备</a>'
  1030. $('#firstpane .menu_body').html(html);
  1031. scrollBar()
  1032. }
  1033. },
  1034. error: function (type) {
  1035. layer.close(loadingFlag);
  1036. }
  1037. })
  1038. }
  1039. var nowledinfo;
  1040. // 查询SIM卡
  1041. function inquireSim(iccid) {
  1042. $.ajax({
  1043. url: 'siminfo',
  1044. type: 'post',
  1045. dataType: 'json',
  1046. data: {
  1047. simid: iccid,
  1048. },
  1049. beforeSend: function (XMLHttpRequest) {
  1050. //注意,layer.msg默认3秒自动关闭,如果数据加载耗时比较长,需要设置time
  1051. loadingFlag = layer.msg('请求中,请稍候……', { icon: 16, shade: 0.01, shadeClose: false, time: 60000 });
  1052. },
  1053. success: function (data) {
  1054. var dat = data.data;
  1055. if (data.code == 0) {
  1056. var status;
  1057. if (dat.account_status == "0") {
  1058. status = "未知";
  1059. } else if (dat.account_status == "1") {
  1060. status = "测试期";
  1061. } else if (dat.account_status == "2") {
  1062. status = "沉默期";
  1063. } else if (dat.account_status == "3") {
  1064. status = "使用中";
  1065. } else if (dat.account_status == "4") {
  1066. status = "停机";
  1067. } else if (dat.account_status == "5") {
  1068. status = "停机保号";
  1069. } else if (dat.account_status == "6") {
  1070. status = "预销号";
  1071. } else if (dat.account_status == "7") {
  1072. status = "销号";
  1073. }
  1074. var usage;
  1075. if (dat.iccid) {
  1076. usage = dat.data_usage;
  1077. } else {
  1078. usage.innerHTML = '--';
  1079. }
  1080. var balance;
  1081. if (dat.iccid) {
  1082. balance = dat.data_balance;
  1083. } else {
  1084. balance = '--';
  1085. }
  1086. var time;
  1087. if (dat.iccid) {
  1088. var timestamp4 = new Date(dat.expiry_date * 1000);//直接用 new Date(时间戳) 格式转化获得当前时间
  1089. time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8);
  1090. } else {
  1091. time = '--';
  1092. }
  1093. layer.close(loadingFlag);
  1094. layer.open({
  1095. type: 1
  1096. , title: false //不显示标题栏
  1097. , skin: 'layui-layer-simCode' //样式类名
  1098. , closeBtn: false
  1099. , area: '300px;'
  1100. , shade: 0.8
  1101. , id: 'simCode' //设定一个id,防止重复弹出
  1102. , btn: ['我知道了']
  1103. , btnAlign: 'c'
  1104. , moveType: 1 //拖拽模式,0或者1
  1105. , 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>'
  1106. , success: function (layero) {
  1107. }
  1108. });
  1109. } else {
  1110. layer.msg(data.msg);
  1111. }
  1112. }
  1113. })
  1114. }
  1115. //在线状态筛选
  1116. $('#selectId').on('change', function () {
  1117. getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1118. })
  1119. //设备状态
  1120. function loadProject(facId) {
  1121. $.ajax({
  1122. url: 'qxz_status',
  1123. type: 'post',
  1124. dataType: 'json',
  1125. data: {
  1126. e_id: facId,
  1127. },
  1128. beforeSend: function (XMLHttpRequest) {
  1129. loadingFlag = layer.load();
  1130. },
  1131. success: function (data) {
  1132. layer.close(loadingFlag);
  1133. nowledinfo = data.ledinfo
  1134. // 实时状态
  1135. newStatus('newStatusBox', data, facId);
  1136. $('#updataTime').html(data.base.upl_time || '暂无上传数据');
  1137. if (data.base.qxz_picture) {
  1138. $('#viewPhoto').attr('src', 'http://120.27.222.26/' + data.base.qxz_picture);
  1139. } else {
  1140. $('#viewPhoto').attr('src', 'http://120.27.222.26/' + 'qxz_photo/default.jpg');
  1141. }
  1142. addCtrlBtn(data.qxz_switch, data.switch_name);
  1143. if (data.qxz_switch && (data.qxz_switch.length != 2)) {
  1144. $('#ctrlBoxParentDiv').show();
  1145. $('#getthresholdDivParentDiv').show();
  1146. $('#timingDivParentDiv').show();
  1147. $('#data24Div').hide();
  1148. gettimimgFun(data);
  1149. getthresholdFun(data);
  1150. scrollBar()
  1151. } else { // 无开关显示24小时数据
  1152. $('#ctrlBoxParentDiv').hide();
  1153. $('#getthresholdDivParentDiv').hide();
  1154. $('#timingDivParentDiv').hide();
  1155. $('#data24Div').show();
  1156. get24Data(facId)
  1157. scrollBar()
  1158. }
  1159. },
  1160. error: function (type) {
  1161. layer.close(loadingFlag);
  1162. }
  1163. })
  1164. }
  1165. // 阈值请求
  1166. function getthresholdFun(data) {
  1167. if (data.auto_list.length > 2) {
  1168. var switchData = eval('(' + data.auto_list + ')');
  1169. var qxz_switch = eval('(' + data.qxz_switch + ')');
  1170. // var qxz_list = data.new_data;
  1171. if (data.switch_name.length > 2) {
  1172. var switch_name = eval('(' + data.switch_name + ')');
  1173. } else {
  1174. var switch_name = [];
  1175. }
  1176. } else {
  1177. var switchData = [];
  1178. // var qxz_list = [];
  1179. var switch_name = [];
  1180. }
  1181. if (switchData.length) {
  1182. var html = '';
  1183. for (var i = 0; i < switchData.length; i++) {
  1184. if (switchData[i].JK != 255) {
  1185. if (switchData[i].upper == 32767 || switchData[i].lower == 32767) {
  1186. var check = false;
  1187. } else {
  1188. var check = true;
  1189. }
  1190. // 判断通道号
  1191. if (!isNaN(switchData[i].eKey)) {
  1192. var eknum = switchData[i].eKey + 1;
  1193. var ek = 'e' + eknum;
  1194. } else {
  1195. var ek = switchData[i].eKey;
  1196. }
  1197. // 开关名
  1198. if (switchData[i].JK == qxz_switch[i].JK) {
  1199. if (switch_name.length > 2) {
  1200. if (switch_name[i].name) {
  1201. var name = switch_name[i].name;
  1202. } else {
  1203. var name = '开关' + qxz_switch[i].JK;
  1204. }
  1205. } else {
  1206. var name = '开关' + qxz_switch[i].JK;
  1207. }
  1208. } else {
  1209. var name = timingData[i].JK;
  1210. }
  1211. if (data.dat[ek]) {
  1212. var eNum = data.dat[ek].split('#')[1];
  1213. var txt = data.conf[ek].split('#')[0];
  1214. html += '<div class="col-xs-6 col-sm-4"><div class="thresholdCtrl">' +
  1215. '<div class="setthresholdBtn" onclick="setthresholdFun(this)">' +
  1216. '<i class="fa fa-cog setName" aria-hidden="true"></i></div>' +
  1217. '<input type="hidden" class="currVal" value=\'' + JSON.stringify(switchData[i]) + '\'>' +
  1218. '<div class="thresholdCtrlName"><p>' + name + '(通道' + switchData[i].eKey + ')</p></div>' +
  1219. '<div class="thresholdCtrlShowDiv"><div class="qxys"><div>' +
  1220. '<img src="http://www.yfzhwlw.com/static/img/dev/icon_' + eNum + '.png" alt=""></div>' +
  1221. '<div>' + txt + data.conf[ek].split('#')[1] + '</div></div><div class="maxminNum"><p>最大值:<span>' + switchData[i].upper + '</span></p>' +
  1222. '<p>最小值:<span>' + switchData[i].lower + '</span></p></div></div><div class="equipCtrlInp">';
  1223. if (check) {
  1224. html += '<label><input name="switch-field-1" class="ace ace-switch ace-switch-6" checked="checked" type="checkbox">' +
  1225. '<span class="lbl"></span></label></div></div></div>';
  1226. } else {
  1227. html += '<label><input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">' +
  1228. '<span class="lbl"></span></label></div></div></div>';
  1229. }
  1230. }
  1231. }
  1232. if (i == switchData.length - 1) {
  1233. if (html) {
  1234. $('#getthresholdDiv').html(html)
  1235. } else {
  1236. $('#getthresholdDiv').html('<div style="text-align:center">空</div>')
  1237. }
  1238. }
  1239. }
  1240. } else {
  1241. $('#getthresholdDiv').html('<div style="text-align:center">空</div>')
  1242. }
  1243. }
  1244. // 定时请求
  1245. function gettimimgFun(data) {
  1246. var switch_name = data.switch_name;
  1247. var qxz_switch = data.qxz_switch;
  1248. if (data.timing_list.length) {
  1249. var timingData = eval('(' + data.timing_list + ')');
  1250. var qxz_switch = eval('(' + data.qxz_switch + ')');
  1251. var qxz_list = data.qxz_list;
  1252. if (switch_name.length > 2) {
  1253. var switch_name = eval('(' + switch_name + ')');
  1254. } else {
  1255. var switch_name = [];
  1256. }
  1257. } else {
  1258. var timingData = [];
  1259. var qxz_list = [];
  1260. var switch_name = [];
  1261. }
  1262. if (timingData.length) {
  1263. var html = '';
  1264. for (var i = 0; i < timingData.length; i++) {
  1265. if (timingData[i].JK != 255) {
  1266. if (timingData[i].Duration == 32767 || timingData[i].StartTime == 32767) {
  1267. var check = false;
  1268. var curCheckedVal = {
  1269. JK: timingData[i].JK,
  1270. StartTime: '--',
  1271. Duration: '--'
  1272. }
  1273. var startTime = '--';
  1274. var duration = '--';
  1275. } else {
  1276. var check = true;
  1277. var curCheckedVal = {
  1278. JK: timingData[i].JK,
  1279. StartTime: timingData[i].StartTime,
  1280. Duration: timingData[i].Duration
  1281. }
  1282. var startTime = timingData[i].StartTime;
  1283. var duration = timingData[i].Duration;
  1284. }
  1285. if (timingData[i].JK == qxz_switch[i].JK) {
  1286. if (switch_name.length > 2) {
  1287. if (switch_name[i].name) {
  1288. var name = switch_name[i].name;
  1289. } else {
  1290. var name = '开关' + qxz_switch[i].JK;
  1291. }
  1292. } else {
  1293. var name = '开关' + qxz_switch[i].JK;
  1294. }
  1295. } else {
  1296. var name = timingData[i].JK;
  1297. }
  1298. html += '<div class="col-xs-6 col-sm-4"><div class="thresholdCtrl">' +
  1299. '<div class="setthresholdBtn" onclick="timingOnOff(this)">' +
  1300. '<i class="fa fa-cog setName" aria-hidden="true"></i></div>' +
  1301. '<input type="hidden" class="currVal" value=\'' + JSON.stringify(curCheckedVal) + '\'>' +
  1302. '<div class="thresholdCtrlName"><p>' + name + '</p></div>' +
  1303. '<div class="thresholdCtrlShowDiv"><div class="maxminNum">' +
  1304. '<p>起始时间:<span>' + startTime + '</span>点</p><p>工作时长:<span>' + duration + '</span>小时</p>' +
  1305. '</div></div><div class="equipCtrlInp"><label>';
  1306. if (check) {
  1307. html += '<input name="switch-field-1" checked class="ace ace-switch ace-switch-6" type="checkbox">' +
  1308. '<span class="lbl"></span></label></div></div></div>';
  1309. } else {
  1310. html += '<input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">' +
  1311. '<span class="lbl"></span></label></div></div></div>';
  1312. }
  1313. }
  1314. if (i == timingData.length - 1) {
  1315. if (html) {
  1316. $('#gettimingDiv').html(html)
  1317. } else {
  1318. $('#gettimingDiv').html('<div style="text-align:center">空</div>')
  1319. }
  1320. }
  1321. }
  1322. } else {
  1323. $('#gettimingDiv').html('<div style="text-align:center">空</div>')
  1324. }
  1325. }
  1326. // 控制按钮
  1327. function addCtrlBtn(data, switch_name) {
  1328. if (data && switch_name.length > 2) {
  1329. var data = eval('(' + data + ')');
  1330. var ctrl_name = eval('(' + switch_name + ')');
  1331. $('.qxzDownCtrl').show();
  1332. } else if (data) {
  1333. var data = eval('(' + data + ')');
  1334. var ctrl_name = [];
  1335. } else {
  1336. var data = []
  1337. $('.qxzDownCtrl').hide();
  1338. }
  1339. if (data.length) {
  1340. var html = '';
  1341. for (var i = 0; i < data.length; i++) {
  1342. if (data[i].status == 0) {
  1343. var curClass = '';
  1344. } else {
  1345. var curClass = 'active';
  1346. }
  1347. if (data[i].status == 0) {
  1348. var curChecked = ''; //关
  1349. } else {
  1350. var curChecked = 'checked';
  1351. }
  1352. if (ctrl_name.length) {
  1353. if (ctrl_name[i].name != '') {
  1354. var switch_name = ctrl_name[i].name;
  1355. } else {
  1356. var switch_name = '开关' + ctrl_name[i].JK;
  1357. }
  1358. } else {
  1359. var switch_name = '开关' + data[i].JK;
  1360. }
  1361. html += '<div class="col-xs-2"><div class="equipCtrl"><input type="hidden" class="currStutas" value="' + data[i].JK + '">' +
  1362. '<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">' +
  1363. '<label><input name="switch-field-1" ' + curChecked + ' class="ace ace-switch ace-switch-4 btn-rotate" type="checkbox">' +
  1364. '<span class="lbl"></span></label></div></div></div>';
  1365. if (i == data.length - 1) {
  1366. $('#ctrlBox').html(html);
  1367. }
  1368. }
  1369. } else {
  1370. $('#ctrlBox').html('<div style="text-align:center">空</div>');
  1371. }
  1372. }
  1373. $('#ctrlBox').on('click', '.btn-rotate', function () {
  1374. var _this = this;
  1375. $(this).parents('.equipCtrl').find('.ctrlLoading').remove()
  1376. $(this).attr('disabled', true);
  1377. $(this).parents('.equipCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  1378. var currWay = $(this).parents('.equipCtrl').find('.currStutas').val();
  1379. var imei = $('#qxzPhotoId').val();
  1380. if ($(this).is(":checked")) {
  1381. var oldStatus = 0;
  1382. var currStutas = 1;
  1383. } else {
  1384. var oldStatus = 1;
  1385. var currStutas = 0;
  1386. }
  1387. $.ajax({
  1388. url: 'qxz_switch',
  1389. type: 'post',
  1390. data: {
  1391. 'req': 'set',
  1392. 'imei': imei,
  1393. 'way': currWay,
  1394. 'switch': currStutas
  1395. },
  1396. success: function (data) {
  1397. setTimeout(function () {
  1398. var id = $('#firstpane .menu-active').attr('id')
  1399. loadProject(id);
  1400. }, 5000)
  1401. // $(_this).attr('disabled', false);
  1402. // $(_this).parents('.equipCtrl').find('.ctrlLoading').html('');
  1403. // if (currStutas) {
  1404. // $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
  1405. // } else {
  1406. // $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
  1407. // }
  1408. },
  1409. error: function (type) {
  1410. layer.close(loadingFlag);
  1411. $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1412. $(_this).attr('disabled', false);
  1413. if (oldStatus) {
  1414. $(_this).prop('checked', true);
  1415. $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
  1416. } else {
  1417. $(_this).prop('checked', '');
  1418. $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
  1419. }
  1420. }
  1421. })
  1422. })
  1423. // 下发控制名称
  1424. $('#ctrlBox').on('click', '.setName', function () {
  1425. var _this = this;
  1426. var ele = $(this).parents('.equipCtrl').find('.numName');
  1427. var currWay = $(this).parents('.equipCtrl').find('.currStutas').val();
  1428. layui.use('layer', function () {
  1429. var layer = layui.layer;
  1430. layer.prompt({ title: '自定义名称', offset: '300px', formType: 0, value: ele.html(), maxlength: 10 }, function (text, index) {
  1431. if (text == ele.html()) {
  1432. return false;
  1433. layer.close(index);
  1434. layer.msg('演示完毕!您的口令:' + text);
  1435. ele.html(text)
  1436. }
  1437. $.ajax({
  1438. url: 'qxz_switch_name',
  1439. type: 'post',
  1440. data: {
  1441. 'imei': $('#qxzPhotoId').val(),
  1442. 'way': currWay,
  1443. 'sw_name': text
  1444. },
  1445. success: function (data) {
  1446. if (data == 0) {
  1447. ele.html(text)
  1448. }
  1449. layer.close(index);
  1450. },
  1451. error: function (type) {
  1452. $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1453. $(_this).attr('disabled', false);
  1454. if (oldStatus) {
  1455. $(_this).prop('checked', true);
  1456. $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
  1457. } else {
  1458. $(_this).prop('checked', '');
  1459. $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
  1460. }
  1461. }
  1462. })
  1463. });
  1464. });
  1465. })
  1466. // 获取最新控制按钮状态
  1467. function qxzDownCtrlFun() {
  1468. $.ajax({
  1469. url: 'qxz_switch',
  1470. type: 'post',
  1471. data: {
  1472. 'req': 'conf', //
  1473. 'imei': $('#qxzPhotoId').val(),
  1474. },
  1475. beforeSend: function () {
  1476. loadFlage = layer.load();
  1477. },
  1478. complete: function () {
  1479. setTimeout(function () {
  1480. layer.close(loadFlage);
  1481. }, 5000)
  1482. },
  1483. success: function (data) {
  1484. setTimeout(function () {
  1485. loadProject($('#qxzPhotoId').val())
  1486. }, 5000)
  1487. }
  1488. })
  1489. }
  1490. // 获取最新数据
  1491. function newDataRefresh() {
  1492. $.ajax({
  1493. url: 'qxz_switch',
  1494. type: 'post',
  1495. data: {
  1496. 'req': 'read',
  1497. 'imei': $('#qxzPhotoId').val(),
  1498. },
  1499. beforeSend: function () {
  1500. loadFlage = layer.load();
  1501. },
  1502. complete: function () {
  1503. setTimeout(function () {
  1504. layer.close(loadFlage);
  1505. }, 5000)
  1506. },
  1507. success: function (data) {
  1508. setTimeout(function () {
  1509. loadProject($('#qxzPhotoId').val())
  1510. }, 5000)
  1511. }
  1512. })
  1513. }
  1514. // 设备列表
  1515. var currpage = 1;
  1516. function changePage(symbol) {
  1517. var totelpage = Number($('#totelpage').html());
  1518. if (symbol == 'add') {
  1519. if (currpage < totelpage) {
  1520. currpage++;
  1521. $('#currentpage').html(currpage);
  1522. $('#jumpPage').val(currpage);
  1523. $('addPage').attr('disable', 'false')
  1524. } else {
  1525. $('addPage').attr('disable', 'true')
  1526. return false;
  1527. }
  1528. } else if (symbol == 'jian') {
  1529. if (currpage > 1) {
  1530. currpage--;
  1531. $('#currentpage').html(currpage);
  1532. $('#jumpPage').val(currpage);
  1533. $('jianPage').attr('disable', 'false')
  1534. } else {
  1535. $('jianPage').attr('disable', 'true')
  1536. return false;
  1537. }
  1538. } else if (symbol == 'jump') {
  1539. var jumpPage = $('#jumpPage').val();
  1540. if (jumpPage <= totelpage && jumpPage > 0) {
  1541. currpage = jumpPage;
  1542. } else if (jumpPage > totelpage) {
  1543. currpage = totelpage;
  1544. } else if (jumpPage < 0) {
  1545. currpage = 1;
  1546. }
  1547. $('#jumpPage').val(currpage);
  1548. $('#currentpage').html(currpage);
  1549. }
  1550. getEquipList(currpage, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
  1551. }
  1552. // 首页
  1553. function gotofirstpage() {
  1554. currpage = 1;
  1555. $('#currentpage').html(1);
  1556. $('#jumpPage').val(1);
  1557. getEquipList(1, $('#searchImei').val())
  1558. }
  1559. // 定时刷新
  1560. // msgInterval = setInterval(function () {
  1561. // var currid = $('#firstpane .menu-active').attr('id');
  1562. // loadProject(currid);
  1563. // }, 60000);
  1564. var waterTempId = [16062009, 16062010, 16062011, 16062012, 16062013, 16062014, 16062015, 16062016, 16062017, 16062018, 16062019, 16062020, 16062021, 16062022, 16062023, 16062024, 16062025];
  1565. // 实时状态
  1566. function newStatus(statusBox, data, facId) {
  1567. var dat = data.dat;
  1568. var html = '';
  1569. $(document.getElementById(statusBox)).html('');
  1570. var random = ['bg_lb', 'bg_ly', 'bg_ls', 'bg_lg', 'bg_lo', 'bg_lr']; //颜色随机
  1571. if (Object.keys(dat).length) {
  1572. for (var i = 1; i < 31; i++) {
  1573. var ekeyNum = 'e' + i;
  1574. if (dat[ekeyNum] != '' && (parseInt(dat[ekeyNum].split('#')[1]) != 163)) {
  1575. if (dat[ekeyNum].split('#')[0] == -99.99) {
  1576. var eVal = 'N/A';
  1577. } else {
  1578. if(dat[ekeyNum].split('#')[1] == 117){ //判断是否是雨雪天气
  1579. var eVal = dat[ekeyNum].split('#')[0]?'有':'无';
  1580. }else{
  1581. var eVal = dat[ekeyNum].split('#')[0];
  1582. }
  1583. }
  1584. var eNum = dat[ekeyNum].split('#')[1];
  1585. var ekey = dat[ekeyNum].split('#')[2];
  1586. var colorClass = eNum % 4;
  1587. // if(Object.keys(data.conf).length){
  1588. var eTxtUnit = data.conf[ekeyNum].split('#')[0];
  1589. var eUnit = data.conf[ekeyNum].split('#')[1];
  1590. // }
  1591. html += '<div class=" col-xs-4 col-md-3 col-lg-2"><div class="dev ' + random[colorClass] + '"><div class="left">' +
  1592. '<img class="img-dev" src="/static/img/dev/icon_' + eNum + '.png">' +
  1593. '</div><div class="right"><div class="name">' + eTxtUnit + '</div>';
  1594. if(dat[ekeyNum].split('#')[1] == 117){
  1595. html += '<div class="data"><strong><span style="font-size: 22px;">' + eVal + '</span>';
  1596. }else{
  1597. html += '<div class="data"><strong><span style="font-size: 25px;">' + eVal + '</span>';
  1598. }
  1599. html += '</strong>' + eUnit + '</div></div><div class="aisle">通道' + ekey.substr(1) + '</div></div></div>';
  1600. }
  1601. }
  1602. }
  1603. if (html) {
  1604. $(document.getElementById(statusBox)).append(html);
  1605. } else {
  1606. html = '<div style="text-align:center">空</div>';
  1607. $(document.getElementById(statusBox)).append(html);
  1608. // $('.widget-content .equip_name').html('');
  1609. // var id = $('#firstpane .menu-active').attr('id')
  1610. // $('.widget-content .equip_id').html('设备ID:' + id);
  1611. // $('#viewPhoto').attr('src', 'qxz_photo/default.jpg');
  1612. // scrollBar()
  1613. }
  1614. scrollBar()
  1615. }
  1616. // 24小时数据
  1617. function get24Data(facId) {
  1618. $.ajax({
  1619. url: 'qxz_day_data',
  1620. type: 'post',
  1621. dataType: 'json',
  1622. data: {
  1623. e_id: facId,
  1624. },
  1625. beforeSend: function (XMLHttpRequest) {
  1626. loadingFlag = layer.load();
  1627. },
  1628. success: function (data) {
  1629. layer.close(loadingFlag);
  1630. $("#newtable tr:not(:first)").remove();
  1631. if (data.data.length) {
  1632. Fill_Table('newtable', data, facId)
  1633. } else {
  1634. Fill_null_Table('newtable', data, facId)
  1635. }
  1636. },
  1637. error: function (type) {
  1638. layer.close(loadingFlag);
  1639. layer.msg('请求失败');
  1640. $("#newtable tr:not(:first)").remove();
  1641. }
  1642. })
  1643. }
  1644. function Fill_Table(table_id, data, facId) {
  1645. var dat = data.data;
  1646. //js循环读取json数据
  1647. var table = document.getElementById(table_id).children[1];
  1648. for (var i = 0; i < dat.length; i++) {
  1649. var row = table.insertRow(table.rows.length);
  1650. var c1 = row.insertCell(0);
  1651. c1.innerHTML = dat[i].ekey;
  1652. var c2 = row.insertCell(1);
  1653. var eNum = dat[i].enum
  1654. var elementName = data.conf[dat[i].ekey].split('#');
  1655. c2.innerHTML = elementName[0] + '(' + elementName[1] + ')';
  1656. var c3 = row.insertCell(2);
  1657. if (dat[i].min == -99.99) {
  1658. c3.innerHTML = 'N/A';
  1659. } else {
  1660. if(eNum[0] == 117){
  1661. c3.innerHTML = dat[i].min?'有':'无';
  1662. }else{
  1663. c3.innerHTML = dat[i].min;
  1664. }
  1665. }
  1666. var c4 = row.insertCell(3);
  1667. var min_time = dat[i].mintime;
  1668. c4.innerHTML = min_time;
  1669. var c5 = row.insertCell(4);
  1670. if (dat[i].max == -99.99) {
  1671. c5.innerHTML = 'N/A';
  1672. } else {
  1673. if(eNum[0] == 117){
  1674. c5.innerHTML = dat[i].max?'有':'无';
  1675. }else{
  1676. c5.innerHTML = dat[i].max;
  1677. }
  1678. }
  1679. var c6 = row.insertCell(5);
  1680. var max_time = dat[i].maxtime;
  1681. c6.innerHTML = max_time;
  1682. if (i == dat.length - 1) {
  1683. scrollBar()
  1684. }
  1685. }
  1686. }
  1687. function Fill_null_Table(table_id) {
  1688. var table = document.getElementById(table_id).children[1];
  1689. var row = table.insertRow(table.rows.length);
  1690. var c1 = row.insertCell(0);
  1691. c1.setAttribute('colspan', '16');
  1692. c1.setAttribute('class', 'nullData');
  1693. c1.innerHTML = "暂无数据";
  1694. scrollBar()
  1695. }
  1696. window.onresize = function () {
  1697. scrollBar()
  1698. }
  1699. // file 文件
  1700. // divId div id
  1701. // imgId 图片id
  1702. // fileId 文件id
  1703. // width 图片宽
  1704. // height 图片高
  1705. function previewImage(file, divId, imgId, fileId, width, height) {
  1706. width = $('#viewPhotoParent').width();
  1707. var div = document.getElementById(divId);
  1708. if (file.files && file.files[0]) {
  1709. if (file.files[0].size / 1024 / 1024 < 4) {
  1710. sendUserPhoto();
  1711. div.innerHTML = '<img id=' + imgId + ' onclick=$("#' + fileId + '").click()>';
  1712. var img = document.getElementById(imgId);
  1713. img.onload = function () {
  1714. // var rect = clacImgZoomParam(width, height, img.offsetWidth, img.offsetHeight);
  1715. img.width = width;
  1716. img.height = height;
  1717. // img.style.marginTop = rect.top+'px';
  1718. }
  1719. var reader = new FileReader();
  1720. reader.onload = function (evt) {
  1721. img.src = evt.target.result;
  1722. // $(window.parent.document).find('.nav-user-photo').attr('src',evt.target.result);
  1723. }
  1724. reader.readAsDataURL(file.files[0]);
  1725. // $('#userPhoto').submit();
  1726. } else {
  1727. $(file).val('');
  1728. layer.alert("图片过大!");
  1729. }
  1730. } else {//兼容IE
  1731. var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
  1732. file.select();
  1733. if (document.selection != undefined) {
  1734. var src = document.selection.createRange().text;
  1735. div.innerHTML = '<img id=' + imgId + '>';
  1736. var img = document.getElementById(imgId);
  1737. img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
  1738. var rect = clacImgZoomParam(width, height, img.offsetWidth, img.offsetHeight);
  1739. status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height);
  1740. div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;" + sFilter + src + "\"'></div>";
  1741. }
  1742. }
  1743. }
  1744. function clacImgZoomParam(maxWidth, maxHeight, width, height) {
  1745. var param = { top: 0, left: 0, width: width, height: height };
  1746. if (width > maxWidth || height > maxHeight) {
  1747. var rateWidth = width / maxWidth;
  1748. var rateHeight = height / maxHeight;
  1749. if (rateWidth > rateHeight) {
  1750. param.width = maxWidth;
  1751. param.height = Math.round(height / rateWidth);
  1752. } else {
  1753. param.width = Math.round(width / rateHeight);
  1754. param.height = maxHeight;
  1755. }
  1756. }
  1757. param.left = Math.round((maxWidth - param.width) / 2);
  1758. param.top = Math.round((maxHeight - param.height) / 2);
  1759. return param;
  1760. }
  1761. // 上传图片
  1762. function sendUserPhoto() {
  1763. var formData = new FormData($("#userPhoto")[0]);
  1764. $.ajax({
  1765. url: 'qxz_photo',
  1766. type: 'POST',
  1767. data: formData,
  1768. contentType: false,
  1769. processData: false,
  1770. success: function (data) {
  1771. if (data == 0) {
  1772. $(window.parent.document).find('.nav-user-photo').attr('src', $('#viewPhoto').prop('src'));
  1773. $('#uploadPhoto').val('');
  1774. }
  1775. else { layer.msg("上传失败!"); return false; }
  1776. }
  1777. });
  1778. }
  1779. // 设置阈值
  1780. function setthresholdFun(ele) {
  1781. var obj = $(ele);
  1782. var currValstr = obj.next().val();
  1783. var currVal = eval('(' + currValstr + ')');
  1784. layui.use(['layer', 'form'], function () {
  1785. var rule0 = "低于下限<span>开启</span>,高于上限<span>关闭</span>";
  1786. var rule1 = "低于下限<span>关闭</span>,高于上限<span>开启</span>";
  1787. var layer = layui.layer;
  1788. var form = layui.form;
  1789. //给表单赋值
  1790. form.val("formModel", {
  1791. "JK": currVal.JK
  1792. , "eKey": currVal.eKey
  1793. , "upper": currVal.upper
  1794. , "lower": currVal.lower
  1795. , "method": currVal.method
  1796. });
  1797. if (currVal.method == 1) {
  1798. $('#hintDiv').html(rule1)
  1799. } else {
  1800. $('#hintDiv').html(rule0)
  1801. }
  1802. form.on('radio(radioSwitch)', function (data) {
  1803. if (data.value == 1) {
  1804. $('#hintDiv').html(rule1)
  1805. } else {
  1806. $('#hintDiv').html(rule0)
  1807. }
  1808. });
  1809. layer.open({
  1810. type: 1,
  1811. title: '阈值设置',
  1812. offset: '380px',
  1813. btn: ['确定', '取消'],
  1814. area: ['600px', '300px'], //宽高
  1815. content: $('#Modal'),
  1816. success: function (layero, index) { // 成功弹出后回调
  1817. // 添加form标识
  1818. layero.addClass('layui-form');
  1819. // 将保存按钮改变成提交按钮
  1820. layero.find('.layui-layer-btn0').attr({
  1821. 'lay-filter': 'setYuzhi',
  1822. 'lay-submit': ''
  1823. });
  1824. },
  1825. yes: function (index, layero) {
  1826. form.on('submit(setYuzhi)', function (data) {
  1827. var dat = data.field;
  1828. if (parseInt(data.field.upper) < parseInt(data.field.lower)) {
  1829. layer.tips('最大值不能小于最小值!', $('#upper'));
  1830. return false;
  1831. }
  1832. var hideVal = JSON.stringify(data.field)
  1833. var id = $('#firstpane .menu-active').attr('id')
  1834. data.field.equip_id = id;
  1835. var curinputBtn = obj.parent().find('.ace-switch');
  1836. if (curinputBtn.is(":checked")) {
  1837. var oldStatus = 0;
  1838. var currStutas = 1;
  1839. } else {
  1840. var oldStatus = 1;
  1841. var currStutas = 0;
  1842. }
  1843. obj.parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  1844. $.ajax({
  1845. url: 'qxz_value_mqtt',
  1846. type: 'post',
  1847. data: data.field,
  1848. success: function (data) {
  1849. setTimeout(function () {
  1850. curinputBtn.attr('disabled', false);
  1851. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('');
  1852. obj.parent().find('.maxminNum').find('p').eq(0).find('span').html(dat.upper)//最大值
  1853. obj.parent().find('.maxminNum').find('p').eq(1).find('span').html(dat.lower)//最小值
  1854. obj.parents('.thresholdCtrl').find('.ace-switch').prop('checked', 'checked');//开启阈值
  1855. var id = $('#firstpane .menu-active').attr('id')
  1856. loadProject(id);
  1857. }, 5000)
  1858. },
  1859. error: function (type) {
  1860. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1861. curinputBtn.attr('disabled', false);
  1862. }
  1863. })
  1864. // $('.maxminNum')
  1865. layer.closeAll(); //疯狂模式,关闭所有层
  1866. return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
  1867. });
  1868. }
  1869. , btn2: function (index, layero) {
  1870. $('#Modal').hide()
  1871. //return false 开启该代码可禁止点击该按钮关闭
  1872. }
  1873. });
  1874. });
  1875. }
  1876. // 下发阈值控制
  1877. $('#getthresholdDiv').on('click', '.ace-switch', function () {
  1878. var _this = this;
  1879. $(this).parents('.thresholdCtrl').find('.ctrlLoading').remove()
  1880. $(this).attr('disabled', true);
  1881. $(this).parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  1882. var currVal = $(this).parents('.thresholdCtrl').find('.currVal').val();
  1883. var currWayjson = JSON.parse(currVal);
  1884. var id = $('#firstpane .menu-active').attr('id')
  1885. currWayjson.equip_id = id;
  1886. if ($(this).is(":checked")) { //开启
  1887. var oldStatus = 0;
  1888. var currStutas = 1;
  1889. } else { //关闭
  1890. var oldStatus = 1;
  1891. var currStutas = 0;
  1892. currWayjson.upper = '32767';
  1893. currWayjson.lower = '32767';
  1894. }
  1895. $.ajax({
  1896. url: 'qxz_value_mqtt',
  1897. type: 'post',
  1898. data: currWayjson,
  1899. success: function (data) {
  1900. setTimeout(function () {
  1901. $(_this).attr('disabled', false);
  1902. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('');
  1903. var id = $('#firstpane .menu-active').attr('id')
  1904. loadProject(id);
  1905. }, 5000)
  1906. },
  1907. error: function (type) {
  1908. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1909. $(_this).attr('disabled', false);
  1910. if (oldStatus) {
  1911. $(_this).prop('checked', true);
  1912. } else {
  1913. $(_this).prop('checked', '');
  1914. }
  1915. }
  1916. })
  1917. })
  1918. // 定时开关
  1919. function timingOnOff(ele) {
  1920. var obj = $(ele);
  1921. var currValstr = obj.next().val();
  1922. var currVal = eval('(' + currValstr + ')');
  1923. layui.use(['layer', 'form'], function () {
  1924. var layer = layui.layer;
  1925. var form = layui.form;
  1926. form.verify({
  1927. starttimeRegex: function (value, item) { //value:表单的值、item:表单的DOM对象
  1928. if (value < 0 || value > 23) {
  1929. return '请输入范围内数值';
  1930. }
  1931. },
  1932. durationRegex: function (value, item) { //value:表单的值、item:表单的DOM对象
  1933. if (value < 1 || value > 24) {
  1934. return '请输入范围内数值';
  1935. }
  1936. }
  1937. });
  1938. //给表单赋值
  1939. form.val("formModel", {
  1940. "JK": currVal.JK
  1941. , "StartTime": currVal.StartTime
  1942. , "Duration": currVal.Duration
  1943. });
  1944. layer.open({
  1945. type: 1,
  1946. title: '阈值设置',
  1947. offset: '380px',
  1948. btn: ['确定', '取消'],
  1949. area: ['600px', '300px'], //宽高
  1950. content: $('#timingOnOffModal'),
  1951. success: function (layero, index) { // 成功弹出后回调
  1952. // 添加form标识
  1953. layero.addClass('layui-form');
  1954. // 将保存按钮改变成提交按钮
  1955. layero.find('.layui-layer-btn0').attr({
  1956. 'lay-filter': 'setdingshi',
  1957. 'lay-submit': ''
  1958. });
  1959. },
  1960. yes: function (index, layero) {
  1961. form.on('submit(setdingshi)', function (data) {
  1962. var hideVal = JSON.stringify(data.field)
  1963. var dat = data.field;
  1964. var curinputBtn = obj.parent().find('.ace-switch');
  1965. if (curinputBtn.is(":checked")) {
  1966. var oldStatus = 0;
  1967. var currStutas = 1;
  1968. } else {
  1969. var oldStatus = 1;
  1970. var currStutas = 0;
  1971. }
  1972. var id = $('#firstpane .menu-active').attr('id')
  1973. dat.equip_id = id;
  1974. obj.parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  1975. $.ajax({
  1976. url: 'qxz_timing_mqtt',
  1977. type: 'post',
  1978. data: dat,
  1979. success: function (data) {
  1980. setTimeout(function () {
  1981. obj.next().val(hideVal)
  1982. curinputBtn.attr('disabled', false);
  1983. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('');
  1984. obj.parent().find('.maxminNum').find('p').eq(0).find('span').html(dat.StartTime)//最大值
  1985. obj.parent().find('.maxminNum').find('p').eq(1).find('span').html(dat.Duration)//最小值
  1986. obj.parents('.thresholdCtrl').find('.ace-switch').prop('checked', 'checked');//开启阈值
  1987. var id = $('#firstpane .menu-active').attr('id')
  1988. loadProject(id);
  1989. }, 5000)
  1990. },
  1991. error: function (type) {
  1992. curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  1993. curinputBtn.attr('disabled', false);
  1994. }
  1995. })
  1996. // $('.maxminNum')
  1997. layer.closeAll(); //疯狂模式,关闭所有层
  1998. return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
  1999. });
  2000. }
  2001. , btn2: function (index, layero) {
  2002. $('#Modal').hide()
  2003. //return false 开启该代码可禁止点击该按钮关闭
  2004. }
  2005. });
  2006. });
  2007. }
  2008. $('#starttime').on('blur', function () {
  2009. $(this).val(parseInt($(this).val()))
  2010. })
  2011. $('#Duration').on('blur', function () {
  2012. $(this).val(parseInt($(this).val()))
  2013. })
  2014. // 下发定时开关
  2015. $('#gettimingDiv').on('click', '.ace-switch', function () {
  2016. var _this = this;
  2017. var currVal = $(this).parents('.thresholdCtrl').find('.currVal').val();
  2018. var currWayjson = JSON.parse(currVal);
  2019. var id = $('#firstpane .menu-active').attr('id')
  2020. currWayjson.equip_id = id;
  2021. if (currWayjson.StartTime == '--' || currWayjson.Duration == '--') {
  2022. $(this).parents('.thresholdCtrl').find('.setthresholdBtn').click();
  2023. layer.msg('请先设置定时时间', { icon: 2 })
  2024. return false;
  2025. }
  2026. $(this).parents('.thresholdCtrl').find('.ctrlLoading').remove()
  2027. $(this).attr('disabled', true);
  2028. $(this).parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
  2029. if ($(this).is(":checked")) { //开启
  2030. var oldStatus = 0;
  2031. var currStutas = 1;
  2032. } else { //关闭
  2033. var oldStatus = 1;
  2034. var currStutas = 0;
  2035. currWayjson.StartTime = '255';
  2036. currWayjson.Duration = '32767';
  2037. }
  2038. $.ajax({
  2039. url: 'qxz_timing_mqtt',
  2040. type: 'post',
  2041. data: currWayjson,
  2042. success: function (data) {
  2043. setTimeout(function () {
  2044. $(_this).attr('disabled', false);
  2045. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('');
  2046. var id = $('#firstpane .menu-active').attr('id')
  2047. loadProject(id);
  2048. }, 5000)
  2049. },
  2050. error: function (type) {
  2051. $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
  2052. $(_this).attr('disabled', false);
  2053. if (oldStatus) {
  2054. $(_this).prop('checked', true);
  2055. } else {
  2056. $(_this).prop('checked', '');
  2057. }
  2058. }
  2059. })
  2060. })
  2061. // 设置要素名称
  2062. function setEleName() {
  2063. var e_id = $('#firstpane .menu-active').attr('id')
  2064. $.ajax({
  2065. url: 'qxz_title_conf',
  2066. type: 'get',
  2067. data: {
  2068. e_id: e_id
  2069. },
  2070. dataType: 'json',
  2071. success: function (data) {
  2072. var dataa = [];
  2073. var len = Object.keys(data.default).length;
  2074. for (var i = 1; i <= len; i++) {
  2075. var key = 'e' + i;
  2076. if (data.default[key]) {
  2077. var detxt = data.default[key].split('#')[0];
  2078. var deunit = data.default[key].split('#')[1];
  2079. if (data.conf[key]) {
  2080. var conftxt = data.conf[key].split('#')[0];
  2081. } else {
  2082. var conftxt = '-';
  2083. }
  2084. dataa.push({
  2085. "ekey": key,
  2086. "name": conftxt,
  2087. "elementName": detxt,
  2088. "unit": deunit
  2089. })
  2090. }
  2091. if (i == len) {
  2092. // console.log(dataa)
  2093. //页面层
  2094. layer.open({
  2095. type: 1,
  2096. title: '修改要素名称',
  2097. area: ['800px', '540px'], //宽高
  2098. content: $('#eleName'),
  2099. skin: 'layui-layer-editName', //样式类名
  2100. success: function (layero, index) {
  2101. layui.use('table', function () {
  2102. var table = layui.table;
  2103. table.render({
  2104. elem: '#eleTable'
  2105. , data: dataa
  2106. , done: function (res, curr, count) {
  2107. $("table").css("width", "100%");
  2108. }
  2109. , limit: 30
  2110. , cols: [[
  2111. { field: 'ekey', width: '25%', align: 'center', title: '通道号' }
  2112. , { field: 'name', width: '35%', align: 'center', title: '<i class="layui-icon">&#xe642;</i>名称', event: 'cellClick' }
  2113. , { field: 'elementName', width: '40%', align: 'center', title: '要素' }
  2114. ]]
  2115. });
  2116. table.on('tool(eleTable)', function (obj) {
  2117. switch (obj.event) {
  2118. case 'cellClick':
  2119. CellClick(this, obj, e_id);
  2120. break;
  2121. };
  2122. });
  2123. });
  2124. },
  2125. cancel: function (index, layero) {
  2126. loadProject(e_id);
  2127. }
  2128. });
  2129. }
  2130. }
  2131. },
  2132. error: function (type) {
  2133. layer.msg('请求失败');
  2134. }
  2135. })
  2136. }
  2137. layui.use(['form'], function () {
  2138. var form = layui.form;
  2139. form.on('switch(equipTypeDemo)', function (obj) {
  2140. var state = obj.elem.checked ? 1 : 0;
  2141. //方法二取数据 (根据索引table.cache里面的行数据)
  2142. var index = obj.othis.parents('tr').attr("data-index");
  2143. datMsg[index].type = state;
  2144. });
  2145. })
  2146. function CellClick(that, obj, e_id) {
  2147. //当前点击字段
  2148. var field = $(that).data("field");
  2149. //判断是否需要添加编辑框
  2150. if (field == "edit") return true;
  2151. //当前行数据
  2152. var data = obj.data;
  2153. //当前单元格的值
  2154. var value = data[field];
  2155. //当前点击td的宽高
  2156. var height = $(that)[0].offsetHeight, width = $(that)[0].offsetWidth;
  2157. //当前点击td的坐标
  2158. var top = $(that).offset().top, left = $(that).offset().left;
  2159. //输入框 这里可以自定义表单内容
  2160. var input = '<input type="text" maxlength=10 class="layui-input" id="' + field + '_input" data-field="' + field + '" style="width:' + width + 'px;height:' + height + 'px">';
  2161. //弹出层
  2162. layer.open({
  2163. type: 1
  2164. , title: false
  2165. , page: true
  2166. , limit: 1
  2167. , closeBtn: 0
  2168. , area: [width + "px", height + "px"]
  2169. , shade: [0.01, '#fff']
  2170. , shadeClose: true
  2171. , content: input //这里content是一个普通的String
  2172. , offset: [top, left]
  2173. , success: function () {
  2174. //使弹出层相对定位
  2175. $(".layui-layer-page").css("position", "absolute")
  2176. //设置输入框的值
  2177. $("#" + field + "_input").val(value);
  2178. $("#" + field + "_input").blur(function () {
  2179. var dat = data;
  2180. var ekey = dat.ekey;
  2181. var conf = $(this).val();
  2182. var unit = data.unit;
  2183. $.ajax({
  2184. url: 'qxz_title_conf',
  2185. type: 'post',
  2186. data: {
  2187. e_id: e_id,
  2188. ekey: ekey,
  2189. conf: conf + '#' + unit
  2190. },
  2191. dataType: 'json',
  2192. success: function (data) {
  2193. if (data == 0) {
  2194. //同步更新缓存对应的值
  2195. dat[field] = conf;
  2196. obj.update(dat);
  2197. layer.msg('修改成功')
  2198. }
  2199. },
  2200. error: function (type) {
  2201. layer.msg('修改失败')
  2202. }
  2203. })
  2204. })
  2205. }
  2206. });
  2207. }
  2208. function thresholdClick(that, obj, e_id, form) {
  2209. //当前点击字段
  2210. var field = $(that).data("field");
  2211. // console.log(obj)
  2212. //判断是否需要添加编辑框
  2213. if (field == "edit") return true;
  2214. //当前行数据
  2215. var data = obj.data;
  2216. //当前单元格的值
  2217. var value = data[field];
  2218. //当前点击td的宽高
  2219. var height = $(that)[0].offsetHeight, width = $(that)[0].offsetWidth;
  2220. //当前点击td的坐标
  2221. var top = $(that).offset().top, left = $(that).offset().left;
  2222. //输入框 这里可以自定义表单内容
  2223. 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">';
  2224. //弹出层
  2225. layer.open({
  2226. type: 1
  2227. , title: false
  2228. , page: true
  2229. , limit: 1
  2230. , closeBtn: 0
  2231. , area: [width + "px", height + "px"]
  2232. , shade: [0.01, '#fff']
  2233. , shadeClose: true
  2234. , content: input //这里content是一个普通的String
  2235. , offset: [top, left]
  2236. , success: function () {
  2237. //使弹出层相对定位
  2238. $(".layui-layer-page").css("position", "absolute")
  2239. //设置输入框的值
  2240. $("#" + field + "_input").val(value);
  2241. $("#" + field + "_input").focus()
  2242. $("#" + field + "_input").blur(function () {
  2243. var dat = data;
  2244. var ekey = dat.ekey;
  2245. var conf = $(this).val();
  2246. var unit = data.unit;
  2247. dat[field] = conf || "";
  2248. obj.update(dat);
  2249. form.render()
  2250. })
  2251. }
  2252. });
  2253. }
  2254. // 查看详情
  2255. function historyData(){
  2256. var id = $('#firstpane .menu-active').attr('id')
  2257. window.location.href = 'qxz_report?id='+id
  2258. }
  2259. </script>
  2260. </body>
  2261. </html>