1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關咨詢
      選擇下列產品馬上在線溝通
      服務時間:8:30-17:00
      你可能遇到了下面的問題
      關閉右側工具欄

      新聞中心

      這里有您想知道的互聯(lián)網營銷解決方案
      使用layui怎么實現(xiàn)一個動態(tài)表頭-創(chuàng)新互聯(lián)

      這期內容當中小編將會給大家?guī)碛嘘P使用layui怎么實現(xiàn)一個動態(tài)表頭,文章內容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

      創(chuàng)新互聯(lián)公司主營五峰網站建設的網絡公司,主營網站建設方案,成都app軟件開發(fā),五峰h5微信平臺小程序開發(fā)搭建,五峰網站營銷推廣歡迎五峰等地區(qū)企業(yè)咨詢

      layui是什么

      layui是一款采用自身模塊規(guī)范編寫的前端UI框架,它遵循原生HTML/CSS/JS的書寫與組織形式,門檻極低,適合新手,并且它還提供了豐富的內置模塊,他們皆可通過模塊化的方式按需加載,從核心代碼到API的每一處細節(jié)都經過精心雕琢,非常適合界面的快速開發(fā),能夠作為PC網頁端后臺系統(tǒng)與前臺界面的速成開發(fā)方案。

      @Override
        public List> distribution(String begin,String end,String name,String hospitalCode) {
          HashMap params = new HashMap();
          StringBuffer buf = new StringBuffer();
          
          List hRateAllotDepartment = rateAllotDepartmentDao.getRateDepartment(hospitalCode);
          String str1 = "";
          String str2 = "";
          for(int i=0;i=:begin and g.createDate<=:end and b.name like :name and a.state ='02' group by b.`id`,d.`id` ) d group by d.productId_ WITH ROLLUP ");
          if(begin == null || begin.length() == 0){
            begin = "1970-01-01";
          }
          if(end == null || end.length() == 0){
            end = "2099-01-01";
          }
          params.put("begin",begin);
          params.put("end",end);
          params.put("name","%"+name+"%");
          return this.getMapListByMap(buf.toString(), params); 
          
          
        }

      可以看到,一開始是有一個list,這個list是醫(yī)院醫(yī)生可以配置的科室,這些科室就是動態(tài)的。這樣一來后臺即可得到動態(tài)數據。同理,如果在layui時用到page,在這里返回成page類型即可。接下來再看js

      function toList(begin,end,name){
          
          console.log(begin);
          console.log(end);
          
          $.ajax({
            url: basePath + "/biz/hospital/rate/allot/list.do",
            data: {
              begin:begin,
              end:end,
              name:name
            },
            type : 'post',
            dataType : 'json',
            success : function(data) {
                
              var arrayPrice = new Array();
      
              for(var i=0;i";
                  }
                  if(i==(arrayPrice.length-1)&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                    sumCols+=""+arrayPrice[i][key]+"";
                  }
                  if(i!=(arrayPrice.length-1)&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                    partColsStr += ""+arrayPrice[i][key]+"";
                    
                  }
                 
                }
                
                partCols.push(partColsStr);
                
              }
      
              var sRenshu = 0;
              var stotal = 0;
              
              var tablex = "";
              
              tablex += "項目名稱檢查人數金額(元)"+title+"";
              
              if(data!=null && data.length>0){
                for(var i=0;i總計"+sRenshu+""+stotal+""+sumCols+"";
                
                for(var i=0;i"+data[i].name+"" +
                        "" +
                          ""+
                                                    data[i].renshu+"" +
                        ""+data[i].total+ partCols[i] +
                        "";
                  }
                }
                
              }
              $("#table_status").empty();
              $("#table_status").append(tablex);
                
              },
            error : function() {
              layer.msg('系統(tǒng)異常,請聯(lián)系管理員!',{icon:2,time:2000});
            }
          });
          
          
        }

      可以在最上方圖看到,有些字段是固定的,但是有些字段是動態(tài)的。思路是通過將調用接口返回出來的數據,動態(tài)的部分放到一個鍵值對數組下。這樣一來,固定的部分,依然可以用返回的data得到,而動態(tài)的部分,用處理的數組循環(huán)賦值即可。動態(tài)表頭就是動態(tài)數組的鍵。數據就是值。

      function toList(begin,end,name){
          
          console.log(begin);
          console.log(end);
          
          $.ajax({
            url: basePath + "/biz/hospital/rate/allot/list.do",
            data: {
              begin:begin,
              end:end,
              name:name
            },
            type : 'post',
            dataType : 'json',
            success : function(data) {
                
              var arrayPrice = new Array();
      
              for(var i=0;i";
                  }
                  if(i==(arrayPrice.length-1)&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                    sumCols+=""+arrayPrice[i][key]+"";
                  }
                  if(i!=(arrayPrice.length-1)&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                    partColsStr += ""+arrayPrice[i][key]+"";
                    
                  }
                 
                }
                
                partCols.push(partColsStr);
                
              }
      
              var sRenshu = 0;
              var stotal = 0;
              
              var tablex = "";
              
              tablex += "項目名稱檢查人數金額(元)"+title+"";
              
              if(data!=null && data.length>0){
                for(var i=0;i總計"+sRenshu+""+stotal+""+sumCols+"";
                
                for(var i=0;i"+data[i].name+"" +
                        "" +
                          ""+
                                                    data[i].renshu+"" +
                        ""+data[i].total+ partCols[i] +
                        "";
                  }
                }
                
              }
              $("#table_status").empty();
              $("#table_status").append(tablex);
                
              },
            error : function() {
              layer.msg('系統(tǒng)異常,請聯(lián)系管理員!',{icon:2,time:2000});
            }
          });
          
          
        }

      這塊是name這些的是固定的,就排除掉,然后將數據放到arrayPrice1下再push到數組下。tablex就是表格的html。當時拼接的是分兩步,先是表頭,然后是數據。有個總計,后來在sql下加了WITH ROLLUP就得到了。

      for(var key in arrayPrice[i]){
      
          
              if(i==0&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                 title+=""+key+"(元)";
              }
              if(i==(arrayPrice.length-1)&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                sumCols+=""+arrayPrice[i][key]+"";
              }
              if(i!=(arrayPrice.length-1)&&(arrayPrice[arrayPrice.length-1][key]!=0)){
                partColsStr += ""+arrayPrice[i][key]+"";
                
              }
             
            }

      這塊就是動態(tài)的數據,title表頭,sumCols總計,partColsStr具體數據,加到tablex下就行。以上就是原生的思路。

      使用layui怎么實現(xiàn)一個動態(tài)表頭

      這塊table用到了layui,當時也是看著這個layui動態(tài)設置的思路去寫的原生。主要思路是:cols是一個數組,通過ajax得到數據后放到數組下,再放到cols下即可。

      $.ajax({
        url: basePath + "/biz/hospital/rate/allot/department/getDepartment.do",
        data: {
        
        },
        type : 'post',
        dataType : 'json',
        success : function(data) {
          mycols[0] = {field : 'nameTrue', title:"姓名", align:'center',width:'120'};
          mycols[1] = {field : 'telephoneTrue', title:'支付手機號', align:'center',width:'120'};
          mycols[2] = {field : 'orderNO', title:'訂單號', align:'center',width:'120'};
          mycols[3] = {field : 'createDate', title:'訂單創(chuàng)建時間', align:'center',width:'120'};
          mycols[4] = {field : 'modifyDate', title:'訂單使用時間', align:'center',width:'120'};
          mycols[5] = {field : 'price', title:'支付金額(元)', align:'center',width:'120'};
          
          for (var i = 0;i < data.length; i++){ 
            var obj = data[i].departmentName;
            if(obj!=0){
              mycols[i+6] = {field : obj, title:obj+"(元)", align:'center',width:'120'};
            }
            
            }
          
        console.log(mycols);
        
        reload();
        
        },
        error : function() {
          layer.msg('系統(tǒng)異常,請聯(lián)系管理員!',{icon:2,time:2000});
        }
      });

      以上是ajax調用后處理的數組。下面這些就是table。reload();就是重新渲染。

      var options = {
            url: basePath + "/biz/hospital/rate/allot/list_mx.do",
            method: 'post',
            where:{
              begin:$("#startDate").val().toString(),
              end:end,
              productId_:$("#productId_").val().toString(),
              orderNO:$("#qorderNO").val().toString(),
              name:$("#qname").val().toString()
            },
            //分頁請求參數
            request:{
              pageName: 'pageIndex', //頁碼
              limitName: 'limit' //每頁多少數據
            },
            //返回的數據格式
            response:{
               statusName: 'status', //數據狀態(tài)的字段名稱,默認:code
               statusCode: 200, //成功的狀態(tài)碼,默認:0
               msgName: 'message', //狀態(tài)信息的字段名稱,默認:msg
               countName: 'total', //數據總數的字段名稱,默認:count
               dataName: 'data' //數據列表的字段名稱,默認:data
            },
            //每頁10條數據
            limit: 10,
            
            //加載時出現(xiàn)加載條
            loading: true,
            elem: '#data_table',
            cols: [
              mycols
             ],
             
      
             
            id: 'dataTable',
            page: true,
            };
        
        //方法級渲染
        table.render(options);
      
      function reload(){
          
          date = new Date($("#endDate").val());
          
          date=date.setDate(date.getDate()+1);
          date=new Date(date);
        
          datemonth=date.getMonth()+1;   //獲取當前月份(0-11,0代表1月)
      
          end=date.getFullYear()+"-"+datemonth+"-"+date.getDate();
          
          //options.where.departmentId = $("#departmentId").val();
          options.where.begin = $("#startDate").val();
          options.where.end = end;
          options.where.orderNO = $("#qorderNO").val();;
          options.where.name = $("#qname").val();;
           
          table.reload("dataTable",options);
          
        }

      可以看到

      cols: [
              mycols
             ],

      上述就是小編為大家分享的使用layui怎么實現(xiàn)一個動態(tài)表頭了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注創(chuàng)新互聯(lián)成都網站設計公司行業(yè)資訊頻道。

      另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。


      本文題目:使用layui怎么實現(xiàn)一個動態(tài)表頭-創(chuàng)新互聯(lián)
      本文地址:http://www.ef60e0e.cn/article/cohjdp.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        仙桃市| 彭山县| 徐闻县| 鸡泽县| 榆树市| 平昌县| 民权县| 酒泉市| 宝兴县| 宁河县| 吉林市| 景德镇市| 大姚县| 隆林| 阿拉尔市| 富锦市| 内丘县| 云浮市| 咸阳市| 绍兴县| 中牟县| 黎城县| 宜宾县| 大冶市| 博白县| 肥城市| 芒康县| 石屏县| 乌兰察布市| 叶城县| 昂仁县| 教育| 北辰区| 淅川县| 怀集县| 玉树县| 长武县| 错那县| 滕州市| 拉孜县| 德钦县|