Commit c1617fe0ef1e3f5095d901c633d6097c145d2cce

Authored by 潘钊
1 parent e11bc91c

update...

src/main/java/com/bsth/controller/sys/RealControAuthorityController.java
@@ -2,12 +2,15 @@ package com.bsth.controller.sys; @@ -2,12 +2,15 @@ package com.bsth.controller.sys;
2 2
3 import com.bsth.controller.BaseController; 3 import com.bsth.controller.BaseController;
4 import com.bsth.entity.sys.RealControAuthority; 4 import com.bsth.entity.sys.RealControAuthority;
  5 +import com.bsth.security.util.SecurityUtils;
5 import com.bsth.service.sys.RealControAuthorityService; 6 import com.bsth.service.sys.RealControAuthorityService;
6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestParam; 9 import org.springframework.web.bind.annotation.RequestParam;
9 import org.springframework.web.bind.annotation.RestController; 10 import org.springframework.web.bind.annotation.RestController;
10 11
  12 +import javax.servlet.http.HttpServletRequest;
  13 +
11 /** 14 /**
12 * Created by panzhao on 2017/2/14. 15 * Created by panzhao on 2017/2/14.
13 */ 16 */
@@ -23,4 +26,9 @@ public class RealControAuthorityController extends BaseController<RealControAuth @@ -23,4 +26,9 @@ public class RealControAuthorityController extends BaseController<RealControAuth
23 26
24 return realControAuthorityService.findByUserId(userId); 27 return realControAuthorityService.findByUserId(userId);
25 } 28 }
  29 +
  30 + @RequestMapping("findByCurrentUser")
  31 + public RealControAuthority findByUserId(HttpServletRequest request){
  32 + return realControAuthorityService.findByUserId(SecurityUtils.getCurrentUser().getId());
  33 + }
26 } 34 }
src/main/resources/static/pages/control/lineallot/allot.html
@@ -112,10 +112,10 @@ @@ -112,10 +112,10 @@
112 margin-bottom: 3px; 112 margin-bottom: 3px;
113 } 113 }
114 114
115 - /** 闵行没有分公司,直接隐藏 */ 115 + /** 闵行没有分公司,直接隐藏
116 .company, .sub-company { 116 .company, .sub-company {
117 display: none !important; 117 display: none !important;
118 - } 118 + } */
119 </style> 119 </style>
120 120
121 <div class="page-head"> 121 <div class="page-head">
@@ -138,6 +138,8 @@ @@ -138,6 +138,8 @@
138 class="caption-subject font-green bold uppercase">选择线路</span> 138 class="caption-subject font-green bold uppercase">选择线路</span>
139 </div> 139 </div>
140 </div> 140 </div>
  141 + <div class="alert alert-info">
  142 + <strong>ps</strong> 可选择的线路,进入后是监控还是主调模式。可在 权限管理-> 用户管理里 进行配置。 </div>
141 <div class="portlet-body"> 143 <div class="portlet-body">
142 <div class="row" style="margin-bottom: 30px;"> 144 <div class="row" style="margin-bottom: 30px;">
143 <div class="col-md-8 col-sm-12 col-md-offset-2" style="text-align: center;"> 145 <div class="col-md-8 col-sm-12 col-md-offset-2" style="text-align: center;">
@@ -162,11 +164,11 @@ @@ -162,11 +164,11 @@
162 <div class="selected-body"></div> 164 <div class="selected-body"></div>
163 165
164 <div class="lb_panel"> 166 <div class="lb_panel">
165 - <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1>  
166 - <i class="fa fa-power-off"></i> 主调模式 </a> 167 + <a href="javascript:;" class="btn btn-lg blue gotoControl" data-status=1>
  168 + <i class="fa fa-power-off"></i> 进入线路调度 </a>
167 169
168 - <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0>  
169 - <i class="fa fa-tv"></i> 监控模式 </a> 170 + <!--<a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0>
  171 + <i class="fa fa-tv"></i> 监控模式 </a>-->
170 &nbsp; 172 &nbsp;
171 <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;"> 173 <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;">
172 <i class="fa fa-history"></i> 重置</a> 174 <i class="fa fa-history"></i> 重置</a>
@@ -184,15 +186,9 @@ @@ -184,15 +186,9 @@
184 </div> 186 </div>
185 187
186 <script id="line_select_cont_temp" type="text/html"> 188 <script id="line_select_cont_temp" type="text/html">
187 - {{each data as obj company}}  
188 - <h3 class="company">{{company}}</h3>  
189 - {{each data[company] as subObj subCompany}}  
190 - <h5 class="sub-company" style="font-family: 仿宋;">{{company}}_{{subCompany}}</h5>  
191 - {{each data[company][subCompany] as line i}} 189 + {{each list as line i}}
192 <div class="line" name="line_{{line.lineCode}}" data-id={{line.lineCode}}>{{line.name}}</div> 190 <div class="line" name="line_{{line.lineCode}}" data-id={{line.lineCode}}>{{line.name}}</div>
193 {{/each}} 191 {{/each}}
194 - {{/each}}  
195 - {{/each}}  
196 </script> 192 </script>
197 <script src="/assets/js/eventproxy.js"></script> 193 <script src="/assets/js/eventproxy.js"></script>
198 <script> 194 <script>
@@ -213,64 +209,54 @@ @@ -213,64 +209,54 @@
213 var lineIds = {}; 209 var lineIds = {};
214 210
215 var storage = window.localStorage; 211 var storage = window.localStorage;
216 - 212 + //线调权限
  213 + var auth;
217 $get('/line/all', {destroy_eq: 0}, function (allLine) { 214 $get('/line/all', {destroy_eq: 0}, function (allLine) {
218 - $('#searchLineInput').focus();  
219 - //按公司分组  
220 - var companyJson = groupData(allLine, 'company');  
221 - //按分公司分组  
222 - for (var company in companyJson) {  
223 - companyJson[company] = groupData(companyJson[company], 'brancheCompany');  
224 - } 215 + //用户分配的线路
  216 + $.get('/realControAuthority/findByCurrentUser', function (t) {
  217 + auth = t;
  218 + var newArray = [], authArray = t.lineCodeStr.split(',');
  219 +
  220 + $.each(allLine, function () {
  221 + if (this.lineCode && authArray.indexOf(this.lineCode) != -1) {
  222 + newArray.push(this);
  223 + }
  224 + });
225 225
226 - var htmlStr = template('line_select_cont_temp', {data: companyJson});  
227 - $('.line-select-body').html(htmlStr)  
228 - .slimscroll({//滚动条  
229 - height: '270px'  
230 - });  
231 -  
232 - //替换公司编码  
233 - /* var gsmap = {};  
234 - $get('/business/all', null, function(array){  
235 - $.each(array, function(i, gs){  
236 - var k = gs.upCode + '_' + gs.businessCode;  
237 - if(gs.upCode === '88'){  
238 - k = gs.businessCode;  
239 - }  
240 - gsmap[k] = gs.businessName;  
241 - });  
242 -  
243 - $.each($('.company,.sub-company'), function(j , e){  
244 - var k = $(e).text();  
245 - gsmap[k] && $(e).text(gsmap[k]);  
246 - })  
247 - }); */  
248 -  
249 - //映射  
250 - $.each(allLine, function (s, line) {  
251 - camelChars[pinyin.getCamelChars(line.name)] = line.lineCode;  
252 - fullChars[pinyin.getFullChars(line.name).toUpperCase()] = line.lineCode;  
253 - zhChars[line.name] = line.lineCode;  
254 - lineIdMap[line.lineCode] = line;  
255 -  
256 - lineIds[line.lineCode] = line.name;  
257 - });  
258 - //合并映射  
259 - $.extend(allChars, camelChars, fullChars, zhChars);  
260 -  
261 - //线路选中事件  
262 - $('.line-select-body .line').on('click', function () {  
263 - if ($(this).hasClass('active')) {  
264 - $(this).removeClass('active');  
265 - $('.selected-body .line[name=' + $(this).attr('name') + ']').remove();  
266 - }  
267 - else {  
268 - $(this).addClass('active');  
269 - $('.selected-body').append($(this).clone());  
270 - } 226 + var htmlStr = template('line_select_cont_temp', {list: newArray});
  227 + $('.line-select-body').html(htmlStr)
  228 + .slimscroll({//滚动条
  229 + height: '270px'
  230 + });
  231 +
  232 + //映射
  233 + $.each(allLine, function (s, line) {
  234 + camelChars[pinyin.getCamelChars(line.name)] = line.lineCode;
  235 + fullChars[pinyin.getFullChars(line.name).toUpperCase()] = line.lineCode;
  236 + zhChars[line.name] = line.lineCode;
  237 + lineIdMap[line.lineCode] = line;
  238 +
  239 + lineIds[line.lineCode] = line.name;
  240 + });
  241 + //合并映射
  242 + $.extend(allChars, camelChars, fullChars, zhChars);
  243 +
  244 + //线路选中事件
  245 + $('.line-select-body .line').on('click', function () {
  246 + if ($(this).hasClass('active')) {
  247 + $(this).removeClass('active');
  248 + $('.selected-body .line[name=' + $(this).attr('name') + ']').remove();
  249 + }
  250 + else {
  251 + $(this).addClass('active');
  252 + $('.selected-body').append($(this).clone());
  253 + }
  254 + });
  255 +
  256 + storage.setItem('lineIds', JSON.stringify(lineIds));
271 }); 257 });
272 258
273 - storage.setItem('lineIds', JSON.stringify(lineIds)); 259 + $('#searchLineInput').focus();
274 }); 260 });
275 261
276 //搜索框事件 262 //搜索框事件
@@ -304,9 +290,9 @@ @@ -304,9 +290,9 @@
304 }); 290 });
305 storage.setItem('lineControlItems', JSON.stringify(lsData)); 291 storage.setItem('lineControlItems', JSON.stringify(lsData));
306 292
307 - var operationMode = $(this).data('status'); 293 + //ar operationMode = $(this).data('status');
308 //监控模式还是主调模式 294 //监控模式还是主调模式
309 - storage.setItem('operationMode', operationMode); 295 + storage.setItem('operationMode', auth.pattern);
310 296
311 var ep = new EventProxy(); 297 var ep = new EventProxy();
312 //缓存车辆自编号和设备号对照 298 //缓存车辆自编号和设备号对照
src/main/resources/static/pages/permission/user/controlAllot.html
@@ -102,6 +102,8 @@ @@ -102,6 +102,8 @@
102 }); 102 });
103 103
104 $('.line-list', wrap).html(htmlStr); 104 $('.line-list', wrap).html(htmlStr);
  105 +
  106 + $('select[name=pattern]', wrap).val(t.pattern);
105 }); 107 });
106 }); 108 });
107 }); 109 });
src/main/resources/static/real_control_v2/css/main.css
@@ -776,3 +776,12 @@ li.map-panel { @@ -776,3 +776,12 @@ li.map-panel {
776 #schedule-lp_change-modal .ct_table.sch-list.reverse .ct_table_body dl.active dd { 776 #schedule-lp_change-modal .ct_table.sch-list.reverse .ct_table_body dl.active dd {
777 border-top: 1px solid #ffe2b9; 777 border-top: 1px solid #ffe2b9;
778 } 778 }
  779 +
  780 +#cache_data_manage-modal .uk-table td{
  781 + vertical-align: bottom;
  782 +}
  783 +
  784 +#cache_data_manage-modal .uk-table td,
  785 +#cache_data_manage-modal .uk-table th{
  786 + padding: 8px 8px 6px;
  787 +}
779 \ No newline at end of file 788 \ No newline at end of file
src/main/resources/static/real_control_v2/electron/lineSelect.html
@@ -177,38 +177,52 @@ @@ -177,38 +177,52 @@
177 var lineIdMap = {}; 177 var lineIdMap = {};
178 var storage = window.localStorage; 178 var storage = window.localStorage;
179 179
  180 + var auth;
180 gb_common.$get('/line/all', {destroy_eq: 0}, function (list) { 181 gb_common.$get('/line/all', {destroy_eq: 0}, function (list) {
181 - var htmlStr = '';  
182 - $.each(list, function () {  
183 - htmlStr += '<span class="line-item" data-name="' + this.name + '" data-code="' + this.lineCode + '">' +  
184 - ' <input class="i-cbox" type="checkbox"> ' + this.name +  
185 - '</span>';  
186 -  
187 - //拼音首字母  
188 - this.camelChars = pinyin.getCamelChars(this.name);  
189 - //全拼  
190 - this.fullChars = pinyin.getFullChars(this.name).toUpperCase();  
191 -  
192 - lineIdMap[this.lineCode] = this;  
193 - });  
194 - all = list;  
195 182
196 - $('.line-btn-list').html(htmlStr); 183 + //用户分配的线路
  184 + $.get('/realControAuthority/findByCurrentUser', function (t) {
  185 + auth = t;
  186 + var newArray = [], authArray = t.lineCodeStr.split(',');
197 187
198 - $('.line-btn-list .line-item').on('click', function () {  
199 - var box = $(this).find('input[type=checkbox]')[0];  
200 - if ($(this).hasClass('active')) {  
201 - $(this).removeClass('active');  
202 - box.checked = false; 188 + $.each(list, function () {
  189 + if (this.lineCode && authArray.indexOf(this.lineCode) != -1) {
  190 + newArray.push(this);
  191 + }
  192 + });
203 193
204 - removeSelected(this);  
205 - }  
206 - else {  
207 - $(this).addClass('active');  
208 - box.checked = true; 194 + var htmlStr = '';
  195 + $.each(newArray, function () {
  196 + htmlStr += '<span class="line-item" data-name="' + this.name + '" data-code="' + this.lineCode + '">' +
  197 + ' <input class="i-cbox" type="checkbox"> ' + this.name +
  198 + '</span>';
209 199
210 - addSelected(this);  
211 - } 200 + //拼音首字母
  201 + this.camelChars = pinyin.getCamelChars(this.name);
  202 + //全拼
  203 + this.fullChars = pinyin.getFullChars(this.name).toUpperCase();
  204 +
  205 + lineIdMap[this.lineCode] = this;
  206 + });
  207 + all = list;
  208 +
  209 + $('.line-btn-list').html(htmlStr);
  210 +
  211 + $('.line-btn-list .line-item').on('click', function () {
  212 + var box = $(this).find('input[type=checkbox]')[0];
  213 + if ($(this).hasClass('active')) {
  214 + $(this).removeClass('active');
  215 + box.checked = false;
  216 +
  217 + removeSelected(this);
  218 + }
  219 + else {
  220 + $(this).addClass('active');
  221 + box.checked = true;
  222 +
  223 + addSelected(this);
  224 + }
  225 + });
212 }); 226 });
213 }); 227 });
214 228
@@ -278,6 +292,9 @@ @@ -278,6 +292,9 @@
278 ep.emitLater('car2DeviceId'); 292 ep.emitLater('car2DeviceId');
279 }); 293 });
280 294
  295 + //监控模式还是主调模式
  296 + storage.setItem('operationMode', auth.pattern);
  297 +
281 //缓存线路路由 298 //缓存线路路由
282 codeStr = codeStr.substr(0, codeStr.length - 1); 299 codeStr = codeStr.substr(0, codeStr.length - 1);
283 $.get('/realMap/multiRouteByLine', {codeStr: codeStr}, function (rs) { 300 $.get('/realMap/multiRouteByLine', {codeStr: codeStr}, function (rs) {
src/main/resources/static/real_control_v2/fragments/north/nav/cache_data/list.html 0 → 100644
  1 +<div class="uk-modal" id="cache_data_manage-modal">
  2 + <div class="uk-modal-dialog" style="width: 620px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <h2>缓存数据管理</h2>
  5 +
  6 + <div class="uk-overflow-container">
  7 + <table class="uk-table">
  8 + <caption>对照数据列表</caption>
  9 + <tbody>
  10 + <tr>
  11 + <td><strong>车辆信息</strong></td>
  12 + <td>车辆自编号和设备号对照数据</td>
  13 + <td>
  14 + <div class="uk-button-group" style="margin-top: 2px;">
  15 + <button data-type="nbbm2DeviceId" class="uk-button uk-button-primary show-data"><i class="uk-icon-search"></i> 查看</button>
  16 + <button class="uk-button"><i class="uk-icon-refresh"></i> 刷新数据</button>
  17 + </div>
  18 + </td>
  19 + </tr>
  20 + <tr>
  21 + <td><strong>人员信息</strong></td>
  22 + <td>人员工号和姓名对照数据</td>
  23 + <td>
  24 + <div class="uk-button-group" style="margin-top: 2px;">
  25 + <button data-type="work2Name" class="uk-button uk-button-primary show-data"><i class="uk-icon-search"></i> 查看</button>
  26 + <button class="uk-button"><i class="uk-icon-refresh"></i> 刷新数据</button>
  27 + </div>
  28 + </td>
  29 + </tr>
  30 + </tbody>
  31 + </table>
  32 + </div>
  33 + </div>
  34 +
  35 + <script>
  36 + (function () {
  37 + var modal = '#cache_data_manage-modal';
  38 + $(modal).on('init', function (e, data) {
  39 + e.stopPropagation();
  40 +
  41 +
  42 + });
  43 +
  44 + var showDetailData = {
  45 + nbbm2DeviceId: function () {
  46 + open_modal('/real_control_v2/fragments/north/nav/cache_data/nbbm_deviceid.html', {}, {bgclose: false, modal: false})
  47 + }
  48 + };
  49 +
  50 + $('.show-data', modal).on('click', function () {
  51 + var type = $(this).data('type');
  52 + if(type)
  53 + showDetailData[type]();
  54 + });
  55 + })();
  56 + </script>
  57 +</div>
0 \ No newline at end of file 58 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/north/nav/cache_data/nbbm_deviceid.html 0 → 100644
  1 +<div class="uk-modal" id="cache_data_nbbm_deviceid-modal">
  2 + <div class="uk-modal-dialog" style="width: 480px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <h3>车辆自编号和设备号对照数据</h3>
  5 + <div>
  6 +
  7 + <table class="uk-table">
  8 + <thead>
  9 + <tr>
  10 + <th>自编号</th>
  11 + <th>设备号</th>
  12 + </tr>
  13 + </thead>
  14 + <tbody>
  15 + <tr>
  16 + <td>W2b-023</td>
  17 + <td>559L0028</td>
  18 + </tr>
  19 + </tbody>
  20 + </table>
  21 +
  22 + </div>
  23 + </div>
  24 +
  25 + <script>
  26 + (function () {
  27 + var modal = '#cache_data_nbbm_deviceid-modal';
  28 +
  29 +
  30 + })();
  31 + </script>
  32 +</div>
0 \ No newline at end of file 33 \ No newline at end of file
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
@@ -88,13 +88,7 @@ @@ -88,13 +88,7 @@
88 { 88 {
89 "id": 3, 89 "id": 3,
90 "text": "系统设置", 90 "text": "系统设置",
91 - "children": [  
92 - {  
93 - "id": 3.1,  
94 - "text": "线路配置",  
95 - "event": "line_config"  
96 - }  
97 - ,{ 91 + "children": [{
98 "id": 3.2, 92 "id": 3.2,
99 "text": "TTS", 93 "text": "TTS",
100 "event": "tts_config" 94 "event": "tts_config"
src/main/resources/static/real_control_v2/js/north/toolbar.js
@@ -95,6 +95,9 @@ var gb_northToolbar = (function () { @@ -95,6 +95,9 @@ var gb_northToolbar = (function () {
95 }, 95 },
96 line_config: function () { 96 line_config: function () {
97 open_modal('/real_control_v2/fragments/north/nav/line_config/line_config.html', {}, modal_opts); 97 open_modal('/real_control_v2/fragments/north/nav/line_config/line_config.html', {}, modal_opts);
  98 + },
  99 + cache_data_manage: function () {
  100 + open_modal('/real_control_v2/fragments/north/nav/cache_data/list.html', {}, modal_opts);
98 } 101 }
99 }; 102 };
100 103