123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <!DOCTYPE html>
- <html lang="zh-cn">
- <head>
- <meta charset="UTF-8">
- <meta name="format-detection" content="telephone=no" />
- <meta name="format-detection" content="email=no" />
- <title>mes</title>
- <link rel="stylesheet" href="../css/reset.css">
- <script src="../script/flexible.js"></script>
- <style>
- html,body{
- height:100%;
- }
- .task_con {
- overflow-y: auto;
- overflow-x: hidden;
- padding-top: .23rem;
- -webkit-transform: translateZ(0);
- transform: translateZ(0);
- }
- .task_con ul{
- display: none;
- }
- .task_con li {
- min-width: 100%;
- height: 3rem;
- margin-bottom: .1rem;
- background-color: #fff;
- padding: .3rem .2rem;
- position: relative;
- }
- .task_con li>div {
- display: inline-block;
- }
- .task_taskCon{
- padding-top: .1rem;
- }
- .task_taskCon p{
- height: .5rem;
- margin-bottom: .25rem;
- }
- .selectDiv{
- width: 0;
- height: 100%;
- overflow: hidden;
- position: relative;
- -webkit-transition: .3s;
- transition: .3s;
- }
- .selectDiv img{
- display: inline-block;
- width: .6rem;
- height: .6rem;
- position: absolute;
- left: calc(50% - .3rem);
- top: calc(50% - .3rem);
- }
- .selectDiv.active{
- width: 1.5rem;
- }
- .disImg{
- width: 2.5rem;
- height: 2.3rem;
- margin-right: .15rem;
- }
- .disImg img{
- display: inline-block;
- width: 100%;
- height: 100%;
- }
- .task_dbqk {
- display: inline-block;
- font-size: .3rem;
- border-radius: .3rem;
- padding: 0 .2rem;
- margin-left: .23rem;
- white-space: nowrap;
- }
- .task_dbqk1{
- color: #f39700;
- border: 1px solid #f39700;
- }
- .task_dbqk2{
- color: #ff0000;
- border: 1px solid #ff0000;
- }
- .task_dbqk3{
- color: #bbbc5f;
- border: 1px solid #bbbc5f;
- }
- .task_dbqk4{
- color: #e60012;
- border: 1px solid #e60012;
- }
- .task_dbqk5{
- color: #cacbbb;
- border: 1px solid #cacbbb;
- }
- .task_name{
- font-size: .42rem;
- color: #3d3d3d;
- }
- .ds{
- font-size: .4rem;
- color: #818181;
- }
- .ms span{
- font-size: .3rem;
- padding: .1rem .15rem;
- color: #fff;
- background-color: #22ad38;
- border-radius: .1rem;
- margin-right: .1rem;
- }
- .ms span.active{
- background-color: #f36523;
- }
- .ds i{
- display: inline-block;
- height: .3rem;
- }
- .ds i:nth-of-type(1){
- width: .2rem;
- margin-right: .1rem;
- }
- .ds i:nth-of-type(2){
- width: .23rem;
- }
- .ds i img{
- display: inline-block;
- width: 100%;
- height: 100%;
- }
- .ds>span.active{
- color: #ff0000;
- }
- .task_jt {
- position: absolute;
- top:0;
- right: 0;
- height: 100%;
- line-height: 3rem;
- font-size: .5rem;
- color: #b5b5b5;
- padding: 0 .15rem;
- }
- .hid{
- display: none;
- }
- </style>
- </head>
- <body>
- <div class="flex-con task_con">
- <ul>
- <li class="flex-wrap" data-taskid="{{taskID}}" data-lon="{{lon}}" data-lat="{{lat}}">
- <div class="selectDiv"><img src="../image/selectIcon.png" alt="" rel="true"></div>
- <div class="disImg">{{img}}</div>
- <div class="task_taskCon flex-con">
- <p class="clearFix"><span class="task_name left">{{name}}</span><span class="task_dbqk task_dbqk2 left {{isH}}">温度过高</span></p>
- <p class="ds"><span class="{{dsactive1}}"><i><img src="{{dsimg1}}" alt=""></i>温度<span id="wd">{{wd}}</span>℃</span> <span class="{{dsactive2}}"><i><img src="{{msactive2}}" alt=""></i> 湿度<span id="sd">{{sd}}</span>%</span></p>
- <p class="ms"><span class="{{msactive}}">{{isjd}}</span>{{mss}}</p>
- </div>
- <div class="task_jt">〉</div>
- </li>
- </ul>
- </div>
- <script src="../script/publicData.js"></script>
- <script src="../script/jqueryMin.js"></script>
- <script type="text/javascript" src="../script/api.js"></script>
- <script>
- var selectArr=[],titArr=[];
- apiready = function() {
- if(api.systemType=="ios"){
- $(".task_taskCon p").css("margin-bottom",".1rem")
- }
- var photoBrowser = api.require('photoBrowser');
- api.showProgress({
- title: '努力加载中...',
- text: '请稍等...',
- modal: false
- });
- var duty=[];
- var postData={
- user_id:$api.getStorage("user").id
- };
- var ulModel=$(".task_con ul").html();
- var spanModel='<span class="{{ish}}">{{num}}</span>';
- var imgModel='<img src="{{img}}" alt="">';
- getData();
- function getData() {
- api.execScript({
- name: 'winname',
- script: 'selFalse();'
- });
- api.ajax({
- url: pageUrl+"/index/street/street-info",
- method: 'get',
- timeout: 30,
- dataType: 'text',
- returnAll: false,
- data: {
- values: {street_id:api.pageParam.index}
- }
- }, function (data, err) {
- data=JSON.parse(data)
- // console.log(JSON.stringify(data))
- var data=data.bdg,str="",str2="";
- var dataNames1=[];
- if(!data.length){
- str="<p style='padding-top: 5.3rem;font-size: .5rem;text-align: center;color: #818181'>暂无变电柜</p>"
- }else {
- for(var i in data){
- str+=ulModel.replace("{{taskID}}",data[i]['id']).replace("{{name}}",data[i]['title']).replace("{{img}}",imgModel.replace("{{img}}",pageImg+data[i]['img'])).replace("{{isH}}",data[i]['temperature']>50?"":"hid").replace("{{dsactive1}}",data[i]['temperature']>50?"active":"")
- .replace("{{dsactive2}}",data[i]['humidity']>50?"active":"").replace("{{msactive}}",data[i]['has_dian']=="0"?"active":"").replace("{{dsimg1}}",data[i]['temperature']>50?"../image/map_popups_icon1_2.png":"../image/map_popups_icon1.png")
- .replace("{{msactive2}}",data[i]['humidity']>50?"../image/map_popups_icon2_2.png":"../image/map_popups_icon2.png").replace("{{wd}}",data[i]['temperature']).replace("{{sd}}",data[i]['humidity']).replace("{{isjd}}",data[i]['has_dian']=="0"?"离线":"在线").replace("{{lon}}",data[i]['lon']).replace("{{lat}}",data[i]['lat'])
- str2="";
- for(var j in data[i]['lock']){
- str2+=spanModel.replace("{{ish}}",data[i]['lock'][j]["is_lock"]=="0"?"":"active").replace("{{num}}",data[i]['lock'][j]['title'])
- }
- str=str.replace("{{mss}}",str2)
- duty[i]={
- id:data[i]['id'],
- text: data[i]['title'],
- status: 'normal'
- }
- }
- }
- api.refreshHeaderLoadDone();
- api.hideProgress();
- $(".task_con ul").html(str).css("display","block");
- selBox();
- searchFn1(dataNames1)
- $api.setStorage("allBDG",duty);
- $(".task_con>ul>li").click(function () {
- //在名为winName的window中执行jsfun脚本
- if($(".selectDiv").hasClass("active")){
- $(this).find('.selectDiv')[0].click();
- }else {
- var that=$(this);
- api.openWin({
- name: 'createTask',
- url: './createTask.html',
- pageParam: {name: $(this).find(".task_name").text(),id:this.dataset.taskid}
- });
- }
- })
- $(".disImg>img").click(function (e) {
- e.stopPropagation();
- photoBrowser.open({
- images: [
- "http"+$(this).attr("src").slice(4)
- ],
- placeholderImg: 'widget://res/img/apicloud.png',
- bgColor: '#000'
- }, function(ret, err) {
- $api.setStorage("imgOpen","1");
- api.addEventListener({
- name: 'closeImg'
- }, function (ret, err) {
- photoBrowser.close();
- $api.setStorage("imgOpen",null);
- });
- if (ret) {
- if(ret.eventType=="click"){
- photoBrowser.close();
- $api.setStorage("imgOpen",null);
- }
- } else {
- api.toast({
- msg: '图片加载失败',
- duration: 2000,
- location: 'bottom'
- });
- }
- });
- })
- api.execScript({
- name: 'root',
- script: 'totalTime(0);'
- });
- });
- }
- function selBox() {
- var num=0;
- $(".selectDiv").click(function (e) {
- e.stopPropagation();
- if($(this).find("img").attr("rel")=="true"){
- $(this).find("img").attr({"src":"../image/selectIcon2.png","rel":"false"});
- $(this).parent().addClass("isSel");
- num++;
- api.execScript({
- name: 'root',
- script: 'selTrue();'
- });
- }else {
- $(this).find("img").attr({"src":"../image/selectIcon.png","rel":"true"});
- $(this).parent().removeClass("isSel");
- num--;
- if (!num) {
- api.execScript({
- name: 'root',
- script: 'selFalse();'
- });
- }
- }
- })
- }
- function getTime(time) {
- var time=new Date(time*1000),str="";
- var year=time.getFullYear();
- var month=time.getMonth()+1;
- var day=time.getDate();
- var hours=time.getHours();
- var minutes=time.getMinutes();
- var str=year+"-"+checkTime(month)+"-"+checkTime(day)+" "+checkTime(hours)+":"+checkTime(minutes);
- return str;
- }
- function checkTime(val) {
- var val=val;
- if((val+"").length==1){
- val="0"+val;
- }
- return val
- }
- function searchFn1(dataNames) {
- api.addEventListener({name:"search1"},function (ret) {
- var re=new RegExp("("+ret.value.val+")"),liArr=[];
- for(var i=0;i<dataNames.length;i++){
- if(re.test(dataNames[i])){
- liArr.push($(".task_con ul li").get(i));
- }
- }
- if(!liArr.length){
- api.toast({
- msg: '没有搜索到该任务',
- duration: 2000,
- location: 'bottom'
- });
- }else {
- $(".task_con ul").html(" ");
- for(var j=0;j<liArr.length;j++){
- $(".task_con ul").append(liArr[j]);
- }
- }
- })
- }
- $("body").click(function () {
- api.sendEvent({
- name: 'clInput'
- });
- })
- api.setRefreshHeaderInfo({
- loadingImg: 'widget://image/refresh.png',
- bgColor: '#fff',
- textColor: '#818181',
- textDown: '下拉刷新...',
- textUp: '松开刷新...'
- }, function(ret, err) {
- //在这里从服务器加载数据,加载完成后调用api.refreshHeaderLoadDone()方法恢复组件到默认状态
- getData();
- });
- }
- function showSelect() {
- $(".selectDiv").addClass("active");
- }
- function hidSelect() {
- var activeLi=document.getElementsByClassName("isSel"),selectArr=[],titArr=[];
- if(activeLi.length){
- for(var i=0;i<activeLi.length;i++){
- selectArr.push(activeLi[i].dataset.taskid);
- titArr.push(activeLi[i].getElementsByClassName("task_name")[0].innerText);
- }
- $api.setStorage("CTasks",selectArr);
- $api.setStorage("tasksTit",titArr);
- }
- $(".selectDiv").removeClass("active").find("img").attr("src","../image/selectIcon.png");
- }
- </script>
- </body>
- </html>
|