Commit 90b2b18d51a2fbdd84f8824d1e52fcc9f44195c0

Authored by ljq
1 parent b65d207c

排班明细中添加公司筛选条件

src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
... ... @@ -226,23 +226,30 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im
226 226 String line = map.get("line").toString();
227 227 String page = map.get("page").toString();
228 228 Map<String, Object> modelMap = new HashMap<String, Object>();
229   -
  229 + String fgs="";
  230 + if(map.get("fgsdm")!=null){
  231 + fgs=map.get("fgsdm").toString();
  232 + }
230 233  
231 234 String sql ="SELECT sp.xl as xl,MAX(sp.tt_info_names) as tt_info_name, " +
232 235 "MAX(sp.schedule_from_time) as from_time ,MAX(sp.schedule_to_time) as to_time, " +
233 236 "MAX(line.name) as name , MAX(us.user_name) as uname, " +
234   - "MAX(sp.update_date) as updata_date " +
  237 + "MAX(sp.update_date) as updata_date,max(bu.business_name) as business_name " +
235 238 "from bsth_c_s_sp sp " +
236 239 "LEFT JOIN bsth_c_line line on sp.xl = line.line_code " +
237 240 "left join bsth_c_sys_user us on sp.update_by = us.id " +
  241 + "LEFT JOIN bsth_c_business bu on line.branche_company = bu.business_code " +
238 242 "where line.name not like '%测试线路%' and sfyy = '1' " +
239 243 "and line.destroy = '0' " ;
240   - if(!line.equals(" ") && !line.equals("")){
241   - sql += "and sp.xl="+line;
242   - }
243   -
  244 + if(!fgs.equals(" ") && !fgs.equals("")){
  245 + sql +=" and line.branche_company = '"+fgs+"'";
  246 + }
  247 + if(!line.equals(" ") && !line.equals("")){
  248 + sql += "and sp.xl="+line;
  249 + }
  250 +
244 251 sql += " GROUP BY sp.xl ORDER BY MAX(sp.schedule_from_time);";
245   - List<Map> list = null;
  252 + List<Map> list = null;
246 253 try {
247 254 list = jdbcTemplate.query(sql, new RowMapper<Map>() {
248 255 @Override
... ... @@ -255,7 +262,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
255 262 map.put("name", rs.getString("name"));
256 263 map.put("uName", rs.getString("uname"));
257 264 map.put("updataDate", rs.getString("updata_date"));
258   -
  265 + map.put("businessName", rs.getString("business_name"));
259 266 return map;
260 267 }
261 268  
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/newest/list_newest.html
... ... @@ -40,11 +40,16 @@
40 40  
41 41 </div>
42 42 <div class="portlet-body">
  43 + <div style="display: none" id="gsdmDiv">
  44 + <span class="item-label" style="width: 80px;">公司: </span>
  45 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  46 + </div>
43 47 <div class="table-container" style="margin-top: 10px">
44 48 <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line">
45 49 <thead>
46 50 <tr role="row" class="heading">
47 51 <th style="width: 70px;">序号</th>
  52 + <th style="width: 160px;">分公司</th>
48 53 <th style="width: 160px;">线路名称</th>
49 54 <th style="width: 250px;">关联时刻表</th>
50 55 <th style="width: 150px;">排班开始日期</th>
... ... @@ -54,12 +59,14 @@
54 59 <tr role="row" class="filter">
55 60 <td></td>
56 61 <td>
  62 + <select class="form-control" name="fgsdm" id="fgsdm" style="width: 200px;"></select>
  63 + </td>
  64 + <td>
57 65 <select class="form-control" name="line" id="line" style="width: 200px;"></select>
  66 + </td>
58 67 <td>
59   -
60 68 </td>
61 69 <td>
62   -
63 70 </td>
64 71 <td>
65 72 </td>
... ... @@ -93,6 +100,52 @@
93 100 if (!$('body').hasClass('page-sidebar-closed'))
94 101 $('.menu-toggler.sidebar-toggler').click();
95 102  
  103 +
  104 + var fage=false;
  105 + var obj = [];
  106 + var xlList;
  107 + $.get('/report/lineList',function(result){
  108 + xlList=result;
  109 +
  110 + $.get('/user/companyData', function(result){
  111 + obj = result;
  112 + console.log(obj);
  113 + var options = '';
  114 + for(var i = 0; i < obj.length; i++){
  115 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  116 + }
  117 +
  118 + if(obj.length ==0){
  119 + $("#gsdmDiv").css('display','none');
  120 + }else if(obj.length ==1){
  121 + $("#gsdmDiv").css('display','none');
  122 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  123 + $('#fgsdmDiv').css('display','none');
  124 + }
  125 + $('#gsdm').html(options);
  126 +
  127 + updateCompany();
  128 + });
  129 + });
  130 +
  131 + $("#gsdm").on("change",updateCompany);
  132 + function updateCompany(){
  133 + var company = $('#gsdm').val();
  134 + var options =[];
  135 + options.push({id: " ", text: "全部"});
  136 + for(var i = 0; i < obj.length; i++){
  137 + if(obj[i].companyCode == company){
  138 + var children = obj[i].children;
  139 + for(var j = 0; j < children.length; j++){
  140 + options.push({id: children[j].code, text: children[j].name});
  141 + }
  142 + }
  143 + }
  144 + //$('#fgsdm').html(options);
  145 + initPinYinSelect2('#fgsdm', options, '');
  146 + }
  147 +
  148 +
96 149 var tempData = {};
97 150  
98 151 $.get('/report/lineList', function (xlList) {
... ... @@ -118,14 +171,17 @@
118 171  
119 172 var list;
120 173 var line = $("#line").val();
  174 + var fgsdm = $("#fgsdm").val();
121 175 //初始化页面
122 176 load(true);
123 177 $("#query").on("click",function(){
124 178 line = $("#line").val();
  179 + fgsdm = $("#fgsdm").val();
125 180 load(true);
126 181 });
127 182 $("#notification-trigger").on("click",function(){
128   - line = " ";
  183 + line = " ";
  184 + fgsdm = " ";
129 185 $('tr.filter input, select').val(' ').change();
130 186 load(true);
131 187 });
... ... @@ -133,6 +189,7 @@
133 189 function load(pagination){
134 190 var params = {};
135 191 params.line = line;
  192 + params.fgsdm = fgsdm;
136 193 params.page = page;
137 194 $get('/spc/listwest',params,function(result){
138 195 list = result.list;
... ... @@ -202,8 +259,12 @@
202 259 {{(list.page*10)+(i+1)}}
203 260 </td>
204 261 <td>
  262 + {{obj.businessName}}
  263 + </td>
  264 + <td>
205 265 {{obj.name}}
206 266 </td>
  267 +
207 268 <td>
208 269 {{obj.ttInfoName}}
209 270 </td>
... ...