CJJ
2018-12-20 866a6facb439b93b7d693bb84730714200c7f85a
申请添加
2个文件已添加
2个文件已修改
723 ■■■■■ 已修改文件
gx_tieta/WebRoot/mobil/batt-infor-conf-temp1.html 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/mobil/ele-param2.html 543 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/mobil/iframe/searchBatt.html 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/mobil/testControl.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/mobil/batt-infor-conf-temp1.html
@@ -57,6 +57,7 @@
    console.info(temp);
    console.info(temp[30]);
    console.info(temp[33]);
    console.info(temp[34]);
    var suoyin = temp[33];
    
   $(function(){creatAllView(suoyin)});
@@ -99,7 +100,7 @@
        
        <!-- 头部内容 -->
        <div data-role="header" data-position="fixed">
            <a href="ele-param1.html" target="_top" class="ui-btn ui-corner-all ui-shadow ui-icon-back ui-btn-icon-left" style="padding-top: 0.7em; padding-bottom: 0.7em;">返回</a>
            <a href="ele-param2.html" target="_top" class="ui-btn ui-corner-all ui-shadow ui-icon-back ui-btn-icon-left" style="padding-top: 0.7em; padding-bottom: 0.7em;">返回</a>
            <h1>电池组申请安装</h1>
            
        </div>
@@ -350,7 +351,13 @@
    $(function () {
        //setTimes($("#startTestrecord"),'2000-01-01');
        //setTimes($("#endTestrecord"),new Date().format('yyyy-MM-dd'));
        creatgroupid();//如果检测为NEW ,则执行添加ID,如果为修改,则执行为拿到ID
        console.info()
        if(temp[34]!="edit")
        {
        console.warn("sssss")
            creatgroupid();//如果检测为NEW ,则执行添加ID,如果为修改,则执行为拿到ID
        }else{
        }
        installstartdata(temp);
    });
    
@@ -421,7 +428,7 @@
    
    //导入表格默认数据
    function installstartdata(temp){
        creatgroupid();
        var data = {
                StationId: '4011100'
                ,StationName1: '广西省'
@@ -458,7 +465,8 @@
                ,install_user: '呵呵'
            };
            console.info(data.StationId);
        if(temp.length>0){
        if(temp[34]!="edit"){
            creatgroupid();
            document.getElementById("StationId").value = data.StationId;
    //        document.getElementById("station_name1").value = data.StationName1;
    //        document.getElementById("city").value = data.StationName2;            //市
@@ -502,7 +510,7 @@
            document.getElementById("StationName3").value = temp[4];   //机房名称
            document.getElementById("StationName4").value = temp[5];    //设备名称
            document.getElementById("StationIp").value = temp[6];        //设备IP
            //document.getElementById("FBSDeviceId").value = dev_id;
            document.getElementById("FBSDeviceId").value = temp[7];
            document.getElementById("FbsDeviceIp").value = temp[8];
            document.getElementById("FbsDeviceIp_YM").value = temp[9];
            document.getElementById("FbsDeviceIp_WG").value = temp[10];
@@ -594,18 +602,19 @@
        $(".unable").prop("readonly","readonly").attr("unselectable","on").addClass("uncheck");
        $("#sure").click(function(){
            if(nullOrn()){
            //if(tem[35]=="new"){
                creatgroupid();//提交之前再次验证,创建ID
                addBattnew();     //提交
            //}else{editBatt();
            //}
                if(temp[34]=="edit"){
                    creatgroupid();//提交之前再次验证,创建ID
                    addBattnew();     //提交
                }else{
                    editBatt();
                }
            }else{
            }                //验证重要项是否为空,为空则提示;   
               //function backpage(){window.location.href="ele-param1.html";}
             // setTimeout(backpage,500); 
        });
        $("#cancel").click(function(){
            window.location.href="ele-param1.html";
            window.location.href="ele-param2.html";
        });
    });
     
gx_tieta/WebRoot/mobil/ele-param2.html
New file
@@ -0,0 +1,543 @@
<!DOCTYPE html>
<html lang="en" class="full-height">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>申请电池组安装</title>
    <link rel="stylesheet" href="mobilCss/jquery.mobile-1.4.5.min.css"/>
    <link rel="stylesheet" href="css/basic.css">
    <link rel="stylesheet" href="src/css/layui.css">
    <link rel="stylesheet" href="app/css/common.css">
    <link rel="stylesheet" href="app/css/map.css">
    <link rel="stylesheet" type="text/css" href="css/tbl.css">
    <link rel="stylesheet" href="font-awesome-4.7.0/css/font-awesome.css">
    <script src="js/jquery-1.8.3.js"></script>
    <script src="mobilJs/jquery.mobile-1.4.5.min.js"></script>
    <style type="text/css">
        .checkdata{
             display:inline-block;width:48%;margin:0 0 0 0;float:left;
         }
         .next-page, .pre-page {
            position: fixed;
            width: 40px;
            height: 40px;
            top: 50%;
            margin-top: -15px;
        }
        .next-page  {
            right: 0;
        }
        .pre-page  {
            left: 0;
        }
        table {
            margin-top:.5em;
            border-collapse:separate;
            border-spacing:0 .5em;
        }
        tbody tr td{
            overflow: hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
        }
        .ui-table-reflow td .ui-table-cell-label,.ui-table-reflow th .ui-table-cell-label {
        padding: .4em;
        min-width: 35%;
        display: inline-block;
        margin: -.4em 1em -.4em -.4em;
        }
        .ui-select .ui-btn select{
        width:100%;
        }
        .mt6{
        margin:6em 0 0 0;
        }
        .pl5{
        padding-left:5.9em;
        }
        .operat-but{
            margin:0 0 0 8em;
            padding: 0.1em 2em;
            background-color: #dddddd4d!important;
        }
        .abs{
          position: fixed;
          width:100%;
          height:4.5em;
          overflow: hidden;
          z-index:999;
        }
        .rel-full{
          overflow-y: hidden;
        }
         .mt7{
          margin-top:7em;
        }
    </style>
</head>
<body >
    <div class="abs">
        <div class="rel-full">
            <div class="page-header bg-gay3">
                <div class="layui-row h40">
                    <div class="layui-col-xs3 layui-col-md1 full-height">
                        <a href="index.html" class="layui-btn layui-btn-primary layui-btn-sm mrt5 mrl8"><i class="fa fa-reply mrr4"></i>返回</a>
                    </div>
                    <div class="layui-col-xs6 layui-col-md10 full-height line-height40">申请电池组安装</div>
                    <div class="layui-col-xs3 layui-col-md1 full-height line-height40 t-align-right t-align-right">
                        <!-- <button class="layui-btn layui-btn-primary layui-btn-sm mrr8" id="homeInfo"><i class="fa fa fa-bars mrr4"></i>功能</button> -->
                    </div>
                </div>
            </div>
            <div class="page-content abs abs-top40">
                <div class="rel-full">
                    <div id="map" class="full-height"></div>
                    <div id="mapSearch" class="map-search-container">
                        <div class="layui-form layui-form-pane" action="">
                            <div class="layui-form-item">
                                <label class="layui-form-label"><i class="fa fa-search"></i></label>
                                <div class="layui-input-block">
                                    <input type="text" name="title" id="searchInput" autocomplete="off" placeholder="机房搜索" class="layui-input">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 主体内容 -->
        <div data-role="main" class="mt7">
            <div class="pre-page"><a href="#" class="ui-btn ui-corner-all ui-icon-carat-l ui-btn-icon-notext">图标</a></div>
            <div class="next-page"><a href="#" class="ui-btn ui-corner-all ui-icon-carat-r ui-btn-icon-notext">图标</a></div>
            <!-- 表格容器 -->
            <div class="tbl-container"></div>
            <table data-role="table" class="ui-responsive ui-shadow" id="tab" >
            </table>
        </div>
        <div data-role="footer" data-position="fixed" data-theme="a">
            <div data-role="navbar">
                <ul>
                  <li><a href="index.html" id="cancel"  class="ui-btn ui-btn-inline ui-corner-all  ui-btn-icon-delete" data-position-to="window" data-icon="delete" data-role="button">首页</a></li>
                  <li><a href="#yourPopup" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all  ui-btn-icon-check" data-position-to="window" data-icon="check" data-role="button">新建</a></li>
                </ul>
            </div>
        </div>
        <div data-role="popup" id="yourPopup" class="ui-content" data-overlay-theme="b">
        <a href="#"  data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">关闭</a>
                  <h1>选择新建电池组个数</h1>
                   <fieldset data-role="controlgroup" >
                        <select id="newbattnum" data-mini="true">
                          <option value="1">新建1个电池组</option>
                          <option value="2">新建2个电池组</option>
                          <option value="3">新建3个电池组</option>
                          <option value="4">新建4个电池组</option>
                        </select>
                    </fieldset>
                    <div data-role="controlgroup" data-type="horizontal" class="mt6">
                        <a href=""  id="sure" class="ui-btn ui-corner-all ui-shadow  ui-btn-icon-left ui-icon-check pl5" >确定</a>
                        <a href=""  data-rel="back" class="ui-btn ui-corner-all ui-shadow  ui-btn-icon-left ui-icon-delete pl5" >取消</a>
                    </div>
         </div>
    <!-- 存储机房信息列表 -->
    <div id="searchHomeIframe"></div>
    <!-- 机房查询存储数据-->
    <div id="homeLocation"></div>
    <!-- 存在机房信息 -->
    <div id="homeInfoIframe"></div>
    <script src="src/layui.all.js"></script>
    <script type="text/javascript" src="js/tbl.js"></script>
    <script type="text/javascript" src="mobilJs/base.js"></script>
    <script>
        function getEditButIndex(t){
        console.warn($(t).attr("but-index")+' 修改');
        var index = $(t).attr("but-index");
           setcookieedit(index);
           //window.location.href="batt-infor-unapproved-edit.html";
        return ;
    }
         $(document).ready(function(){
  ($('a[data-rel="back"]')).on('click',function(event) {
    event.preventDefault();
    event.stopImmediatePropagation();
    window.location.href="ele-param2.html";
  });
});
        // 搜索机房获取焦点
        $('#searchInput').on('focus', function() {
            $(this).blur();
            iframePopup = layer.open({
                type: 2
                ,closeBtn: 0
                ,title: false
                ,area: ['100%', '100%']
                ,full: true
                ,anim: 5
                ,content: 'iframe/searchBatt.html'
            });
        });
        // 查询机房
        findHome();
        function findHome() {
            var tmp = {
                StationName1:'',
                StationName2: '',
                StationName5:''
            };
            // 查询机房信息
            $.post("BattInfAction!serchStationName3","json="+JSON.stringify(tmp),function(result){
                var rs = JSON.parse(result.result);
                if(rs.code==1){
                    homeSource = [];
                    var data = rs.data;
                    for(var i=0; i<data.length; i++) {
                        var _data = data[i];
                        var tmp = {
                            label: _data.StationName+'('+_data.StationId+')',
                            province: _data.StationName1,
                            city: _data.StationName2,
                            county: _data.StationName5,
                            home: _data.StationName,
                            homeid: _data.StationId
                        };
                        // 添加到资源
                        homeSource.push(tmp);
                    }
                    //console.log(homeSource)
                    // 设置资源内容
                    $('#searchHomeIframe').data('homeSource', homeSource);
                }
            });
        }
        // 机房定位面板
        $('#homeLocation').on('click', function() {
            var homeInfo = $(this).data('homeInfo');
             console.warn(homeInfo);
                searchBattLife();
        });
        //拦截安卓回退按钮
        history.pushState(null, null, location.href);
        window.addEventListener('popstate', function(event) {
            history.pushState(null, null, location.href );
            //此处加入回退时你要执行的代码
        });
          var arrTd=new Array();        //当前表格td数据
    var tblCon = $('.tbl-container');
    var Page = {
        pageSize:20,                 //每页的行数
        pageCurr:1,                  //当前页码数
        pageAll:0,
    };
    $("#sure").click(function(){
        var currentlength = Math.floor(arrTd.length/34);
        if(currentlength<Page.pageSize){
            setcookieCreat(currentlength-1);
        }else{
               setcookieCreat(Page.pageSize-1);
           }
        window.location.href="batt-infor-conf-temp1.html";
    });
    var arrTh = [ '机房编号', '省', '城市','区县','机房名称','设备名称','机房IP','FBS设备ID(重要)','FBS设备IP(重要)','子网掩码','网关','FBS设备名称','FBS电池索引(0-3)','电池组ID','机房内电池组编号','电池组名称','浮充电压阀值(V)','离线电压阀值(V)','浮充电流阀值(A)','单体数量','标称容量(AH)','标称单体电压(V)','标称单体内阻(mΩ)','标称单体电导','单体电压次低偏移量(V)','负载电流(A)','最大核容电流(A)','基站号码','电池品牌','电池型号','电池生产日期','投入使用日期','安装人员',''];
    dataArr = [];
    var startTime = "1980-01-01";
    var endTime = new Date().format('yyyy-MM-dd');
    var tbl = $('.tbl-container');
    createTbl(tbl, arrTh, dataArr);
    $(document).ready(function(){
        setPage();
            //newbattnum;
            Page.pageCurr=1;
            //searchBattLife();
     });
         function setcookieCreat(index){
                 var arrcookie = new Array();
                   for(var i=0;i<33;i++){//共33项
                       var value = Math.floor(33*index);
                       console.info(value);
                       value = Math.floor(value+i);
                     if(i==13){//新建功能,电池组ID默认为当页最后一个电池组ID号加1
                         var groupid = Math.floor(arrTd[value]+1);
                         console.info(groupid);
                         arrcookie.push(groupid);
                     }else{
                           console.info(value);
                           arrcookie.push(arrTd[value]);
                       }
                   }
                   console.info($("#newbattnum").val());
                   arrcookie.push($("#newbattnum").val());
                   //console.info(arrcookie);
                   var json=window.JSON.stringify(arrcookie);
                   setCookie("eleparm",json);  //这里setcookie,若有上一条cookie则清空上一笔
         }
        function setcookieedit(index){
            var arrcookie = new Array();
                   for(var i=0;i<33;i++){//共33项
                       var value = Math.floor(33*index);
                       console.info(value);
                       value = Math.floor(value+i);
                     if(i==13){//新建功能,电池组ID默认为当页最后一个电池组ID号加1
                         var groupid = Math.floor(arrTd[value]+1);
                         console.info(groupid);
                         arrcookie.push(groupid);
                     }else{
                           console.info(value);
                           arrcookie.push(arrTd[value]);
                       }
                   }
                   console.info($("#newbattnum").val());
                   arrcookie.push($("#newbattnum").val());
                   arrcookie.push("edit");
                   //console.info(arrcookie);
                   var json=window.JSON.stringify(arrcookie);
                   setCookie("eleparm",json);  //这里setcookie,若有上一条cookie则清空上一笔
                   window.location.href="batt-infor-conf-temp1.html";
        }
    // 查询内容
        function searchBattLife(){
             var temp = createSearchParam();
            var json = JSON.stringify(temp);
            console.info(json);
            arrTd = new Array();
            var load;
             $.ajax({
                type:"post",
                url:"BattInfAction!searchInform",
                async:true,
                datatype:'text',
                data:"json="+json,
                success:function(data){
                    //console.info(data);
                    var data = JSON.parse(data.result);
                    //layer.close(load);
                    console.info(data);
                    if(data.code==1&&data.data.length>0){
                        data=data.data;
                        var index = 0;
                        var ArryTb= new Array();
                        for(i=0;i<data.length;i++){
                            arrTd.push(data[i].StationId);                //机房编号
                            arrTd.push(data[i].StationName1);                // 省
                            arrTd.push(data[i].StationName2);                // 市
                            arrTd.push(data[i].StationName5);                // 区/县
                            arrTd.push(data[i].StationName3);                //机房名称
                            arrTd.push(data[i].StationName4);                //设备名称
                            arrTd.push(data[i].StationIp);                //机房ip
                            arrTd.push(data[i].FBSDeviceId);                //FBS设备ID
                            arrTd.push(data[i].FbsDeviceIp);                //FBS设备IP
                            arrTd.push(data[i].FbsDeviceIp_YM);            //子网掩码
                            arrTd.push(data[i].FbsDeviceIp_WG);            //网关
                            arrTd.push(data[i].FBSDeviceName);            //FBS设备名称
                            arrTd.push(data[i].GroupIndexInFBSDevice);    //FBS设备索引
                            arrTd.push(data[i].BattGroupId);                //电池组ID
                            arrTd.push(data[i].BattGroupNum);                //机房内电池组编号
                            arrTd.push(data[i].BattGroupName);            //电池组名称
                            arrTd.push(data[i].FloatVolLevel);            //浮充电压阀值
                            arrTd.push(data[i].OfflineVolLevel);            //离线电压阀值
                            arrTd.push(data[i].BattFloatCurrent);            //浮充阀值
                            arrTd.push(data[i].MonCount);                    //单体数量
                            arrTd.push(data[i].MonCapStd);                //标称容量
                            arrTd.push(data[i].MonVolStd);                //标称单体电压
                            arrTd.push(data[i].MonResStd);                //标称单体内阻
                            arrTd.push(data[i].MonSerStd);                //标称单体电导
                            arrTd.push(data[i].MonVolLowToAvg);            //单体电压次低偏移量
                            arrTd.push(data[i].Load_curr);                //负载电流
                            arrTd.push(data[i].DisCurrMax);                //最大核容电流
                            arrTd.push(data[i].station_phone);            //基站手机号码
                            arrTd.push(data[i].BattProducer);                //电池品牌
                            arrTd.push(data[i].BattModel);                //电池型号
                            arrTd.push(data[i].BattProductDate.substr(0,10));            //电池生产日期
                            arrTd.push(data[i].BattInUseDate.substr(0,10));            //投入使用日期
                            arrTd.push(data[i].install_user);                    // 设备安装人员
                            arrTd.push('<a onclick="getEditButIndex(this)"  id="edit" class="ui-btn ui-btn-inline ui-corner-all operat-but" data-position-to="window"'+'but-index='+i+'>修改</a>');
                            Page.pageAll = data[i].num;
                        }
                    }else{
                        Page.pageAll = 0;
                    }
                    setPage();
                    createTbl(tblCon, arrTh, arrTd);
                }
            });
        /*    for(var i=0;i<340;i++){
                if(i%34==33){
                //<a href="count-report.html" target="_top" class="ui-btn ui-corner-all ui-shadow ui-icon-back ui-btn-icon-left" style="padding-top: 0.7em; padding-bottom: 0.7em;">返回</a>
                console.info(i);
                arrTd[i]='<a onclick="getEditButIndex(this)"  id="edit" class="ui-btn ui-btn-inline ui-corner-all operat-but" data-position-to="window"'+'but-index='+i+'>修改</a>';
                continue;
            }   if(i==13){
                    arrTd[i]=1002102;
                }else{
                    arrTd[i]=i*10;
                }
            }
            createTbl(tblCon, arrTh, arrTd);
        */
        }
        //构造查询条件
        function createSearchParam(){
            var homeLocation = $('#homeLocation').data('homeInfo');
            console.info(homeLocation);
            var temp = {
                page:Page,
                binf:{
                    StationName1:homeLocation.province,
                    StationName2:homeLocation.city,
                    StationName5: homeLocation.county,
                    StationName:homeLocation.home,
                },
            };
            console.info(temp);
            return temp;
        }
        function getUpdateArr(temp){
            var arr = new Array();
            var obj = new Object();
            obj.StationId = temp[0];    // 机房编号
            obj.StationName = (temp[1]+"-"+temp[2]+"-"+temp[4]+"-"+temp[5]);    // 拼接机房名称
            obj.StationName1 = temp[1];        // 省
            obj.StationName2 = temp[2];        // 市
            obj.StationName5 = temp[3];        // 区/县
            obj.StationName3 = temp[4];        // 机房名称
            obj.StationName4 = temp[5];        // 设备名称
            obj.StationIp = temp[6];                //机房ip
            obj.FBSDeviceId = temp[7];                //设备id
            obj.FbsDeviceIp = temp[8];                //设备ip
            obj.FbsDeviceIp_YM = temp[9];            // 设备掩码
            obj.FbsDeviceIp_WG = temp[10];            // 网关
            obj.FBSDeviceName = temp[11];            //设备名称
            obj.GroupIndexInFBSDevice = temp[12];    //fbs设备索引
            obj.BattGroupId = temp[13];                //电池组id
            obj.BattGroupNum = temp[14];            //机房内电池组编号
            obj.BattGroupName = temp[15];            //电池组名称
            obj.FloatVolLevel = temp[16];            //浮充电压阀值
            obj.OfflineVolLevel = temp[17];            //离线电压阀值
            obj.BattFloatCurrent = temp[18];        //浮充电流阀值
            obj.MonCount = temp[19];                //单体数量
            obj.MonCapStd = temp[20];                //标称容量
            obj.MonVolStd = temp[21];                //标称电压
            obj.MonResStd = temp[22];                //标称内阻
            obj.MonSerStd = temp[23];                //标称电导
            obj.MonVolLowToAvg = temp[24];            //单体电压次低偏移量
            obj.Load_curr = temp[25];                //负载电流
            obj.DisCurrMax = temp[26];                //最大核容电流
            obj.station_phone = temp[27];            //基站号码
            obj.BattProducer = temp[28];            //电池品牌
            obj.BattModel = temp[29];                //电池型号
            obj.BattProductDate =  temp[30];        //电池生产日期
            obj.BattInUseDate =  temp[31];            //电池使用日期
            obj.install_user = temp[32];            //安装人员
            arr.push(obj);
            console.info(arr);
            return arr;
        }
        $(function() {
        //点击上一页
        $('.pre-page').on('click', 'a', function() {
            if(Page.pageCurr>1){
                Page.pageCurr = Page.pageCurr - 1;
                searchBattLife();
            }
        });
        //点击下一页
        $('.next-page').on('click', 'a', function() {
            var pageNum = Math.ceil(Page.pageAll/Page.pageSize);
            if(Page.pageCurr<pageNum){
                Page.pageCurr = Page.pageCurr + 1;
                searchBattLife();
            }
        });
    });
    // 判断是否显示翻页按钮
    function setPageTurning(isShowPre, isShowNext) {
        if(isShowPre) {    // 判断是否显示向上翻页按钮
            $('.pre-page').show();
        }else {
            $('.pre-page').hide();
        }
        if(isShowNext) {    // 判断是否显示向下翻页按钮
            $('.next-page').show();
        }else {
            $('.next-page').hide();
        }
    }
    //设置页面的跳转链接
    function setPage(){
        if(Page.pageCurr <= 1){
            $('.pre-page').hide();
        }else{
            $('.pre-page').show();
        }
        var pageNum = Math.ceil(Page.pageAll/Page.pageSize);
        if(Page.pageCurr < pageNum){
            $('.next-page').show();
        }else{
            $('.next-page').hide();
        }
    }
    </script>
</body>
</html>
gx_tieta/WebRoot/mobil/iframe/searchBatt.html
New file
@@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="en" class="full-height">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>百度地图</title>
    <link rel="stylesheet" href="../css/basic.css">
    <link rel="stylesheet" href="../src/css/layui.css">
    <link rel="stylesheet" href="../app/css/common.css">
    <link rel="stylesheet" href="../app/css/map.css">
    <link rel="stylesheet" href="../font-awesome-4.7.0/css/font-awesome.css">
</head>
<body class="full-height">
    <div class="rel-full">
        <div class="page-header bg-gay3">
            <div class="layui-row h40">
                <div class="layui-col-xs12 layui-col-md12 full-height line-height40">
                    <div class="layui-form mrt4 mrr8" action="">
                        <div class="layui-form-item">
                            <div class="back-his" id="closeIframe">
                                <i class="fa fa-angle-left"></i>
                            </div>
                            <div class="layui-input-block">
                                <input type="text" name="title" id="searchInput" autocomplete="off" placeholder="请输入机房的名称" class="layui-input">
                            </div>
                            <div class="location-his" id="searchBtn">
                                <i class="fa fa-check"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="page-content abs abs-top40">
            <div class="rel-full">
                <div id="homeList" class="home-list mrt8 mrr8"></div>
            </div>
        </div>
    </div>
    <script src="../js/jquery-1.8.3.js"></script>
    <script src="../src/layui.js"></script>
    <script src="../app/js/common.js"></script>
    <script>
        // layui模块
        layui.use(['layer', 'laytpl', 'form'], function() {
            var layer = layui.layer;        // 获取layer模块
            var laytpl = layui.laytpl;      // 获取laytpl模块
            var form = layui.form;          // 获取form模块
            var upload = layui.upload;      // 获取upload模块
            // 关闭form
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            $('#closeIframe').click(function() {        // 设置点击按钮关闭当前iframe
                parent.layer.close(index);
            });
            //  获取所有机房的列表
            var homeSource = parent.$('#searchHomeIframe').data('homeSource');
            // 实例化数据检测
            var checkHomeData = new CheckData();
            checkHomeData.setSource(homeSource);
            createHomeList($('#homeList'), homeSource);
            // 更改文本框的值获取
            $('#searchInput').on('input propertychange', function() {
                var _val = $(this).val();
                $(this).data('homeInfo', '');
                // console.log($(this).data('homeInfo'));
                var data = checkHomeData.getData(_val);
                createHomeList($('#homeList'), data);
            });
            // 点击查询获取homeInfo的值
            var homeLocation = parent.$('#homeLocation');
            $('#searchBtn').click(function() {
                console.log(111);
                var homeInfo = $('#searchInput').data('homeInfo');
                console.log(222);
                if(homeInfo) {
                    // console.log(homeInfo);
                    homeLocation.data('homeInfo', homeInfo);
                    homeLocation.click();
                    console.log(333);
                    parent.layer.close(index);
                    //searchBattLife()
                }else {
                    layer.msg('请选择下方的机房');
                }
            });
            // 点击机房列表触发
            $('#homeList').on('click', '.home-item', function() {
                var homeInfo = $(this).data('homeInfo');
                // 激活选中的行
                $('#homeList .home-item').removeClass('ac-this');
                $(this).addClass('ac-this');
                // 获取机房信息定位机房
                if(homeInfo.label.length!=0) {
                    $('#searchInput').val(homeInfo.label);
                    $('#searchInput').data('homeInfo', homeInfo);
                }else {
                    $('#searchInput').data('homeInfo', '');
                }
            });
            // 根据数据生成列表
            function createHomeList(ele, data) {
                // 清空列表
                ele.text('');
                //  设置默认的data值
                var defaultData = [
                    {label: ''}
                    ,{label: ''}
                    ,{label: ''}
                    ,{label: ''}
                    ,{label: ''}
                    ,{label: ''}
                ];
                if(data.length == 0) {
                    data = defaultData;
                }
                // 遍历data的值
                for(var i=0; i<data.length; i++) {
                    var _data = data[i];
                    var homeItem = $('<div class="home-item"></div>');
                    var homeIcon = $('<span class="home-item-icon fa fa-home"></span>');
                    var homeTxt = $('<span class="home-item-txt">'+_data.label+'</span>');
                    if(_data.label.length != 0) {
                        homeItem.append(homeIcon);
                    }
                    homeItem.append(homeTxt);
                    homeItem.data('homeInfo', _data);
                    ele.append(homeItem);
                    ele.append('<hr class="layui-bg-gray">')
                }
            }
        });
    </script>
</body>
</html>
gx_tieta/WebRoot/mobil/testControl.html
@@ -20,7 +20,7 @@
            <div data-role="content">
                <ul data-role="listview" data-inset="true">
                    <li>
                        <a href="ele-param1.html" target="_top">申请添加电池组</a>
                        <a href="ele-param2.html" target="_top">申请添加电池组</a>
                    </li>
                </ul>