Commit 7e4690591600990d0930238863258dfc5cb8c119
1 parent
81c42c3c
1.站点公司、分公司字段加入完善
Showing
7 changed files
with
147 additions
and
18 deletions
src/main/java/com/bsth/entity/Station.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore; | 4 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | 5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 5 | import org.geolatte.geom.Point; | 6 | import org.geolatte.geom.Point; |
| @@ -346,6 +347,9 @@ public class Station { | @@ -346,6 +347,9 @@ public class Station { | ||
| 346 | } | 347 | } |
| 347 | 348 | ||
| 348 | public String getCompanyName() { | 349 | public String getCompanyName() { |
| 350 | + if (company != null) { | ||
| 351 | + return BasicData.businessCodeNameMap.get(company); | ||
| 352 | + } | ||
| 349 | return companyName; | 353 | return companyName; |
| 350 | } | 354 | } |
| 351 | 355 | ||
| @@ -362,6 +366,9 @@ public class Station { | @@ -362,6 +366,9 @@ public class Station { | ||
| 362 | } | 366 | } |
| 363 | 367 | ||
| 364 | public String getBrancheCompanyName() { | 368 | public String getBrancheCompanyName() { |
| 369 | + if (company != null && brancheCompany != null) { | ||
| 370 | + return BasicData.businessFgsCodeNameMap.get(String.format("%s_%s", brancheCompany, company)); | ||
| 371 | + } | ||
| 365 | return brancheCompanyName; | 372 | return brancheCompanyName; |
| 366 | } | 373 | } |
| 367 | 374 |
src/main/resources/static/pages/base/section/js/section-operation.js
| @@ -2,9 +2,9 @@ var SectionOperation = function () { | @@ -2,9 +2,9 @@ var SectionOperation = function () { | ||
| 2 | var map, type = 0, editSection; | 2 | var map, type = 0, editSection; |
| 3 | var operation = { | 3 | var operation = { |
| 4 | initMap: function() { | 4 | initMap: function() { |
| 5 | - var CENTER_POINT = {lng: 121.528733,lat: 31.237425}; | 5 | + //var CENTER_POINT = {lng: 121.528733,lat: 31.237425}; |
| 6 | map = new BMap.Map('map_section'); | 6 | map = new BMap.Map('map_section'); |
| 7 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); | 7 | + map.centerAndZoom('成都', 15); |
| 8 | map.enableDragging(); | 8 | map.enableDragging(); |
| 9 | map.enableScrollWheelZoom(); | 9 | map.enableScrollWheelZoom(); |
| 10 | map.disableDoubleClickZoom(); | 10 | map.disableDoubleClickZoom(); |
src/main/resources/static/pages/base/station/add.html
| @@ -122,6 +122,30 @@ | @@ -122,6 +122,30 @@ | ||
| 122 | </div> | 122 | </div> |
| 123 | </div> | 123 | </div> |
| 124 | </div> | 124 | </div> |
| 125 | + <!-- 公司 --> | ||
| 126 | + <div class="form-body"> | ||
| 127 | + <div class="form-group"> | ||
| 128 | + <label class="control-label col-md-3"> | ||
| 129 | + <span class="required"> * </span> 公司 : | ||
| 130 | + </label> | ||
| 131 | + <div class="col-md-7"> | ||
| 132 | + <select name="company" id="companySelect" class="form-control"> | ||
| 133 | + </select> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + </div> | ||
| 137 | + <!-- 分公司 --> | ||
| 138 | + <div class="form-body"> | ||
| 139 | + <div class="form-group"> | ||
| 140 | + <label class="control-label col-md-3"> | ||
| 141 | + <span class="required"> * </span> 分公司 : | ||
| 142 | + </label> | ||
| 143 | + <div class="col-md-7"> | ||
| 144 | + <select name="brancheCompany" id="brancheCompanySelect" class="form-control"> | ||
| 145 | + </select> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + </div> | ||
| 125 | <!-- 站点名称 --> | 149 | <!-- 站点名称 --> |
| 126 | <div class="form-body"> | 150 | <div class="form-body"> |
| 127 | <div class="form-group"> | 151 | <div class="form-group"> |
src/main/resources/static/pages/base/station/edit.html
| @@ -28,6 +28,30 @@ | @@ -28,6 +28,30 @@ | ||
| 28 | </div> | 28 | </div> |
| 29 | </div> | 29 | </div> |
| 30 | </div> | 30 | </div> |
| 31 | + <!-- 公司 --> | ||
| 32 | + <div class="form-body"> | ||
| 33 | + <div class="form-group"> | ||
| 34 | + <label class="control-label col-md-3"> | ||
| 35 | + <span class="required"> * </span> 公司 : | ||
| 36 | + </label> | ||
| 37 | + <div class="col-md-7"> | ||
| 38 | + <select name="company" id="companySelect" class="form-control"> | ||
| 39 | + </select> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + <!-- 分公司 --> | ||
| 44 | + <div class="form-body"> | ||
| 45 | + <div class="form-group"> | ||
| 46 | + <label class="control-label col-md-3"> | ||
| 47 | + <span class="required"> * </span> 分公司 : | ||
| 48 | + </label> | ||
| 49 | + <div class="col-md-7"> | ||
| 50 | + <select name="brancheCompany" id="brancheCompanySelect" class="form-control"> | ||
| 51 | + </select> | ||
| 52 | + </div> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 31 | <!-- 经纬度 --> | 55 | <!-- 经纬度 --> |
| 32 | <div class="form-body"> | 56 | <div class="form-body"> |
| 33 | <div class="form-group"> | 57 | <div class="form-group"> |
| @@ -138,6 +162,7 @@ | @@ -138,6 +162,7 @@ | ||
| 138 | </div> | 162 | </div> |
| 139 | <script type="text/javascript"> | 163 | <script type="text/javascript"> |
| 140 | $('#edit_station_modal').on('modal.show', function(e, map,fun,stat){ | 164 | $('#edit_station_modal').on('modal.show', function(e, map,fun,stat){ |
| 165 | + var code2company = {}, cgsbm = []; | ||
| 141 | layer.closeAll(); | 166 | layer.closeAll(); |
| 142 | // 获取站点对象信息 | 167 | // 获取站点对象信息 |
| 143 | var station = stat.getAddStation(); | 168 | var station = stat.getAddStation(); |
| @@ -157,6 +182,42 @@ $('#edit_station_modal').on('modal.show', function(e, map,fun,stat){ | @@ -157,6 +182,42 @@ $('#edit_station_modal').on('modal.show', function(e, map,fun,stat){ | ||
| 157 | map.clearMarkAndOverlays(); | 182 | map.clearMarkAndOverlays(); |
| 158 | fun.initStationInfo(station.id); | 183 | fun.initStationInfo(station.id); |
| 159 | } | 184 | } |
| 185 | + | ||
| 186 | + function getComp(cb) { | ||
| 187 | + $.get('/user/companyData',null,function(rs) { | ||
| 188 | + return cb && cb(rs); | ||
| 189 | + }); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + $.ajaxSettings.async = false; | ||
| 193 | + getComp(function(rs) { | ||
| 194 | + var html = new Array(''); | ||
| 195 | + for (var i = 0;i < rs.length;i++) { | ||
| 196 | + var item = rs[i], children = item.children; | ||
| 197 | + var company = {}; | ||
| 198 | + company.name = item.companyName; | ||
| 199 | + company.children = children; | ||
| 200 | + for (var j = 0;j < children.length;j++) { | ||
| 201 | + cgsbm.push(item.companyCode + '_' + children[j].code); | ||
| 202 | + } | ||
| 203 | + code2company[item.companyCode] = company; | ||
| 204 | + html.push('<option value="', item.companyCode, '">', item.companyName, '</option>'); | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + $('#companySelect').html(html.join('')); | ||
| 208 | + $('#companySelect').on('change', function() { | ||
| 209 | + var companyCode = $(this).val(), html = []; | ||
| 210 | + if (companyCode) { | ||
| 211 | + for (var i = 0;i < code2company[companyCode].children.length;i++) { | ||
| 212 | + var item = code2company[companyCode].children[i]; | ||
| 213 | + html.push('<option value="', item.code, '">', item.name, '</option>'); | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + $('#brancheCompanySelect').html(html.join('')); | ||
| 217 | + }).val(station.company).trigger('change'); | ||
| 218 | + }) | ||
| 219 | + $.ajaxSettings.async = true; | ||
| 220 | + | ||
| 160 | // 编辑表单元素 | 221 | // 编辑表单元素 |
| 161 | var form = $('#edit_station_form'); | 222 | var form = $('#edit_station_form'); |
| 162 | // 获取错误提示元素 | 223 | // 获取错误提示元素 |
| @@ -168,21 +229,21 @@ $('#edit_station_modal').on('modal.show', function(e, map,fun,stat){ | @@ -168,21 +229,21 @@ $('#edit_station_modal').on('modal.show', function(e, map,fun,stat){ | ||
| 168 | }); | 229 | }); |
| 169 | // 表单验证 | 230 | // 表单验证 |
| 170 | form.validate({ | 231 | form.validate({ |
| 171 | - errorElement : 'span', | ||
| 172 | - errorClass : 'help-block help-block-error', | ||
| 173 | - focusInvalid : false, | 232 | + errorElement : 'span', |
| 233 | + errorClass : 'help-block help-block-error', | ||
| 234 | + focusInvalid : false, | ||
| 174 | rules : { | 235 | rules : { |
| 175 | 'stationName' : {required : true} | 236 | 'stationName' : {required : true} |
| 176 | }, | 237 | }, |
| 177 | - invalidHandler : function(event, validator) { | 238 | + invalidHandler : function(event, validator) { |
| 178 | error.show(); | 239 | error.show(); |
| 179 | App.scrollTo(error, -200); | 240 | App.scrollTo(error, -200); |
| 180 | }, | 241 | }, |
| 181 | - highlight : function(element) { | ||
| 182 | - $(element).closest('.form-group').addClass('has-error'); | 242 | + highlight : function(element) { |
| 243 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 183 | }, | 244 | }, |
| 184 | - unhighlight : function(element) { | ||
| 185 | - $(element).closest('.form-group').removeClass('has-error'); | 245 | + unhighlight : function(element) { |
| 246 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 186 | }, | 247 | }, |
| 187 | success : function(label) { | 248 | success : function(label) { |
| 188 | label.closest('.form-group').removeClass('has-error'); | 249 | label.closest('.form-group').removeClass('has-error'); |
src/main/resources/static/pages/base/station/js/add-form-wizard.js
| @@ -5,6 +5,8 @@ | @@ -5,6 +5,8 @@ | ||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | var FormWizard = function() { | 7 | var FormWizard = function() { |
| 8 | + var code2company = {}, cgsbm = []; | ||
| 9 | + | ||
| 8 | return { | 10 | return { |
| 9 | // 启动初始化向导导航 | 11 | // 启动初始化向导导航 |
| 10 | init : function() { | 12 | init : function() { |
| @@ -141,6 +143,13 @@ var FormWizard = function() { | @@ -141,6 +143,13 @@ var FormWizard = function() { | ||
| 141 | } | 143 | } |
| 142 | }); | 144 | }); |
| 143 | } | 145 | } |
| 146 | + | ||
| 147 | + function getComp(cb) { | ||
| 148 | + $.get('/user/companyData',null,function(rs) { | ||
| 149 | + return cb && cb(rs); | ||
| 150 | + }); | ||
| 151 | + } | ||
| 152 | + | ||
| 144 | /** 按钮点击时触发 */ | 153 | /** 按钮点击时触发 */ |
| 145 | var handleTitle = function(tab, navigation, index) { | 154 | var handleTitle = function(tab, navigation, index) { |
| 146 | // 定义导航条标签个数 | 155 | // 定义导航条标签个数 |
| @@ -179,6 +188,34 @@ var FormWizard = function() { | @@ -179,6 +188,34 @@ var FormWizard = function() { | ||
| 179 | $('html,body').animate({scrollTop: ($('#form-wizard-info').offset().top-5) + "px"},500); | 188 | $('html,body').animate({scrollTop: ($('#form-wizard-info').offset().top-5) + "px"},500); |
| 180 | },300) | 189 | },300) |
| 181 | }else if(current==3) { | 190 | }else if(current==3) { |
| 191 | + $.ajaxSettings.async = false; | ||
| 192 | + getComp(function(rs) { | ||
| 193 | + var html = new Array(); | ||
| 194 | + for (var i = 0;i < rs.length;i++) { | ||
| 195 | + var item = rs[i], children = item.children; | ||
| 196 | + var company = {}; | ||
| 197 | + company.name = item.companyName; | ||
| 198 | + company.children = children; | ||
| 199 | + for (var j = 0;j < children.length;j++) { | ||
| 200 | + cgsbm.push(item.companyCode + '_' + children[j].code); | ||
| 201 | + } | ||
| 202 | + code2company[item.companyCode] = company; | ||
| 203 | + html.push('<option value="', item.companyCode, '">', item.companyName, '</option>'); | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + $('#companySelect').html(html.join('')); | ||
| 207 | + $('#companySelect').on('change', function() { | ||
| 208 | + var companyCode = $(this).val(), html = []; | ||
| 209 | + if (companyCode) { | ||
| 210 | + for (var i = 0;i < code2company[companyCode].children.length;i++) { | ||
| 211 | + var item = code2company[companyCode].children[i]; | ||
| 212 | + html.push('<option value="', item.code, '">', item.name, '</option>'); | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + $('#brancheCompanySelect').html(html.join('')); | ||
| 216 | + }).trigger('change'); | ||
| 217 | + }) | ||
| 218 | + $.ajaxSettings.async = true; | ||
| 182 | setTimeout(function(){ | 219 | setTimeout(function(){ |
| 183 | $('html,body').animate({scrollTop: ($('#tab3').offset().top-70) + "px"}); | 220 | $('html,body').animate({scrollTop: ($('#tab3').offset().top-70) + "px"}); |
| 184 | },500); | 221 | },500); |
src/main/resources/static/pages/base/station/js/add-vmap-world.js
| @@ -3,11 +3,11 @@ var StationPVmapWorlds = function() { | @@ -3,11 +3,11 @@ var StationPVmapWorlds = function() { | ||
| 3 | var Bmap = { | 3 | var Bmap = { |
| 4 | init : function() { | 4 | init : function() { |
| 5 | // 设置中心点, | 5 | // 设置中心点, |
| 6 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | 6 | + //var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; |
| 7 | // 初始化百度地图 | 7 | // 初始化百度地图 |
| 8 | mapB = new BMap.Map("stationbmap_basic"); | 8 | mapB = new BMap.Map("stationbmap_basic"); |
| 9 | //中心点和缩放级别 | 9 | //中心点和缩放级别 |
| 10 | - mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | 10 | + mapB.centerAndZoom('成都', 15); |
| 11 | //启用地图拖拽事件,默认启用(可不写) | 11 | //启用地图拖拽事件,默认启用(可不写) |
| 12 | mapB.enableDragging(); | 12 | mapB.enableDragging(); |
| 13 | //启用地图滚轮放大缩小 | 13 | //启用地图滚轮放大缩小 |
src/main/resources/static/pages/base/station/list.html
| @@ -119,6 +119,12 @@ | @@ -119,6 +119,12 @@ | ||
| 119 | {{obj.stationCode}} | 119 | {{obj.stationCode}} |
| 120 | </td> | 120 | </td> |
| 121 | <td> | 121 | <td> |
| 122 | + {{obj.companyName}} | ||
| 123 | + </td> | ||
| 124 | + <td> | ||
| 125 | + {{obj.brancheCompanyName}} | ||
| 126 | + </td> | ||
| 127 | + <td> | ||
| 122 | {{obj.passLines}} | 128 | {{obj.passLines}} |
| 123 | </td> | 129 | </td> |
| 124 | <td> | 130 | <td> |
| @@ -139,12 +145,6 @@ | @@ -139,12 +145,6 @@ | ||
| 139 | {{/if}} | 145 | {{/if}} |
| 140 | </td> | 146 | </td> |
| 141 | <td> | 147 | <td> |
| 142 | - {{obj.roadCoding}} | ||
| 143 | - </td> | ||
| 144 | - <td> | ||
| 145 | - {{obj.address}} | ||
| 146 | - </td> | ||
| 147 | - <td> | ||
| 148 | <a href="positions.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a> | 148 | <a href="positions.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a> |
| 149 | </td> | 149 | </td> |
| 150 | </tr> | 150 | </tr> |