Commit a457f9b54506e5338d224b9e87712aa34b6c1994

Authored by 廖磊
1 parent 43e2f0b1

加油车卡不符

src/main/java/com/bsth/controller/oil/YlxxbController.java
1 package com.bsth.controller.oil; 1 package com.bsth.controller.oil;
2 2
3 import java.util.HashMap; 3 import java.util.HashMap;
  4 +import java.util.List;
4 import java.util.Map; 5 import java.util.Map;
5 6
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +29,12 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ @@ -28,6 +29,12 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{
28 return pagequery; 29 return pagequery;
29 } 30 }
30 31
  32 + @RequestMapping(value = "/listNbbm",method = RequestMethod.GET)
  33 + public List<Ylxxb> listNbbm(@RequestParam Map<String, Object> map){
  34 + List<Ylxxb> list=service.Pagequery_nbbm(map);
  35 + return list;
  36 + }
  37 +
31 38
32 /** 39 /**
33 * 核对油量(有加油没里程) 40 * 核对油量(有加油没里程)
@@ -45,4 +52,17 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{ @@ -45,4 +52,17 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{
45 } 52 }
46 return list; 53 return list;
47 } 54 }
  55 +
  56 + @RequestMapping(value = "/checkNbbm",method = RequestMethod.POST)
  57 + public Map<String, Object> checkNbbm(@RequestParam Map<String, Object> map){
  58 + Map<String, Object> list=new HashMap<>();
  59 + try {
  60 + list = service.checkNbbm(map);
  61 + } catch (Exception e) {
  62 + // TODO Auto-generated catch block
  63 + e.printStackTrace();
  64 + }
  65 + return list;
  66 + }
  67 +
48 } 68 }
src/main/java/com/bsth/entity/oil/YlxxbUpdate.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import org.springframework.format.annotation.DateTimeFormat;
  12 +
  13 +import com.bsth.data.BasicData;
  14 +
  15 +@Entity
  16 +@Table(name = "bsth_c_ylxxb_update")
  17 +public class YlxxbUpdate {
  18 + @Id
  19 + @GeneratedValue
  20 + private Integer id;
  21 + @DateTimeFormat(pattern="yyyy-MM-dd")
  22 + private Date yyrq;
  23 + private Date jlrq;
  24 + private String nbbm;
  25 + private String jsy;
  26 + private Double jzl;
  27 + private String stationid;
  28 + private Date createtime;
  29 + private String gsdm;
  30 +
  31 + private Date xgrq;
  32 + private String xgr;
  33 + private String tj;
  34 + public Integer getId() {
  35 + return id;
  36 + }
  37 + public void setId(Integer id) {
  38 + this.id = id;
  39 + }
  40 + public Date getYyrq() {
  41 + return yyrq;
  42 + }
  43 + public void setYyrq(Date yyrq) {
  44 + this.yyrq = yyrq;
  45 + }
  46 + public Date getJlrq() {
  47 + return jlrq;
  48 + }
  49 + public void setJlrq(Date jlrq) {
  50 + this.jlrq = jlrq;
  51 + }
  52 + public String getNbbm() {
  53 + return nbbm;
  54 + }
  55 + public void setNbbm(String nbbm) {
  56 + this.nbbm = nbbm;
  57 + }
  58 + public String getJsy() {
  59 + return jsy;
  60 + }
  61 + public void setJsy(String jsy) {
  62 + this.jsy = jsy;
  63 + }
  64 + public Double getJzl() {
  65 + return jzl;
  66 + }
  67 + public void setJzl(Double jzl) {
  68 + this.jzl = jzl;
  69 + }
  70 + public String getStationid() {
  71 + return stationid;
  72 + }
  73 + public void setStationid(String stationid) {
  74 + this.stationid = stationid;
  75 + }
  76 + public Date getCreatetime() {
  77 + return createtime;
  78 + }
  79 + public void setCreatetime(Date createtime) {
  80 + this.createtime = createtime;
  81 + }
  82 + public String getGsdm() {
  83 + return gsdm;
  84 + }
  85 + public void setGsdm(String gsdm) {
  86 + this.gsdm = gsdm;
  87 + }
  88 + public Date getXgrq() {
  89 + return xgrq;
  90 + }
  91 + public void setXgrq(Date xgrq) {
  92 + this.xgrq = xgrq;
  93 + }
  94 + public String getXgr() {
  95 + return xgr;
  96 + }
  97 + public void setXgr(String xgr) {
  98 + this.xgr = xgr;
  99 + }
  100 + public String getTj() {
  101 + return tj;
  102 + }
  103 + public void setTj(String tj) {
  104 + this.tj = tj;
  105 + }
  106 +
  107 +
  108 +
  109 +
  110 +}
src/main/java/com/bsth/repository/oil/YlxxbUpdateRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +
  4 +import org.springframework.stereotype.Repository;
  5 +import com.bsth.entity.oil.YlxxbUpdate;
  6 +import com.bsth.repository.BaseRepository;
  7 +
  8 +@Repository
  9 +public interface YlxxbUpdateRepository extends BaseRepository<YlxxbUpdate, Integer>{
  10 +
  11 +}
src/main/java/com/bsth/service/oil/YlxxbService.java
1 package com.bsth.service.oil; 1 package com.bsth.service.oil;
2 2
  3 +import java.util.List;
3 import java.util.Map; 4 import java.util.Map;
4 5
5 import com.bsth.entity.oil.Ylxxb; 6 import com.bsth.entity.oil.Ylxxb;
@@ -9,6 +10,9 @@ import com.bsth.util.PageObject; @@ -9,6 +10,9 @@ import com.bsth.util.PageObject;
9 public interface YlxxbService extends BaseService<Ylxxb, Integer>{ 10 public interface YlxxbService extends BaseService<Ylxxb, Integer>{
10 PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; 11 PageObject<Ylxxb> Pagequery(Map<String, Object> map) ;
11 12
  13 + List<Ylxxb> Pagequery_nbbm(Map<String, Object> map) ;
  14 +
12 Map<String, Object> checkJsy(Map<String, Object> map) throws Exception; 15 Map<String, Object> checkJsy(Map<String, Object> map) throws Exception;
  16 + Map<String, Object> checkNbbm(Map<String, Object> map) throws Exception;
13 17
14 } 18 }
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
@@ -5,6 +5,7 @@ import java.sql.SQLException; @@ -5,6 +5,7 @@ import java.sql.SQLException;
5 import java.text.ParseException; 5 import java.text.ParseException;
6 import java.text.SimpleDateFormat; 6 import java.text.SimpleDateFormat;
7 import java.util.ArrayList; 7 import java.util.ArrayList;
  8 +import java.util.Date;
8 import java.util.HashMap; 9 import java.util.HashMap;
9 import java.util.List; 10 import java.util.List;
10 import java.util.Map; 11 import java.util.Map;
@@ -25,9 +26,11 @@ import com.bsth.common.ResponseCode; @@ -25,9 +26,11 @@ import com.bsth.common.ResponseCode;
25 import com.bsth.entity.excep.Offline; 26 import com.bsth.entity.excep.Offline;
26 import com.bsth.entity.oil.Ylb; 27 import com.bsth.entity.oil.Ylb;
27 import com.bsth.entity.oil.Ylxxb; 28 import com.bsth.entity.oil.Ylxxb;
  29 +import com.bsth.entity.oil.YlxxbUpdate;
28 import com.bsth.entity.search.CustomerSpecs; 30 import com.bsth.entity.search.CustomerSpecs;
29 import com.bsth.repository.oil.YlbRepository; 31 import com.bsth.repository.oil.YlbRepository;
30 import com.bsth.repository.oil.YlxxbRepository; 32 import com.bsth.repository.oil.YlxxbRepository;
  33 +import com.bsth.repository.oil.YlxxbUpdateRepository;
31 import com.bsth.service.impl.BaseServiceImpl; 34 import com.bsth.service.impl.BaseServiceImpl;
32 import com.bsth.service.oil.YlxxbService; 35 import com.bsth.service.oil.YlxxbService;
33 import com.bsth.util.PageHelper; 36 import com.bsth.util.PageHelper;
@@ -40,6 +43,8 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -40,6 +43,8 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
40 @Autowired 43 @Autowired
41 YlxxbRepository repository; 44 YlxxbRepository repository;
42 @Autowired 45 @Autowired
  46 + YlxxbUpdateRepository updateRepository;
  47 + @Autowired
43 YlbRepository ylbRepository; 48 YlbRepository ylbRepository;
44 @Autowired 49 @Autowired
45 JdbcTemplate jdbcTemplate; 50 JdbcTemplate jdbcTemplate;
@@ -191,5 +196,86 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -191,5 +196,86 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
191 } 196 }
192 return newMap; 197 return newMap;
193 } 198 }
  199 + @Override
  200 + public List<Ylxxb> Pagequery_nbbm(Map<String, Object> map) {
  201 + // TODO Auto-generated method stub
  202 + String rq=map.get("yyrq").toString();
  203 + String gsdm=map.get("gsdm_like").toString();
  204 + String nbbm=map.get("nbbm").toString();
  205 +
  206 + String sql="select * from (select *,CONCAT(t.nbbm,'_',t.jsy,'_',t.jzl) as tj "
  207 + + " from bsth_c_ylxxb t where t.yyrq='"+rq+"' and t.gsdm='"+gsdm+"' and "
  208 + + " t.nylx=0 and t.jylx=0 and t.nbbm like '%"+nbbm+"%') y "
  209 + + " where y.nbbm not in (select c.inside_code from bsth_c_cars c "
  210 + + " where c.business_code ='05' and c.sfdc=0) and y.tj not in ("
  211 + + " select x.tj from bsth_c_ylxxb_update x)";
  212 +
  213 + //根具条件查询指定日期Ylb的数据
  214 +// List<Ylb> ylbIterator=ylbRepository.checkYl(rq,gsdm,fgsdm);
  215 + List<Ylxxb> list=jdbcTemplate.query(sql,
  216 + new RowMapper<Ylxxb>(){
  217 + @Override
  218 + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
  219 + Ylxxb s = new Ylxxb();
  220 + s.setId(rs.getInt("id"));
  221 + s.setYyrq(rs.getDate("yyrq"));
  222 + s.setNbbm(rs.getString("nbbm"));
  223 + s.setGsdm(rs.getString("gsdm"));
  224 + s.setJsy(rs.getString("jsy"));
  225 + s.setJzl(rs.getDouble("jzl"));
  226 + s.setStationid(rs.getString("stationid"));
  227 + s.setNylx(rs.getInt("nylx"));
  228 + s.setJyggh(rs.getString("jyggh"));
  229 + s.setYj(rs.getDouble("yj"));
  230 +// s.setLdgh(rs.getString("ldgh"));
  231 + s.setBz(rs.getString("bz"));
  232 + return s;
  233 + }
  234 + });
  235 + return list;
  236 + }
194 237
  238 + @Transactional
  239 + @Override
  240 + public Map<String, Object> checkNbbm(Map<String, Object> map) throws Exception{
  241 + Map<String, Object> newMap=new HashMap<String,Object>();
  242 + // TODO Auto-generated method stub
  243 + try {
  244 +// int id=Integer.parseInt(map.get("id").toString());
  245 +// String jsy=map.get("jsy").toString();
  246 +// Ylxxb ylxxb=repository.findOne(id);
  247 +// ylxxb.setJsy(jsy);
  248 +// repository.save(ylxxb);
  249 + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
  250 + JSONArray jsonArray=JSONArray.parseArray(json);
  251 + JSONObject jsonObject;
  252 + for (int x = 0; x < jsonArray.size(); x++) {
  253 + jsonObject=jsonArray.getJSONObject(x);
  254 + Integer id =jsonObject.getInteger("id");
  255 + String nbbm =jsonObject.getString("nbbm").trim();
  256 + Ylxxb ylxxb=repository.findOne(id);
  257 + if(!ylxxb.getNbbm().equals(nbbm)){
  258 + ylxxb.setNbbm(nbbm);
  259 + ylxxb.setJylx(2);
  260 + repository.save(ylxxb);
  261 + YlxxbUpdate ylxxbUpdate=new YlxxbUpdate();
  262 + ylxxbUpdate.setGsdm(ylxxb.getGsdm());
  263 + ylxxbUpdate.setJsy(ylxxb.getJsy());
  264 + ylxxbUpdate.setJzl(ylxxb.getJzl());
  265 + ylxxbUpdate.setJlrq(ylxxb.getJlrq());
  266 + ylxxbUpdate.setNbbm(ylxxb.getNbbm());
  267 + ylxxbUpdate.setYyrq(ylxxb.getYyrq());
  268 + ylxxbUpdate.setCreatetime(new Date());
  269 + ylxxbUpdate.setTj(nbbm+"_"+ylxxb.getJsy()+"_"+ylxxb.getJzl());
  270 + updateRepository.save(ylxxbUpdate);
  271 + }
  272 + }
  273 + newMap.put("status", ResponseCode.SUCCESS);
  274 + }catch(Exception e){
  275 + newMap.put("status", ResponseCode.ERROR);
  276 + logger.error("save erro.", e);
  277 + throw e;
  278 + }
  279 + return newMap;
  280 + }
195 } 281 }
src/main/resources/static/pages/oil/checkNbbmList.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_nbbm_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-users font-dark"></i> <span
  20 + class="caption-subject font-dark sbold uppercase">加油车辆备卡</span>
  21 + </div>
  22 + <div class="actions">
  23 +<!-- <a class="btn btn-circle blue" href="cylAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a> -->
  24 + <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-minus-square"></i> 保存</button>
  25 + </div>
  26 + </div>
  27 + <div class="portlet-body">
  28 + <div class="table-container" style="margin-top: 10px">
  29 + <table
  30 + class="table table-striped table-bordered table-hover table-checkable"
  31 + id="datatable_check">
  32 + <thead>
  33 + <tr role="row" class="heading">
  34 + <th width="3%">#</th>
  35 + <th width="10%">日期</th>
  36 + <th width="10%">公司</th>
  37 + <th width="15%">车辆</th>
  38 + <th width="12%">驾驶员</th>
  39 + <th width="4%">加注量</th>
  40 + <th width="4%">加油站</th>
  41 + <th width="4%">加油类型</th>
  42 + <th width="2%">油价</th>
  43 + <th width="4%">备注</th>
  44 + <th width="19%">操作</th>
  45 + </tr>
  46 + <tr role="row" class="filter">
  47 + <td></td>
  48 + <td>
  49 + <input type="text" id="yyrq" class="form-control form-filter input-sm" name="yyrq">
  50 + </td>
  51 + <td>
  52 + <select class="form-control" name="gsdm_like" id="jyryListGsdmId" ></select>
  53 + </td>
  54 + <td>
  55 + <input type="text" id="nbbm" class="form-control form-filter input-sm" name="nbbm">
  56 + </td>
  57 + <td>
  58 + </td>
  59 + <td></td>
  60 + <td></td>
  61 + <td></td>
  62 + <td></td>
  63 + <td></td>
  64 + <td>
  65 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  66 + <i class="fa fa-search"></i> 搜索</button>
  67 +
  68 + <button class="btn btn-sm red btn-outline filter-cancel">
  69 + <i class="fa fa-times"></i> 重置</button>
  70 + </td>
  71 + </tr>
  72 + </thead>
  73 + <tbody></tbody>
  74 + </table>
  75 + <div style="text-align: right;">
  76 + <ul id="pagination" class="pagination"></ul>
  77 + </div>
  78 + </div>
  79 + </div>
  80 + </div>
  81 + </div>
  82 +</div>
  83 +
  84 +<script id="check_list_temp" type="text/html">
  85 +{{each list as obj i}}
  86 +<tr>
  87 + <td style="vertical-align: middle;">
  88 + <input type="checkbox" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
  89 + </td>
  90 + <td>{{obj.yyrq}}</td>
  91 + <td>
  92 + {{obj.gsname}}
  93 + </td>
  94 + <td>
  95 + <input type="text" class="form-control in_carpark_nbbm" name="nbbm" id="nbbm{{obj.id}}" data-id="{{obj.id}}" value="{{obj.nbbm}}"/>
  96 + </td>
  97 + <td>
  98 +{{obj.jsy}}
  99 + </select>
  100 + </td>
  101 + <td>
  102 + {{obj.jzl}}
  103 + </td>
  104 + <td>{{obj.stationid}}</td>
  105 + <td></td>
  106 + <td></td>
  107 + <td>
  108 + {{obj.bz}}
  109 + </td>
  110 + <td>
  111 + <!-- <a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>
  112 + -->
  113 +</td>
  114 +</tr>
  115 +{{/each}}
  116 +{{if list.length == 0}}
  117 +<tr>
  118 + <td colspan=14><h6 class="muted">没有找到相关数据</h6></td>
  119 +</tr>
  120 +{{/if}}
  121 +</script>
  122 +<script>
  123 +$(function(){
  124 + $("#saveButton").on('click',function(){
  125 + var ylArray = [];
  126 + $('input.icheck').each(function(){
  127 + var map = {};
  128 + var id=$(this).data('id');
  129 + var nbbm=$('.in_carpark_nbbm[data-id='+id+']', '#ll_nbbm_list').val();
  130 + map['id']=id;
  131 + map['nbbm']=nbbm;
  132 + ylArray.push(map);
  133 + })
  134 + var params = {};
  135 + params['ylbList']=JSON.stringify(ylArray);
  136 + var i = layer.load(2);
  137 + $post('/ylxxb/checkNbbm', params, function(){
  138 + layer.close(i);
  139 + var cells = $('tr.filter')[0].cells
  140 + ,params1 = {}
  141 + ,name;
  142 + $.each(cells, function(i, cell){
  143 + var items = $('input,select', cell);
  144 + for(var j = 0, item; item = items[j++];){
  145 + name = $(item).attr('name');
  146 + if(name){
  147 + params1[name] = $(item).val();
  148 + }
  149 + }
  150 + });
  151 + jsDoQuery(params1,true);
  152 + })
  153 + })
  154 +
  155 + $("#yyrq").datetimepicker({
  156 + format : 'YYYY-MM-DD',
  157 + locale : 'zh-cn'
  158 + });
  159 + var page = 0, initPagination;
  160 + var icheckOptions = {
  161 + radioClass: 'icheckbox_flat-blue icheck',
  162 + increaseArea: '20%'
  163 + }
  164 + //重置
  165 + $('tr.filter .filter-cancel').on('click', function(){
  166 + $('tr.filter input, select').val('').change();
  167 +// jsDoQuery(null, true);
  168 + });
  169 +
  170 +// var gsqx="";
  171 +// var fgsqx="";
  172 +
  173 + $.get('/user/companyData', function(result){
  174 + obj = result;
  175 + var options = '';
  176 +// '<option value="">请选择</option>';
  177 + for(var i = 0; i < obj.length; i++){
  178 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  179 +// setFgsqx(obj[i].companyCode);
  180 +// gsqx +=obj[i].companyCode+",";
  181 + }
  182 + $('#jyryListGsdmId').html(options);
  183 +// updateCompany();
  184 + });
  185 +
  186 +
  187 + //提交
  188 + $('tr.filter .filter-submit').on('click', function(){
  189 + var jyryGsdm=$("#jyryListGsdmId").val();
  190 + if($("#yyrq").val()==""||$("#yyrq").val()==null ){
  191 + layer.msg('请选择日期.');
  192 + }else if(jyryGsdm=="" || jyryGsdm==null){
  193 + layer.msg('请选择公司和分公司.');
  194 + }else{
  195 + var cells = $('tr.filter')[0].cells
  196 + ,params = {}
  197 + ,name;
  198 + $.each(cells, function(i, cell){
  199 + var items = $('input,select', cell);
  200 + for(var j = 0, item; item = items[j++];){
  201 + name = $(item).attr('name');
  202 + if(name){
  203 + params[name] = $(item).val();
  204 + }
  205 + }
  206 + });
  207 + page = 0;
  208 + jsDoQuery(params, true);
  209 + }
  210 + });
  211 +
  212 + /*
  213 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  214 + */
  215 + function jsDoQuery(p, pagination){
  216 + var params = {}
  217 +
  218 + if(p)
  219 + params = p;
  220 + //更新时间排序
  221 + params['order'] = 'nbbm';
  222 + params['page'] = page;
  223 + params['yyrq']=$("#yyrq").val();
  224 + var i = layer.load(2);
  225 + $get('/ylxxb/listNbbm' ,params, function(data){
  226 + layer.close(i);
  227 +
  228 + $.each(data, function(i, obj) {
  229 + obj.yyrq = moment(obj.yyrq).format("YYYY-MM-DD");
  230 + });
  231 +
  232 + var bodyHtm = template('check_list_temp', {list: data});
  233 + $('#datatable_check tbody').html(bodyHtm);
  234 +// iCheckChange();
  235 + });
  236 + }
  237 +
  238 + function iCheckChange(){
  239 + var tr = $(this).parents('tr');
  240 + if(this.checked)
  241 + tr.addClass('row-active');
  242 + else
  243 + tr.removeClass('row-active');
  244 +
  245 +// $('input.icheck').each(function(){
  246 +// var id=$(this).data('id');
  247 +// startOptJsy(id);
  248 +// })
  249 +
  250 + /* if($('#datatable_resource input.icheck:checked').length == 1)
  251 + $('#removeButton').removeAttr('disabled');
  252 + else
  253 + $('#removeButton').attr('disabled', 'disabled'); */
  254 + }
  255 +
  256 + function showPagination(data){
  257 + //分页
  258 + $('#pagination').jqPaginator({
  259 + totalPages: data.totalPage,
  260 + visiblePages: 6,
  261 + currentPage: page + 1,
  262 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  263 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  264 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  265 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  266 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  267 + onPageChange: function (num, type) {
  268 + if(initPagination){
  269 + initPagination = false;
  270 + return;
  271 + }
  272 + page = num - 1;
  273 + jsDoQuery(null, false);
  274 + }
  275 + });
  276 + }
  277 +
  278 +
  279 + //删除
  280 + $('#removeButton').on('click', function(){
  281 + if($(this).attr('disabled'))
  282 + return;
  283 +
  284 + var id = $('#datatable_resource input.icheck:checked').data('id');
  285 +
  286 + removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
  287 + $('tr.filter .filter-submit').click();
  288 + });
  289 + });
  290 +
  291 +
  292 +
  293 + //改变状态
  294 + function startOptJsy(id){
  295 + $('#jsy'+id).select2({
  296 + placeholder: '搜索驾驶员...',
  297 + ajax: {
  298 + url: '/report/userList',
  299 + dataType: 'json',
  300 + delay: 150,
  301 + data: function(params){
  302 + return{jsy: params.term,
  303 + gsbm:$('#jyryListGsdmId').val()};
  304 + },
  305 + processResults: function (data) {
  306 + return {
  307 + results: data
  308 + };
  309 + },
  310 + cache: true
  311 + },
  312 + templateResult: function(repo){
  313 + if (repo.loading) return repo.text;
  314 + var h = '<span>'+repo.text+'</span>';
  315 + return h;
  316 + },
  317 + escapeMarkup: function (markup) { return markup; },
  318 + minimumInputLength: 1,
  319 + templateSelection: function(repo){
  320 + return repo.text;
  321 + },
  322 + language: {
  323 + noResults: function(){
  324 + return '<span style="color:red;font-size: 12px;">没有搜索到驾驶员!</span>';
  325 + },
  326 + inputTooShort : function(e) {
  327 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入工号搜索驾驶员</span>';
  328 + },
  329 + searching : function() {
  330 + return '<span style="color:gray;font-size: 12px;"> 正在搜索驾驶员...</span>';
  331 + }
  332 + }
  333 + })
  334 + }
  335 +
  336 +});
  337 +
  338 +</script>
0 \ No newline at end of file 339 \ No newline at end of file