Commit 319ad5391af83d8d4175fef2555c461e15b14caa

Authored by 廖磊
1 parent c1e10442

用油管理

src/main/java/com/bsth/controller/oil/DlbController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +import com.bsth.controller.BaseController;
  6 +import com.bsth.entity.oil.Dlb;
  7 +
  8 +@RestController
  9 +@RequestMapping("dlb")
  10 +public class DlbController extends BaseController<Dlb, Integer>{
  11 +
  12 +}
... ...
src/main/java/com/bsth/entity/oil/Dlb.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.Date;
  5 +
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +import javax.persistence.Transient;
  11 +
  12 +import org.springframework.format.annotation.DateTimeFormat;
  13 +
  14 +import com.bsth.data.BasicData;
  15 +
  16 +@Entity
  17 +@Table(name = "bsth_c_dlb")
  18 +public class Dlb {
  19 + @Id
  20 + @GeneratedValue
  21 + private Integer id;
  22 + @DateTimeFormat(pattern="yyyy-MM-dd")
  23 + private Date rq;
  24 + private String xlbm;
  25 + private String ssgsdm;
  26 + private String fgsdm;
  27 + private String nbbm;
  28 + private String jsy;
  29 + private Double czlc=0.0;
  30 + private Double jzlc=0.0;
  31 + //出站存电
  32 + private Double czcd=0.0;
  33 + //进站存电
  34 + private Double jzcd=0.0;
  35 + //充电量
  36 + private Double cdl;
  37 + private int sfkt;
  38 + private String jhsj;
  39 + //耗电
  40 + private Double hd=0.0;
  41 + private Double sh=0.0;
  42 + private String shyy;
  43 + private Double zlc=0.0;
  44 + private int yhlx;
  45 +
  46 + private Double ns=0.0;
  47 + private Double fyylc=0.0;
  48 + private Double jhzlc=0.0;
  49 + private Double jhfyylc=0.0;
  50 + private int jhzbc;
  51 + private int jhbc;
  52 + private int sjzbc;
  53 + private int sjbc;
  54 + private String edituser;
  55 + private Date edittime;
  56 + private Date createtime;
  57 + private int nylx;
  58 + //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
  59 + private int jcsx;
  60 +
  61 + @Transient
  62 + private String bglyh;
  63 +
  64 + @Transient
  65 + private String xlname;
  66 +
  67 + @Transient
  68 + private String gsname;
  69 +
  70 +
  71 +
  72 +
  73 + public Integer getId() {
  74 + return id;
  75 + }
  76 +
  77 + public void setId(Integer id) {
  78 + this.id = id;
  79 + }
  80 +
  81 + public Date getRq() {
  82 + return rq;
  83 + }
  84 +
  85 + public void setRq(Date rq) {
  86 + this.rq = rq;
  87 + }
  88 +
  89 + public String getXlbm() {
  90 + return xlbm;
  91 + }
  92 +
  93 + public void setXlbm(String xlbm) {
  94 + this.xlbm = xlbm;
  95 + }
  96 +
  97 + public String getSsgsdm() {
  98 + return ssgsdm;
  99 + }
  100 +
  101 + public void setSsgsdm(String ssgsdm) {
  102 + this.ssgsdm = ssgsdm;
  103 + }
  104 +
  105 + public String getFgsdm() {
  106 + return fgsdm;
  107 + }
  108 +
  109 + public void setFgsdm(String fgsdm) {
  110 + this.fgsdm = fgsdm;
  111 + }
  112 +
  113 + public String getNbbm() {
  114 + return nbbm;
  115 + }
  116 +
  117 + public void setNbbm(String nbbm) {
  118 + this.nbbm = nbbm;
  119 + }
  120 +
  121 + public String getJsy() {
  122 + return jsy;
  123 + }
  124 +
  125 + public void setJsy(String jsy) {
  126 + this.jsy = jsy;
  127 + }
  128 +
  129 + public Double getCzlc() {
  130 + return czlc;
  131 + }
  132 +
  133 + public void setCzlc(Double czlc) {
  134 + this.czlc = czlc;
  135 + }
  136 +
  137 + public Double getJzlc() {
  138 + return jzlc;
  139 + }
  140 +
  141 + public void setJzlc(Double jzlc) {
  142 + this.jzlc = jzlc;
  143 + }
  144 +
  145 + public Double getCzcd() {
  146 + return czcd;
  147 + }
  148 +
  149 + public void setCzcd(Double czcd) {
  150 + this.czcd = czcd;
  151 + }
  152 +
  153 + public Double getJzcd() {
  154 + return jzcd;
  155 + }
  156 +
  157 + public void setJzcd(Double jzcd) {
  158 + this.jzcd = jzcd;
  159 + }
  160 +
  161 + public Double getCdl() {
  162 + return cdl;
  163 + }
  164 +
  165 + public void setCdl(Double cdl) {
  166 + this.cdl = cdl;
  167 + }
  168 +
  169 + public int getSfkt() {
  170 + return sfkt;
  171 + }
  172 +
  173 + public void setSfkt(int sfkt) {
  174 + this.sfkt = sfkt;
  175 + }
  176 +
  177 + public String getJhsj() {
  178 + return jhsj;
  179 + }
  180 +
  181 + public void setJhsj(String jhsj) {
  182 + this.jhsj = jhsj;
  183 + }
  184 +
  185 + public Double getHd() {
  186 + return hd;
  187 + }
  188 +
  189 + public void setHd(Double hd) {
  190 + this.hd = hd;
  191 + }
  192 +
  193 + public Double getSh() {
  194 + return sh;
  195 + }
  196 +
  197 + public void setSh(Double sh) {
  198 + this.sh = sh;
  199 + }
  200 +
  201 + public String getShyy() {
  202 + return shyy;
  203 + }
  204 +
  205 + public void setShyy(String shyy) {
  206 + this.shyy = shyy;
  207 + }
  208 +
  209 + public Double getZlc() {
  210 + return zlc;
  211 + }
  212 +
  213 + public void setZlc(Double zlc) {
  214 + this.zlc = zlc;
  215 + }
  216 +
  217 + public int getYhlx() {
  218 + return yhlx;
  219 + }
  220 +
  221 + public void setYhlx(int yhlx) {
  222 + this.yhlx = yhlx;
  223 + }
  224 +
  225 + public Double getNs() {
  226 + return ns;
  227 + }
  228 +
  229 + public void setNs(Double ns) {
  230 + this.ns = ns;
  231 + }
  232 +
  233 + public Double getFyylc() {
  234 + return fyylc;
  235 + }
  236 +
  237 + public void setFyylc(Double fyylc) {
  238 + this.fyylc = fyylc;
  239 + }
  240 +
  241 + public Double getJhzlc() {
  242 + return jhzlc;
  243 + }
  244 +
  245 + public void setJhzlc(Double jhzlc) {
  246 + this.jhzlc = jhzlc;
  247 + }
  248 +
  249 + public Double getJhfyylc() {
  250 + return jhfyylc;
  251 + }
  252 +
  253 + public void setJhfyylc(Double jhfyylc) {
  254 + this.jhfyylc = jhfyylc;
  255 + }
  256 +
  257 + public int getJhzbc() {
  258 + return jhzbc;
  259 + }
  260 +
  261 + public void setJhzbc(int jhzbc) {
  262 + this.jhzbc = jhzbc;
  263 + }
  264 +
  265 + public int getJhbc() {
  266 + return jhbc;
  267 + }
  268 +
  269 + public void setJhbc(int jhbc) {
  270 + this.jhbc = jhbc;
  271 + }
  272 +
  273 + public int getSjzbc() {
  274 + return sjzbc;
  275 + }
  276 +
  277 + public void setSjzbc(int sjzbc) {
  278 + this.sjzbc = sjzbc;
  279 + }
  280 +
  281 + public int getSjbc() {
  282 + return sjbc;
  283 + }
  284 +
  285 + public void setSjbc(int sjbc) {
  286 + this.sjbc = sjbc;
  287 + }
  288 +
  289 + public String getEdituser() {
  290 + return edituser;
  291 + }
  292 +
  293 + public void setEdituser(String edituser) {
  294 + this.edituser = edituser;
  295 + }
  296 +
  297 + public Date getEdittime() {
  298 + return edittime;
  299 + }
  300 +
  301 + public void setEdittime(Date edittime) {
  302 + this.edittime = edittime;
  303 + }
  304 +
  305 + public Date getCreatetime() {
  306 + return createtime;
  307 + }
  308 +
  309 + public void setCreatetime(Date createtime) {
  310 + this.createtime = createtime;
  311 + }
  312 +
  313 + public int getNylx() {
  314 + return nylx;
  315 + }
  316 +
  317 + public void setNylx(int nylx) {
  318 + this.nylx = nylx;
  319 + }
  320 +
  321 + public int getJcsx() {
  322 + return jcsx;
  323 + }
  324 +
  325 + public void setJcsx(int jcsx) {
  326 + this.jcsx = jcsx;
  327 + }
  328 +
  329 + public String getBglyh() {
  330 + if(this.getZlc()==0){
  331 + return "0.00";
  332 + }else{
  333 + DecimalFormat df = new DecimalFormat("0.00");
  334 + return df.format(this.getHd()/this.getZlc()*100);
  335 + }
  336 + }
  337 +
  338 + public void setBglyh(String bglyh) {
  339 + this.bglyh = bglyh;
  340 + }
  341 +
  342 + public String getXlname() {
  343 + return BasicData.lineCode2NameMap.get(this.xlbm);
  344 + }
  345 +
  346 + public void setXlname(String xlname) {
  347 + this.xlname = xlname;
  348 + }
  349 +
  350 + public String getGsname() {
  351 + return BasicData.businessCodeNameMap.get(this.ssgsdm);
  352 + }
  353 +
  354 + public void setGsname(String gsname) {
  355 + this.gsname = gsname;
  356 + }
  357 +
  358 +
  359 +}
... ...
src/main/java/com/bsth/repository/oil/DlbRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +import org.springframework.stereotype.Repository;
  4 +import com.bsth.entity.oil.Dlb;
  5 +import com.bsth.repository.BaseRepository;
  6 +
  7 +@Repository
  8 +public interface DlbRepository extends BaseRepository<Dlb, Integer>{
  9 +
  10 +}
... ...
src/main/java/com/bsth/service/oil/DlbService.java 0 → 100644
  1 +package com.bsth.service.oil;
  2 +
  3 +import com.bsth.entity.oil.Dlb;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +public interface DlbService extends BaseService<Dlb, Integer>{
  7 +}
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java 0 → 100644
  1 +package com.bsth.service.oil.impl;
  2 +
  3 +
  4 +
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import com.bsth.entity.oil.Dlb;
  8 +import com.bsth.service.impl.BaseServiceImpl;
  9 +import com.bsth.service.oil.DlbService;
  10 +
  11 +@Service
  12 +public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{
  13 +
  14 +
  15 +}
... ...
src/main/resources/static/pages/electricity/list/list.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>进出场存电量</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">用电管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">进出场存电量</span></li>
  11 +</ul>
  12 +
  13 +<div class="row" id="ll_oil_list">
  14 + <div class="col-md-12">
  15 + <!-- Begin: life time stats -->
  16 + <div class="portlet light portlet-fit portlet-datatable bordered">
  17 + <div class="portlet-title">
  18 + <div class="caption">
  19 + <i class="fa fa-fire-extinguisher"></i> <span
  20 + class="caption-subject font-dark sbold uppercase">进出场存电量表</span>
  21 + </div>
  22 + <div class="actions">
  23 + <!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> -->
  24 + <button type="button" class="btn btn-circle blue" id="obtain"><i class="fa fa-hourglass-half"></i>
  25 + 获取加/存电信息
  26 + </button>
  27 + <button type="button" class="btn btn-circle blue" id="checkYl"><i class="fa fa-gg-circle"></i>
  28 + 核对加注量(有加电无里程)
  29 + </button>
  30 + <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
  31 + 导出Excel
  32 + </button>
  33 + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
  34 + </div>
  35 + </div>
  36 + <div class="portlet-body">
  37 + <div class="table-container" style="margin-top: 10px">
  38 + <table
  39 + class="table table-striped table-bordered table-hover table-checkable"
  40 + id="datatable_dlb">
  41 + <thead>
  42 + <tr role="row" class="filter">
  43 + <td> 公司:</td>
  44 + <td colspan="2">
  45 +
  46 + <select class="form-control" name="ssgsdm_like" id="ylbListGsdmId" ></select>
  47 +
  48 + </td>
  49 + <td>
  50 + 分公司:
  51 + </td>
  52 + <td colspan="2">
  53 +
  54 + <select class="form-control" name="fgsdm_like" id="ylbListFgsdmId" ></select>
  55 + </td>
  56 +
  57 + <td>
  58 + 日期:
  59 + </td>
  60 + <td>
  61 + <input type="text" style="width: 80px" name="rq" id="rq"/>
  62 + </td>
  63 + <td >
  64 + 线路:
  65 + </td>
  66 + <td colspan="2">
  67 + <select class="form-control" name="xlbm_eq" id="xlbm" style="width: 120px;"></select>
  68 + &nbsp;
  69 + </td>
  70 + <td >
  71 + 内部编码:
  72 + </td>
  73 + <td colspan="2">
  74 + <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;"></select>
  75 + </td>
  76 + <td colspan="4">
  77 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
  78 + <i class="fa fa-search"></i> 搜索
  79 + </button>
  80 +
  81 + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px">
  82 + <i class="fa fa-times"></i> 重置
  83 + </button>
  84 +
  85 + </td>
  86 + </tr>
  87 + <tr role="row" class="heading">
  88 + <th width="2%">#</th>
  89 + <th width="9%">日期</th>
  90 + <th width="6%">公司</th>
  91 + <th width="9%">线路</th>
  92 + <th width="6%">自编号</th>
  93 + <th width="7%">驾驶员</th>
  94 + <th width="4%">充电量</th>
  95 + <th width="5%">出场公里</th>
  96 + <th width="4%">进场公里</th>
  97 + <th width="4%">出场存电</th>
  98 + <th width="4%">进场存电</th>
  99 + <th width="5%">耗电</th>
  100 + <th width="4%">尿素</th>
  101 + <th width="5%">耗损原因</th>
  102 + <th width="5%">耗损电量</th>
  103 + <th width="5%">当日总里程</th>
  104 + <th width="5%">数据类型</th>
  105 + <th width="5%">百公里电耗</th>
  106 + <!-- <th width="5%">操作</th> -->
  107 + </tr>
  108 + </thead>
  109 + <tbody></tbody>
  110 + </table>
  111 + <div style="text-align: right;">
  112 + <ul id="pagination" class="pagination"></ul>
  113 + </div>
  114 + </div>
  115 + </div>
  116 + </div>
  117 + </div>
  118 +</div>
  119 +
  120 +<script id="ylb_list_temp" type="text/html">
  121 + {{each list as obj i}}
  122 + <tr>
  123 + <td style="vertical-align: middle;">
  124 + <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
  125 + </td>
  126 +
  127 + <td>
  128 + {{obj.rq}}
  129 + </td>
  130 + <td>
  131 + {{obj.gsname}}
  132 + </td>
  133 + <td>
  134 + {{obj.xlname}}
  135 + </td>
  136 + <td>
  137 + {{obj.nbbm}}
  138 + </td>
  139 + <td>
  140 + {{obj.jsy}}
  141 + </td>
  142 + <td>
  143 + {{obj.jzl}}
  144 + </td>
  145 + <td>
  146 + {{obj.czlc}}
  147 + </td>
  148 + <td>
  149 + {{obj.jzlc}}
  150 + </td>
  151 + <td>
  152 + {{obj.czyl}}
  153 + </td>
  154 + <td>
  155 + <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl">
  156 + {{obj.jzyl}}
  157 + </a>
  158 + </td>
  159 + <td>
  160 + {{obj.yh}}
  161 + </td>
  162 + <td>
  163 + {{obj.ns}}
  164 + </td>
  165 + <td>
  166 + {{obj.shyy}}
  167 + </td>
  168 + <td>
  169 + {{obj.sh}}
  170 + </td>
  171 + <td>
  172 + {{obj.zlc}}
  173 + </td>
  174 + <td>
  175 + {{obj.yhlx}}
  176 + </td>
  177 + <td>
  178 + {{obj.bglyh}}
  179 + </td>
  180 + <td>
  181 + <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>-->
  182 + </td>
  183 + </tr>
  184 + {{/each}}
  185 + {{if list.length == 0}}
  186 + <tr>
  187 + <td colspan=19><h6 class="muted">没有找到相关数据</h6></td>
  188 + </tr>
  189 + {{/if}}
  190 +</script>
  191 +
  192 +<script>
  193 + $(function () {
  194 + //var id = 15;
  195 + //$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list')
  196 +
  197 + $("#checkYl").on('click', function () {
  198 + if ($("#rq").val() != "") {
  199 + var cells = $('tr.filter')[0].cells
  200 + , params = {}
  201 + , name;
  202 + $.each(cells, function (i, cell) {
  203 + var items = $('input,select', cell);
  204 + for (var j = 0, item; item = items[j++];) {
  205 + name = $(item).attr('name');
  206 + if (name) {
  207 + params[name] = $(item).val();
  208 + }
  209 + }
  210 + });
  211 + $get('/ylb/checkYl', params, function () {
  212 + jsDoQuery(null, true);
  213 + });
  214 + } else {
  215 + layer.msg('请选择日期.');
  216 + }
  217 + })
  218 +
  219 +
  220 + //获取加存信息
  221 + $("#obtain").on('click', function () {
  222 + if ($("#rq").val() != "") {
  223 + var cells = $('tr.filter')[0].cells
  224 + , params = {}
  225 + , name;
  226 + $.each(cells, function (i, cell) {
  227 + var items = $('input,select', cell);
  228 + for (var j = 0, item; item = items[j++];) {
  229 + name = $(item).attr('name');
  230 + if (name) {
  231 + params[name] = $(item).val();
  232 + }
  233 + }
  234 + });
  235 + $get('/ylb/obtain', params, function () {
  236 + jsDoQuery(params, true);
  237 + });
  238 + } else {
  239 + layer.msg('请选择日期.');
  240 + }
  241 +
  242 + })
  243 + $("#rq").datetimepicker({
  244 + format: 'YYYY-MM-DD',
  245 + locale: 'zh-cn'
  246 + });
  247 +
  248 + var page = 0, initPagination;
  249 + var icheckOptions = {
  250 + radioClass: 'iradio_square-blue icheck',
  251 + increaseArea: '20%'
  252 + }
  253 +
  254 + //重置
  255 + $('tr.filter .filter-cancel').on('click', function () {
  256 + $('tr.filter input, select').val('').change();
  257 + });
  258 +
  259 + //提交
  260 + $('tr.filter .filter-submit').on('click', function () {
  261 + var ylbGsdm=$("#ylbListGsdmId").val();
  262 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  263 + if ($("#rq").val() == "" || $("#rq").val() ==null){
  264 + layer.msg('请选择日期.');
  265 + }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
  266 + layer.msg('请选择公司和分公司.');
  267 + }else {
  268 + var cells = $('tr.filter')[0].cells
  269 + , params = {}
  270 + , name;
  271 + $.each(cells, function (i, cell) {
  272 + var items = $('input,select', cell);
  273 + for (var j = 0, item; item = items[j++];) {
  274 + name = $(item).attr('name');
  275 + if (name) {
  276 + params[name] = $(item).val();
  277 + }
  278 + }
  279 + });
  280 + page = 0;
  281 + jsDoQuery(params, true);
  282 + }
  283 + });
  284 +
  285 +
  286 +// var gsqxdm="";
  287 +
  288 +
  289 + $.get('/user/companyData', function(result){
  290 + obj = result;
  291 + var options="";
  292 +// = '<option value="">请选择</option>';
  293 + for(var i = 0; i < obj.length; i++){
  294 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  295 +// setFgsqx(obj[i].companyCode);
  296 + }
  297 + $('#ylbListGsdmId').html(options);
  298 + updateCompany();
  299 + });
  300 + /* function setFgsqx(gs){
  301 + var company =gs
  302 + var options = '';
  303 + for(var i = 0; i < obj.length; i++){
  304 + if(obj[i].companyCode == company){
  305 + var children = obj[i].children;
  306 + for(var j = 0; j < children.length; j++){
  307 + gsqxdm +=company+""+children[j].code+",";
  308 + }
  309 + }
  310 + }
  311 + } */
  312 + $("#ylbListGsdmId").on("change",updateCompany);
  313 + function updateCompany(){
  314 + var company = $('#ylbListGsdmId').val();
  315 + var options ="";
  316 +// = '<option value="">请选择</option>';
  317 + for(var i = 0; i < obj.length; i++){
  318 + if(obj[i].companyCode == company){
  319 + var children = obj[i].children;
  320 + for(var j = 0; j < children.length; j++){
  321 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  322 + }
  323 + }
  324 + }
  325 + $('#ylbListFgsdmId').html(options);
  326 + }
  327 + /*
  328 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  329 + */
  330 + function jsDoQuery(p, pagination) {
  331 + var params = {};
  332 + if (p)
  333 + params = p;
  334 + //更新时间排序
  335 + params['order'] = 'nbbm';
  336 + params['page'] = page;
  337 + params['rq'] = $("#rq").val();
  338 +
  339 + /* var ylbGsdm=$("#ylbListGsdmId").val();
  340 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  341 + if(ylbGsdm==''|| ylbGsdm==null){
  342 + params['concat(ssgsdm,fgsdm)_in']=gsqxdm;
  343 + }else{
  344 + if(ylbFgsdm==''||ylbFgsdm==null){
  345 + var fgsqx1='';
  346 + for(var i = 0; i < obj.length; i++){
  347 + if(obj[i].companyCode == ylbGsdm){
  348 + var children = obj[i].children;
  349 + for(var j = 0; j < children.length; j++){
  350 + fgsqx1 +=children[j].code+",";
  351 + }
  352 + }
  353 + }
  354 + params['fgsdm_in']=fgsqx1;
  355 + }
  356 + } */
  357 + var i = layer.load(2);
  358 + $get('/ylb', params, function (data) {
  359 + $.each(data.content, function (i, obj) {
  360 + obj.rq = moment(obj.rq).format("YYYY-MM-DD");
  361 + });
  362 + var bodyHtm = template('ylb_list_temp', {list: data.content});
  363 +
  364 + $('#datatable_dlb tbody').html(bodyHtm)
  365 + .find('.icheck').iCheck(icheckOptions)
  366 + .on('ifChanged', iCheckChange);
  367 + if (pagination && data.content.length > 0) {
  368 + //重新分页
  369 + initPagination = true;
  370 + showPagination(data);
  371 + }
  372 + layer.close(i);
  373 +
  374 + startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
  375 + });
  376 + }
  377 +
  378 + //改变状态
  379 + function startOptJzylLink(es) {
  380 + es.editable({
  381 + type: 'text',
  382 + placement: 'right',
  383 + width: 100,
  384 + display: false,
  385 + validate: function (value) {
  386 + if (!value)
  387 + return '值不能为空!';
  388 + if (isNaN(value))
  389 + return '只能为数字!';
  390 + if (value < 0)
  391 + return '值不能小于0!';
  392 + },
  393 + inputclass: 'form-control input-medium input-edtable-sm'
  394 + })
  395 + .on('save', function (e, params) {
  396 + $(this).text(params.newValue);
  397 + });
  398 + }
  399 +
  400 + function iCheckChange() {
  401 + var tr = $(this).parents('tr');
  402 + if (this.checked)
  403 + tr.addClass('row-active');
  404 + else
  405 + tr.removeClass('row-active');
  406 +
  407 + /* if($('#datatable_resource input.icheck:checked').length == 1)
  408 + $('#removeButton').removeAttr('disabled');
  409 + else
  410 + $('#removeButton').attr('disabled', 'disabled'); */
  411 + }
  412 +
  413 + function showPagination(data) {
  414 + //分页
  415 + $('#pagination').jqPaginator({
  416 + totalPages: data.totalPages,
  417 + visiblePages: 6,
  418 + currentPage: page + 1,
  419 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  420 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  421 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  422 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  423 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  424 + onPageChange: function (num, type) {
  425 + if (initPagination) {
  426 + initPagination = false;
  427 + return;
  428 + }
  429 +
  430 + var cells = $('tr.filter')[0].cells
  431 + , params = {}
  432 + , name;
  433 + $.each(cells, function (i, cell) {
  434 + var items = $('input,select', cell);
  435 + for (var j = 0, item; item = items[j++];) {
  436 + name = $(item).attr('name');
  437 + if (name) {
  438 + params[name] = $(item).val();
  439 + }
  440 + }
  441 + });
  442 + page = num - 1;
  443 + jsDoQuery(params, true);
  444 + }
  445 + });
  446 + }
  447 +
  448 +
  449 + //删除
  450 + $('#removeButton').on('click', function () {
  451 + if ($(this).attr('disabled'))
  452 + return;
  453 +
  454 + var id = $('input.icheck:checked').data('id');
  455 + removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () {
  456 + $('tr.filter .filter-submit').click();
  457 + });
  458 + });
  459 +
  460 + //搜索线路
  461 + $.get('/basic/lineCode2Name',function(result){
  462 + var data=[];
  463 +
  464 + for(var code in result){
  465 + data.push({id: code, text: result[code]});
  466 + }
  467 + initPinYinSelect2('#xlbm',data,'');
  468 +
  469 + })
  470 +
  471 + $('#nbbm').select2({
  472 + placeholder: '搜索车辆...',
  473 + ajax: {
  474 + url: '/realSchedule/sreachVehic',
  475 + dataType: 'json',
  476 + delay: 150,
  477 + data: function (params) {
  478 + return {nbbm: params.term};
  479 + },
  480 + processResults: function (data) {
  481 + return {
  482 + results: data
  483 + };
  484 + },
  485 + cache: true
  486 + },
  487 + templateResult: function (repo) {
  488 + if (repo.loading) return repo.text;
  489 + var h = '<span>' + repo.text + '</span>';
  490 + h += (repo.lineName ? '&nbsp;<span class="select2-desc">' + repo.lineName + '</span>' : '');
  491 + return h;
  492 + },
  493 + escapeMarkup: function (markup) {
  494 + return markup;
  495 + },
  496 + minimumInputLength: 1,
  497 + templateSelection: function (repo) {
  498 + return repo.text;
  499 + },
  500 + language: {
  501 + noResults: function () {
  502 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  503 + },
  504 + inputTooShort: function (e) {
  505 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  506 + },
  507 + searching: function () {
  508 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  509 + }
  510 + }
  511 + })
  512 +
  513 +
  514 +//导出
  515 +
  516 + $("#export").on("click", function () {
  517 + if ($("#rq").val() != "") {
  518 + var cells = $('tr.filter')[0].cells
  519 + , params = {}
  520 + , name;
  521 + $.each(cells, function (i, cell) {
  522 + var items = $('input,select', cell);
  523 + for (var j = 0, item; item = items[j++];) {
  524 + name = $(item).attr('name');
  525 + if (name) {
  526 + params[name] = $(item).val();
  527 + }
  528 + }
  529 + });
  530 + $post('/ylb/listExport', params, function (result) {
  531 + window.open("/downloadFile/download?fileName=进出场存电量" + moment($("#rq").val()).format("YYYYMMDD"));
  532 + });
  533 + } else {
  534 + layer.msg('请选择日期.');
  535 + }
  536 + });
  537 +
  538 + });
  539 +</script>
0 540 \ No newline at end of file
... ...