| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559 |
- {% load staticfiles %}
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <link href="{% static '/lib/bootstrap-3.3.7/css/bootstrap.css' %}" rel="stylesheet">
- <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}">
- <link rel="stylesheet" href="{% static '/lib/css/ace.min.css' %}" />
- <link rel="stylesheet" href="{% static '/lib/css/ace-skins.min.css' %}">
- <link rel="stylesheet" href="{% static '/lib/css/ace-rtl.min.css' %}">
- <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
- <link rel="stylesheet" href="{% static '/lib/css/jquery-ui.css' %}" />
- <link rel="stylesheet" href="{% static '/lib/css/swiper.min.css' %}" />
- <style type="text/css">
- .swiper-slide {
- text-align: center;
- font-size: 14px;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
- }
- .swiper-button-next, .swiper-button-prev{
- background-size: 50%;
- }
- .swiper-slide .elValBox{
- position: relative;
- width: 80px;
- height: 80px;
- margin: 0 auto;
- color: #fff;
- font-size: 20px;
- line-height: 80px;
- border-radius: 5px;
- }
- .swiper-slide .elValBox.bg_blue{
- background-image: url(../static/img/qxzBj/1.png);
- }
- .swiper-slide .elValBox.bg_yellow{
- background-image: url(../static/img/qxzBj/2.png);
- }
- .swiper-slide .elValBox.bg_green{
- background-image: url(../static/img/qxzBj/3.png);
- }
- .swiper-slide .elValBox.bg_red{
- background-image: url(../static/img/qxzBj/4.png);
- }
- .swiper-slide .elValBox.bg_purpol{
- background-image: url(../static/img/qxzBj/5.png);
- }
- .swiper-slide .elValBox.bg_darkblue{
- background-image: url(../static/img/qxzBj/6.png);
- }
- .swiper-slide .elValBox .elNum{
- position: absolute;
- left: 5px;
- top: 5px;
- font-size: 14px;
- line-height: 12px;
- }
- .swiper-slide .eLtxt{
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- body {
- background: #fff;
- }
- .row {
- margin: 0;
- }
- /* 菜单 */
- .menu_body .nulldata {
- line-height: 80px;
- text-align: center;
- height: 80px;
- background: #eee;
- }
- .menu_list {
- margin-top: 10px;
- }
- .menu_head {
- height: 30px;
- line-height: 30px;
- padding-left: 10px;
- font-size: 12px;
- color: #313131;
- cursor: pointer;
- border: 1px solid #e1e1e1;
- border-top: 0px solid #e1e1e1;
- position: relative;
- background: #f1f1f1 url(../static/img/jia.png) center right 5px no-repeat;
- margin: 0;
- word-break: keep-all;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .menu_body {
- height: auto;
- overflow: hidden;
- line-height: 38px;
- border-left: 1px solid #e1e1e1;
- border-right: 1px solid #e1e1e1;
- }
- .menu_body a {
- display: block;
- height: 32px;
- line-height: 32px;
- padding-left: 10px;
- color: #525252;
- background: #fff;
- text-decoration: none;
- border-bottom: 1px solid #e1e1e1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .menu_body a span {
- display: inline-block;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- margin-right: 6px;
- }
- .bjred {
- background: red;
- }
- .bjgreen {
- background: green;
- }
- .menu_list .current {
- background: #f1f1f1 url(../static/img/jian.png) center right 5px no-repeat;
- font-weight: bold;
- color: #313131;
- }
- .menu_body .menu-active {
- color: #00bcd4;
- border-left: solid 3px #00bcd4;
- }
- .currAstive {
- background-color: #00bcd4;
- color: #fff;
- }
- /* 主题标题 */
- .widget-box {
- background: none repeat scroll 0 0 #F9F9F9;
- clear: both;
- margin-top: 16px;
- margin-bottom: 16px;
- position: relative;
- border: none;
- }
- .widget-title {
- height: 36px;
- line-height: 36px;
- border-bottom: solid 1px #e5e5e5;
- padding-bottom: 1px;
- /* text-align: center; */
- }
- .widget-title .equipInfo {
- float: left;
- }
- .widget-title h5 {
- color: #666;
- float: left;
- font-size: 12px;
- font-weight: bold;
- padding: 12px;
- line-height: 12px;
- margin: 0;
- margin-bottom: 3px;
- border-bottom: solid 2px #38b0ec;
- }
- /*状态 */
- .dev:HOVER {
- background: #2E363F;
- }
- .dev {
- display: flex;
- justify-content: space-around;
- /* width: 215px;
- height: 88px;
- float: left; */
- /* margin: 0px; */
- color: #f2f2f2;
- margin-bottom: 15px;
- cursor: pointer;
- position: relative;
- }
- .bg_lb {
- background:
- /* #27a9e3 */
- #4ab8e8;
- }
- .dev .left {
- width: 80px;
- padding-top: 10px;
- /* float: left; */
- }
- .dev .left .img-dev {
- width: 45px;
- margin-left: 12px;
- /* margin-top: 8px; */
- }
- .dev .right {
- width: 120px;
- padding-top: 3px;
- /* float: left; */
- font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;
- }
- .dev .right .name {
- font-size: 20px;
- line-height: 20px;
- text-align: left;
- padding-top: 10px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .dev .right .data {
- font-size: 14px;
- text-align: left;
- padding-top: 15px;
- }
- /* 项目 */
- .todo li {
- border-bottom: 1px solid #EBEBEB;
- margin-bottom: 0;
- padding: 10px 0;
- }
- .equipPage {
- line-height: 34px;
- text-align: center;
- }
- table tr td.nullData {
- text-align: center;
- line-height: 250px;
- }
- /* 状态块颜色 */
- .bg_lb {
- background:
- /* #27a9e3 */
- #4ab8e8;
- }
- .bg_ly {
- background:
- /* #ffb848 */
- #f5b761;
- }
- .bg_lg {
- background:
- /* #28b779 */
- #3eb984;
- }
- .bg_ls {
- background:
- /* #2255a4 */
- #4978c1;
- }
- .bg_lo {
- background:
- /* #da542e */
- #dc6442;
- }
- .bg_lr {
- background:
- /* #f74d4d */
- #f77979;
- }
- .aisle {
- position: absolute;
- left: 6px;
- bottom: 1px;
- font-size: 12px;
- }
- #uploadPhoto {
- display: none;
- }
- #viewPhoto {
- cursor: pointer;
- }
- /* 设备控制 */
- #ctrlBox>div {
- margin-bottom: 20px;
- }
- .handCtrlBox {
- margin-bottom: 20px;
- }
- input[type="checkbox"].ace.ace-switch.ace-switch-4+.lbl::before,
- input[type="checkbox"].ace.ace-switch.ace-switch-5+.lbl::before {
- text-indent: -39px;
- }
- .equipCtrl {
- border: 1px solid #cecece;
- padding: 15px 10px;
- background: #f5f5f5;
- box-shadow: 1px 1px 4px 1px #cecece;
- border-radius: 3px;
- cursor: pointer;
- }
- .equipCtrl:hover {
- border-color: #468fcd;
- box-shadow: 1px 2px 4px 0px #468fcd;
- }
- .equipCtrlInp {
- margin-top: 20px;
- text-align: right;
- }
- .isonlineicon {
- display: inline-block;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- margin-right: 7px;
- }
- .isonlineicon.active {
- background: green;
- animation: 1s ease 0s infinite normal none running myfirst01;
- }
- .isonlineicon {
- background: #909090;
- animation: 1s ease 0s infinite normal none running myfirst02;
- }
- @keyframes myfirst01 {
- 0% {
- -moz-box-shadow: 0px 0px 6px 1px green;
- box-shadow: 0px 0px 6px 1px green;
- }
- 100% {
- -moz-box-shadow: 0px 0px 6px 1px green;
- box-shadow: 0px 0px 6px 1px green;
- }
- }
- @keyframes myfirst02 {
- 0% {
- -moz-box-shadow: 0px 0px 6px 1px #909090;
- box-shadow: 0px 0px 6px 1px #909090;
- }
- 100% {
- -moz-box-shadow: 0px 0px 6px 1px #909090;
- box-shadow: 0px 0px 6px 1px #909090;
- }
- }
- .ctrlLoading {
- position: absolute;
- bottom: 6px;
- }
- .equipCtrl .fa-cog {
- position: absolute;
- right: 26px;
- font-size: 20px;
- color: #3eb983;
- top: 11px;
- }
- .qxzDownCtrl {
- display: none;
- float: right;
- width: 53px;
- background: white;
- border: 1px solid #8aafce;
- color: #6688a6 !important;
- }
- .numName {
- display: inline-block;
- width: 70%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- vertical-align: middle;
- }
- /* 阈值控制 */
- #getthresholdDiv>div,
- #gettimingDiv>div {
- padding-bottom: 20px;
- }
- .thresholdCtrl {
- background: #4ab8e8;
- border-radius: 5px;
- color: #fff;
- box-shadow: 1px 1px 4px 1px #98dbf8;
- border: 1px solid #98dbf8;
- padding: 5px 10px;
- cursor: pointer;
- position: relative;
- }
- #gettimingDiv .thresholdCtrl {
- background: #65b83b;
- box-shadow: 1px 1px 4px 1px #d1ffba;
- border: 1px solid #65b83b;
- }
- .setthresholdBtn {
- position: absolute;
- right: 13px;
- top: 12px;
- font-size: 20px;
- }
- .setthresholdBtn:hover {
- color: #08ff46;
- }
- .thresholdCtrl::before {
- position: absolute;
- content: '';
- bottom: 0;
- left: 0;
- right: 0;
- height: 30%;
- background: rgba(255, 255, 255, 0.5);
- }
- .thresholdCtrlName {
- line-height: 30px;
- font-size: 16px;
- }
- .thresholdCtrlShowDiv {
- overflow: hidden;
- }
- .thresholdCtrlShowDiv>div {
- float: left;
- }
- .qxys img {
- width: 47px;
- }
- .maxminNum {
- font-size: 18px;
- line-height: 30px;
- margin-top: 11px;
- padding-left: 7%;
- }
- /* 色值阈值框 */
- .layui-form-item .layui-input-inline {
- width: 44%;
- }
- #Modal>div,
- #timingOnOffModal>div {
- margin-top: 20px;
- }
- .layui-form-mid.layui-word-aux span {
- color: red;
- }
- /* 定时设置 */
- #timingOnOffModal .layui-form-label {
- width: 100px;
- }
- /* .layui-body{overflow-y: scroll;} */
- .layui-layer-editName.layui-layer-page .layui-layer-content {
- overflow: hidden !important;
- overflow-y: scroll !important;
- }
- /* LED大屏样式 */
- .layui-layer-demo.layui-layer {
- background: transparent;
- box-shadow: none;
- color: #ff0000;
- }
- .layui-layer-demo .layui-layer-content {
- overflow-y: hidden !important;
- }
- .layui-layer-demo .qxzLedBj {
- padding-top: 115px;
- /* width: 684px;
- height: 781px; */
- width: 525px;
- height: 619px;
- background: url(../static/img/ledBj.png) no-repeat;
- background-size: 100% 100%;
- }
- .layui-layer-demo .qxzLedInfo {
- width: 95%;
- }
- .layui-layer-demo .qxzLedTitle {
- position: relative;
- height: 47px;
- /* white-space: nowrap; */
- overflow: hidden;
- width: 92%;
- margin: 16px auto;
- font-size: 36px;
- letter-spacing: 7px;
- 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);
- box-sizing: border-box;
- word-break: break-all;
- }
- .layui-layer-demo .qxzLedTitle p {
- white-space: nowrap;
- /*position: absolute;
- left: -865px;
- top: 0; */
- /* display: inline-block; */
- text-align: center;
- }
- .layui-layer-demo .qxzLedTitle .qxzLedTitleLong {
- /* text-align: right; */
- padding-left: 100%;
- /* 从右至左开始滚动 */
- display: inline-block;
- animation: marqueeTransform 16s linear infinite;
- }
- @keyframes marqueeTransform {
- 0% {
- transform: translate(0, 0);
- }
- 100% {
- transform: translate(-100%, 0);
- }
- }
- .layui-layer-demo .eleContent {
- width: 82%;
- margin: 0 auto 0;
- height: 157px;
- overflow: hidden;
- }
- .layui-layer-demo .scrollUl {
- animation: scrollUlTransform 8s linear infinite;
- }
- @keyframes scrollUlTransform {
- 0% {
- transform: translate(0, 0);
- }
- 50% {
- transform: translate(0, 0);
- }
- 51% {
- transform: translate(0, -50%);
- }
- 100% {
- transform: translate(0, -50%);
- }
- }
- .layui-layer-demo .scrollUl li {
- line-height: 51px;
- font-size: 30px;
- 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);
- }
- /* led标题更改 */
- .layui-layer.layui-layer-led {
- border-radius: 20px;
- overflow: hidden;
- }
- .layui-layer-led .layui-layer-content {
- overflow: hidden !important;
- box-sizing: border-box;
- /* padding: 10px 15px; */
- }
- .layui-layer-led .LEDTitle {
- line-height: 45px;
- background: #ececec;
- border-bottom: 1px solid #d1d1d1;
- padding: 0 15px;
- color: #797979;
- }
- .layui-layer-led .LEDContent {
- padding: 15px;
- }
- .layui-layer-led .LEDContent>div {
- margin-bottom: 20px;
- }
- .layui-layer-led .LEDBtns {
- text-align: center;
- }
- .layui-layer-led .LEDBtns button {
- margin: 0 20px;
- }
- textarea {
- resize: none;
- }
- /* 短信阈值下发 */
- .layui-form-switch {
- background-color: #00abf8;
- border-color: #00abf8;
- }
- .layui-form-switch em {
- color: #fff !important;
- }
- .layui-form-switch i {
- background-color: #fff;
- }
- .layui-form-onswitch {
- border-color: #5FB878;
- background-color: #5FB878;
- }
- .authInp {
- width: 100%;
- }
- /* 在线、所属公司筛选框 */
- .iptScreen {
- width: 75%;
- }
- .layui-input-block {
- margin-left: 0;
- }
- .input-group-btnA {
- display: inline-block;
- }
- </style>
- <body>
- <div class="content">
- <div class="row">
- <!-- 左菜单 -->
- <div class="col-xs-12 col-sm-3 col-md-2">
- <div class="input-group">
- <input type="text" class="form-control" id="searchImei" name="searchImei" placeholder="输入编号或名称查询">
- <div class="input-group-btn">
- <button type="button" id="searchBtn" class="btn btn-default no-border btn-sm">
- <i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
- </button>
- </div>
- </div>
- <!-- 下拉框 -->
- <!-- 在线状态 -->
- <div class="layui-input-block">
- <p class="">在线状态:</p>
- <select name="status" lay-verify="required" id="selectId" class="iptScreen">
- <option value="" selected>全部</option>
- <option value="0">离线</option>
- <option value="1">在线</option>
- </select>
- </div>
- <div id="firstpane" class="menu_list">
- <p class="menu_head current" id="area_322">设备列表</p>
- <div class="menu_body">
- <!-- <a href="javascript:;" title="设备15112501" class="text-overflow" id="15112501" data-pid="322">设备15112501</a> -->
- </div>
- <div class="equipPage">
- <!-- <button class="btn btn-minier btn-yellow"><i class="fa fa-sort-up" aria-hidden="true"></i></button> -->
- <input type="button" class="btn btn-minier btn-yellow" onclick="gotofirstpage()" value="首页">
- <button class="btn btn-minier btn-yellow" id="jianPage"
- onclick="changePage('jian')">上一页</button>
- 第
- <span id="currentpage">1</span>页
- <button class="btn btn-minier btn-yellow" id="addPage" onclick="changePage('add')">下一页</button>
- 共<span id="totelpage">4</span>页
- </div>
- <div class="equipPage">
- 跳转 <input type="text" id="jumpPage" value="1"
- style="width: 60px;height: 30px;text-align: center;"
- onkeypress="if (event.keyCode == 13) changePage('jump');"> 页
- <button class="btn btn-minier btn-yellow" id="jianPage" onclick="changePage('jump')">确定</button>
- </div>
- </div>
- <div class="">
- <div class="widget-box" style="margin-top: 20px;">
- <div class="widget-title">
- <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
- <h5>项目信息</h5>
- </div>
- </div>
- <div class="widget-content" style="padding: 0px;margin-top: 8px;">
- <div>
- <!-- <img src="www.yfzhwlw.com/qxz_photo/default.png" class="equip_photo" width="100%" height="100%" style=""> -->
- <form action="" method="post" id="userPhoto" class="form-horizontal"
- enctype="multipart/form-data">{% csrf_token %}
- <input type="hidden" value="" id="qxzPhotoId" name="id">
- <div class="personal-avatar">
- <div class="top-avatar" id="viewPhotoParent">
- <img id="viewPhoto" class="equip_photo" onclick="$('#uploadPhoto').click()"
- src="" width="100%" height="100%">
- </div>
- <a class="upload-avatar" href="javascript:;">
- <input class="upload-btn" name="upicture"
- onchange="previewImage(this,'viewPhotoParent','viewPhoto','uploadPhoto','100%',200)"
- type="file" id="uploadPhoto">
- </a>
- <!-- <input type="hidden" name="req" value="photo"> -->
- </div>
- </form>
- </div>
- <div class="todo" style="background: white;margin-top: 5px;" id="qxzInfoDiv">
- <ul>
- <li class="clearfix">
- <div class="txt equip_name"> </div>
- </li>
- <li class="clearfix">
- <div class="txt equip_id"> </div>
- </li>
- <li class="clearfix" id="isonline">
- <div class="txt"> </div>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- <!-- 右 -->
- <div class="col-xs-12 col-sm-9 col-md-10">
- <!-- 实时状态 -->
- <div class="currTimeStatus">
- <div class="widget-box" style="margin-top: 0px;">
- <div class="widget-title">
- <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
- <h5>实时状态</h5>
- <div class="equipInfo" id="equipInfo"> </div>
-
- <div class="span5" id="equipCtrlDiv" style="float: right;">
- <button class="btn btn-white btn-primary" id="newDataRefresh" onclick="newDataRefresh()"
- type="button">
- <i class="fa fa-refresh" aria-hidden="true"></i>
- </button>
- <button class="btn btn-white btn-primary" id="setEleName" onclick="setEleName()"
- type="button">
- <i class="fa fa-cog" aria-hidden="true"></i>
- </button>
- <button class="btn btn-white btn-primary" id="updataTime" type="button">2020-03-12
- 13:48:15</button>
- </div>
- <div style="float: right;margin-right:5px;" id="sinCodeInquire">
- <!-- <button class="btn btn-white btn-primary" onclick="inquireSim('89860403101970072488')" id="" type="button">流量查询</button> -->
- </div>
- </div>
- </div>
- </div>
- <!-- <div class="body-content clearfix row" id="newStatusBox"> -->
- <!-- <div class="dev col-xs-4 col-md-3 col-lg-2 bg_lb">
- <div class="left">
- <img class="img-dev" src="{% static '/img/switchBtnIcon.png' %}">
- </div>
- <div class="right">
- <div class="name">风速</div>
- <div class="data">
- <strong>
- <span style="font-size: 25px;">0.0</span>
- </strong>m/s</div>
- </div>
- </div> -->
- <!-- </div> -->
- <div style="position: relative;">
- <!-- Swiper -->
- <div class="swiper-container" style="width:95%;height:120px;">
- <div class="swiper-wrapper" id="newStatusBox">
- <div class="swiper-slide">
- <div class="elValBox">
- <p class="elNum">e1</p>
- <div class="elVal">33</div>
- </div>
- <div class="eLtxt">辐射累积辐射辐射累积辐射辐射累积辐射</div>
- <div class="elUnit">(m j / m ㎡)</div>
- </div>
- </div>
- </div>
- <div class="swiper-button-prev"></div>
- <div class="swiper-button-next"></div>
- </div>
- <!-- 设备手动控制 -->
- <div id="ctrlBoxParentDiv">
- <div class="currTimeStatus">
- <div class="widget-box">
- <div class="widget-title">
- <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
- <h5>设备手动控制</h5>
- <button class="btn btn-white btn-primary qxzDownCtrl" onclick="qxzDownCtrlFun()">
- <i class="fa fa-refresh" aria-hidden="true"></i>
- </button>
- </div>
- </div>
- </div>
- <div class="row handCtrlBox" id="ctrlBox">
- <!-- <div class="col-xs-2">
- <div class="equipCtrl">
- <input type="hidden" value="1">
- <div>
- <span class="isonlineicon active"></span>
- 控制1
- </div>
- <div class="equipCtrlInp">
- <label>
- <input name="switch-field-1" checked class="ace ace-switch ace-switch-4 btn-rotate" type="checkbox">
- <span class="lbl"></span>
- </label>
- </div>
- </div>
- </div> -->
- </div>
- </div>
- <!-- 设备阈值控制 -->
- <div id="getthresholdDivParentDiv">
- <div class="currTimeStatus">
- <div class="widget-box" style="margin-top: 0px;">
- <div class="widget-title">
- <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
- <h5>设备阈值控制</h5>
- <button class="btn btn-white btn-primary qxzDownCtrl" id="" onclick="" type="button">
- <i class="fa fa-refresh" aria-hidden="true"></i>
- </button>
- </div>
- </div>
- </div>
- <div class="row" id="getthresholdDiv">
- <!-- <div class="col-xs-2 col-sm-3">
- <div class="thresholdCtrl">
- <div class="setthresholdBtn" onclick="setthresholdFun(this)">
- <i class="fa fa-cog setName" aria-hidden="true"></i>
- </div>
- <input type="hidden" class="currVal" value='{"JK":1,"eKey":1,"upper":700,"lower":300,"method":1}'>
- <div class="thresholdCtrlName">
- <p>开关1(e1)</p>
- </div>
- <div class="thresholdCtrlShowDiv">
- <div class="qxys">
- <div>
- <img src="{% static '/img/dev/icon_110.png' %}" alt="">
- </div>
- <div>雨量累计</div>
- </div>
- <div class="maxminNum">
- <p>最大值:
- <span>30</span>
- </p>
- <p>最小值:
- <span>10</span>
- </p>
- </div>
- </div>
- <div class="equipCtrlInp">
- <label>
- <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">
- <span class="lbl"></span>
- </label>
- </div>
- </div>
- </div> -->
- </div>
- </div>
- <!-- 设备定时控制 -->
- <div id="timingDivParentDiv">
- <div class="currTimeStatus">
- <div class="widget-box" style="margin-top: 0px;">
- <div class="widget-title">
- <!-- <span class="icon"> <i class="icon-th"></i> </span> -->
- <h5>设备定时控制</h5>
- <button class="btn btn-white btn-primary qxzDownCtrl" id="" onclick="" type="button">
- <i class="fa fa-refresh" aria-hidden="true"></i>
- </button>
- </div>
- </div>
- </div>
- <div class="row" id="gettimingDiv">
- <!-- <div class="col-xs-2 col-sm-3">
- <div class="thresholdCtrl">
- <div class="setthresholdBtn" onclick="timingOnOff(this)">
- <i class="fa fa-cog setName" aria-hidden="true"></i>
- </div>
- <input type="hidden" class="currVal" value='{"JK":1,"StartTime":12,"Duration":10}'>
- <div class="thresholdCtrlName">
- <p>开关1(e1)</p>
- </div>
- <div class="thresholdCtrlShowDiv">
- <div class="maxminNum">
- <p>起始时间:
- <span>12</span>
- 点
- </p>
- <p>工作时长:
- <span>10</span>
- 小时
- </p>
- </div>
- </div>
- <div class="equipCtrlInp">
- <label>
- <input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">
- <span class="lbl"></span>
- </label>
- </div>
- </div>
- </div> -->
- </div>
- </div>
- <!-- 24小时数据 -->
- <div id="data24Div">
- <div class="currTimeStatus">
- <div class="widget-box">
- <div class="widget-title">
- <h5>24小时数据</h5>
- <div class="span5" id="equipCtrlDiv" style="float: right;">
- <button class="btn btn-white btn-primary" onclick="historyData()">历史数据 >></button>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-12 col-md-12 col-lg-9">
- <table id="newtable" class="table table-striped table-hover">
- <tr>
- <td>传感器通道</td>
- <td>通道名称</td>
- <td>最小值</td>
- <td>最小值时间</td>
- <td>最大值</td>
- <td>最大值时间</td>
- </tr>
- <tbody>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- Modal -->
- <div id="Modal" class="model" style="display:none">
- <div>
- <form class="layui-form" action="" id="modelForm" lay-filter="formModel">
- <input type="hidden" value="" name="JK">
- <input type="hidden" value="" name="eKey">
- <div class="layui-form-item">
- <label class="layui-form-label">最大值</label>
- <div class="layui-input-inline">
- <input type="text" name="upper" id="upper" required lay-verify="required" placeholder="请输入最大值"
- autocomplete="off" class="layui-input">
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">最小值</label>
- <div class="layui-input-inline">
- <input type="text" name="lower" required lay-verify="required" placeholder="请输入最小值"
- autocomplete="off" class="layui-input">
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">规 则</label>
- <div class="layui-input-inline">
- <input type="radio" name="method" lay-filter="radioSwitch" value="1" title="程序一" checked="">
- <input type="radio" name="method" lay-filter="radioSwitch" value="0" title="程序二">
- </div>
- <div class="layui-form-mid layui-word-aux" id="hintDiv">低于下限
- <span>开启</span>,高于上限
- <span>关闭</span>
- </div>
- </div>
- </form>
- </div>
- </div>
- <!-- Modal2 -->
- <div id="timingOnOffModal" class="model" style="display:none">
- <div>
- <form class="layui-form" action="" id="modelForm" lay-filter="formModel">
- <input type="hidden" value="" name="JK">
- <div class="layui-form-item">
- <label class="layui-form-label">起始时间:</label>
- <div class="layui-input-inline">
- <input type="number" name="StartTime" id="starttime" required
- lay-verify="required|starttimeRegex" placeholder="请输入起始时间" autocomplete="off"
- class="layui-input">
- <!-- <select name="city" lay-verify="">
- <option value="">请选择一个城市</option>
- <option value="010">北京</option>
- <option value="021">上海</option>
- <option value="0571">杭州</option>
- </select>
- <select name="city" lay-verify="required">
- <option value=""></option>
- <option value="0">北京</option>
- <option value="1">上海</option>
- <option value="2">广州</option>
- <option value="3">深圳</option>
- <option value="4">杭州</option>
- </select> -->
- </div>
- <div class="layui-form-mid layui-word-aux">时间范围(0-23)</div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">工作时长:</label>
- <div class="layui-input-inline">
- <input type="number" name="Duration" id="Duration" required lay-verify="required|durationRegex"
- placeholder="请输入工作时长" autocomplete="off" class="layui-input">
- </div>
- <div class="layui-form-mid layui-word-aux">工作时长(1-24)</div>
- </div>
- </form>
- </div>
- </div>
- <!-- setEleName -->
- <div id="eleName" style="width:800px;display:none">
- <div style="width:95%;margin:0 auto;">
- <table class="layui-hide" id="eleTable" lay-filter="eleTable"></table>
- </div>
- </div>
- <!-- 管理员查看设备电压历史记录 -->
- <div id="record" style="display: none;">
- <div style="padding: 20px;width: 500px;float: left;">
- <table id="recordTable" lay-filter="recordTableFilter"></table>
- <div id="recordPage"></div>
- </div>
- <div style="margin-left: 480px;padding: 20px;">
- <div id="recordEcharts" style="height: 450px;width: 500px;"></div>
- </div>
- </div>
- {% verbatim %}
- <script type="text/html" id="switchTpl">
- <!-- 这里的 checked 的状态只是演示 -->
- <input type="checkbox" name="equipType" value="{{d.type}}" lay-skin="switch" lay-text="大于|小于"
- lay-filter="equipTypeDemo" {{ d.type == 1 ? 'checked' : '' }}>
- </script>
- {% endverbatim %}
- <script src="{% static '/lib/js/jquery-2.1.4.min.js' %}"></script>
- <script src="{% static '/lib/bootstrap-3.3.7/js/bootstrap.js' %}"></script>
- <script src="{% static '/lib/layui/layui.all.js' %}"></script>
- <script src="{% static '/js/common.js' %}?versions=0.5.4"></script>
- <script src="{% static '/lib/js/echarts.min.js' %}"></script>
- <script src="{% static '/lib/js/swiper.min.js' %}"></script>
- <script type="text/javascript">
- $.ajaxSetup({
- data: { csrfmiddlewaretoken: '{{ csrf_token }}' },
- });
- </script>
- <script>
- var swiperWidth = $('.swiper-container').width();
- var swiperCount = Math.floor(swiperWidth/130);
-
- //默认加载设备列表
- getEquipList(1, '');
- // 搜索
- $('#searchBtn').on('click', function () {
- getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
- });
- $('#searchImei').on('keyup', function (event) {
- if (event.keyCode == 13) {
- getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
- }
- })
- function getEquipList(page, filter, is_online, etype) {
- if (etype == undefined && is_online == undefined) {
- var etype = ''
- var is_online = ''
- }
- $.ajax({
- url: 'qxz_page',
- type: 'get',
- dataType: 'json',
- data: {
- page: page,
- f_id: filter,
- etype: etype, //所属公司
- is_online: is_online, //设备状态
- },
- beforeSend: function (XMLHttpRequest) {
- loadingFlag = layer.load();
- },
- success: function (data) {
- layer.close(loadingFlag);
- if (data.nums) {
- var html = '';
- var msg = data.ids
- var pagecount = Math.ceil(data.nums / 10);
- for (var i = 0; i < msg.length; i++) {
- if (msg[i].equip_name) {
- var equip_name = '设备:' + msg[i].equip_name;
- } else if (msg[i].equip_id.length == 15) {
- var equip_name = '设备:' + msg[i].equip_id.substring(msg[i].equip_id.length - 8);
- } else {
- var equip_name = '设备:' + msg[i].equip_id;
- }
- var offTime = msg[i].off_time || '';
- if (msg[i].is_online == 1) {
- var classStatic = 'bjgreen';
- } else if (msg[i].is_online == 0) {
- var classStatic = 'bjred';
- } else {
- var classStatic = '';
- }
- // var equip_name = msg[i].equip_name?'---设备名:'+msg[i].equip_name:'';
- 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>'
- }
- $('#firstpane .menu_body').html(html);
- $('.equipPage').show();
- $('#totelpage').html(pagecount)
- // 菜单栏
- $("#firstpane .menu_body:eq(0) a:eq(0)").addClass('menu-active');
- $('.widget-content .equip_id').html('设备ID:' + msg[0].equip_id);
- $('.widget-content .equip_name').html('项目名称:' + (msg[0].equip_name || '设备' + msg[0].equip_id));
- $(".menu_body a").click(function () {
- $(".menu_head").removeClass("currAstive");
- $(".menu_body a").removeClass("menu-active");
- $(this).addClass("menu-active");
- $(this).parent().prev().addClass('currAstive');
- // 名称切换
- $('.widget-content .equip_id').html('设备ID:' + $(this).attr('id'));
- $('.widget-content .equip_name').html('项目名称:' + ($(this).attr('name') || '设备' + $(this).attr('id')));
- var facId = $(this).attr("id");
- var currisonline = $(this).attr("isonline");
- var curroffTime = $(this).attr("offTime");
- if (currisonline == 0) {
- $('#isonline').show();
- $('#isonline div').html('离线时间:' + curroffTime);
- } else {
- $('#isonline').hide();
- }
- if (facId && facId != null && facId != "") {
- loadProject(facId);
- $('#qxzPhotoId').val(facId);
- }
- });
- loadProject(msg[0].equip_id);
- if (msg[0].is_online == 0) {
- $('#isonline').show();
- $('#isonline div').html('离线时间:' + (msg[0].off_time || ''));
- } else {
- $('#isonline').hide();
- }
- $('#qxzPhotoId').val(msg[0].equip_id)
- } else {
- $('.equipPage').hide();
- var html = '<a href="javascript:;" class="text-overflow nulldata" data-pid="322">暂未设备</a>'
- $('#firstpane .menu_body').html(html);
- scrollBar()
- }
- },
- error: function (type) {
- layer.close(loadingFlag);
- }
- })
- }
- var nowledinfo;
- // 查询SIM卡
- function inquireSim(iccid) {
- $.ajax({
- url: 'siminfo',
- type: 'post',
- dataType: 'json',
- data: {
- simid: iccid,
- },
- beforeSend: function (XMLHttpRequest) {
- //注意,layer.msg默认3秒自动关闭,如果数据加载耗时比较长,需要设置time
- loadingFlag = layer.msg('请求中,请稍候……', { icon: 16, shade: 0.01, shadeClose: false, time: 60000 });
- },
- success: function (data) {
- var dat = data.data;
- if (data.code == 0) {
- var status;
- if (dat.account_status == "0") {
- status = "未知";
- } else if (dat.account_status == "1") {
- status = "测试期";
- } else if (dat.account_status == "2") {
- status = "沉默期";
- } else if (dat.account_status == "3") {
- status = "使用中";
- } else if (dat.account_status == "4") {
- status = "停机";
- } else if (dat.account_status == "5") {
- status = "停机保号";
- } else if (dat.account_status == "6") {
- status = "预销号";
- } else if (dat.account_status == "7") {
- status = "销号";
- }
- var usage;
- if (dat.iccid) {
- usage = dat.data_usage;
- } else {
- usage.innerHTML = '--';
- }
- var balance;
- if (dat.iccid) {
- balance = dat.data_balance;
- } else {
- balance = '--';
- }
- var time;
- if (dat.iccid) {
- var timestamp4 = new Date(dat.expiry_date * 1000);//直接用 new Date(时间戳) 格式转化获得当前时间
- time = timestamp4.toLocaleDateString().replace(/\//g, "-") + " " + timestamp4.toTimeString().substr(0, 8);
- } else {
- time = '--';
- }
- layer.close(loadingFlag);
- layer.open({
- type: 1
- , title: false //不显示标题栏
- , skin: 'layui-layer-simCode' //样式类名
- , closeBtn: false
- , area: '300px;'
- , shade: 0.8
- , id: 'simCode' //设定一个id,防止重复弹出
- , btn: ['我知道了']
- , btnAlign: 'c'
- , moveType: 1 //拖拽模式,0或者1
- , 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>'
- , success: function (layero) {
- }
- });
- } else {
- layer.msg(data.msg);
- }
- }
- })
- }
-
- //在线状态筛选
- $('#selectId').on('change', function () {
- getEquipList(1, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
- })
- //设备状态
- function loadProject(facId) {
- $.ajax({
- url: 'qxz_status',
- type: 'post',
- dataType: 'json',
- data: {
- e_id: facId,
- },
- beforeSend: function (XMLHttpRequest) {
- loadingFlag = layer.load();
- },
- success: function (data) {
- layer.close(loadingFlag);
- nowledinfo = data.ledinfo
- // 实时状态
- newStatus('newStatusBox', data, facId);
- $('#updataTime').html(data.base.upl_time || '暂无上传数据');
- if (data.base.qxz_picture) {
- $('#viewPhoto').attr('src', 'http://120.27.222.26/' + data.base.qxz_picture);
- } else {
- $('#viewPhoto').attr('src', 'http://120.27.222.26/' + 'qxz_photo/default.jpg');
- }
- addCtrlBtn(data.qxz_switch, data.switch_name);
- if (data.qxz_switch && (data.qxz_switch.length != 2)) {
- $('#ctrlBoxParentDiv').show();
- $('#getthresholdDivParentDiv').show();
- $('#timingDivParentDiv').show();
- $('#data24Div').hide();
- gettimimgFun(data);
- getthresholdFun(data);
- scrollBar()
- } else { // 无开关显示24小时数据
- $('#ctrlBoxParentDiv').hide();
- $('#getthresholdDivParentDiv').hide();
- $('#timingDivParentDiv').hide();
- $('#data24Div').show();
- get24Data(facId)
- scrollBar()
- }
- },
- error: function (type) {
- layer.close(loadingFlag);
- }
- })
- }
- // 阈值请求
- function getthresholdFun(data) {
- if (data.auto_list.length > 2) {
- var switchData = eval('(' + data.auto_list + ')');
- var qxz_switch = eval('(' + data.qxz_switch + ')');
- // var qxz_list = data.new_data;
- if (data.switch_name.length > 2) {
- var switch_name = eval('(' + data.switch_name + ')');
- } else {
- var switch_name = [];
- }
- } else {
- var switchData = [];
- // var qxz_list = [];
- var switch_name = [];
- }
- if (switchData.length) {
- var html = '';
- for (var i = 0; i < switchData.length; i++) {
- if (switchData[i].JK != 255) {
- if (switchData[i].upper == 32767 || switchData[i].lower == 32767) {
- var check = false;
- } else {
- var check = true;
- }
- // 判断通道号
- if (!isNaN(switchData[i].eKey)) {
- var eknum = switchData[i].eKey + 1;
- var ek = 'e' + eknum;
- } else {
- var ek = switchData[i].eKey;
- }
- // 开关名
- if (switchData[i].JK == qxz_switch[i].JK) {
- if (switch_name.length > 2) {
- if (switch_name[i].name) {
- var name = switch_name[i].name;
- } else {
- var name = '开关' + qxz_switch[i].JK;
- }
- } else {
- var name = '开关' + qxz_switch[i].JK;
- }
- } else {
- var name = timingData[i].JK;
- }
- if (data.dat[ek]) {
- var eNum = data.dat[ek].split('#')[1];
- var txt = data.conf[ek].split('#')[0];
- html += '<div class="col-xs-6 col-sm-4"><div class="thresholdCtrl">' +
- '<div class="setthresholdBtn" onclick="setthresholdFun(this)">' +
- '<i class="fa fa-cog setName" aria-hidden="true"></i></div>' +
- '<input type="hidden" class="currVal" value=\'' + JSON.stringify(switchData[i]) + '\'>' +
- '<div class="thresholdCtrlName"><p>' + name + '(通道' + switchData[i].eKey + ')</p></div>' +
- '<div class="thresholdCtrlShowDiv"><div class="qxys"><div>' +
- '<img src="http://www.yfzhwlw.com/static/img/dev/icon_' + eNum + '.png" alt=""></div>' +
- '<div>' + txt + data.conf[ek].split('#')[1] + '</div></div><div class="maxminNum"><p>最大值:<span>' + switchData[i].upper + '</span></p>' +
- '<p>最小值:<span>' + switchData[i].lower + '</span></p></div></div><div class="equipCtrlInp">';
- if (check) {
- html += '<label><input name="switch-field-1" class="ace ace-switch ace-switch-6" checked="checked" type="checkbox">' +
- '<span class="lbl"></span></label></div></div></div>';
- } else {
- html += '<label><input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">' +
- '<span class="lbl"></span></label></div></div></div>';
- }
- }
- }
- if (i == switchData.length - 1) {
- if (html) {
- $('#getthresholdDiv').html(html)
- } else {
- $('#getthresholdDiv').html('<div style="text-align:center">空</div>')
- }
- }
- }
- } else {
- $('#getthresholdDiv').html('<div style="text-align:center">空</div>')
- }
- }
- // 定时请求
- function gettimimgFun(data) {
- var switch_name = data.switch_name;
- var qxz_switch = data.qxz_switch;
- if (data.timing_list.length) {
- var timingData = eval('(' + data.timing_list + ')');
- var qxz_switch = eval('(' + data.qxz_switch + ')');
- var qxz_list = data.qxz_list;
- if (switch_name.length > 2) {
- var switch_name = eval('(' + switch_name + ')');
- } else {
- var switch_name = [];
- }
- } else {
- var timingData = [];
- var qxz_list = [];
- var switch_name = [];
- }
- if (timingData.length) {
- var html = '';
- for (var i = 0; i < timingData.length; i++) {
- if (timingData[i].JK != 255) {
- if (timingData[i].Duration == 32767 || timingData[i].StartTime == 32767) {
- var check = false;
- var curCheckedVal = {
- JK: timingData[i].JK,
- StartTime: '--',
- Duration: '--'
- }
- var startTime = '--';
- var duration = '--';
- } else {
- var check = true;
- var curCheckedVal = {
- JK: timingData[i].JK,
- StartTime: timingData[i].StartTime,
- Duration: timingData[i].Duration
- }
- var startTime = timingData[i].StartTime;
- var duration = timingData[i].Duration;
- }
- if (timingData[i].JK == qxz_switch[i].JK) {
- if (switch_name.length > 2) {
- if (switch_name[i].name) {
- var name = switch_name[i].name;
- } else {
- var name = '开关' + qxz_switch[i].JK;
- }
- } else {
- var name = '开关' + qxz_switch[i].JK;
- }
- } else {
- var name = timingData[i].JK;
- }
- html += '<div class="col-xs-6 col-sm-4"><div class="thresholdCtrl">' +
- '<div class="setthresholdBtn" onclick="timingOnOff(this)">' +
- '<i class="fa fa-cog setName" aria-hidden="true"></i></div>' +
- '<input type="hidden" class="currVal" value=\'' + JSON.stringify(curCheckedVal) + '\'>' +
- '<div class="thresholdCtrlName"><p>' + name + '</p></div>' +
- '<div class="thresholdCtrlShowDiv"><div class="maxminNum">' +
- '<p>起始时间:<span>' + startTime + '</span>点</p><p>工作时长:<span>' + duration + '</span>小时</p>' +
- '</div></div><div class="equipCtrlInp"><label>';
- if (check) {
- html += '<input name="switch-field-1" checked class="ace ace-switch ace-switch-6" type="checkbox">' +
- '<span class="lbl"></span></label></div></div></div>';
- } else {
- html += '<input name="switch-field-1" class="ace ace-switch ace-switch-6" type="checkbox">' +
- '<span class="lbl"></span></label></div></div></div>';
- }
- }
- if (i == timingData.length - 1) {
- if (html) {
- $('#gettimingDiv').html(html)
- } else {
- $('#gettimingDiv').html('<div style="text-align:center">空</div>')
- }
- }
- }
- } else {
- $('#gettimingDiv').html('<div style="text-align:center">空</div>')
- }
- }
- // 控制按钮
- function addCtrlBtn(data, switch_name) {
- if (data && switch_name.length > 2) {
- var data = eval('(' + data + ')');
- var ctrl_name = eval('(' + switch_name + ')');
- $('.qxzDownCtrl').show();
- } else if (data) {
- var data = eval('(' + data + ')');
- var ctrl_name = [];
- } else {
- var data = []
- $('.qxzDownCtrl').hide();
- }
- if (data.length) {
- var html = '';
- for (var i = 0; i < data.length; i++) {
- if (data[i].status == 0) {
- var curClass = '';
- } else {
- var curClass = 'active';
- }
- if (data[i].status == 0) {
- var curChecked = ''; //关
- } else {
- var curChecked = 'checked';
- }
- if (ctrl_name.length) {
- if (ctrl_name[i].name != '') {
- var switch_name = ctrl_name[i].name;
- } else {
- var switch_name = '开关' + ctrl_name[i].JK;
- }
- } else {
- var switch_name = '开关' + data[i].JK;
- }
- html += '<div class="col-xs-2"><div class="equipCtrl"><input type="hidden" class="currStutas" value="' + data[i].JK + '">' +
- '<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">' +
- '<label><input name="switch-field-1" ' + curChecked + ' class="ace ace-switch ace-switch-4 btn-rotate" type="checkbox">' +
- '<span class="lbl"></span></label></div></div></div>';
- if (i == data.length - 1) {
- $('#ctrlBox').html(html);
- }
- }
- } else {
- $('#ctrlBox').html('<div style="text-align:center">空</div>');
- }
- }
- $('#ctrlBox').on('click', '.btn-rotate', function () {
- var _this = this;
- $(this).parents('.equipCtrl').find('.ctrlLoading').remove()
- $(this).attr('disabled', true);
- $(this).parents('.equipCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
- var currWay = $(this).parents('.equipCtrl').find('.currStutas').val();
- var imei = $('#qxzPhotoId').val();
- if ($(this).is(":checked")) {
- var oldStatus = 0;
- var currStutas = 1;
- } else {
- var oldStatus = 1;
- var currStutas = 0;
- }
- $.ajax({
- url: 'qxz_switch',
- type: 'post',
- data: {
- 'req': 'set',
- 'imei': imei,
- 'way': currWay,
- 'switch': currStutas
- },
- success: function (data) {
- setTimeout(function () {
- var id = $('#firstpane .menu-active').attr('id')
- loadProject(id);
- }, 5000)
- // $(_this).attr('disabled', false);
- // $(_this).parents('.equipCtrl').find('.ctrlLoading').html('');
- // if (currStutas) {
- // $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
- // } else {
- // $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
- // }
- },
- error: function (type) {
- layer.close(loadingFlag);
- $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
- $(_this).attr('disabled', false);
- if (oldStatus) {
- $(_this).prop('checked', true);
- $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
- } else {
- $(_this).prop('checked', '');
- $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
- }
- }
- })
- })
- // 下发控制名称
- $('#ctrlBox').on('click', '.setName', function () {
- var _this = this;
- var ele = $(this).parents('.equipCtrl').find('.numName');
- var currWay = $(this).parents('.equipCtrl').find('.currStutas').val();
- layui.use('layer', function () {
- var layer = layui.layer;
- layer.prompt({ title: '自定义名称', offset: '300px', formType: 0, value: ele.html(), maxlength: 10 }, function (text, index) {
- if (text == ele.html()) {
- return false;
- layer.close(index);
- layer.msg('演示完毕!您的口令:' + text);
- ele.html(text)
- }
- $.ajax({
- url: 'qxz_switch_name',
- type: 'post',
- data: {
- 'imei': $('#qxzPhotoId').val(),
- 'way': currWay,
- 'sw_name': text
- },
- success: function (data) {
- if (data == 0) {
- ele.html(text)
- }
- layer.close(index);
- },
- error: function (type) {
- $(_this).parents('.equipCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
- $(_this).attr('disabled', false);
- if (oldStatus) {
- $(_this).prop('checked', true);
- $(_this).parents('.equipCtrl').find('.isonlineicon').addClass('active')
- } else {
- $(_this).prop('checked', '');
- $(_this).parents('.equipCtrl').find('.isonlineicon').removeClass('active')
- }
- }
- })
- });
- });
- })
- // 获取最新控制按钮状态
- function qxzDownCtrlFun() {
- $.ajax({
- url: 'qxz_switch',
- type: 'post',
- data: {
- 'req': 'conf', //
- 'imei': $('#qxzPhotoId').val(),
- },
- beforeSend: function () {
- loadFlage = layer.load();
- },
- complete: function () {
- setTimeout(function () {
- layer.close(loadFlage);
- }, 5000)
- },
- success: function (data) {
- setTimeout(function () {
- loadProject($('#qxzPhotoId').val())
- }, 5000)
- }
- })
- }
- // 获取最新数据
- function newDataRefresh() {
- $.ajax({
- url: 'qxz_switch',
- type: 'post',
- data: {
- 'req': 'read',
- 'imei': $('#qxzPhotoId').val(),
- },
- beforeSend: function () {
- loadFlage = layer.load();
- },
- complete: function () {
- setTimeout(function () {
- layer.close(loadFlage);
- }, 5000)
- },
- success: function (data) {
- setTimeout(function () {
- loadProject($('#qxzPhotoId').val())
- }, 5000)
- }
- })
- }
- // 设备列表
- var currpage = 1;
- function changePage(symbol) {
- var totelpage = Number($('#totelpage').html());
- if (symbol == 'add') {
- if (currpage < totelpage) {
- currpage++;
- $('#currentpage').html(currpage);
- $('#jumpPage').val(currpage);
- $('addPage').attr('disable', 'false')
- } else {
- $('addPage').attr('disable', 'true')
- return false;
- }
- } else if (symbol == 'jian') {
- if (currpage > 1) {
- currpage--;
- $('#currentpage').html(currpage);
- $('#jumpPage').val(currpage);
- $('jianPage').attr('disable', 'false')
- } else {
- $('jianPage').attr('disable', 'true')
- return false;
- }
- } else if (symbol == 'jump') {
- var jumpPage = $('#jumpPage').val();
- if (jumpPage <= totelpage && jumpPage > 0) {
- currpage = jumpPage;
- } else if (jumpPage > totelpage) {
- currpage = totelpage;
- } else if (jumpPage < 0) {
- currpage = 1;
- }
- $('#jumpPage').val(currpage);
- $('#currentpage').html(currpage);
- }
- getEquipList(currpage, $('#searchImei').val(), $('#selectId').val(), $('#selectIdA').val())
- }
- // 首页
- function gotofirstpage() {
- currpage = 1;
- $('#currentpage').html(1);
- $('#jumpPage').val(1);
- getEquipList(1, $('#searchImei').val())
- }
- // 定时刷新
- // msgInterval = setInterval(function () {
- // var currid = $('#firstpane .menu-active').attr('id');
- // loadProject(currid);
- // }, 60000);
- var waterTempId = [16062009, 16062010, 16062011, 16062012, 16062013, 16062014, 16062015, 16062016, 16062017, 16062018, 16062019, 16062020, 16062021, 16062022, 16062023, 16062024, 16062025];
- // 实时状态
- function newStatus(statusBox, data, facId) {
- var dat = data.dat;
- var html = '';
- $(document.getElementById(statusBox)).html('');
- var random = ['bg_blue', 'bg_yellow', 'bg_green', 'bg_red', 'bg_purpol', 'bg_darkblue']; //颜色随机
- if (Object.keys(dat).length) {
- for (var i = 1; i < 31; i++) {
- var ekeyNum = 'e' + i;
- if (dat[ekeyNum] != '' && (parseInt(dat[ekeyNum].split('#')[1]) != 163)) {
- if (dat[ekeyNum].split('#')[0] == -99.99) {
- var eVal = 'N/A';
- } else {
- if(dat[ekeyNum].split('#')[1] == 117){ //判断是否是雨雪天气
- var eVal = dat[ekeyNum].split('#')[0]?'有':'无';
- }else{
- var eVal = dat[ekeyNum].split('#')[0];
- }
- }
- var eNum = dat[ekeyNum].split('#')[1];
- var ekey = dat[ekeyNum].split('#')[2];
- var colorClass = eNum % 4;
- // if(Object.keys(data.conf).length){
- var eTxtUnit = data.conf[ekeyNum].split('#')[0];
- var eUnit = data.conf[ekeyNum].split('#')[1];
- // }
- html += '<div class="swiper-slide"><div class="elValBox ' + random[colorClass] + '">'+
- '<p class="elNum">'+ekey+'</p><div class="elVal">'+eVal+'</div></div>'+
- '<div class="eLtxt">'+eTxtUnit+'</div><div class="elUnit">'+eUnit+'</div></div>';
- }
- }
- }
- if (html) {
- $(document.getElementById(statusBox)).append(html);
- var swiper = new Swiper('.swiper-container', {
- slidesPerView: swiperCount,
- spaceBetween: 30,
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev',
- },
- });
- } else {
- html = '<div style="text-align:center">空</div>';
- $(document.getElementById(statusBox)).append(html);
- // $('.widget-content .equip_name').html('');
- // var id = $('#firstpane .menu-active').attr('id')
- // $('.widget-content .equip_id').html('设备ID:' + id);
- // $('#viewPhoto').attr('src', 'qxz_photo/default.jpg');
- // scrollBar()
- }
- scrollBar()
- }
- // 24小时数据
- function get24Data(facId) {
- $.ajax({
- url: 'qxz_day_data',
- type: 'post',
- dataType: 'json',
- data: {
- e_id: facId,
- },
- beforeSend: function (XMLHttpRequest) {
- loadingFlag = layer.load();
- },
- success: function (data) {
- layer.close(loadingFlag);
- $("#newtable tr:not(:first)").remove();
- if (data.data.length) {
- Fill_Table('newtable', data, facId)
- } else {
- Fill_null_Table('newtable', data, facId)
- }
- },
- error: function (type) {
- layer.close(loadingFlag);
- layer.msg('请求失败');
- $("#newtable tr:not(:first)").remove();
- }
- })
- }
- function Fill_Table(table_id, data, facId) {
- var dat = data.data;
- //js循环读取json数据
- var table = document.getElementById(table_id).children[1];
- for (var i = 0; i < dat.length; i++) {
- var row = table.insertRow(table.rows.length);
- var c1 = row.insertCell(0);
- c1.innerHTML = dat[i].ekey;
- var c2 = row.insertCell(1);
- var eNum = dat[i].enum
- var elementName = data.conf[dat[i].ekey].split('#');
- c2.innerHTML = elementName[0] + '(' + elementName[1] + ')';
- var c3 = row.insertCell(2);
- if (dat[i].min == -99.99) {
- c3.innerHTML = 'N/A';
- } else {
- if(eNum[0] == 117){
- c3.innerHTML = dat[i].min?'有':'无';
- }else{
- c3.innerHTML = dat[i].min;
- }
- }
- var c4 = row.insertCell(3);
- var min_time = dat[i].mintime;
- c4.innerHTML = min_time;
- var c5 = row.insertCell(4);
- if (dat[i].max == -99.99) {
- c5.innerHTML = 'N/A';
- } else {
- if(eNum[0] == 117){
- c5.innerHTML = dat[i].max?'有':'无';
- }else{
- c5.innerHTML = dat[i].max;
- }
- }
- var c6 = row.insertCell(5);
- var max_time = dat[i].maxtime;
- c6.innerHTML = max_time;
- if (i == dat.length - 1) {
- scrollBar()
- }
- }
- }
- function Fill_null_Table(table_id) {
- var table = document.getElementById(table_id).children[1];
- var row = table.insertRow(table.rows.length);
- var c1 = row.insertCell(0);
- c1.setAttribute('colspan', '16');
- c1.setAttribute('class', 'nullData');
- c1.innerHTML = "暂无数据";
- scrollBar()
- }
- window.onresize = function () {
- swiperWidth = $('.swiper-container').width();
- swiperCount = Math.floor(swiperWidth/130);
- swiper = new Swiper('.swiper-container', {
- slidesPerView: swiperCount,
- spaceBetween: 30,
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev',
- },
- });
- scrollBar()
- }
- // file 文件
- // divId div id
- // imgId 图片id
- // fileId 文件id
- // width 图片宽
- // height 图片高
- function previewImage(file, divId, imgId, fileId, width, height) {
- width = $('#viewPhotoParent').width();
- var div = document.getElementById(divId);
- if (file.files && file.files[0]) {
- if (file.files[0].size / 1024 / 1024 < 4) {
- sendUserPhoto();
- div.innerHTML = '<img id=' + imgId + ' onclick=$("#' + fileId + '").click()>';
- var img = document.getElementById(imgId);
- img.onload = function () {
- // var rect = clacImgZoomParam(width, height, img.offsetWidth, img.offsetHeight);
- img.width = width;
- img.height = height;
- // img.style.marginTop = rect.top+'px';
- }
- var reader = new FileReader();
- reader.onload = function (evt) {
- img.src = evt.target.result;
- // $(window.parent.document).find('.nav-user-photo').attr('src',evt.target.result);
- }
- reader.readAsDataURL(file.files[0]);
- // $('#userPhoto').submit();
- } else {
- $(file).val('');
- layer.alert("图片过大!");
- }
- } else {//兼容IE
- var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
- file.select();
- if (document.selection != undefined) {
- var src = document.selection.createRange().text;
- div.innerHTML = '<img id=' + imgId + '>';
- var img = document.getElementById(imgId);
- img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
- var rect = clacImgZoomParam(width, height, img.offsetWidth, img.offsetHeight);
- status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height);
- div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;" + sFilter + src + "\"'></div>";
- }
- }
- }
- function clacImgZoomParam(maxWidth, maxHeight, width, height) {
- var param = { top: 0, left: 0, width: width, height: height };
- if (width > maxWidth || height > maxHeight) {
- var rateWidth = width / maxWidth;
- var rateHeight = height / maxHeight;
- if (rateWidth > rateHeight) {
- param.width = maxWidth;
- param.height = Math.round(height / rateWidth);
- } else {
- param.width = Math.round(width / rateHeight);
- param.height = maxHeight;
- }
- }
- param.left = Math.round((maxWidth - param.width) / 2);
- param.top = Math.round((maxHeight - param.height) / 2);
- return param;
- }
- // 上传图片
- function sendUserPhoto() {
- var formData = new FormData($("#userPhoto")[0]);
- $.ajax({
- url: 'qxz_photo',
- type: 'POST',
- data: formData,
- contentType: false,
- processData: false,
- success: function (data) {
- if (data == 0) {
- $(window.parent.document).find('.nav-user-photo').attr('src', $('#viewPhoto').prop('src'));
- $('#uploadPhoto').val('');
- }
- else { layer.msg("上传失败!"); return false; }
- }
- });
- }
- // 设置阈值
- function setthresholdFun(ele) {
- var obj = $(ele);
- var currValstr = obj.next().val();
- var currVal = eval('(' + currValstr + ')');
- layui.use(['layer', 'form'], function () {
- var rule0 = "低于下限<span>开启</span>,高于上限<span>关闭</span>";
- var rule1 = "低于下限<span>关闭</span>,高于上限<span>开启</span>";
- var layer = layui.layer;
- var form = layui.form;
- //给表单赋值
- form.val("formModel", {
- "JK": currVal.JK
- , "eKey": currVal.eKey
- , "upper": currVal.upper
- , "lower": currVal.lower
- , "method": currVal.method
- });
- if (currVal.method == 1) {
- $('#hintDiv').html(rule1)
- } else {
- $('#hintDiv').html(rule0)
- }
- form.on('radio(radioSwitch)', function (data) {
- if (data.value == 1) {
- $('#hintDiv').html(rule1)
- } else {
- $('#hintDiv').html(rule0)
- }
- });
- layer.open({
- type: 1,
- title: '阈值设置',
- offset: '380px',
- btn: ['确定', '取消'],
- area: ['600px', '300px'], //宽高
- content: $('#Modal'),
- success: function (layero, index) { // 成功弹出后回调
- // 添加form标识
- layero.addClass('layui-form');
- // 将保存按钮改变成提交按钮
- layero.find('.layui-layer-btn0').attr({
- 'lay-filter': 'setYuzhi',
- 'lay-submit': ''
- });
- },
- yes: function (index, layero) {
- form.on('submit(setYuzhi)', function (data) {
- var dat = data.field;
- if (parseInt(data.field.upper) < parseInt(data.field.lower)) {
- layer.tips('最大值不能小于最小值!', $('#upper'));
- return false;
- }
- var hideVal = JSON.stringify(data.field)
- var id = $('#firstpane .menu-active').attr('id')
- data.field.equip_id = id;
- var curinputBtn = obj.parent().find('.ace-switch');
- if (curinputBtn.is(":checked")) {
- var oldStatus = 0;
- var currStutas = 1;
- } else {
- var oldStatus = 1;
- var currStutas = 0;
- }
- obj.parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
- $.ajax({
- url: 'qxz_value_mqtt',
- type: 'post',
- data: data.field,
- success: function (data) {
- setTimeout(function () {
- curinputBtn.attr('disabled', false);
- curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('');
- obj.parent().find('.maxminNum').find('p').eq(0).find('span').html(dat.upper)//最大值
- obj.parent().find('.maxminNum').find('p').eq(1).find('span').html(dat.lower)//最小值
- obj.parents('.thresholdCtrl').find('.ace-switch').prop('checked', 'checked');//开启阈值
- var id = $('#firstpane .menu-active').attr('id')
- loadProject(id);
- }, 5000)
- },
- error: function (type) {
- curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
- curinputBtn.attr('disabled', false);
- }
- })
- // $('.maxminNum')
- layer.closeAll(); //疯狂模式,关闭所有层
- return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
- });
- }
- , btn2: function (index, layero) {
- $('#Modal').hide()
- //return false 开启该代码可禁止点击该按钮关闭
- }
- });
- });
- }
- // 下发阈值控制
- $('#getthresholdDiv').on('click', '.ace-switch', function () {
- var _this = this;
- $(this).parents('.thresholdCtrl').find('.ctrlLoading').remove()
- $(this).attr('disabled', true);
- $(this).parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
- var currVal = $(this).parents('.thresholdCtrl').find('.currVal').val();
- var currWayjson = JSON.parse(currVal);
- var id = $('#firstpane .menu-active').attr('id')
- currWayjson.equip_id = id;
- if ($(this).is(":checked")) { //开启
- var oldStatus = 0;
- var currStutas = 1;
- } else { //关闭
- var oldStatus = 1;
- var currStutas = 0;
- currWayjson.upper = '32767';
- currWayjson.lower = '32767';
- }
- $.ajax({
- url: 'qxz_value_mqtt',
- type: 'post',
- data: currWayjson,
- success: function (data) {
- setTimeout(function () {
- $(_this).attr('disabled', false);
- $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('');
- var id = $('#firstpane .menu-active').attr('id')
- loadProject(id);
- }, 5000)
- },
- error: function (type) {
- $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
- $(_this).attr('disabled', false);
- if (oldStatus) {
- $(_this).prop('checked', true);
- } else {
- $(_this).prop('checked', '');
- }
- }
- })
- })
- // 定时开关
- function timingOnOff(ele) {
- var obj = $(ele);
- var currValstr = obj.next().val();
- var currVal = eval('(' + currValstr + ')');
- layui.use(['layer', 'form'], function () {
- var layer = layui.layer;
- var form = layui.form;
- form.verify({
- starttimeRegex: function (value, item) { //value:表单的值、item:表单的DOM对象
- if (value < 0 || value > 23) {
- return '请输入范围内数值';
- }
- },
- durationRegex: function (value, item) { //value:表单的值、item:表单的DOM对象
- if (value < 1 || value > 24) {
- return '请输入范围内数值';
- }
- }
- });
- //给表单赋值
- form.val("formModel", {
- "JK": currVal.JK
- , "StartTime": currVal.StartTime
- , "Duration": currVal.Duration
- });
- layer.open({
- type: 1,
- title: '阈值设置',
- offset: '380px',
- btn: ['确定', '取消'],
- area: ['600px', '300px'], //宽高
- content: $('#timingOnOffModal'),
- success: function (layero, index) { // 成功弹出后回调
- // 添加form标识
- layero.addClass('layui-form');
- // 将保存按钮改变成提交按钮
- layero.find('.layui-layer-btn0').attr({
- 'lay-filter': 'setdingshi',
- 'lay-submit': ''
- });
- },
- yes: function (index, layero) {
- form.on('submit(setdingshi)', function (data) {
- var hideVal = JSON.stringify(data.field)
- var dat = data.field;
- var curinputBtn = obj.parent().find('.ace-switch');
- if (curinputBtn.is(":checked")) {
- var oldStatus = 0;
- var currStutas = 1;
- } else {
- var oldStatus = 1;
- var currStutas = 0;
- }
- var id = $('#firstpane .menu-active').attr('id')
- dat.equip_id = id;
- obj.parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
- $.ajax({
- url: 'qxz_timing_mqtt',
- type: 'post',
- data: dat,
- success: function (data) {
- setTimeout(function () {
- obj.next().val(hideVal)
- curinputBtn.attr('disabled', false);
- curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('');
- obj.parent().find('.maxminNum').find('p').eq(0).find('span').html(dat.StartTime)//最大值
- obj.parent().find('.maxminNum').find('p').eq(1).find('span').html(dat.Duration)//最小值
- obj.parents('.thresholdCtrl').find('.ace-switch').prop('checked', 'checked');//开启阈值
- var id = $('#firstpane .menu-active').attr('id')
- loadProject(id);
- }, 5000)
- },
- error: function (type) {
- curinputBtn.parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
- curinputBtn.attr('disabled', false);
- }
- })
- // $('.maxminNum')
- layer.closeAll(); //疯狂模式,关闭所有层
- return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
- });
- }
- , btn2: function (index, layero) {
- $('#Modal').hide()
- //return false 开启该代码可禁止点击该按钮关闭
- }
- });
- });
- }
- $('#starttime').on('blur', function () {
- $(this).val(parseInt($(this).val()))
- })
- $('#Duration').on('blur', function () {
- $(this).val(parseInt($(this).val()))
- })
- // 下发定时开关
- $('#gettimingDiv').on('click', '.ace-switch', function () {
- var _this = this;
- var currVal = $(this).parents('.thresholdCtrl').find('.currVal').val();
- var currWayjson = JSON.parse(currVal);
- var id = $('#firstpane .menu-active').attr('id')
- currWayjson.equip_id = id;
- if (currWayjson.StartTime == '--' || currWayjson.Duration == '--') {
- $(this).parents('.thresholdCtrl').find('.setthresholdBtn').click();
- layer.msg('请先设置定时时间', { icon: 2 })
- return false;
- }
- $(this).parents('.thresholdCtrl').find('.ctrlLoading').remove()
- $(this).attr('disabled', true);
- $(this).parents('.thresholdCtrl').append('<div class="ctrlLoading"><img src="http://www.nyzhwlw.com/images/loading.gif" width="24">操作中...</div>');
- if ($(this).is(":checked")) { //开启
- var oldStatus = 0;
- var currStutas = 1;
- } else { //关闭
- var oldStatus = 1;
- var currStutas = 0;
- currWayjson.StartTime = '255';
- currWayjson.Duration = '32767';
- }
- $.ajax({
- url: 'qxz_timing_mqtt',
- type: 'post',
- data: currWayjson,
- success: function (data) {
- setTimeout(function () {
- $(_this).attr('disabled', false);
- $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('');
- var id = $('#firstpane .menu-active').attr('id')
- loadProject(id);
- }, 5000)
- },
- error: function (type) {
- $(_this).parents('.thresholdCtrl').find('.ctrlLoading').html('<span style="color:red">操作失败</span>');
- $(_this).attr('disabled', false);
- if (oldStatus) {
- $(_this).prop('checked', true);
- } else {
- $(_this).prop('checked', '');
- }
- }
- })
- })
- // 设置要素名称
- function setEleName() {
- var e_id = $('#firstpane .menu-active').attr('id')
- $.ajax({
- url: 'qxz_title_conf',
- type: 'get',
- data: {
- e_id: e_id
- },
- dataType: 'json',
- success: function (data) {
- var dataa = [];
- var len = Object.keys(data.default).length;
- for (var i = 1; i <= len; i++) {
- var key = 'e' + i;
- if (data.default[key]) {
- var detxt = data.default[key].split('#')[0];
- var deunit = data.default[key].split('#')[1];
- if (data.conf[key]) {
- var conftxt = data.conf[key].split('#')[0];
- } else {
- var conftxt = '-';
- }
- dataa.push({
- "ekey": key,
- "name": conftxt,
- "elementName": detxt,
- "unit": deunit
- })
- }
- if (i == len) {
- // console.log(dataa)
- //页面层
- layer.open({
- type: 1,
- title: '修改要素名称',
- area: ['800px', '540px'], //宽高
- content: $('#eleName'),
- skin: 'layui-layer-editName', //样式类名
- success: function (layero, index) {
- layui.use('table', function () {
- var table = layui.table;
- table.render({
- elem: '#eleTable'
- , data: dataa
- , done: function (res, curr, count) {
- $("table").css("width", "100%");
- }
- , limit: 30
- , cols: [[
- { field: 'ekey', width: '25%', align: 'center', title: '通道号' }
- , { field: 'name', width: '35%', align: 'center', title: '<i class="layui-icon"></i>名称', event: 'cellClick' }
- , { field: 'elementName', width: '40%', align: 'center', title: '要素' }
- ]]
- });
- table.on('tool(eleTable)', function (obj) {
- switch (obj.event) {
- case 'cellClick':
- CellClick(this, obj, e_id);
- break;
- };
- });
- });
- },
- cancel: function (index, layero) {
- loadProject(e_id);
- }
- });
- }
- }
- },
- error: function (type) {
- layer.msg('请求失败');
- }
- })
- }
- layui.use(['form'], function () {
- var form = layui.form;
- form.on('switch(equipTypeDemo)', function (obj) {
- var state = obj.elem.checked ? 1 : 0;
- //方法二取数据 (根据索引table.cache里面的行数据)
- var index = obj.othis.parents('tr').attr("data-index");
- datMsg[index].type = state;
- });
- })
- function CellClick(that, obj, e_id) {
- //当前点击字段
- var field = $(that).data("field");
- //判断是否需要添加编辑框
- if (field == "edit") return true;
- //当前行数据
- var data = obj.data;
- //当前单元格的值
- var value = data[field];
- //当前点击td的宽高
- var height = $(that)[0].offsetHeight, width = $(that)[0].offsetWidth;
- //当前点击td的坐标
- var top = $(that).offset().top, left = $(that).offset().left;
- //输入框 这里可以自定义表单内容
- var input = '<input type="text" maxlength=10 class="layui-input" id="' + field + '_input" data-field="' + field + '" style="width:' + width + 'px;height:' + height + 'px">';
- //弹出层
- layer.open({
- type: 1
- , title: false
- , page: true
- , limit: 1
- , closeBtn: 0
- , area: [width + "px", height + "px"]
- , shade: [0.01, '#fff']
- , shadeClose: true
- , content: input //这里content是一个普通的String
- , offset: [top, left]
- , success: function () {
- //使弹出层相对定位
- $(".layui-layer-page").css("position", "absolute")
- //设置输入框的值
- $("#" + field + "_input").val(value);
- $("#" + field + "_input").blur(function () {
- var dat = data;
- var ekey = dat.ekey;
- var conf = $(this).val();
- var unit = data.unit;
- $.ajax({
- url: 'qxz_title_conf',
- type: 'post',
- data: {
- e_id: e_id,
- ekey: ekey,
- conf: conf + '#' + unit
- },
- dataType: 'json',
- success: function (data) {
- if (data == 0) {
- //同步更新缓存对应的值
- dat[field] = conf;
- obj.update(dat);
- layer.msg('修改成功')
- }
- },
- error: function (type) {
- layer.msg('修改失败')
- }
- })
- })
- }
- });
- }
- function thresholdClick(that, obj, e_id, form) {
- //当前点击字段
- var field = $(that).data("field");
- // console.log(obj)
- //判断是否需要添加编辑框
- if (field == "edit") return true;
- //当前行数据
- var data = obj.data;
- //当前单元格的值
- var value = data[field];
- //当前点击td的宽高
- var height = $(that)[0].offsetHeight, width = $(that)[0].offsetWidth;
- //当前点击td的坐标
- var top = $(that).offset().top, left = $(that).offset().left;
- //输入框 这里可以自定义表单内容
- 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">';
- //弹出层
- layer.open({
- type: 1
- , title: false
- , page: true
- , limit: 1
- , closeBtn: 0
- , area: [width + "px", height + "px"]
- , shade: [0.01, '#fff']
- , shadeClose: true
- , content: input //这里content是一个普通的String
- , offset: [top, left]
- , success: function () {
- //使弹出层相对定位
- $(".layui-layer-page").css("position", "absolute")
- //设置输入框的值
- $("#" + field + "_input").val(value);
- $("#" + field + "_input").focus()
- $("#" + field + "_input").blur(function () {
- var dat = data;
- var ekey = dat.ekey;
- var conf = $(this).val();
- var unit = data.unit;
- dat[field] = conf || "";
- obj.update(dat);
- form.render()
- })
- }
- });
- }
- // 查看详情
- function historyData(){
- var id = $('#firstpane .menu-active').attr('id')
- window.location.href = 'qxz_report?id='+id
- }
-
- </script>
- </body>
- </html>
|