Commit d5dca6f2be6a30d02991ea96c27274d1ff7f8e11
1 parent
586eab26
线调更新
Showing
9 changed files
with
170 additions
and
70 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -691,4 +691,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -691,4 +691,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 691 | public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ | 691 | public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ |
| 692 | return scheduleRealInfoService.deleteToHistory(id); | 692 | return scheduleRealInfoService.deleteToHistory(id); |
| 693 | } | 693 | } |
| 694 | + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST) | ||
| 695 | + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){ | ||
| 696 | + Map<String, Object> map =new HashMap<>(); | ||
| 697 | + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode)); | ||
| 698 | + return map; | ||
| 699 | + } | ||
| 694 | } | 700 | } |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| @@ -231,6 +231,15 @@ public class ScheduleRealInfo { | @@ -231,6 +231,15 @@ public class ScheduleRealInfo { | ||
| 231 | * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成 | 231 | * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成 |
| 232 | */ | 232 | */ |
| 233 | private boolean ccService; | 233 | private boolean ccService; |
| 234 | + private Integer lpChange; | ||
| 235 | + | ||
| 236 | + public Integer getLpChange() { | ||
| 237 | + return lpChange; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + public void setLpChange(Integer lpChange) { | ||
| 241 | + this.lpChange = lpChange; | ||
| 242 | + } | ||
| 234 | 243 | ||
| 235 | public boolean isDfAuto() { | 244 | public boolean isDfAuto() { |
| 236 | return dfAuto; | 245 | return dfAuto; |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -392,6 +392,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -392,6 +392,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 392 | 392 | ||
| 393 | @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | 393 | @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) |
| 394 | @Override | 394 | @Override |
| 395 | + @Query(value = "select r from StationRoute r where r.destroy=0") | ||
| 395 | List<StationRoute> findAll(); | 396 | List<StationRoute> findAll(); |
| 396 | 397 | ||
| 397 | @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") | 398 | @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -223,4 +223,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -223,4 +223,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 223 | @Override | 223 | @Override |
| 224 | List<ScheduleRealInfo> findAll(); | 224 | List<ScheduleRealInfo> findAll(); |
| 225 | 225 | ||
| 226 | + @Modifying | ||
| 227 | + @Transactional | ||
| 228 | + @Query(value = "update ScheduleRealInfo s set s.lpChange=1 where s.id=?1 ") | ||
| 229 | + Integer updateLpChange(Long id); | ||
| 230 | + | ||
| 231 | + @Query(value = "select count (s.id) from ScheduleRealInfo s where s.clZbh=?1 and s.scheduleDateStr=?2 and s.xlBm=?3 and s.qdzCode=?4") | ||
| 232 | + Object isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode); | ||
| 233 | + | ||
| 226 | } | 234 | } |
src/main/java/com/bsth/repository/sys/RoleRepository.java
| @@ -3,6 +3,7 @@ package com.bsth.repository.sys; | @@ -3,6 +3,7 @@ package com.bsth.repository.sys; | ||
| 3 | 3 | ||
| 4 | import javax.transaction.Transactional; | 4 | import javax.transaction.Transactional; |
| 5 | 5 | ||
| 6 | +import org.springframework.data.jpa.domain.Specification; | ||
| 6 | import org.springframework.data.jpa.repository.Modifying; | 7 | import org.springframework.data.jpa.repository.Modifying; |
| 7 | import org.springframework.data.jpa.repository.Query; | 8 | import org.springframework.data.jpa.repository.Query; |
| 8 | import org.springframework.stereotype.Repository; | 9 | import org.springframework.stereotype.Repository; |
| @@ -10,6 +11,8 @@ import org.springframework.stereotype.Repository; | @@ -10,6 +11,8 @@ import org.springframework.stereotype.Repository; | ||
| 10 | import com.bsth.entity.sys.Role; | 11 | import com.bsth.entity.sys.Role; |
| 11 | import com.bsth.repository.BaseRepository; | 12 | import com.bsth.repository.BaseRepository; |
| 12 | 13 | ||
| 14 | +import java.util.List; | ||
| 15 | + | ||
| 13 | @Repository | 16 | @Repository |
| 14 | public interface RoleRepository extends BaseRepository<Role, Integer>{ | 17 | public interface RoleRepository extends BaseRepository<Role, Integer>{ |
| 15 | 18 | ||
| @@ -21,4 +24,7 @@ public interface RoleRepository extends BaseRepository<Role, Integer>{ | @@ -21,4 +24,7 @@ public interface RoleRepository extends BaseRepository<Role, Integer>{ | ||
| 21 | @Transactional | 24 | @Transactional |
| 22 | @Query("update Role r set r.codeName=?1, r.roleName=?2, r.enable=?3, r.descriptions=?4 where r.id=?5") | 25 | @Query("update Role r set r.codeName=?1, r.roleName=?2, r.enable=?3, r.descriptions=?4 where r.id=?5") |
| 23 | void update(String codeName, String roleName, boolean enable, String descriptions, Integer id); | 26 | void update(String codeName, String roleName, boolean enable, String descriptions, Integer id); |
| 27 | + | ||
| 28 | + @Query(value = "select * from role where id in(?1)",nativeQuery = true) | ||
| 29 | + List<Role> findAllById(String ids); | ||
| 24 | } | 30 | } |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -193,4 +193,5 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -193,4 +193,5 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 193 | 193 | ||
| 194 | List<Map<String, Object>> scheduleCorrectionReport(String gsdm, String fgsdm, | 194 | List<Map<String, Object>> scheduleCorrectionReport(String gsdm, String fgsdm, |
| 195 | String line, String date, String date2); | 195 | String line, String date, String date2); |
| 196 | + Integer isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode); | ||
| 196 | } | 197 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -5537,8 +5537,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -5537,8 +5537,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 5537 | ScheduleRealInfo leftSch, rightSch = null; | 5537 | ScheduleRealInfo leftSch, rightSch = null; |
| 5538 | for (int i = 0; i < largeList.size(); i++) { | 5538 | for (int i = 0; i < largeList.size(); i++) { |
| 5539 | leftSch = largeList.get(i); | 5539 | leftSch = largeList.get(i); |
| 5540 | + leftSch.setLpChange(1); | ||
| 5540 | if (i < smallList.size()) { | 5541 | if (i < smallList.size()) { |
| 5541 | rightSch = smallList.get(i); | 5542 | rightSch = smallList.get(i); |
| 5543 | + rightSch.setLpChange(1); | ||
| 5542 | ts.add(rightSch); | 5544 | ts.add(rightSch); |
| 5543 | } else { | 5545 | } else { |
| 5544 | //不对称时多出来的 | 5546 | //不对称时多出来的 |
| @@ -5557,6 +5559,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -5557,6 +5559,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 5557 | 5559 | ||
| 5558 | carSet.add(leftSch.getClZbh()); | 5560 | carSet.add(leftSch.getClZbh()); |
| 5559 | carSet.add(rightSch.getClZbh()); | 5561 | carSet.add(rightSch.getClZbh()); |
| 5562 | + scheduleRealInfoRepository.updateLpChange(leftSch.getId()); | ||
| 5563 | + scheduleRealInfoRepository.updateLpChange(rightSch.getId()); | ||
| 5560 | } | 5564 | } |
| 5561 | 5565 | ||
| 5562 | //重新计算路牌的起点应到时间 | 5566 | //重新计算路牌的起点应到时间 |
| @@ -5912,6 +5916,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -5912,6 +5916,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 5912 | lMap.add(resMap); | 5916 | lMap.add(resMap); |
| 5913 | return lMap; | 5917 | return lMap; |
| 5914 | } | 5918 | } |
| 5919 | + | ||
| 5920 | + @Override | ||
| 5921 | + public Integer isCircleQdz(String clzbh, String sdr, String xlbm, String qdzCode) { | ||
| 5922 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 5923 | + String time =sdf.format(Long.parseLong(sdr)); | ||
| 5924 | + | ||
| 5925 | + Object num=scheduleRealInfoRepository.isCircleQdz(clzbh, time, xlbm, qdzCode); | ||
| 5926 | + Integer num2=num==0||num==0L?0:1; | ||
| 5927 | + return num2; | ||
| 5928 | + } | ||
| 5915 | } | 5929 | } |
| 5916 | 5930 | ||
| 5917 | class AccountMap implements Comparator<Map<String, Object>> { | 5931 | class AccountMap implements Comparator<Map<String, Object>> { |
src/main/java/com/bsth/service/sys/impl/RoleServiceImpl.java
| @@ -103,4 +103,9 @@ public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements | @@ -103,4 +103,9 @@ public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements | ||
| 103 | map.put("userNames", userNames); | 103 | map.put("userNames", userNames); |
| 104 | return map; | 104 | return map; |
| 105 | } | 105 | } |
| 106 | + | ||
| 107 | + @Override | ||
| 108 | + public List<Role> findAllByIds(String ids) { | ||
| 109 | + return roleRepository.findAllById(ids); | ||
| 110 | + } | ||
| 106 | } | 111 | } |
src/main/resources/static/pages/permission/authorize_all/user_auth.html
| @@ -8,9 +8,10 @@ | @@ -8,9 +8,10 @@ | ||
| 8 | <form class="ct_pattern_form"> | 8 | <form class="ct_pattern_form"> |
| 9 | <div class="uk-margin"> | 9 | <div class="uk-margin"> |
| 10 | <div uk-form-custom="target: > * > span:first" style="display: none"> | 10 | <div uk-form-custom="target: > * > span:first" style="display: none"> |
| 11 | - <select id="pattern_select" > | 11 | + <select id="pattern_select"> |
| 12 | <option value="0">监控模式</option> | 12 | <option value="0">监控模式</option> |
| 13 | <option value="1">主调模式</option> | 13 | <option value="1">主调模式</option> |
| 14 | + <option value="2">作废模式</option> | ||
| 14 | </select> | 15 | </select> |
| 15 | <button class="uk-button uk-button-default" type="button" tabindex="-1"> | 16 | <button class="uk-button uk-button-default" type="button" tabindex="-1"> |
| 16 | <span></span> | 17 | <span></span> |
| @@ -72,6 +73,7 @@ | @@ -72,6 +73,7 @@ | ||
| 72 | <h4>系统设置</h4> | 73 | <h4>系统设置</h4> |
| 73 | <ul class="uk-list uk-list-large uk-list-divider"> | 74 | <ul class="uk-list uk-list-large uk-list-divider"> |
| 74 | <li><label><input class="uk-checkbox" type="checkbox" data-event="line_config"> 线路配置</label></li> | 75 | <li><label><input class="uk-checkbox" type="checkbox" data-event="line_config"> 线路配置</label></li> |
| 76 | + <li><label><input class="uk-checkbox" type="checkbox" data-event="fbzdzx_config"> 翻班与自动执行</label></li> | ||
| 75 | <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li> | 77 | <li><label><input class="uk-checkbox" type="checkbox" data-event="tts_config"> TTS</label></li> |
| 76 | <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li> | 78 | <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li> |
| 77 | </ul> | 79 | </ul> |
| @@ -120,12 +122,12 @@ | @@ -120,12 +122,12 @@ | ||
| 120 | 122 | ||
| 121 | <script id="authorize-user-auth-lines-temp" type="text/html"> | 123 | <script id="authorize-user-auth-lines-temp" type="text/html"> |
| 122 | {{each list as t i}} | 124 | {{each list as t i}} |
| 123 | - <h5>{{t.fgsName}}</h5> | ||
| 124 | - <div class="sub_lines"> | 125 | + <h5>{{t.fgsName}}</h5> |
| 126 | + <div class="sub_lines"> | ||
| 125 | {{each t.list as obj j}} | 127 | {{each t.list as obj j}} |
| 126 | - <span title="{{obj.lineCode}}" class="line_btn {{obj.destroy==1?'destroy':''}}">{{obj.name}}</span> | 128 | + <span title="{{obj.lineCode}}" class="line_btn {{obj.destroy==1?'destroy':''}}">{{obj.name}}</span> |
| 127 | {{/each}} | 129 | {{/each}} |
| 128 | - </div> | 130 | + </div> |
| 129 | {{/each}} | 131 | {{/each}} |
| 130 | </script> | 132 | </script> |
| 131 | <script id="authorize-user-auth-title-temp" type="text/html"> | 133 | <script id="authorize-user-auth-title-temp" type="text/html"> |
| @@ -137,25 +139,47 @@ | @@ -137,25 +139,47 @@ | ||
| 137 | 139 | ||
| 138 | <script id="authorize-modal-lines-temp" type="text/html"> | 140 | <script id="authorize-modal-lines-temp" type="text/html"> |
| 139 | {{each list as obj i}} | 141 | {{each list as obj i}} |
| 140 | - <label class="btn {{obj.destroy==1?'destroy':''}}" data-gs="{{obj.company}}" data-fgs="{{obj.brancheCompany}}" title="{{obj.name}}" data-code="{{obj.lineCode}}"> | ||
| 141 | - <input class="uk-checkbox" type="checkbox" >{{obj.name}} | ||
| 142 | - </label> | 142 | + <label class="btn {{obj.destroy==1?'destroy':''}}" data-gs="{{obj.company}}" data-fgs="{{obj.brancheCompany}}" |
| 143 | + title="{{obj.name}}" data-code="{{obj.lineCode}}"> | ||
| 144 | + <input class="uk-checkbox" type="checkbox">{{obj.name}} | ||
| 145 | + </label> | ||
| 143 | {{/each}} | 146 | {{/each}} |
| 144 | </script> | 147 | </script> |
| 145 | <script> | 148 | <script> |
| 146 | (function () { | 149 | (function () { |
| 147 | - var wrap = '#user_authorize_wrap', user, xd_auth, all_lines,companyData; | 150 | + var wrap = '#user_authorize_wrap', user, xd_auth, all_lines, companyData; |
| 148 | //分公司名称映射(只用于分组展示,就写死) | 151 | //分公司名称映射(只用于分组展示,就写死) |
| 149 | - var fgs_name_mapp={ | ||
| 150 | - '55_3': '上南公司(六分公司)', '55_1': '上南公司(二分公司)', '55_2': '上南公司(三分公司)', '55_4': '上南公司(一分公司)', '55_5': '上南公司(培训部)', | ||
| 151 | - '22_2': '金高公司(二分公司)', '22_1': '金高公司(四分公司)', '22_3': '金高公司(三分公司)', '22_5': '金高公司(一分公司)', | ||
| 152 | - '26_3': '南汇公司(三分公司)', '26_2': '南汇公司(南汇二分)', '26_1': '南汇公司(南汇一分)', '26_4': '南汇公司(南汇维修公司)', '26_5': '南汇公司(南汇公司)', '26_6': '南汇公司(南汇六分)', | ||
| 153 | - '05_5': '杨高公司(杨高分公司)', '05_6': '杨高公司(周浦分公司)', '05_3': '杨高公司(芦潮港分公司)', '05_1': '杨高公司(川沙分公司)', '05_2': '杨高公司(金桥分公司)', | ||
| 154 | - '77_78': '闵行公司','300_301': '金球公交', '99_100': '青浦公交','24_1': '一车队', '24_2': '二车队', '24_3': '三车队' | 152 | + var fgs_name_mapp = { |
| 153 | + '55_3': '上南公司(六分公司)', | ||
| 154 | + '55_1': '上南公司(二分公司)', | ||
| 155 | + '55_2': '上南公司(三分公司)', | ||
| 156 | + '55_4': '上南公司(一分公司)', | ||
| 157 | + '55_5': '上南公司(培训部)', | ||
| 158 | + '22_2': '金高公司(二分公司)', | ||
| 159 | + '22_1': '金高公司(四分公司)', | ||
| 160 | + '22_3': '金高公司(三分公司)', | ||
| 161 | + '22_5': '金高公司(一分公司)', | ||
| 162 | + '26_3': '南汇公司(三分公司)', | ||
| 163 | + '26_2': '南汇公司(南汇二分)', | ||
| 164 | + '26_1': '南汇公司(南汇一分)', | ||
| 165 | + '26_4': '南汇公司(南汇维修公司)', | ||
| 166 | + '26_5': '南汇公司(南汇公司)', | ||
| 167 | + '26_6': '南汇公司(南汇六分)', | ||
| 168 | + '05_5': '杨高公司(杨高分公司)', | ||
| 169 | + '05_6': '杨高公司(周浦分公司)', | ||
| 170 | + '05_3': '杨高公司(芦潮港分公司)', | ||
| 171 | + '05_1': '杨高公司(川沙分公司)', | ||
| 172 | + '05_2': '杨高公司(金桥分公司)', | ||
| 173 | + '77_78': '闵行公司', | ||
| 174 | + '300_301': '金球公交', | ||
| 175 | + '99_100': '青浦公交', | ||
| 176 | + '24_1': '一车队', | ||
| 177 | + '24_2': '二车队', | ||
| 178 | + '24_3': '三车队' | ||
| 155 | }; | 179 | }; |
| 156 | 180 | ||
| 157 | var defauleConfig; | 181 | var defauleConfig; |
| 158 | - | 182 | + var patSelect; |
| 159 | $(wrap).on('init', function (e, data) { | 183 | $(wrap).on('init', function (e, data) { |
| 160 | e.stopPropagation(); | 184 | e.stopPropagation(); |
| 161 | user = data.user; | 185 | user = data.user; |
| @@ -174,41 +198,51 @@ | @@ -174,41 +198,51 @@ | ||
| 174 | $.get('/realControAuthority/findByUserId', {userId: user.id}, function (rs) { | 198 | $.get('/realControAuthority/findByUserId', {userId: user.id}, function (rs) { |
| 175 | //console.log('rsrs',rs); | 199 | //console.log('rsrs',rs); |
| 176 | xd_auth = rs; | 200 | xd_auth = rs; |
| 177 | - if(!xd_auth) | ||
| 178 | - xd_auth=defauleConfig; | 201 | + if (!xd_auth) |
| 202 | + xd_auth = defauleConfig; | ||
| 179 | //渲染线路权限 | 203 | //渲染线路权限 |
| 180 | render_auth_lines(); | 204 | render_auth_lines(); |
| 181 | //渲染菜单权限 | 205 | //渲染菜单权限 |
| 182 | render_auth_menus(); | 206 | render_auth_menus(); |
| 183 | //渲染线路选择modal | 207 | //渲染线路选择modal |
| 184 | //render_line_select_modal(); | 208 | //render_line_select_modal(); |
| 185 | - $('#pattern_select',wrap).val(xd_auth.pattern).trigger('change').parent().show(); | 209 | + patSelect = rs.pattern; |
| 210 | + $('#pattern_select', wrap).val(xd_auth.pattern).trigger('change').parent().show(); | ||
| 186 | }); | 211 | }); |
| 187 | }); | 212 | }); |
| 213 | + $('#pattern_select').change(function () { | ||
| 214 | + if ($('#pattern_select', wrap).val() == 2 && $('#pattern_select', wrap).val() != patSelect) { | ||
| 215 | + // UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function(){ | ||
| 216 | + // | ||
| 217 | + // }); | ||
| 218 | + UIkit.modal.alert("选择作废模式后该用户将失去所有线路和权限!"); | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + }) | ||
| 188 | 222 | ||
| 189 | function render_auth_lines() { | 223 | function render_auth_lines() { |
| 190 | - var data = [], codeArray=[]; | ||
| 191 | - if(xd_auth && xd_auth.lineCodeStr) | 224 | + var data = [], codeArray = []; |
| 225 | + if (xd_auth && xd_auth.lineCodeStr) | ||
| 192 | codeArray = xd_auth.lineCodeStr.split(','); | 226 | codeArray = xd_auth.lineCodeStr.split(','); |
| 193 | 227 | ||
| 194 | $.each(all_lines, function () { | 228 | $.each(all_lines, function () { |
| 195 | - if(codeArray.indexOf(this.lineCode)!=-1) | 229 | + if (codeArray.indexOf(this.lineCode) != -1) |
| 196 | data.push(this); | 230 | data.push(this); |
| 197 | }); | 231 | }); |
| 198 | 232 | ||
| 199 | data.sort(function (a, b) { | 233 | data.sort(function (a, b) { |
| 200 | - return a.name.localeCompare(b.name); | 234 | + return a.name.localeCompare(b.name); |
| 201 | }); | 235 | }); |
| 202 | //按分公司分组 | 236 | //按分公司分组 |
| 203 | var gd = groupBy(data, 'cgsbm'); | 237 | var gd = groupBy(data, 'cgsbm'); |
| 204 | data = []; | 238 | data = []; |
| 205 | - for(var code in gd){ | 239 | + for (var code in gd) { |
| 206 | data.push({ | 240 | data.push({ |
| 207 | code: code, | 241 | code: code, |
| 208 | fgsName: fgs_name_mapp[code], | 242 | fgsName: fgs_name_mapp[code], |
| 209 | list: gd[code] | 243 | list: gd[code] |
| 210 | }); | 244 | }); |
| 211 | - if(!fgs_name_mapp[code]){ | 245 | + if (!fgs_name_mapp[code]) { |
| 212 | alert('出现异常的公司归属 :' + code); | 246 | alert('出现异常的公司归属 :' + code); |
| 213 | } | 247 | } |
| 214 | } | 248 | } |
| @@ -225,14 +259,15 @@ | @@ -225,14 +259,15 @@ | ||
| 225 | } | 259 | } |
| 226 | 260 | ||
| 227 | function render_auth_menus() { | 261 | function render_auth_menus() { |
| 228 | - var excludeArray = [],event; | ||
| 229 | - if(xd_auth && xd_auth.excludeMenus) | 262 | + debugger |
| 263 | + var excludeArray = [], event; | ||
| 264 | + if (xd_auth && xd_auth.excludeMenus) | ||
| 230 | excludeArray = xd_auth.excludeMenus.split(','); | 265 | excludeArray = xd_auth.excludeMenus.split(','); |
| 231 | 266 | ||
| 232 | $('.xd_menu_grid li>label>input').each(function () { | 267 | $('.xd_menu_grid li>label>input').each(function () { |
| 233 | - event=$(this).data('event'); | ||
| 234 | - if(excludeArray.indexOf(event)==-1) | ||
| 235 | - this.checked=true; | 268 | + event = $(this).data('event'); |
| 269 | + if (excludeArray.indexOf(event) == -1) | ||
| 270 | + this.checked = true; | ||
| 236 | }); | 271 | }); |
| 237 | $('.xd_menu_grid').show(); | 272 | $('.xd_menu_grid').show(); |
| 238 | $('.xd_menu_grid .uk-list', wrap).perfectScrollbar('update'); | 273 | $('.xd_menu_grid .uk-list', wrap).perfectScrollbar('update'); |
| @@ -243,42 +278,46 @@ | @@ -243,42 +278,46 @@ | ||
| 243 | /** | 278 | /** |
| 244 | * 线路选择modal | 279 | * 线路选择modal |
| 245 | */ | 280 | */ |
| 246 | - var compSelectData, modal='#select_line_modal',modalRender; | 281 | + var compSelectData, modal = '#select_line_modal', modalRender; |
| 247 | $(modal).on('show', function () { | 282 | $(modal).on('show', function () { |
| 248 | - if(!modalRender){ | 283 | + if (!modalRender) { |
| 249 | render_line_select_modal(); | 284 | render_line_select_modal(); |
| 250 | modalRender = true; | 285 | modalRender = true; |
| 251 | } | 286 | } |
| 252 | $('#modal_line_input', modal).focus(); | 287 | $('#modal_line_input', modal).focus(); |
| 253 | }); | 288 | }); |
| 289 | + | ||
| 254 | function render_line_select_modal() { | 290 | function render_line_select_modal() { |
| 255 | - var htmlStr = template('authorize-modal-lines-temp', {list: all_lines, destroy: $('.modal_type_select',modal).val()}); | 291 | + var htmlStr = template('authorize-modal-lines-temp', { |
| 292 | + list: all_lines, | ||
| 293 | + destroy: $('.modal_type_select', modal).val() | ||
| 294 | + }); | ||
| 256 | $('.line_checkbox_list').html(htmlStr); | 295 | $('.line_checkbox_list').html(htmlStr); |
| 257 | //选中线路 | 296 | //选中线路 |
| 258 | - var codeArray=[]; | ||
| 259 | - if(xd_auth && xd_auth.lineCodeStr) | 297 | + var codeArray = []; |
| 298 | + if (xd_auth && xd_auth.lineCodeStr) | ||
| 260 | codeArray = xd_auth.lineCodeStr.split(','); | 299 | codeArray = xd_auth.lineCodeStr.split(','); |
| 261 | 300 | ||
| 262 | $('.line_checkbox_list>label.btn').each(function () { | 301 | $('.line_checkbox_list>label.btn').each(function () { |
| 263 | - if(codeArray.indexOf($(this).data('code')+'')!=-1){ | ||
| 264 | - $(this).addClass('active').find('>input')[0].checked=true; | 302 | + if (codeArray.indexOf($(this).data('code') + '') != -1) { |
| 303 | + $(this).addClass('active').find('>input')[0].checked = true; | ||
| 265 | } | 304 | } |
| 266 | }); | 305 | }); |
| 267 | 306 | ||
| 268 | //构建公司级联下拉框 | 307 | //构建公司级联下拉框 |
| 269 | - compSelectData=convert_buss_data(companyData); | 308 | + compSelectData = convert_buss_data(companyData); |
| 270 | var companyStr = '<option value="">请选择...</option>'; | 309 | var companyStr = '<option value="">请选择...</option>'; |
| 271 | - for(var code in compSelectData){ | ||
| 272 | - companyStr+='<option value="'+code+'">'+compSelectData[code].name+'</option>'; | 310 | + for (var code in compSelectData) { |
| 311 | + companyStr += '<option value="' + code + '">' + compSelectData[code].name + '</option>'; | ||
| 273 | } | 312 | } |
| 274 | $('#modal_company_select', modal).html(companyStr).on('change', function () { | 313 | $('#modal_company_select', modal).html(companyStr).on('change', function () { |
| 275 | - var code = $(this).val(), subSelect=$('#modal_sub_company_select', modal); | ||
| 276 | - if(!code) | 314 | + var code = $(this).val(), subSelect = $('#modal_sub_company_select', modal); |
| 315 | + if (!code) | ||
| 277 | subSelect.empty().attr('disabled', 'disabled'); | 316 | subSelect.empty().attr('disabled', 'disabled'); |
| 278 | - else{ | 317 | + else { |
| 279 | var subCompStr = '<option value="">请选择...</option>'; | 318 | var subCompStr = '<option value="">请选择...</option>'; |
| 280 | $.each(compSelectData[code].childs, function () { | 319 | $.each(compSelectData[code].childs, function () { |
| 281 | - subCompStr+='<option value="'+this.businessCode+'">'+this.businessName+'</option>'; | 320 | + subCompStr += '<option value="' + this.businessCode + '">' + this.businessName + '</option>'; |
| 282 | }); | 321 | }); |
| 283 | subSelect.html(subCompStr).removeAttr('disabled'); | 322 | subSelect.html(subCompStr).removeAttr('disabled'); |
| 284 | } | 323 | } |
| @@ -290,56 +329,56 @@ | @@ -290,56 +329,56 @@ | ||
| 290 | } | 329 | } |
| 291 | 330 | ||
| 292 | $('#modal_line_input', modal).on('input', function () { | 331 | $('#modal_line_input', modal).on('input', function () { |
| 293 | - var t = $(this).val()+''; | ||
| 294 | - if(!t){ | 332 | + var t = $(this).val() + ''; |
| 333 | + if (!t) { | ||
| 295 | filter_modal_lines(); | 334 | filter_modal_lines(); |
| 296 | return; | 335 | return; |
| 297 | } | 336 | } |
| 298 | - var codes=[]; | 337 | + var codes = []; |
| 299 | $.each(all_lines, function () { | 338 | $.each(all_lines, function () { |
| 300 | - if(this.name.indexOf(t)!=-1) | 339 | + if (this.name.indexOf(t) != -1) |
| 301 | codes.push(this.lineCode); | 340 | codes.push(this.lineCode); |
| 302 | }); | 341 | }); |
| 303 | 342 | ||
| 304 | var array = $('.line_checkbox_list>label.btn').css('display', 'none'); | 343 | var array = $('.line_checkbox_list>label.btn').css('display', 'none'); |
| 305 | array.each(function () { | 344 | array.each(function () { |
| 306 | - if(codes.indexOf($(this).data('code')+'')!=-1) | 345 | + if (codes.indexOf($(this).data('code') + '') != -1) |
| 307 | $(this).css('display', 'inline-block'); | 346 | $(this).css('display', 'inline-block'); |
| 308 | }); | 347 | }); |
| 309 | }); | 348 | }); |
| 310 | 349 | ||
| 311 | function filter_modal_lines() { | 350 | function filter_modal_lines() { |
| 312 | console.log('filter_modal_lines'); | 351 | console.log('filter_modal_lines'); |
| 313 | - var company=$('#modal_company_select', modal).val(),//公司代码 | ||
| 314 | - sub_company=$('#modal_sub_company_select', modal).val(),//分公司代码 | ||
| 315 | - type = $('#modal_type_select', modal).val();//线路状态 | 352 | + var company = $('#modal_company_select', modal).val(),//公司代码 |
| 353 | + sub_company = $('#modal_sub_company_select', modal).val(),//分公司代码 | ||
| 354 | + type = $('#modal_type_select', modal).val();//线路状态 | ||
| 316 | 355 | ||
| 317 | - var array = $('.line_checkbox_list>label.btn').css('display', 'none'),s_dom=[]; | 356 | + var array = $('.line_checkbox_list>label.btn').css('display', 'none'), s_dom = []; |
| 318 | 357 | ||
| 319 | - if(!company && !sub_company && type==-1){ | 358 | + if (!company && !sub_company && type == -1) { |
| 320 | array.css('display', 'inline-block'); | 359 | array.css('display', 'inline-block'); |
| 321 | return; | 360 | return; |
| 322 | } | 361 | } |
| 323 | 362 | ||
| 324 | var status; | 363 | var status; |
| 325 | array.each(function () { | 364 | array.each(function () { |
| 326 | - if(company && $(this).data('gs')!=company) | 365 | + if (company && $(this).data('gs') != company) |
| 327 | return true; | 366 | return true; |
| 328 | - if(sub_company && $(this).data('fgs')!=sub_company) | 367 | + if (sub_company && $(this).data('fgs') != sub_company) |
| 329 | return true; | 368 | return true; |
| 330 | 369 | ||
| 331 | - status = $(this).hasClass('destroy')?1:0; | ||
| 332 | - if(type!=-1 && type!=status) | 370 | + status = $(this).hasClass('destroy') ? 1 : 0; |
| 371 | + if (type != -1 && type != status) | ||
| 333 | return true; | 372 | return true; |
| 334 | 373 | ||
| 335 | s_dom.push(this); | 374 | s_dom.push(this); |
| 336 | }); | 375 | }); |
| 337 | - for(var i=0,dom;dom=s_dom[i++];) | 376 | + for (var i = 0, dom; dom = s_dom[i++];) |
| 338 | $(dom).css('display', 'inline-block'); | 377 | $(dom).css('display', 'inline-block'); |
| 339 | } | 378 | } |
| 340 | 379 | ||
| 341 | $('.line_checkbox_list').on('click', 'label.btn', function () { | 380 | $('.line_checkbox_list').on('click', 'label.btn', function () { |
| 342 | - if($('input',this)[0].checked) | 381 | + if ($('input', this)[0].checked) |
| 343 | $(this).addClass('active'); | 382 | $(this).addClass('active'); |
| 344 | else | 383 | else |
| 345 | $(this).removeClass('active'); | 384 | $(this).removeClass('active'); |
| @@ -347,13 +386,13 @@ | @@ -347,13 +386,13 @@ | ||
| 347 | 386 | ||
| 348 | //全选 | 387 | //全选 |
| 349 | $('#globalCheckbox', modal).on('click', function () { | 388 | $('#globalCheckbox', modal).on('click', function () { |
| 350 | - var state=this.checked; | 389 | + var state = this.checked; |
| 351 | $('.line_checkbox_list>label.btn:visible>input').each(function () { | 390 | $('.line_checkbox_list>label.btn:visible>input').each(function () { |
| 352 | - this.checked=state; | 391 | + this.checked = state; |
| 353 | }); | 392 | }); |
| 354 | 393 | ||
| 355 | $('.line_checkbox_list>label.btn:visible').each(function () { | 394 | $('.line_checkbox_list>label.btn:visible').each(function () { |
| 356 | - if(state) | 395 | + if (state) |
| 357 | $(this).addClass('active'); | 396 | $(this).addClass('active'); |
| 358 | else | 397 | else |
| 359 | $(this).removeClass('active'); | 398 | $(this).removeClass('active'); |
| @@ -362,9 +401,9 @@ | @@ -362,9 +401,9 @@ | ||
| 362 | 401 | ||
| 363 | //确定 | 402 | //确定 |
| 364 | $('#confirmBtn', modal).on('click', function () { | 403 | $('#confirmBtn', modal).on('click', function () { |
| 365 | - var lines=''; | 404 | + var lines = ''; |
| 366 | $('.line_checkbox_list>label.btn.active').each(function () { | 405 | $('.line_checkbox_list>label.btn.active').each(function () { |
| 367 | - lines+=($(this).data('code') + ','); | 406 | + lines += ($(this).data('code') + ','); |
| 368 | }); | 407 | }); |
| 369 | xd_auth.lineCodeStr = lines; | 408 | xd_auth.lineCodeStr = lines; |
| 370 | render_auth_lines(); | 409 | render_auth_lines(); |
| @@ -376,14 +415,25 @@ | @@ -376,14 +415,25 @@ | ||
| 376 | $('#global_save_btn', wrap).on('click', function () { | 415 | $('#global_save_btn', wrap).on('click', function () { |
| 377 | $(this).attr('disabled', 'disabled'); | 416 | $(this).attr('disabled', 'disabled'); |
| 378 | //调度模式 | 417 | //调度模式 |
| 379 | - xd_auth.pattern=$('#pattern_select',wrap).val(); | 418 | + xd_auth.pattern = $('#pattern_select', wrap).val(); |
| 380 | //要排除的线调菜单 | 419 | //要排除的线调菜单 |
| 381 | - var excludeMenus=''; | 420 | + var excludeMenus = ''; |
| 382 | $('.xd_menu_grid ul input[type=checkbox]').each(function () { | 421 | $('.xd_menu_grid ul input[type=checkbox]').each(function () { |
| 383 | - if(!this.checked) | ||
| 384 | - excludeMenus+=$(this).data('event')+','; | 422 | + if (!this.checked) |
| 423 | + excludeMenus += $(this).data('event') + ','; | ||
| 385 | }); | 424 | }); |
| 386 | - xd_auth.excludeMenus=excludeMenus; | 425 | + xd_auth.excludeMenus = excludeMenus; |
| 426 | + if (xd_auth.pattern == 2) { | ||
| 427 | + //UIkit.modal.confirm("选择作废模式后该用户将失去所有线路和权限", function () { | ||
| 428 | + xd_auth.lineCodeStr = ''; | ||
| 429 | + var excludeMenusAll = ''; | ||
| 430 | + $('.xd_menu_grid ul input[type=checkbox]').each(function () { | ||
| 431 | + excludeMenusAll += $(this).data('event') + ','; | ||
| 432 | + }); | ||
| 433 | + xd_auth.excludeMenus = excludeMenusAll; | ||
| 434 | + //}); | ||
| 435 | + | ||
| 436 | + } | ||
| 387 | $.post('/realControAuthority', xd_auth, function (rs) { | 437 | $.post('/realControAuthority', xd_auth, function (rs) { |
| 388 | UIkit.notification('保存成功!', 'primary'); | 438 | UIkit.notification('保存成功!', 'primary'); |
| 389 | $('.authorize_right_cont').trigger('refresh-user'); | 439 | $('.authorize_right_cont').trigger('refresh-user'); |