Commit 8937dc2af3d830fdbee5b5020640b7118f119a1f

Authored by 潘钊
2 parents 7f4eb44a cda7cc42

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

Showing 23 changed files with 1430 additions and 1313 deletions
src/main/java/com/bsth/controller/schedule/BController.java
... ... @@ -40,7 +40,7 @@ public class BController<T, ID extends Serializable> {
40 40 t_b.setCreateDate(new Date());
41 41 }
42 42  
43   - T t_saved = bService.save((T) t_b);
  43 + T t_saved = bService.save(t_b == null ? t : (T) t_b);
44 44 Map<String, Object> rtn = new HashMap<>();
45 45 rtn.put("status", ResponseCode.SUCCESS);
46 46 rtn.put("data", t_saved);
... ... @@ -58,7 +58,7 @@ public class BController&lt;T, ID extends Serializable&gt; {
58 58 t_b.setUpdateDate(new Date());
59 59 }
60 60  
61   - T t_updated = bService.save((T) t_b);
  61 + T t_updated = bService.save(t_b == null ? t : (T) t_b);
62 62 Map<String, Object> rtn = new HashMap<>();
63 63 rtn.put("status", ResponseCode.SUCCESS);
64 64 rtn.put("data", t_updated);
... ...
src/main/java/com/bsth/controller/schedule/basicinfo/EmployeeController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.Personnel;
  6 +import com.bsth.service.schedule.EmployeeService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * 人员基础信息Controller
  19 + */
  20 +@RestController
  21 +@RequestMapping("ee")
  22 +public class EmployeeController extends BController<Personnel, Integer> {
  23 + @Autowired
  24 + private EmployeeService employeeService;
  25 +
  26 + @RequestMapping(value = "/validate_gh", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_gh(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 工号验证
  31 + Personnel personnel = new Personnel(
  32 + param.get("id_eq"),
  33 + param.get("companyCode_eq"),
  34 + param.get("jobCode_eq")
  35 + );
  36 + employeeService.validate_gh(personnel);
  37 + rtn.put("status", ResponseCode.SUCCESS);
  38 + } catch (ScheduleException exp) {
  39 + rtn.put("status", ResponseCode.ERROR);
  40 + rtn.put("msg", exp.getMessage());
  41 + }
  42 +
  43 + return rtn;
  44 + }
  45 +}
... ...
src/main/java/com/bsth/entity/CarDevice.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.entity.sys.SysUser;
  3 +import com.bsth.entity.schedule.BEntity;
4 4  
5 5 import javax.persistence.*;
6 6 import java.util.Date;
... ... @@ -10,7 +10,7 @@ import java.util.Date;
10 10 */
11 11 @Entity
12 12 @Table(name = "bsth_c_car_device")
13   -public class CarDevice {
  13 +public class CarDevice extends BEntity {
14 14  
15 15 /** 主键 */
16 16 @Id
... ... @@ -62,19 +62,6 @@ public class CarDevice {
62 62 @Column(nullable = false)
63 63 private Boolean isCancel = false;
64 64  
65   - /** 创建人 */
66   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
67   - private SysUser createBy;
68   - /** 修改人 */
69   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
70   - private SysUser updateBy;
71   - /** 创建日期 */
72   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
73   - private Date createDate;
74   - /** 修改日期 */
75   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
76   - private Date updateDate;
77   -
78 65 public Long getId() {
79 66 return id;
80 67 }
... ... @@ -179,38 +166,6 @@ public class CarDevice {
179 166 this.guaranteeDesc = guaranteeDesc;
180 167 }
181 168  
182   - public SysUser getCreateBy() {
183   - return createBy;
184   - }
185   -
186   - public void setCreateBy(SysUser createBy) {
187   - this.createBy = createBy;
188   - }
189   -
190   - public SysUser getUpdateBy() {
191   - return updateBy;
192   - }
193   -
194   - public void setUpdateBy(SysUser updateBy) {
195   - this.updateBy = updateBy;
196   - }
197   -
198   - public Date getCreateDate() {
199   - return createDate;
200   - }
201   -
202   - public void setCreateDate(Date createDate) {
203   - this.createDate = createDate;
204   - }
205   -
206   - public Date getUpdateDate() {
207   - return updateDate;
208   - }
209   -
210   - public void setUpdateDate(Date updateDate) {
211   - this.updateDate = updateDate;
212   - }
213   -
214 169 public Date getQyrq() {
215 170 return qyrq;
216 171 }
... ...
src/main/java/com/bsth/entity/Cars.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.entity.sys.SysUser;
  3 +import com.bsth.entity.schedule.BEntity;
4 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 5  
6 6 import javax.persistence.*;
... ... @@ -24,7 +24,7 @@ import java.util.Date;
24 24 @Entity
25 25 @Table(name = "bsth_c_cars")
26 26 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
27   -public class Cars implements Serializable {
  27 +public class Cars extends BEntity implements Serializable {
28 28  
29 29 /** 主键Id */
30 30 @Id
... ... @@ -136,23 +136,6 @@ public class Cars implements Serializable {
136 136 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */
137 137 private String xlmc;
138 138  
139   -
140   - /** 创建人 */
141   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
142   - private SysUser createBy;
143   -
144   - /** 修改人 */
145   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
146   - private SysUser updateBy;
147   -
148   - /** 创建日期 */
149   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
150   - private Date createDate;
151   -
152   - /** 修改日期 */
153   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
154   - private Date updateDate;
155   -
156 139 public Cars() {}
157 140  
158 141 public Cars(Object id, Object nbbh, Object clbh, Object cph, Object sbbh) {
... ... @@ -516,36 +499,4 @@ public class Cars implements Serializable {
516 499 public void setXlmc(String xlmc) {
517 500 this.xlmc = xlmc;
518 501 }
519   -
520   - public SysUser getCreateBy() {
521   - return createBy;
522   - }
523   -
524   - public void setCreateBy(SysUser createBy) {
525   - this.createBy = createBy;
526   - }
527   -
528   - public SysUser getUpdateBy() {
529   - return updateBy;
530   - }
531   -
532   - public void setUpdateBy(SysUser updateBy) {
533   - this.updateBy = updateBy;
534   - }
535   -
536   - public Date getCreateDate() {
537   - return createDate;
538   - }
539   -
540   - public void setCreateDate(Date createDate) {
541   - this.createDate = createDate;
542   - }
543   -
544   - public Date getUpdateDate() {
545   - return updateDate;
546   - }
547   -
548   - public void setUpdateDate(Date updateDate) {
549   - this.updateDate = updateDate;
550   - }
551 502 }
... ...
src/main/java/com/bsth/entity/Personnel.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.entity.sys.SysUser;
  3 +import com.bsth.entity.schedule.BEntity;
4 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 5  
6 6 import javax.persistence.*;
7   -import java.util.Date;
8 7  
9 8 /**
10 9 *
... ... @@ -23,7 +22,7 @@ import java.util.Date;
23 22 @Entity
24 23 @Table(name = "bsth_c_personnel")
25 24 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26   -public class Personnel {
  25 +public class Personnel extends BEntity {
27 26  
28 27 /** 主键Id */
29 28 @Id
... ... @@ -59,6 +58,20 @@ public class Personnel {
59 58 /** 身份证 */
60 59 private String card;
61 60  
  61 + public Personnel() {}
  62 +
  63 + public Personnel(Object id, Object companyCode, Object gh) {
  64 + if (id != null) {
  65 + this.id = Integer.valueOf(id.toString());
  66 + }
  67 + if (companyCode != null) {
  68 + this.companyCode = companyCode.toString();
  69 + }
  70 + if (gh != null) {
  71 + this.jobCode = gh.toString();
  72 + }
  73 + }
  74 +
62 75 public String getCard() {
63 76 return card;
64 77 }
... ... @@ -78,23 +91,6 @@ public class Personnel {
78 91 /** 描述(TODO:在原系统里没有,这里暂时留着) */
79 92 private String descriptions;
80 93  
81   -
82   -
83   - /** 创建人 */
84   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
85   - private SysUser createBy;
86   - /** 修改人 */
87   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
88   - private SysUser updateBy;
89   -
90   - /** 创建日期 */
91   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
92   - private Date createDate;
93   -
94   - /** 修改日期 */
95   - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
96   - private Date updateDate;
97   -
98 94 public Integer getId() {
99 95 return id;
100 96 }
... ... @@ -222,36 +218,4 @@ public class Personnel {
222 218 public void setDescriptions(String descriptions) {
223 219 this.descriptions = descriptions;
224 220 }
225   -
226   - public SysUser getCreateBy() {
227   - return createBy;
228   - }
229   -
230   - public void setCreateBy(SysUser createBy) {
231   - this.createBy = createBy;
232   - }
233   -
234   - public SysUser getUpdateBy() {
235   - return updateBy;
236   - }
237   -
238   - public void setUpdateBy(SysUser updateBy) {
239   - this.updateBy = updateBy;
240   - }
241   -
242   - public Date getCreateDate() {
243   - return createDate;
244   - }
245   -
246   - public void setCreateDate(Date createDate) {
247   - this.createDate = createDate;
248   - }
249   -
250   - public Date getUpdateDate() {
251   - return updateDate;
252   - }
253   -
254   - public void setUpdateDate(Date updateDate) {
255   - this.updateDate = updateDate;
256   - }
257 221 }
... ...
src/main/java/com/bsth/service/schedule/CarDeviceService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +
  5 +/**
  6 + * Created by xu on 16/12/15.
  7 + */
  8 +public interface CarDeviceService extends BService<CarDevice, Long> {
  9 + void validate_qyrq(CarDevice carDevice) throws ScheduleException;
  10 +}
... ...
src/main/java/com/bsth/service/schedule/EmployeeService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +
  5 +/**
  6 + * Created by xu on 16/12/15.
  7 + */
  8 +public interface EmployeeService extends BService<Personnel, Integer> {
  9 + public void validate_gh(Personnel personnel) throws ScheduleException;
  10 +}
... ...
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import com.bsth.entity.Cars;
  5 +import com.bsth.service.CarsService;
  6 +import com.bsth.service.schedule.CarDeviceService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +import org.springframework.util.CollectionUtils;
  12 +
  13 +import java.util.HashMap;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * Created by xu on 16/12/15.
  18 + */
  19 +@Service(value = "carDeviceServiceImpl_sc")
  20 +public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implements CarDeviceService {
  21 + @Autowired
  22 + private CarsService carsService;
  23 +
  24 + @Transactional
  25 + @Override
  26 + public CarDevice save(CarDevice carDevice) {
  27 + // 查找对应的车辆基础信息,更新设备编号数据
  28 + Cars cars = carsService.findById(carDevice.getCl());
  29 +
  30 + return null;
  31 + }
  32 +
  33 + @Transactional
  34 + @Override
  35 + public void validate_qyrq(CarDevice carDevice) throws ScheduleException {
  36 + if (carDevice.getXl() == null) {
  37 + throw new ScheduleException("线路未选择");
  38 + }
  39 + if (carDevice.getCl() == null) {
  40 + throw new ScheduleException("车辆未选择");
  41 + }
  42 + Map<String, Object> param = new HashMap<>();
  43 + if (carDevice.getId() != null) {
  44 + param.put("id_ne", carDevice.getId());
  45 + }
  46 + param.put("xl_eq", carDevice.getXl());
  47 + param.put("cl_eq", carDevice.getCl());
  48 + param.put("qyrq_ne", carDevice.getQyrq());
  49 + if (!CollectionUtils.isEmpty(list(param))) {
  50 + throw new ScheduleException("启用日期必须比历史的启用日期大");
  51 + }
  52 + }
  53 +}
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import com.bsth.service.schedule.EmployeeService;
  5 +import com.bsth.service.schedule.ScheduleException;
  6 +import org.springframework.stereotype.Service;
  7 +import org.springframework.transaction.annotation.Transactional;
  8 +import org.springframework.util.CollectionUtils;
  9 +
  10 +import java.util.HashMap;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by xu on 16/12/15.
  15 + */
  16 +@Service
  17 +public class EmployeeServiceImpl extends BServiceImpl<Personnel, Integer> implements EmployeeService {
  18 + @Override
  19 + @Transactional
  20 + public void validate_gh(Personnel personnel) throws ScheduleException {
  21 + // 查询条件
  22 + Map<String, Object> param = new HashMap<>();
  23 + if (personnel.getId() != null) {
  24 + param.put("id_ne", personnel.getId());
  25 + }
  26 + param.put("companyCode_eq", personnel.getCompanyCode());
  27 + param.put("jobCode_eq", personnel.getJobCode());
  28 + if (!CollectionUtils.isEmpty(list(param))) {
  29 + throw new ScheduleException("相同公司工号重复");
  30 + }
  31 + }
  32 +}
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -48,7 +48,7 @@
48 48 required ng-maxlength="20"
49 49 remote-Validation
50 50 remotevtype="cars_zbh"
51   - remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
  51 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
52 52 placeholder="请输入车辆内部编码"/>
53 53 </div>
54 54 <!-- 隐藏块,显示验证信息 -->
... ... @@ -66,18 +66,18 @@
66 66 <div class="form-group has-success has-feedback">
67 67 <label class="col-md-2 control-label">所属公司*:</label>
68 68 <div class="col-md-3">
69   - <sa-Select3 model="ctrl.busInfoForSave"
70   - name="gs"
71   - placeholder="请选择所属公司..."
72   - dcvalue="{{ctrl.busInfoForSave.businessCode}}"
  69 + <sa-Select5 name="gs"
  70 + model="ctrl.busInfoForSave"
  71 + cmaps="{'businessCode': 'code', 'company': 'name'}"
73 72 dcname="businessCode"
74 73 icname="code"
75   - dcname2="company"
76   - icname2="name"
77   - icnames="name"
78   - datatype="gsType"
  74 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  75 + iterobjname="item"
  76 + iterobjexp="item.name"
  77 + searchph="请选择所属公司..."
  78 + searchexp="this.name"
79 79 required >
80   - </sa-Select3>
  80 + </sa-Select5>
81 81  
82 82 </div>
83 83 <!-- 隐藏块,显示验证信息 -->
... ... @@ -108,7 +108,7 @@
108 108 required placeholder="请输入车辆编码"
109 109 remote-Validation
110 110 remotevtype="cars_clbh"
111   - remotevparam="{{ {'carCode_eq': ctrl.busInfoForSave.carCode} | json}}"
  111 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'carCode_eq': ctrl.busInfoForSave.carCode} | json}}"
112 112 />
113 113 </div>
114 114 <!-- 隐藏块,显示验证信息 -->
... ... @@ -128,7 +128,7 @@
128 128 required placeholder="请输入车牌号"
129 129 remote-Validation
130 130 remotevtype="cars_cph"
131   - remotevparam="{{ {'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}"
  131 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}"
132 132 />
133 133 </div>
134 134 <!-- 隐藏快,显示验证信息 -->
... ... @@ -143,16 +143,18 @@
143 143 <div class="form-group has-success has-feedback">
144 144 <label class="col-md-2 control-label">设备供应厂商*:</label>
145 145 <div class="col-md-3">
146   - <sa-Select3 model="ctrl.busInfoForSave"
147   - name="supplierName"
148   - placeholder="请选择设备厂商..."
149   - dcvalue="{{ctrl.busInfoForSave.supplierName}}"
  146 + <sa-Select5 name="supplierName"
  147 + model="ctrl.busInfoForSave"
  148 + cmaps="{'supplierName': 'code'}"
150 149 dcname="supplierName"
151 150 icname="code"
152   - icnames="name"
153   - datatype="snames"
  151 + dsparams="{{ {type: 'dic', param: 'snames' } | json }}"
  152 + iterobjname="item"
  153 + iterobjexp="item.name"
  154 + searchph="请选择设备厂商..."
  155 + searchexp="this.name"
154 156 required >
155   - </sa-Select3>
  157 + </sa-Select5>
156 158 </div>
157 159 <!-- 隐藏快,显示验证信息 -->
158 160 <div class="alert alert-danger well-sm" ng-show="myForm.supplierName.$error.required">
... ... @@ -168,7 +170,7 @@
168 170 required placeholder="请输入设备终端号"
169 171 remote-Validation
170 172 remotevtype="cars_sbbh"
171   - remotevparam="{{ {'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}"
  173 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}"
172 174 />
173 175 </div>
174 176 <!-- 隐藏块,显示验证信息 -->
... ... @@ -369,45 +371,54 @@
369 371 <div class="form-group">
370 372 <label class="col-md-2 control-label">车辆类型:</label>
371 373 <div class="col-md-3">
372   - <sa-Select3 model="ctrl.busInfoForSave"
373   - name="carType"
374   - placeholder="请选择车辆类型..."
375   - dcvalue="{{ctrl.busInfoForSave.carType}}"
  374 + <sa-Select5 name="carType"
  375 + model="ctrl.busInfoForSave"
  376 + cmaps="{'carType': 'code'}"
376 377 dcname="carType"
377 378 icname="code"
378   - icnames="name"
379   - datatype="carType" >
380   - </sa-Select3>
  379 + dsparams="{{ {type: 'dic', param: 'carType' } | json }}"
  380 + iterobjname="item"
  381 + iterobjexp="item.name"
  382 + searchph="请选择车辆类型..."
  383 + searchexp="this.name"
  384 + >
  385 + </sa-Select5>
381 386 </div>
382 387 </div>
383 388  
384 389 <div class="form-group">
385 390 <label class="col-md-2 control-label">是否机动车:</label>
386 391 <div class="col-md-3">
387   - <sa-Select3 model="ctrl.busInfoForSave"
388   - name="vehicleStats"
389   - placeholder="请选择机动车类型..."
390   - dcvalue="{{ctrl.busInfoForSave.vehicleStats}}"
  392 + <sa-Select5 name="vehicleStats"
  393 + model="ctrl.busInfoForSave"
  394 + cmaps="{'vehicleStats': 'code'}"
391 395 dcname="vehicleStats"
392 396 icname="code"
393   - icnames="name"
394   - datatype="jdcType" >
395   - </sa-Select3>
  397 + dsparams="{{ {type: 'dic', param: 'jdcType' } | json }}"
  398 + iterobjname="item"
  399 + iterobjexp="item.name"
  400 + searchph="请选择机动车类型..."
  401 + searchexp="this.name"
  402 + >
  403 + </sa-Select5>
396 404 </div>
397 405 </div>
398 406  
399 407 <div class="form-group">
400 408 <label class="col-md-2 control-label">营运状态:</label>
401 409 <div class="col-md-3">
402   - <sa-Select3 model="ctrl.busInfoForSave"
403   - name="operatorsState"
404   - placeholder="请选择营运状态..."
405   - dcvalue="{{ctrl.busInfoForSave.operatorsState}}"
  410 + <sa-Select5 name="operatorsState"
  411 + model="ctrl.busInfoForSave"
  412 + cmaps="{'operatorsState': 'code'}"
406 413 dcname="operatorsState"
407 414 icname="code"
408   - icnames="name"
409   - datatype="yyztType" >
410   - </sa-Select3>
  415 + dsparams="{{ {type: 'dic', param: 'yyztType' } | json }}"
  416 + iterobjname="item"
  417 + iterobjexp="item.name"
  418 + searchph="请选择营运状态..."
  419 + searchexp="this.name"
  420 + >
  421 + </sa-Select5>
411 422 </div>
412 423 </div>
413 424  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
... ... @@ -66,18 +66,18 @@
66 66 <div class="form-group has-success has-feedback">
67 67 <label class="col-md-2 control-label">所属公司*:</label>
68 68 <div class="col-md-3">
69   - <sa-Select3 model="ctrl.busInfoForSave"
70   - name="gs"
71   - placeholder="请选择所属公司..."
72   - dcvalue="{{ctrl.busInfoForSave.businessCode}}"
  69 + <sa-Select5 name="gs"
  70 + model="ctrl.busInfoForSave"
  71 + cmaps="{'businessCode': 'code', 'company': 'name'}"
73 72 dcname="businessCode"
74 73 icname="code"
75   - dcname2="company"
76   - icname2="name"
77   - icnames="name"
78   - datatype="gsType"
  74 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  75 + iterobjname="item"
  76 + iterobjexp="item.name"
  77 + searchph="请选择所属公司..."
  78 + searchexp="this.name"
79 79 required >
80   - </sa-Select3>
  80 + </sa-Select5>
81 81  
82 82 </div>
83 83 <!-- 隐藏块,显示验证信息 -->
... ... @@ -143,16 +143,18 @@
143 143 <div class="form-group has-success has-feedback">
144 144 <label class="col-md-2 control-label">设备供应厂商*:</label>
145 145 <div class="col-md-3">
146   - <sa-Select3 model="ctrl.busInfoForSave"
147   - name="supplierName"
148   - placeholder="请选择设备厂商..."
149   - dcvalue="{{ctrl.busInfoForSave.supplierName}}"
  146 + <sa-Select5 name="supplierName"
  147 + model="ctrl.busInfoForSave"
  148 + cmaps="{'supplierName': 'code'}"
150 149 dcname="supplierName"
151 150 icname="code"
152   - icnames="name"
153   - datatype="snames"
  151 + dsparams="{{ {type: 'dic', param: 'snames' } | json }}"
  152 + iterobjname="item"
  153 + iterobjexp="item.name"
  154 + searchph="请选择设备厂商..."
  155 + searchexp="this.name"
154 156 required >
155   - </sa-Select3>
  157 + </sa-Select5>
156 158 </div>
157 159 <!-- 隐藏快,显示验证信息 -->
158 160 <div class="alert alert-danger well-sm" ng-show="myForm.supplierName.$error.required">
... ... @@ -369,45 +371,54 @@
369 371 <div class="form-group">
370 372 <label class="col-md-2 control-label">车辆类型:</label>
371 373 <div class="col-md-3">
372   - <sa-Select3 model="ctrl.busInfoForSave"
373   - name="carType"
374   - placeholder="请选择车辆类型..."
375   - dcvalue="{{ctrl.busInfoForSave.carType}}"
  374 + <sa-Select5 name="carType"
  375 + model="ctrl.busInfoForSave"
  376 + cmaps="{'carType': 'code'}"
376 377 dcname="carType"
377 378 icname="code"
378   - icnames="name"
379   - datatype="carType" >
380   - </sa-Select3>
  379 + dsparams="{{ {type: 'dic', param: 'carType' } | json }}"
  380 + iterobjname="item"
  381 + iterobjexp="item.name"
  382 + searchph="请选择车辆类型..."
  383 + searchexp="this.name"
  384 + >
  385 + </sa-Select5>
381 386 </div>
382 387 </div>
383 388  
384 389 <div class="form-group">
385 390 <label class="col-md-2 control-label">是否机动车:</label>
386 391 <div class="col-md-3">
387   - <sa-Select3 model="ctrl.busInfoForSave"
388   - name="vehicleStats"
389   - placeholder="请选择机动车类型..."
390   - dcvalue="{{ctrl.busInfoForSave.vehicleStats}}"
  392 + <sa-Select5 name="vehicleStats"
  393 + model="ctrl.busInfoForSave"
  394 + cmaps="{'vehicleStats': 'code'}"
391 395 dcname="vehicleStats"
392 396 icname="code"
393   - icnames="name"
394   - datatype="jdcType" >
395   - </sa-Select3>
  397 + dsparams="{{ {type: 'dic', param: 'jdcType' } | json }}"
  398 + iterobjname="item"
  399 + iterobjexp="item.name"
  400 + searchph="请选择机动车类型..."
  401 + searchexp="this.name"
  402 + >
  403 + </sa-Select5>
396 404 </div>
397 405 </div>
398 406  
399 407 <div class="form-group">
400 408 <label class="col-md-2 control-label">营运状态:</label>
401 409 <div class="col-md-3">
402   - <sa-Select3 model="ctrl.busInfoForSave"
403   - name="operatorsState"
404   - placeholder="请选择营运状态..."
405   - dcvalue="{{ctrl.busInfoForSave.operatorsState}}"
  410 + <sa-Select5 name="operatorsState"
  411 + model="ctrl.busInfoForSave"
  412 + cmaps="{'operatorsState': 'code'}"
406 413 dcname="operatorsState"
407 414 icname="code"
408   - icnames="name"
409   - datatype="yyztType" >
410   - </sa-Select3>
  415 + dsparams="{{ {type: 'dic', param: 'yyztType' } | json }}"
  416 + iterobjname="item"
  417 + iterobjexp="item.name"
  418 + searchph="请选择营运状态..."
  419 + searchexp="this.name"
  420 + >
  421 + </sa-Select5>
411 422 </div>
412 423 </div>
413 424  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -30,15 +30,18 @@
30 30 </td>
31 31 <td>
32 32 <div>
33   - <sa-Select3 model="ctrl.searchCondition()"
34   - name="gs"
35   - placeholder="请选择..."
36   - dcvalue="{{ctrl.searchCondition().businessCode_eq}}"
  33 + <sa-Select5 name="gs"
  34 + model="ctrl.searchCondition()"
  35 + cmaps="{'businessCode_eq': 'code'}"
37 36 dcname="businessCode_eq"
38 37 icname="code"
39   - icnames="name"
40   - datatype="gsType">
41   - </sa-Select3>
  38 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  39 + iterobjname="item"
  40 + iterobjexp="item.name"
  41 + searchph="选择公司..."
  42 + searchexp="this.name"
  43 + >
  44 + </sa-Select5>
42 45 </div>
43 46 </td>
44 47 <td>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
... ... @@ -247,9 +247,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
247 247 // 提交方法
248 248 self.submit = function() {
249 249 console.log(self.busInfoForSave);
250   - //if (self.busInfoForSave) {
251   - // delete $stateParams.id;
252   - //}
  250 + // 保存或者更新
253 251 self.busInfoForSave.$save(function() {
254 252 $state.go("busInfoManage");
255 253 });
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/service.js
1 1 // 车辆信息service
2   -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
3   - return {
4   - rest: $resource(
5   - '/cars_sc/:id',
6   - {order: 'carCode', direction: 'ASC', id: '@id_route'},
7   - {
8   - list: {
9   - method: 'GET',
10   - params: {
11   - page: 0
12   - },
13   - transformResponse: function(rs) {
14   - var dst = angular.fromJson(rs);
15   - if (dst.status == 'SUCCESS') {
16   - return dst.data;
17   - } else {
18   - return dst; // 业务错误留给控制器处理
  2 +angular.module('ScheduleApp').factory(
  3 + 'BusInfoManageService_g',
  4 + [
  5 + '$resource',
  6 + function($resource) {
  7 + return {
  8 + rest: $resource(
  9 + '/cars_sc/:id',
  10 + {order: 'carCode', direction: 'ASC', id: '@id'},
  11 + {
  12 + list: {
  13 + method: 'GET',
  14 + params: {
  15 + page: 0
  16 + },
  17 + transformResponse: function(rs) {
  18 + var dst = angular.fromJson(rs);
  19 + if (dst.status == 'SUCCESS') {
  20 + return dst.data;
  21 + } else {
  22 + return dst; // 业务错误留给控制器处理
  23 + }
  24 + }
  25 + },
  26 + get: {
  27 + method: 'GET',
  28 + transformResponse: function(rs) {
  29 + var dst = angular.fromJson(rs);
  30 + if (dst.status == 'SUCCESS') {
  31 + return dst.data;
  32 + } else {
  33 + return dst;
  34 + }
  35 + }
  36 + },
  37 + save: {
  38 + method: 'POST'
19 39 }
20 40 }
21   - },
22   - get: {
23   - method: 'GET',
24   - transformResponse: function(rs) {
25   - var dst = angular.fromJson(rs);
26   - if (dst.status == 'SUCCESS') {
27   - return dst.data;
28   - } else {
29   - return dst;
  41 + ),
  42 + import: $resource(
  43 + '/cars/importfile',
  44 + {},
  45 + {
  46 + do: {
  47 + method: 'POST',
  48 + headers: {
  49 + 'Content-Type': 'application/x-www-form-urlencoded'
  50 + },
  51 + transformRequest: function(obj) {
  52 + var str = [];
  53 + for (var p in obj) {
  54 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  55 + }
  56 + return str.join("&");
  57 + }
30 58 }
31 59 }
32   - },
33   - save: {
34   - method: 'POST'
35   - }
36   - }
37   - ),
38   - import: $resource(
39   - '/cars/importfile',
40   - {},
41   - {
42   - do: {
43   - method: 'POST',
44   - headers: {
45   - 'Content-Type': 'application/x-www-form-urlencoded'
46   - },
47   - transformRequest: function(obj) {
48   - var str = [];
49   - for (var p in obj) {
50   - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  60 + ),
  61 + dataTools: $resource(
  62 + '/cars/:type',
  63 + {},
  64 + {
  65 + dataExport: {
  66 + method: 'GET',
  67 + responseType: "arraybuffer",
  68 + params: {
  69 + type: "dataExport"
  70 + },
  71 + transformResponse: function(data, headers){
  72 + return {data : data};
  73 + }
51 74 }
52   - return str.join("&");
53 75 }
54   - }
55   - }
56   - ),
57   - validate: $resource(
58   - '/cars/validate/:type',
59   - {},
60   - {
61   - insideCode: {
62   - method: 'GET'
63   - }
64   - }
65   - ),
66   - dataTools: $resource(
67   - '/cars/:type',
68   - {},
69   - {
70   - dataExport: {
71   - method: 'GET',
72   - responseType: "arraybuffer",
73   - params: {
74   - type: "dataExport"
75   - },
76   - transformResponse: function(data, headers){
77   - return {data : data};
78   - }
79   - }
80   - }
81   - )
82   - };
83   -}]);
84 76 \ No newline at end of file
  77 + )
  78 + };
  79 +
  80 + }
  81 + ]
  82 +);
85 83 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html
... ... @@ -36,18 +36,18 @@
36 36 <div class="form-group has-success has-feedback">
37 37 <label class="col-md-2 control-label">所属公司*:</label>
38 38 <div class="col-md-3">
39   - <sa-Select3 model="ctrl.employeeInfoForSave"
40   - name="gs"
41   - placeholder="请选择所属公司..."
42   - dcvalue="{{ctrl.employeeInfoForSave.companyCode}}"
  39 + <sa-Select5 name="gs"
  40 + model="ctrl.employeeInfoForSave"
  41 + cmaps="{'companyCode': 'code', 'company': 'name'}"
43 42 dcname="companyCode"
44 43 icname="code"
45   - dcname2="company"
46   - icname2="name"
47   - icnames="name"
48   - datatype="gsType"
  44 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  45 + iterobjname="item"
  46 + iterobjexp="item.name"
  47 + searchph="请输拼音..."
  48 + searchexp="this.name"
49 49 required >
50   - </sa-Select3>
  50 + </sa-Select5>
51 51 </div>
52 52 <!-- 隐藏块,显示验证信息 -->
53 53 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
... ... @@ -74,15 +74,17 @@
74 74 <div class="col-md-3">
75 75 <input type="text" class="form-control"
76 76 name="jobCode" ng-model="ctrl.employeeInfoForSave.jobCode"
77   - remote-Validaton rvtype="jobCode" rv1="{{ctrl.employeeInfoForSave.companyCode}}"
78   - required placeholder="请输入工号"/>
  77 + required placeholder="请输入工号"
  78 + remote-Validation
  79 + remotevtype="ee_gh"
  80 + remotevparam="{{ {'id_eq': ctrl.employeeInfoForSave.id, 'companyCode_eq' : ctrl.employeeInfoForSave.companyCode, 'jobCode_eq': ctrl.employeeInfoForSave.jobCode} | json}}"/>
79 81 </div>
80 82 <!-- 隐藏块,显示验证信息 -->
81 83 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.required">
82 84 工号必须填写
83 85 </div>
84 86 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.remote">
85   - 选择公司并且相同公司工号不能重复
  87 + {{$remote_msg}}
86 88 </div>
87 89 </div>
88 90  
... ... @@ -125,15 +127,18 @@
125 127 <div class="form-group">
126 128 <label class="col-md-2 control-label">工种:</label>
127 129 <div class="col-md-4">
128   - <sa-Select3 model="ctrl.employeeInfoForSave"
129   - name="posts"
130   - placeholder="请选择工种..."
131   - dcvalue="{{ctrl.employeeInfoForSave.posts}}"
  130 + <sa-Select5 name="posts"
  131 + model="ctrl.employeeInfoForSave"
  132 + cmaps="{'posts': 'code'}"
132 133 dcname="posts"
133 134 icname="code"
134   - icnames="name"
135   - datatype="gzType">
136   - </sa-Select3>
  135 + dsparams="{{ {type: 'dic', param: 'gzType' } | json }}"
  136 + iterobjname="item"
  137 + iterobjexp="item.name"
  138 + searchph="请输拼音..."
  139 + searchexp="this.name"
  140 + >
  141 + </sa-Select5>
137 142 </div>
138 143 </div>
139 144  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html
... ... @@ -36,18 +36,18 @@
36 36 <div class="form-group has-success has-feedback">
37 37 <label class="col-md-2 control-label">所属公司*:</label>
38 38 <div class="col-md-3">
39   - <sa-Select3 model="ctrl.employeeInfoForSave"
40   - name="gs"
41   - placeholder="请选择所属公司..."
42   - dcvalue="{{ctrl.employeeInfoForSave.companyCode}}"
  39 + <sa-Select5 name="gs"
  40 + model="ctrl.employeeInfoForSave"
  41 + cmaps="{'companyCode': 'code', 'company': 'name'}"
43 42 dcname="companyCode"
44 43 icname="code"
45   - dcname2="company"
46   - icname2="name"
47   - icnames="name"
48   - datatype="gsType"
  44 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  45 + iterobjname="item"
  46 + iterobjexp="item.name"
  47 + searchph="请输拼音..."
  48 + searchexp="this.name"
49 49 required >
50   - </sa-Select3>
  50 + </sa-Select5>
51 51 </div>
52 52 <!-- 隐藏块,显示验证信息 -->
53 53 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
... ... @@ -74,15 +74,17 @@
74 74 <div class="col-md-3">
75 75 <input type="text" class="form-control"
76 76 name="jobCode" ng-model="ctrl.employeeInfoForSave.jobCode"
77   - remote-Validaton rvtype="jobCode" rv1="{{ctrl.employeeInfoForSave.companyCode}}"
78   - required placeholder="请输入工号"/>
  77 + required placeholder="请输入工号"
  78 + remote-Validation
  79 + remotevtype="ee_gh"
  80 + remotevparam="{{ {'companyCode_eq' : ctrl.employeeInfoForSave.companyCode, 'jobCode_eq': ctrl.employeeInfoForSave.jobCode} | json}}"/>
79 81 </div>
80 82 <!-- 隐藏块,显示验证信息 -->
81 83 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.required">
82 84 工号必须填写
83 85 </div>
84 86 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.remote">
85   - 选择公司并且相同公司工号不能重复
  87 + {{$remote_msg}}
86 88 </div>
87 89 </div>
88 90  
... ... @@ -125,15 +127,18 @@
125 127 <div class="form-group">
126 128 <label class="col-md-2 control-label">工种:</label>
127 129 <div class="col-md-4">
128   - <sa-Select3 model="ctrl.employeeInfoForSave"
129   - name="posts"
130   - placeholder="请选择工种..."
131   - dcvalue="{{ctrl.employeeInfoForSave.posts}}"
  130 + <sa-Select5 name="posts"
  131 + model="ctrl.employeeInfoForSave"
  132 + cmaps="{'posts': 'code'}"
132 133 dcname="posts"
133 134 icname="code"
134   - icnames="name"
135   - datatype="gzType">
136   - </sa-Select3>
  135 + dsparams="{{ {type: 'dic', param: 'gzType' } | json }}"
  136 + iterobjname="item"
  137 + iterobjexp="item.name"
  138 + searchph="请输拼音..."
  139 + searchexp="this.name"
  140 + >
  141 + </sa-Select5>
137 142 </div>
138 143 </div>
139 144  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html
... ... @@ -26,41 +26,46 @@
26 26 </td>
27 27 <td>
28 28 <div>
29   - <sa-Select3 model="ctrl.searchCondition()"
30   - name="gs"
31   - placeholder="请选择..."
32   - dcvalue="{{ctrl.searchCondition().companyCode_eq}}"
  29 + <sa-Select5 name="gs"
  30 + model="ctrl.searchCondition()"
  31 + cmaps="{'companyCode_eq': 'code'}"
33 32 dcname="companyCode_eq"
34 33 icname="code"
35   - icnames="name"
36   - datatype="gsType">
37   - </sa-Select3>
  34 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  35 + iterobjname="item"
  36 + iterobjexp="item.name"
  37 + searchph="请输拼音..."
  38 + searchexp="this.name"
  39 + >
  40 + </sa-Select5>
38 41 </div>
39 42 </td>
40   - <td style="width: 100px">
41   -
  43 + <td>
42 44 </td>
43 45 <td>
44 46 <div>
45   - <sa-Select3 model="ctrl.searchCondition()"
46   - name="gs"
47   - placeholder="请选择..."
48   - dcvalue="{{ctrl.searchCondition().posts_eq}}"
  47 + <sa-Select5 name="gz"
  48 + model="ctrl.searchCondition()"
  49 + cmaps="{'posts_eq': 'code'}"
49 50 dcname="posts_eq"
50 51 icname="code"
51   - icnames="name"
52   - datatype="gzType">
53   - </sa-Select3>
  52 + dsparams="{{ {type: 'dic', param: 'gzType' } | json }}"
  53 + iterobjname="item"
  54 + iterobjexp="item.name"
  55 + searchph="请输拼音..."
  56 + searchexp="this.name"
  57 + >
  58 + </sa-Select5>
54 59 </div>
55 60 </td>
56 61 <td>
57 62 <div>
58 63 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
59   - ng-click="ctrl.pageChanaged()">
  64 + ng-click="ctrl.doPage()">
60 65 <i class="fa fa-search"></i> 搜索</button>
61 66  
62 67 <button class="btn btn-sm red btn-outline filter-cancel"
63   - ng-click="ctrl.resetSearchCondition()">
  68 + ng-click="ctrl.reset()">
64 69 <i class="fa fa-times"></i> 重置</button>
65 70 </div>
66 71  
... ... @@ -69,7 +74,7 @@
69 74 </tr>
70 75 </thead>
71 76 <tbody>
72   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  77 + <tr ng-repeat="info in ctrl.page()['content']" class="odd gradeX">
73 78 <td>
74 79 <span ng-bind="$index + 1"></span>
75 80 </td>
... ... @@ -104,9 +109,9 @@
104 109  
105 110  
106 111 <div style="text-align: right;">
107   - <uib-pagination total-items="ctrl.pageInfo.totalItems"
108   - ng-model="ctrl.pageInfo.currentPage"
109   - ng-change="ctrl.pageChanaged()"
  112 + <uib-pagination total-items="ctrl.page()['totalElements']"
  113 + ng-model="ctrl.page()['uiNumber']"
  114 + ng-change="ctrl.doPage()"
110 115 rotate="false"
111 116 max-size="10"
112 117 boundary-links="true"
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js
1 1 // 人员信息管理 service controller等写在一起
2 2  
3   -angular.module('ScheduleApp').factory('EmployeeInfoManageService', ['EmployeeInfoManageService_g', function(service) {
4   -
5   - /** 当前的查询条件信息 */
6   - var currentSearchCondition = {
7   - //"carCode_like" : "",
8   - //"insideCode_like" : "",
9   - //"equipmentCode_like" : "",
10   - //"carPlate_like" : ""
11   - };
  3 +angular.module('ScheduleApp').factory(
  4 + 'EmployeeInfoManageService',
  5 + [
  6 + 'EmployeeInfoManageService_g',
  7 + function(service) {
12 8  
13   - /** 当前第几页 */
14   - var currentPageNo = 1;
15   -
16   - return {
17   - /**
18   - * 获取查询条件信息,
19   - * 用于给controller用来和页面数据绑定。
20   - */
21   - getSearchCondition: function() {
22   - return currentSearchCondition;
23   - },
24   - /**
25   - * 重置查询条件信息。
26   - */
27   - resetSearchCondition: function() {
28   - var key;
29   - for (key in currentSearchCondition) {
30   - currentSearchCondition[key] = undefined;
31   - }
32   - currentPageNo = 1;
33   - },
34   - /**
35   - * 设置当前页码。
36   - * @param cpn 从1开始,后台是从0开始的
37   - */
38   - setCurrentPageNo: function(cpn) {
39   - currentPageNo = cpn;
40   - },
41   - /**
42   - * 组装查询参数,返回一个promise查询结果。
43   - * @param params 查询参数
44   - * @return 返回一个 promise
45   - */
46   - getPage: function() {
47   - var params = currentSearchCondition; // 查询条件
48   - params.page = currentPageNo - 1; // 服务端页码从0开始
49   - return service.rest.list(params).$promise;
50   - },
51   - /**
52   - * 获取明细信息。
53   - * @param id 车辆id
54   - * @return 返回一个 promise
55   - */
56   - getDetail: function(id) {
57   - var params = {id: id};
58   - return service.rest.get(params).$promise;
59   - },
60   - /**
61   - * 保存信息。
62   - * @param obj 车辆详细信息
63   - * @return 返回一个 promise
64   - */
65   - saveDetail: function(obj) {
66   - return service.rest.save(obj).$promise;
67   - },
68   - /**
69   - * 数据导出。
70   - * @returns {*|Function|promise|n}
71   - */
72   - dataExport: function() {
73   - return service.dataTools.dataExport().$promise;
74   - }
75   - }
  9 + /** 当前的查询条件信息 */
  10 + var currentSearchCondition = {
  11 + //"carCode_like" : "",
  12 + //"insideCode_like" : "",
  13 + //"equipmentCode_like" : "",
  14 + //"carPlate_like" : ""
  15 + };
76 16  
77   -}]);
  17 + // 当前查询返回的信息
  18 + var currentPage = { // 后台spring data返回的格式
  19 + totalElements: 0,
  20 + number: 0, // 后台返回的页码,spring返回从0开始
  21 + content: [],
78 22  
79   -angular.module('ScheduleApp').controller('EmployeeInfoManageCtrl', [
80   - 'EmployeeInfoManageService', '$state', '$uibModal', 'FileDownload_g',
81   - function(employeeInfoManageService, $state, $uibModal, fileDownload) {
82   - var self = this;
  23 + uiNumber: 1 // 页面绑定的页码
  24 + };
83 25  
84   - // 切换到form状态
85   - self.goForm = function() {
86   - //alert("切换");
87   - $state.go("employeeInfoManage_form");
88   - }
  26 + // 查询对象
  27 + var queryClass = service.rest;
89 28  
90   - // 导入excel
91   - self.importData = function() {
92   - // large方式弹出模态对话框
93   - var modalInstance = $uibModal.open({
94   - templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/dataImport.html',
95   - size: "lg",
96   - animation: true,
97   - backdrop: 'static',
98   - resolve: {
99   - // 可以传值给controller
  29 + return {
  30 + getQueryClass: function() {
  31 + return queryClass;
100 32 },
101   - windowClass: 'center-modal',
102   - controller: "EmployInfoManageToolsCtrl",
103   - controllerAs: "ctrl",
104   - bindToController: true
105   - });
106   - modalInstance.result.then(
107   - function() {
108   - console.log("dataImport.html打开");
  33 + /**
  34 + * 获取查询条件信息,
  35 + * 用于给controller用来和页面数据绑定。
  36 + */
  37 + getSearchCondition: function() {
  38 + currentSearchCondition.page = currentPage.uiNumber - 1;
  39 + return currentSearchCondition;
109 40 },
110   - function() {
111   - console.log("dataImport.html消失");
112   - }
113   - );
114   - };
115   -
116   - // 导出excel
117   - self.exportData = function() {
118   - employeeInfoManageService.dataExport().then(
119   - function(result) {
120   - fileDownload.downloadFile(result.data, "application/octet-stream", "人员基础信息.xls");
  41 + /**
  42 + * 组装查询参数,返回一个promise查询结果。
  43 + * @param params 查询参数
  44 + * @return 返回一个 promise
  45 + */
  46 + getPage: function(page) {
  47 + if (page) {
  48 + currentPage.totalElements = page.totalElements;
  49 + currentPage.number = page.number;
  50 + currentPage.content = page.content;
  51 + }
  52 + return currentPage;
  53 + },
  54 + resetStatus: function() {
  55 + currentSearchCondition = {page: 0};
  56 + currentPage = {
  57 + totalElements: 0,
  58 + number: 0,
  59 + content: [],
  60 + uiNumber: 1
  61 + };
121 62 },
122   - function(result) {
123   - console.log("exportData failed:" + result);
  63 +
  64 + /**
  65 + * 数据导出。
  66 + * @returns {*|Function|promise|n}
  67 + */
  68 + dataExport: function() {
  69 + return service.dataTools.dataExport().$promise;
124 70 }
125   - );
126   - };
127   - }]);
  71 + }
  72 + }
  73 + ]
  74 +);
  75 +
  76 +// index.html控制器
  77 +angular.module('ScheduleApp').controller(
  78 + 'EmployeeInfoManageCtrl',
  79 + [
  80 + 'EmployeeInfoManageService',
  81 + '$state',
  82 + '$uibModal',
  83 + 'FileDownload_g',
  84 + function(employeeInfoManageService, $state, $uibModal, fileDownload) {
  85 + var self = this;
  86 +
  87 + // 切换到form状态
  88 + self.goForm = function() {
  89 + //alert("切换");
  90 + $state.go("employeeInfoManage_form");
  91 + };
  92 +
  93 + // 导入excel
  94 + self.importData = function() {
  95 + // large方式弹出模态对话框
  96 + var modalInstance = $uibModal.open({
  97 + templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/dataImport.html',
  98 + size: "lg",
  99 + animation: true,
  100 + backdrop: 'static',
  101 + resolve: {
  102 + // 可以传值给controller
  103 + },
  104 + windowClass: 'center-modal',
  105 + controller: "EmployInfoManageToolsCtrl",
  106 + controllerAs: "ctrl",
  107 + bindToController: true
  108 + });
  109 + modalInstance.result.then(
  110 + function() {
  111 + console.log("dataImport.html打开");
  112 + },
  113 + function() {
  114 + console.log("dataImport.html消失");
  115 + }
  116 + );
  117 + };
  118 +
  119 + // 导出excel
  120 + self.exportData = function() {
  121 + employeeInfoManageService.dataExport().then(
  122 + function(result) {
  123 + fileDownload.downloadFile(result.data, "application/octet-stream", "人员基础信息.xls");
  124 + },
  125 + function(result) {
  126 + console.log("exportData failed:" + result);
  127 + }
  128 + );
  129 + };
  130 +
  131 + }
  132 + ]
  133 +);
128 134  
129 135 angular.module('ScheduleApp').controller('EmployInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
130 136 var self = this;
... ... @@ -161,124 +167,101 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployInfoManageToolsCtrl&#39;, [&#39;$modalIn
161 167  
162 168 }]);
163 169  
164   -angular.module('ScheduleApp').controller('EmployeeInfoManageListCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) {
165   - var self = this;
166   - self.pageInfo = {
167   - totalItems : 0,
168   - currentPage : 1,
169   - infos: []
170   - };
  170 +// list.html控制器
  171 +angular.module('ScheduleApp').controller(
  172 + 'EmployeeInfoManageListCtrl',
  173 + [
  174 + 'EmployeeInfoManageService',
  175 + function(service) {
  176 + var self = this;
  177 + var Employee = service.getQueryClass();
  178 +
  179 + self.page = function() {
  180 + return service.getPage();
  181 + };
  182 +
  183 + self.searchCondition = function() {
  184 + return service.getSearchCondition();
  185 + };
  186 +
  187 + self.doPage = function() {
  188 + var result = Employee.list(self.searchCondition(), function() {
  189 + if (!result.status) {
  190 + service.getPage(result);
  191 + }
  192 + });
  193 + };
  194 + self.reset = function() {
  195 + service.resetStatus();
  196 + var result = Employee.list(self.searchCondition(), function() {
  197 + if (!result.status) {
  198 + service.getPage(result);
  199 + }
  200 + });
  201 + };
  202 +
  203 + self.doPage();
171 204  
172   - // 初始创建的时候,获取一次列表数据
173   - employeeInfoManageService.getPage().then(
174   - function(result) {
175   - self.pageInfo.totalItems = result.totalElements;
176   - self.pageInfo.currentPage = result.number + 1;
177   - self.pageInfo.infos = result.content;
178   - employeeInfoManageService.setCurrentPageNo(result.number + 1);
179   - },
180   - function(result) {
181   - alert("出错啦!");
182 205 }
183   - );
184   -
185   - //$scope.$watch("ctrl.pageInfo.currentPage", function() {
186   - // alert("dfdfdf");
187   - //});
188   -
189   - // 翻页的时候调用
190   - self.pageChanaged = function() {
191   - employeeInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
192   - employeeInfoManageService.getPage().then(
193   - function(result) {
194   - self.pageInfo.totalItems = result.totalElements;
195   - self.pageInfo.currentPage = result.number + 1;
196   - self.pageInfo.infos = result.content;
197   - employeeInfoManageService.setCurrentPageNo(result.number + 1);
198   - },
199   - function(result) {
200   - alert("出错啦!");
201   - }
202   - );
203   - };
204   - // 获取查询条件数据
205   - self.searchCondition = function() {
206   - return employeeInfoManageService.getSearchCondition();
207   - };
208   - // 重置查询条件
209   - self.resetSearchCondition = function() {
210   - employeeInfoManageService.resetSearchCondition();
211   - self.pageInfo.currentPage = 1;
212   - self.pageChanaged();
213   - };
214   -}]);
  206 + ]
  207 +);
215 208  
216   -angular.module('ScheduleApp').controller('EmployeeInfoManageFormCtrl', ['EmployeeInfoManageService', '$stateParams', '$state', function(employeeInfoManageService, $stateParams, $state) {
217   - var self = this;
  209 +// form.html控制器
  210 +angular.module('ScheduleApp').controller(
  211 + 'EmployeeInfoManageFormCtrl',
  212 + [
  213 + 'EmployeeInfoManageService',
  214 + '$stateParams',
  215 + '$state',
  216 + function(service, $stateParams, $state) {
  217 + var self = this;
  218 + var Employee = service.getQueryClass();
218 219  
219   - // 欲保存的busInfo信息,绑定
220   - self.employeeInfoForSave = {};
221   -
222   - // 获取传过来的id,有的话就是修改,获取一遍数据
223   - var id = $stateParams.id;
224   - if (id) {
225   - self.employeeInfoForSave.id = id;
226   - employeeInfoManageService.getDetail(id).then(
227   - function(result) {
228   - var key;
229   - for (key in result) {
230   - self.employeeInfoForSave[key] = result[key];
231   - }
232   - },
233   - function(result) {
234   - alert("出错啦!");
  220 + // 欲保存的busInfo信息,绑定
  221 + self.employeeInfoForSave = new Employee;
  222 +
  223 + // 获取传过来的id,有的话就是修改,获取一遍数据
  224 + var id = $stateParams.id;
  225 + if (id) {
  226 + self.employeeInfoForSave = Employee.get({id: id}, function() {});
235 227 }
236   - );
237   - }
238   -
239   - // 提交方法
240   - self.submit = function() {
241   - console.log(self.employeeInfoForSave);
242   - employeeInfoManageService.saveDetail(self.employeeInfoForSave).then(
243   - function(result) {
244   - // TODO:弹出框方式以后改
245   - if (result.status == 'SUCCESS') {
246   - alert("保存成功!");
  228 +
  229 + // 提交方法
  230 + self.submit = function() {
  231 + console.log(self.employeeInfoForSave);
  232 +
  233 + // 保存或更新
  234 + self.employeeInfoForSave.$save(function() {
247 235 $state.go("employeeInfoManage");
248   - } else {
249   - alert("保存异常!");
250   - }
251   - },
252   - function(result) {
253   - // TODO:弹出框方式以后改
254   - alert("出错啦!");
255   - }
256   - );
257   - };
  236 + });
  237 + };
258 238  
  239 + }
  240 + ]
  241 +);
259 242  
260   -}]);
  243 +// detail.html控制器
  244 +angular.module('ScheduleApp').controller(
  245 + 'EmployeeInfoManageDetailCtrl',
  246 + [
  247 + 'EmployeeInfoManageService',
  248 + '$stateParams',
  249 + function(service, $stateParams) {
  250 + var self = this;
  251 + var Employee = service.getQueryClass();
  252 + var id = $stateParams.id;
261 253  
262   -angular.module('ScheduleApp').controller('EmployeeInfoManageDetailCtrl', ['EmployeeInfoManageService', '$stateParams', function(employeeInfoManageService, $stateParams) {
263   - var self = this;
264   - self.title = "";
265   - self.employeeInfoForDetail = {};
266   - self.employeeInfoForDetail.id = $stateParams.id;
267   -
268   - // 当转向到此页面时,就获取明细信息并绑定
269   - employeeInfoManageService.getDetail($stateParams.id).then(
270   - function(result) {
271   - var key;
272   - for (key in result) {
273   - self.employeeInfoForDetail[key] = result[key];
274   - }
  254 + self.title = "";
  255 + self.employeeInfoForDetail = {};
  256 +
  257 + // 当转向到此页面时,就获取明细信息并绑定
  258 + self.employeeInfoForDetail = Employee.get({id: id}, function() {
  259 + self.title = "员工 " +
  260 + self.employeeInfoForDetail.personnelName +
  261 + " 详细信息";
  262 + });
275 263  
276   - self.title = "员工 " + self.employeeInfoForDetail.personnelName + " 详细信息";
277   - },
278   - function(result) {
279   - // TODO:弹出框方式以后改
280   - alert("出错啦!");
281 264 }
282   - );
283   -}]);
  265 + ]
  266 +);
284 267  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js
1 1 // 人员信息service
2   -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
3   - return {
4   - rest : $resource(
5   - '/personnel/:id',
6   - {order: 'jobCode', direction: 'ASC', id: '@id_route'},
7   - {
8   - list: {
9   - method: 'GET',
10   - params: {
11   - page: 0
  2 +angular.module('ScheduleApp').factory(
  3 + 'EmployeeInfoManageService_g',
  4 + [
  5 + '$resource',
  6 + function($resource) {
  7 + return {
  8 + rest : $resource(
  9 + '/ee/:id',
  10 + {order: 'jobCode', direction: 'ASC', id: '@id'},
  11 + {
  12 + list: {
  13 + method: 'GET',
  14 + params: {
  15 + page: 0
  16 + },
  17 + transformResponse: function(rs) {
  18 + var dst = angular.fromJson(rs);
  19 + if (dst.status == 'SUCCESS') {
  20 + return dst.data;
  21 + } else {
  22 + return dst; // 业务错误留给控制器处理
  23 + }
  24 + }
  25 + },
  26 + get: {
  27 + method: 'GET',
  28 + transformResponse: function(rs) {
  29 + var dst = angular.fromJson(rs);
  30 + if (dst.status == 'SUCCESS') {
  31 + return dst.data;
  32 + } else {
  33 + return dst;
  34 + }
  35 + }
  36 + },
  37 + save: {
  38 + method: 'POST'
  39 + }
12 40 }
13   - },
14   - get: {
15   - method: 'GET'
16   - },
17   - save: {
18   - method: 'POST'
19   - }
20   - }
21   - ),
22   - validate: $resource(
23   - '/personnel/validate/:type',
24   - {},
25   - {
26   - jobCode: {
27   - method: 'GET'
28   - }
29   - }
30   - ),
31   - dataTools: $resource(
32   - '/personnel/:type',
33   - {},
34   - {
35   - dataExport: {
36   - method: 'GET',
37   - responseType: "arraybuffer",
38   - params: {
39   - type: "dataExport"
40   - },
41   - transformResponse: function(data, headers){
42   - return {data : data};
  41 + ),
  42 +
  43 + dataTools: $resource(
  44 + '/personnel/:type',
  45 + {},
  46 + {
  47 + dataExport: {
  48 + method: 'GET',
  49 + responseType: "arraybuffer",
  50 + params: {
  51 + type: "dataExport"
  52 + },
  53 + transformResponse: function(data, headers){
  54 + return {data : data};
  55 + }
  56 + }
43 57 }
44   - }
45   - }
46   - )
47   - };
48   -}]);
  58 + )
  59 + };
  60 +
  61 + }
  62 + ]
  63 +);
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
... ... @@ -109,6 +109,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
109 109 // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
110 110 tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
111 111  
  112 +
  113 + // 当前的数据模式,ajax,dic,local
  114 + var dataModelType = undefined;
  115 +
112 116 return {
113 117 pre: function (scope, element, attr) {
114 118 // TODO:
... ... @@ -167,17 +171,19 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
167 171 // 处理search
168 172 console.log("search:" + search);
169 173  
170   - scope[ctrlAs].$$data = [];
171   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
172   - var upTerm = search.toUpperCase();
173   - if (scope[ctrlAs].$$data.length < 10) {
174   - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
175   - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
176   - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
177   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  174 + if (dataModelType == 'ajax') {
  175 + scope[ctrlAs].$$data = [];
  176 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  177 + var upTerm = search.toUpperCase();
  178 + if (scope[ctrlAs].$$data.length < 10) {
  179 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  180 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  181 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  182 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  183 + }
  184 + } else {
  185 + break;
178 186 }
179   - } else {
180   - break;
181 187 }
182 188 }
183 189 }
... ... @@ -327,16 +333,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
327 333  
328 334 // 重新创建内部保存的数据
329 335 scope[ctrlAs].$$data_real = [];
330   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  336 + var origin_dicgroup = dictionaryUtils.getByGroup(dictype);
331 337 var dic_key; // 字典key
332 338  
  339 + //console.log(origin_dicgroup);
  340 +
333 341 for (dic_key in origin_dicgroup) {
334 342 var data = {}; // 重新组合的字典元素对象
335 343 if (dic_key == "true")
336 344 data[$icname_attr] = true;
337 345 else
338 346 data[$icname_attr] = dic_key;
339   - data[$dscol_attr] = origin_dicgroup[dic_key];
  347 + data['name'] = origin_dicgroup[dic_key]; // 字典写死name这个key名字
340 348 scope[ctrlAs].$$data_real.push(data);
341 349 }
342 350  
... ... @@ -380,11 +388,14 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
380 388 // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
381 389  
382 390 if (obj.type == 'dic') {
  391 + dataModelType = 'dic';
383 392 scope[ctrlAs].$$internal_dic_data(obj.param);
384 393  
385 394 } else if (obj.type == 'ajax') {
  395 + dataModelType = 'ajax';
386 396 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
387 397 } else if (obj.type == 'local') {
  398 + dataModelType = 'local';
388 399 scope[ctrlAs].$$internal_local_data(obj.ldata);
389 400 } else {
390 401 throw new Error("dsparams参数格式异常=" + obj);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -59,7 +59,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
59 59 // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
60 60 var isParamAll = true;
61 61 for (var key in paramTemplate) {
62   - if (!$watch_rvparam_obj[key]) {
  62 + if (key != "id" && !$watch_rvparam_obj[key]) { // id去掉
63 63 isParamAll = false;
64 64 break;
65 65 }
... ... @@ -1385,6 +1385,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1385 1385 // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
1386 1386 tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
1387 1387  
  1388 +
  1389 + // 当前的数据模式,ajax,dic,local
  1390 + var dataModelType = undefined;
  1391 +
1388 1392 return {
1389 1393 pre: function (scope, element, attr) {
1390 1394 // TODO:
... ... @@ -1443,17 +1447,19 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1443 1447 // 处理search
1444 1448 console.log("search:" + search);
1445 1449  
1446   - scope[ctrlAs].$$data = [];
1447   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1448   - var upTerm = search.toUpperCase();
1449   - if (scope[ctrlAs].$$data.length < 10) {
1450   - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
1451   - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
1452   - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
1453   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1450 + if (dataModelType == 'ajax') {
  1451 + scope[ctrlAs].$$data = [];
  1452 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1453 + var upTerm = search.toUpperCase();
  1454 + if (scope[ctrlAs].$$data.length < 10) {
  1455 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  1456 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  1457 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  1458 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1459 + }
  1460 + } else {
  1461 + break;
1454 1462 }
1455   - } else {
1456   - break;
1457 1463 }
1458 1464 }
1459 1465 }
... ... @@ -1603,16 +1609,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1603 1609  
1604 1610 // 重新创建内部保存的数据
1605 1611 scope[ctrlAs].$$data_real = [];
1606   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  1612 + var origin_dicgroup = dictionaryUtils.getByGroup(dictype);
1607 1613 var dic_key; // 字典key
1608 1614  
  1615 + //console.log(origin_dicgroup);
  1616 +
1609 1617 for (dic_key in origin_dicgroup) {
1610 1618 var data = {}; // 重新组合的字典元素对象
1611 1619 if (dic_key == "true")
1612 1620 data[$icname_attr] = true;
1613 1621 else
1614 1622 data[$icname_attr] = dic_key;
1615   - data[$dscol_attr] = origin_dicgroup[dic_key];
  1623 + data['name'] = origin_dicgroup[dic_key]; // 字典写死name这个key名字
1616 1624 scope[ctrlAs].$$data_real.push(data);
1617 1625 }
1618 1626  
... ... @@ -1656,11 +1664,14 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1656 1664 // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
1657 1665  
1658 1666 if (obj.type == 'dic') {
  1667 + dataModelType = 'dic';
1659 1668 scope[ctrlAs].$$internal_dic_data(obj.param);
1660 1669  
1661 1670 } else if (obj.type == 'ajax') {
  1671 + dataModelType = 'ajax';
1662 1672 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
1663 1673 } else if (obj.type == 'local') {
  1674 + dataModelType = 'local';
1664 1675 scope[ctrlAs].$$internal_local_data(obj.ldata);
1665 1676 } else {
1666 1677 throw new Error("dsparams参数格式异常=" + obj);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
... ... @@ -336,6 +336,20 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
336 336 }
337 337 )
338 338 },
  339 +
  340 + ee_gh: { // 工号不能重复
  341 + template: {'companyCode_eq': '-1', 'jobCode_eq': '-1'}, // 查询参数模版
  342 + remote: $resource( // $resource封装对象
  343 + '/ee/validate_gh',
  344 + {},
  345 + {
  346 + do: {
  347 + method: 'GET'
  348 + }
  349 + }
  350 + )
  351 + },
  352 +
339 353 cc_cars: { // 车辆不能重复配置
340 354 template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
341 355 remote: $resource( // $resource封装对象
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
1 1 //所有模块service配置
2 2 // 车辆信息service
3   -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
  3 +angular.module('ScheduleApp').factory(
  4 + 'BusInfoManageService_g',
  5 + [
  6 + '$resource',
  7 + function($resource) {
  8 + return {
  9 + rest: $resource(
  10 + '/cars_sc/:id',
  11 + {order: 'carCode', direction: 'ASC', id: '@id'},
  12 + {
  13 + list: {
  14 + method: 'GET',
  15 + params: {
  16 + page: 0
  17 + },
  18 + transformResponse: function(rs) {
  19 + var dst = angular.fromJson(rs);
  20 + if (dst.status == 'SUCCESS') {
  21 + return dst.data;
  22 + } else {
  23 + return dst; // 业务错误留给控制器处理
  24 + }
  25 + }
  26 + },
  27 + get: {
  28 + method: 'GET',
  29 + transformResponse: function(rs) {
  30 + var dst = angular.fromJson(rs);
  31 + if (dst.status == 'SUCCESS') {
  32 + return dst.data;
  33 + } else {
  34 + return dst;
  35 + }
  36 + }
  37 + },
  38 + save: {
  39 + method: 'POST'
  40 + }
  41 + }
  42 + ),
  43 + import: $resource(
  44 + '/cars/importfile',
  45 + {},
  46 + {
  47 + do: {
  48 + method: 'POST',
  49 + headers: {
  50 + 'Content-Type': 'application/x-www-form-urlencoded'
  51 + },
  52 + transformRequest: function(obj) {
  53 + var str = [];
  54 + for (var p in obj) {
  55 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  56 + }
  57 + return str.join("&");
  58 + }
  59 + }
  60 + }
  61 + ),
  62 + dataTools: $resource(
  63 + '/cars/:type',
  64 + {},
  65 + {
  66 + dataExport: {
  67 + method: 'GET',
  68 + responseType: "arraybuffer",
  69 + params: {
  70 + type: "dataExport"
  71 + },
  72 + transformResponse: function(data, headers){
  73 + return {data : data};
  74 + }
  75 + }
  76 + }
  77 + )
  78 + };
  79 +
  80 + }
  81 + ]
  82 +);
  83 +// 车辆设备信息service
  84 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  85 + return $resource(
  86 + '/cde/:id',
  87 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  88 + {
  89 + list: {
  90 + method: 'GET',
  91 + params: {
  92 + page: 0
  93 + }
  94 + },
  95 + get: {
  96 + method: 'GET'
  97 + },
  98 + save: {
  99 + method: 'POST'
  100 + },
  101 + delete: {
  102 + method: 'DELETE'
  103 + }
  104 + }
  105 + );
  106 +}]);
  107 +// 人员信息service
  108 +angular.module('ScheduleApp').factory(
  109 + 'EmployeeInfoManageService_g',
  110 + [
  111 + '$resource',
  112 + function($resource) {
  113 + return {
  114 + rest : $resource(
  115 + '/ee/:id',
  116 + {order: 'jobCode', direction: 'ASC', id: '@id'},
  117 + {
  118 + list: {
  119 + method: 'GET',
  120 + params: {
  121 + page: 0
  122 + },
  123 + transformResponse: function(rs) {
  124 + var dst = angular.fromJson(rs);
  125 + if (dst.status == 'SUCCESS') {
  126 + return dst.data;
  127 + } else {
  128 + return dst; // 业务错误留给控制器处理
  129 + }
  130 + }
  131 + },
  132 + get: {
  133 + method: 'GET',
  134 + transformResponse: function(rs) {
  135 + var dst = angular.fromJson(rs);
  136 + if (dst.status == 'SUCCESS') {
  137 + return dst.data;
  138 + } else {
  139 + return dst;
  140 + }
  141 + }
  142 + },
  143 + save: {
  144 + method: 'POST'
  145 + }
  146 + }
  147 + ),
  148 +
  149 + dataTools: $resource(
  150 + '/personnel/:type',
  151 + {},
  152 + {
  153 + dataExport: {
  154 + method: 'GET',
  155 + responseType: "arraybuffer",
  156 + params: {
  157 + type: "dataExport"
  158 + },
  159 + transformResponse: function(data, headers){
  160 + return {data : data};
  161 + }
  162 + }
  163 + }
  164 + )
  165 + };
  166 +
  167 + }
  168 + ]
  169 +);
  170 +
  171 +// 车辆配置service
  172 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
4 173 return {
5   - rest: $resource(
6   - '/cars_sc/:id',
7   - {order: 'carCode', direction: 'ASC', id: '@id_route'},
  174 + rest : $resource(
  175 + '/cci/:id',
  176 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
8 177 {
9 178 list: {
10 179 method: 'GET',
... ... @@ -35,99 +204,66 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusInfoManageService_g&#39;, [&#39;$resource&#39;, fu
35 204 method: 'POST'
36 205 }
37 206 }
38   - ),
39   - import: $resource(
40   - '/cars/importfile',
41   - {},
42   - {
43   - do: {
44   - method: 'POST',
45   - headers: {
46   - 'Content-Type': 'application/x-www-form-urlencoded'
47   - },
48   - transformRequest: function(obj) {
49   - var str = [];
50   - for (var p in obj) {
51   - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
52   - }
53   - return str.join("&");
54   - }
55   - }
56   - }
57   - ),
58   - validate: $resource(
59   - '/cars/validate/:type',
60   - {},
61   - {
62   - insideCode: {
63   - method: 'GET'
64   - }
65   - }
66   - ),
67   - dataTools: $resource(
68   - '/cars/:type',
69   - {},
70   - {
71   - dataExport: {
72   - method: 'GET',
73   - responseType: "arraybuffer",
74   - params: {
75   - type: "dataExport"
76   - },
77   - transformResponse: function(data, headers){
78   - return {data : data};
79   - }
80   - }
81   - }
82 207 )
83 208 };
84 209 }]);
85   -// 车辆设备信息service
86   -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  210 +// 线路运营统计service
  211 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
87 212 return $resource(
88   - '/cde/:id',
89   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  213 + '/bic/:id',
  214 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
90 215 {
91 216 list: {
92 217 method: 'GET',
93 218 params: {
94 219 page: 0
95 220 }
96   - },
97   - get: {
98   - method: 'GET'
99   - },
100   - save: {
101   - method: 'POST'
102   - },
103   - delete: {
104   - method: 'DELETE'
105 221 }
106 222 }
107 223 );
108   -}]);
109   -// 人员信息service
110   -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  224 +}]);
  225 +
  226 +// 人员配置service
  227 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
111 228 return {
112 229 rest : $resource(
113   - '/personnel/:id',
114   - {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  230 + '/eci/:id',
  231 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
115 232 {
116 233 list: {
117 234 method: 'GET',
118 235 params: {
119 236 page: 0
  237 + },
  238 + transformResponse: function(rs) {
  239 + var dst = angular.fromJson(rs);
  240 + if (dst.status == 'SUCCESS') {
  241 + return dst.data;
  242 + } else {
  243 + return dst; // 业务错误留给控制器处理
  244 + }
120 245 }
121 246 },
122 247 get: {
123   - method: 'GET'
  248 + method: 'GET',
  249 + transformResponse: function(rs) {
  250 + var dst = angular.fromJson(rs);
  251 + if (dst.status == 'SUCCESS') {
  252 + return dst.data;
  253 + } else {
  254 + return dst;
  255 + }
  256 + }
124 257 },
125 258 save: {
126 259 method: 'POST'
  260 + },
  261 + delete: {
  262 + method: 'DELETE'
127 263 }
128 264 }
129 265 ),
130   - validate: $resource(
  266 + validate: $resource( // TODO:
131 267 '/personnel/validate/:type',
132 268 {},
133 269 {
... ... @@ -135,131 +271,8 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;EmployeeInfoManageService_g&#39;, [&#39;$resource
135 271 method: 'GET'
136 272 }
137 273 }
138   - ),
139   - dataTools: $resource(
140   - '/personnel/:type',
141   - {},
142   - {
143   - dataExport: {
144   - method: 'GET',
145   - responseType: "arraybuffer",
146   - params: {
147   - type: "dataExport"
148   - },
149   - transformResponse: function(data, headers){
150   - return {data : data};
151   - }
152   - }
153   - }
154 274 )
155 275 };
156   -}]);
157   -
158   -// 车辆配置service
159   -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
160   - return {
161   - rest : $resource(
162   - '/cci/:id',
163   - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
164   - {
165   - list: {
166   - method: 'GET',
167   - params: {
168   - page: 0
169   - },
170   - transformResponse: function(rs) {
171   - var dst = angular.fromJson(rs);
172   - if (dst.status == 'SUCCESS') {
173   - return dst.data;
174   - } else {
175   - return dst; // 业务错误留给控制器处理
176   - }
177   - }
178   - },
179   - get: {
180   - method: 'GET',
181   - transformResponse: function(rs) {
182   - var dst = angular.fromJson(rs);
183   - if (dst.status == 'SUCCESS') {
184   - return dst.data;
185   - } else {
186   - return dst;
187   - }
188   - }
189   - },
190   - save: {
191   - method: 'POST'
192   - }
193   - }
194   - )
195   - };
196   -}]);
197   -// 线路运营统计service
198   -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
199   - return $resource(
200   - '/bic/:id',
201   - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
202   - {
203   - list: {
204   - method: 'GET',
205   - params: {
206   - page: 0
207   - }
208   - }
209   - }
210   - );
211   -}]);
212   -
213   -// 人员配置service
214   -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
215   - return {
216   - rest : $resource(
217   - '/eci/:id',
218   - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
219   - {
220   - list: {
221   - method: 'GET',
222   - params: {
223   - page: 0
224   - },
225   - transformResponse: function(rs) {
226   - var dst = angular.fromJson(rs);
227   - if (dst.status == 'SUCCESS') {
228   - return dst.data;
229   - } else {
230   - return dst; // 业务错误留给控制器处理
231   - }
232   - }
233   - },
234   - get: {
235   - method: 'GET',
236   - transformResponse: function(rs) {
237   - var dst = angular.fromJson(rs);
238   - if (dst.status == 'SUCCESS') {
239   - return dst.data;
240   - } else {
241   - return dst;
242   - }
243   - }
244   - },
245   - save: {
246   - method: 'POST'
247   - },
248   - delete: {
249   - method: 'DELETE'
250   - }
251   - }
252   - ),
253   - validate: $resource( // TODO:
254   - '/personnel/validate/:type',
255   - {},
256   - {
257   - jobCode: {
258   - method: 'GET'
259   - }
260   - }
261   - )
262   - };
263 276 }]);
264 277 // 路牌管理service
265 278 angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
... ... @@ -523,454 +536,468 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;TimeTableDetailManageService_g&#39;, [&#39;$resou
523 536 // TODO:导入数据
524 537 };
525 538 }]);
526   -// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
527   -
528   -// 文件下载服务
529   -angular.module('ScheduleApp').factory('FileDownload_g', function() {
530   - return {
531   - downloadFile: function (data, mimeType, fileName) {
532   - var success = false;
533   - var blob = new Blob([data], { type: mimeType });
534   - try {
535   - if (navigator.msSaveBlob)
536   - navigator.msSaveBlob(blob, fileName);
537   - else {
538   - // Try using other saveBlob implementations, if available
539   - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
540   - if (saveBlob === undefined) throw "Not supported";
541   - saveBlob(blob, fileName);
542   - }
543   - success = true;
544   - } catch (ex) {
545   - console.log("saveBlob method failed with the following exception:");
546   - console.log(ex);
547   - }
548   -
549   - if (!success) {
550   - // Get the blob url creator
551   - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
552   - if (urlCreator) {
553   - // Try to use a download link
554   - var link = document.createElement('a');
555   - if ('download' in link) {
556   - // Try to simulate a click
557   - try {
558   - // Prepare a blob URL
559   - var url = urlCreator.createObjectURL(blob);
560   - link.setAttribute('href', url);
561   -
562   - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
563   - link.setAttribute("download", fileName);
564   -
565   - // Simulate clicking the download link
566   - var event = document.createEvent('MouseEvents');
567   - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
568   - link.dispatchEvent(event);
569   - success = true;
570   -
571   - } catch (ex) {
572   - console.log("Download link method with simulated click failed with the following exception:");
573   - console.log(ex);
574   - }
575   - }
576   -
577   - if (!success) {
578   - // Fallback to window.location method
579   - try {
580   - // Prepare a blob URL
581   - // Use application/octet-stream when using window.location to force download
582   - var url = urlCreator.createObjectURL(blob);
583   - window.location = url;
584   - console.log("Download link method with window.location succeeded");
585   - success = true;
586   - } catch (ex) {
587   - console.log("Download link method with window.location failed with the following exception:");
588   - console.log(ex);
589   - }
590   - }
591   - }
592   - }
593   -
594   - if (!success) {
595   - // Fallback to window.open method
596   - console.log("No methods worked for saving the arraybuffer, using last resort window.open");
597   - window.open("", '_blank', '');
598   - }
599   - }
600   - };
601   -});
602   -
603   -
604   -/**
605   - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
606   - * 1、compile阶段使用的属性如下:
607   - * required:用于和表单验证连接,指定成required="true"才有效。
608   - * 2、link阶段使用的属性如下
609   - * model:关联的模型对象
610   - * name:表单验证时需要的名字
611   - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
612   - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
613   - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
614   - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
615   - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
616   - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
617   - * placeholder:select placeholder字符串描述
618   - *
619   - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
620   - * $$SearchInfoService_g,内部使用的数据服务
621   - */
622   -// saSelect2指令使用的内部信service
623   -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
624   - return {
625   - xl: $resource(
626   - '/line/:type',
627   - {order: 'name', direction: 'ASC'},
628   - {
629   - list: {
630   - method: 'GET',
631   - isArray: true
632   - }
633   - }
634   - ),
635   - xlinfo: $resource(
636   - '/lineInformation/:type',
637   - {order: 'line.name', direction: 'ASC'},
638   - {
639   - list: {
640   - method: 'GET',
641   - isArray: true
642   - }
643   - }
644   - ),
645   - zd: $resource(
646   - '/stationroute/stations',
647   - {order: 'stationCode', direction: 'ASC'},
648   - {
649   - list: {
650   - method: 'GET',
651   - isArray: true
652   - }
653   - }
654   - ),
655   - tcc: $resource(
656   - '/carpark/:type',
657   - {order: 'parkCode', direction: 'ASC'},
658   - {
659   - list: {
660   - method: 'GET',
661   - isArray: true
662   - }
663   - }
664   - ),
665   - ry: $resource(
666   - '/personnel/:type',
667   - {order: 'personnelName', direction: 'ASC'},
668   - {
669   - list: {
670   - method: 'GET',
671   - isArray: true
672   - }
673   - }
674   - ),
675   - cl: $resource(
676   - '/cars/:type',
677   - {order: "insideCode", direction: 'ASC'},
678   - {
679   - list: {
680   - method: 'GET',
681   - isArray: true
682   - }
683   - }
684   - ),
685   - ttInfo: $resource(
686   - '/tic/:type',
687   - {order: "name", direction: 'ASC'},
688   - {
689   - list: {
690   - method: 'GET',
691   - isArray: true
692   - }
693   - }
694   - ),
695   - lpInfo: $resource(
696   - '/gic/ttlpnames',
697   - {order: "lpName", direction: 'ASC'},
698   - {
699   - list: {
700   - method: 'GET',
701   - isArray: true
702   - }
703   - }
704   - ),
705   - lpInfo2: $resource(
706   - '/gic/:type',
707   - {order: "lpName", direction: 'ASC'},
708   - {
709   - list: {
710   - method: 'GET',
711   - isArray: true
712   - }
713   - }
714   - ),
715   - cci: $resource(
716   - '/cci/cars',
717   - {},
718   - {
719   - list: {
720   - method: 'GET',
721   - isArray: true
722   - }
723   - }
724   -
725   - ),
726   - cci2: $resource(
727   - '/cci/:type',
728   - {},
729   - {
730   - list: {
731   - method: 'GET',
732   - isArray: true,
733   - transformResponse: function(rs) {
734   - var dst = angular.fromJson(rs);
735   - if (dst.status == 'SUCCESS') {
736   - return dst.data;
737   - } else {
738   - return dst; // 业务错误留给控制器处理
739   - }
740   - }
741   - }
742   - }
743   - ),
744   - cci3: $resource(
745   - '/cci/cars2',
746   - {},
747   - {
748   - list: {
749   - method: 'GET',
750   - isArray: true
751   - }
752   - }
753   -
754   - ),
755   - eci: $resource(
756   - '/eci/jsy',
757   - {},
758   - {
759   - list: {
760   - method: 'GET',
761   - isArray: true
762   - }
763   - }
764   - ),
765   - eci2: $resource(
766   - '/eci/spy',
767   - {},
768   - {
769   - list: {
770   - method: 'GET',
771   - isArray: true
772   - }
773   - }
774   - ),
775   - eci3: $resource(
776   - '/eci/:type',
777   - {},
778   - {
779   - list: {
780   - method: 'GET',
781   - isArray: true
782   - }
783   - }
784   - ),
785   -
786   -
787   - validate: { // remoteValidation指令用到的resource
788   - gbv1: { // 路牌序号验证
789   - template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
790   - remote: $resource(
791   - '/gic/validate1',
792   - {},
793   - {
794   - do: {
795   - method: 'GET'
796   - }
797   - }
798   - )
799   - },
800   - gbv2: { // 路牌名称验证
801   - template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
802   - remote: $resource(
803   - '/gic/validate2',
804   - {},
805   - {
806   - do: {
807   - method: 'GET'
808   - }
809   - }
810   - )
811   - },
812   -
813   - cars_zbh: { // 自编号验证
814   - template: {'insideCode_eq': '-1'}, // 查询参数模版
815   - remote: $resource( // $resource封装对象
816   - '/cars_sc/validate_zbh',
817   - {},
818   - {
819   - do: {
820   - method: 'GET'
821   - }
822   - }
823   - )
824   - },
825   -
826   - cars_sbbh: { // 验证设备编号
827   - template: {'equipmentCode_eq': '-1'}, // 查询参数模版
828   - remote: $resource( // $resource封装对象
829   - '/cars_sc/validate_sbbh',
830   - {},
831   - {
832   - do: {
833   - method: 'GET'
834   - }
835   - }
836   - )
837   - },
838   -
839   - cars_clbh: { // 车辆编号验证
840   - template: {'carCode_eq': '-1'}, // 查询参数模版
841   - remote: $resource( // $resource封装对象
842   - '/cars_sc/validate_clbh',
843   - {},
844   - {
845   - do: {
846   - method: 'GET'
847   - }
848   - }
849   - )
850   - },
851   -
852   - cars_cph: { // 车牌号验证
853   - template: {'carPlate_eq': '-1'}, // 查询参数模版
854   - remote: $resource( // $resource封装对象
855   - '/cars_sc/validate_cph',
856   - {},
857   - {
858   - do: {
859   - method: 'GET'
860   - }
861   - }
862   - )
863   - },
864   - cc_cars: { // 车辆不能重复配置
865   - template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
866   - remote: $resource( // $resource封装对象
867   - '/cci/validate_cars',
868   - {},
869   - {
870   - do: {
871   - method: 'GET'
872   - }
873   - }
874   - )
875   - },
876   - ec_jsy: { // 驾驶员不能重复配置
877   - template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'jsy.id_eq': -1}, // 查询参数模版
878   - remote: $resource( // $resource封装对象
879   - '/eci/validate_jsy',
880   - {},
881   - {
882   - do: {
883   - method: 'GET'
884   - }
885   - }
886   - )
887   - },
888   - ec_spy: { // 售票员不能重复配置
889   - template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'spy.id_eq': -1}, // 查询参数模版
890   - remote: $resource( // $resource封装对象
891   - '/eci/validate_spy',
892   - {},
893   - {
894   - do: {
895   - method: 'GET'
896   - }
897   - }
898   - )
899   - },
900   -
901   - cde1: { // 车辆设备启用日期验证
902   - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
903   - remote: $resource( // $resource封装对象
904   - '/cde//validate/qyrq',
905   - {},
906   - {
907   - do: {
908   - method: 'GET'
909   - }
910   - }
911   - )
912   - },
913   - ttc1: { // 时刻表名字验证
914   - template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
915   - remote: $resource( // $resource封装对象
916   - '/tic/validate/equale',
917   - {},
918   - {
919   - do: {
920   - method: 'GET'
921   - }
922   - }
923   - )
924   - },
925   - sheet: { // 时刻表sheet工作区验证
926   - template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
927   - remote: $resource( // $resource封装对象
928   - '/tidc/validate/sheet',
929   - {},
930   - {
931   - do: {
932   - method: 'POST',
933   - headers: {
934   - 'Content-Type': 'application/x-www-form-urlencoded'
935   - },
936   - transformRequest: function(obj) {
937   - var str = [];
938   - for (var p in obj) {
939   - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
940   - }
941   - return str.join("&");
942   - }
943   - }
944   - }
945   - )
946   - },
947   - sheetli: { // 时刻表线路标准验证
948   - template: {'lineinfoid': -1},
949   - remote: $resource( // $resource封装对象
950   - '/tidc/validate/lineinfo',
951   - {},
952   - {
953   - do: {
954   - method: 'GET'
955   - }
956   - }
957   - )
958   - }
959   - }
960   -
961   - //validate: $resource(
962   - // '/cars/validate/:type',
963   - // {},
964   - // {
965   - // insideCode: {
966   - // method: 'GET'
967   - // }
968   - // }
969   - //)
970   -
971   -
972   -
973   - }
974   -}]);
975   -
976   -
  539 +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
  540 +
  541 +// 文件下载服务
  542 +angular.module('ScheduleApp').factory('FileDownload_g', function() {
  543 + return {
  544 + downloadFile: function (data, mimeType, fileName) {
  545 + var success = false;
  546 + var blob = new Blob([data], { type: mimeType });
  547 + try {
  548 + if (navigator.msSaveBlob)
  549 + navigator.msSaveBlob(blob, fileName);
  550 + else {
  551 + // Try using other saveBlob implementations, if available
  552 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  553 + if (saveBlob === undefined) throw "Not supported";
  554 + saveBlob(blob, fileName);
  555 + }
  556 + success = true;
  557 + } catch (ex) {
  558 + console.log("saveBlob method failed with the following exception:");
  559 + console.log(ex);
  560 + }
  561 +
  562 + if (!success) {
  563 + // Get the blob url creator
  564 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  565 + if (urlCreator) {
  566 + // Try to use a download link
  567 + var link = document.createElement('a');
  568 + if ('download' in link) {
  569 + // Try to simulate a click
  570 + try {
  571 + // Prepare a blob URL
  572 + var url = urlCreator.createObjectURL(blob);
  573 + link.setAttribute('href', url);
  574 +
  575 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  576 + link.setAttribute("download", fileName);
  577 +
  578 + // Simulate clicking the download link
  579 + var event = document.createEvent('MouseEvents');
  580 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  581 + link.dispatchEvent(event);
  582 + success = true;
  583 +
  584 + } catch (ex) {
  585 + console.log("Download link method with simulated click failed with the following exception:");
  586 + console.log(ex);
  587 + }
  588 + }
  589 +
  590 + if (!success) {
  591 + // Fallback to window.location method
  592 + try {
  593 + // Prepare a blob URL
  594 + // Use application/octet-stream when using window.location to force download
  595 + var url = urlCreator.createObjectURL(blob);
  596 + window.location = url;
  597 + console.log("Download link method with window.location succeeded");
  598 + success = true;
  599 + } catch (ex) {
  600 + console.log("Download link method with window.location failed with the following exception:");
  601 + console.log(ex);
  602 + }
  603 + }
  604 + }
  605 + }
  606 +
  607 + if (!success) {
  608 + // Fallback to window.open method
  609 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  610 + window.open("", '_blank', '');
  611 + }
  612 + }
  613 + };
  614 +});
  615 +
  616 +
  617 +/**
  618 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  619 + * 1、compile阶段使用的属性如下:
  620 + * required:用于和表单验证连接,指定成required="true"才有效。
  621 + * 2、link阶段使用的属性如下
  622 + * model:关联的模型对象
  623 + * name:表单验证时需要的名字
  624 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  625 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  626 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  627 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  628 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  629 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  630 + * placeholder:select placeholder字符串描述
  631 + *
  632 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  633 + * $$SearchInfoService_g,内部使用的数据服务
  634 + */
  635 +// saSelect2指令使用的内部信service
  636 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  637 + return {
  638 + xl: $resource(
  639 + '/line/:type',
  640 + {order: 'name', direction: 'ASC'},
  641 + {
  642 + list: {
  643 + method: 'GET',
  644 + isArray: true
  645 + }
  646 + }
  647 + ),
  648 + xlinfo: $resource(
  649 + '/lineInformation/:type',
  650 + {order: 'line.name', direction: 'ASC'},
  651 + {
  652 + list: {
  653 + method: 'GET',
  654 + isArray: true
  655 + }
  656 + }
  657 + ),
  658 + zd: $resource(
  659 + '/stationroute/stations',
  660 + {order: 'stationCode', direction: 'ASC'},
  661 + {
  662 + list: {
  663 + method: 'GET',
  664 + isArray: true
  665 + }
  666 + }
  667 + ),
  668 + tcc: $resource(
  669 + '/carpark/:type',
  670 + {order: 'parkCode', direction: 'ASC'},
  671 + {
  672 + list: {
  673 + method: 'GET',
  674 + isArray: true
  675 + }
  676 + }
  677 + ),
  678 + ry: $resource(
  679 + '/personnel/:type',
  680 + {order: 'personnelName', direction: 'ASC'},
  681 + {
  682 + list: {
  683 + method: 'GET',
  684 + isArray: true
  685 + }
  686 + }
  687 + ),
  688 + cl: $resource(
  689 + '/cars/:type',
  690 + {order: "insideCode", direction: 'ASC'},
  691 + {
  692 + list: {
  693 + method: 'GET',
  694 + isArray: true
  695 + }
  696 + }
  697 + ),
  698 + ttInfo: $resource(
  699 + '/tic/:type',
  700 + {order: "name", direction: 'ASC'},
  701 + {
  702 + list: {
  703 + method: 'GET',
  704 + isArray: true
  705 + }
  706 + }
  707 + ),
  708 + lpInfo: $resource(
  709 + '/gic/ttlpnames',
  710 + {order: "lpName", direction: 'ASC'},
  711 + {
  712 + list: {
  713 + method: 'GET',
  714 + isArray: true
  715 + }
  716 + }
  717 + ),
  718 + lpInfo2: $resource(
  719 + '/gic/:type',
  720 + {order: "lpName", direction: 'ASC'},
  721 + {
  722 + list: {
  723 + method: 'GET',
  724 + isArray: true
  725 + }
  726 + }
  727 + ),
  728 + cci: $resource(
  729 + '/cci/cars',
  730 + {},
  731 + {
  732 + list: {
  733 + method: 'GET',
  734 + isArray: true
  735 + }
  736 + }
  737 +
  738 + ),
  739 + cci2: $resource(
  740 + '/cci/:type',
  741 + {},
  742 + {
  743 + list: {
  744 + method: 'GET',
  745 + isArray: true,
  746 + transformResponse: function(rs) {
  747 + var dst = angular.fromJson(rs);
  748 + if (dst.status == 'SUCCESS') {
  749 + return dst.data;
  750 + } else {
  751 + return dst; // 业务错误留给控制器处理
  752 + }
  753 + }
  754 + }
  755 + }
  756 + ),
  757 + cci3: $resource(
  758 + '/cci/cars2',
  759 + {},
  760 + {
  761 + list: {
  762 + method: 'GET',
  763 + isArray: true
  764 + }
  765 + }
  766 +
  767 + ),
  768 + eci: $resource(
  769 + '/eci/jsy',
  770 + {},
  771 + {
  772 + list: {
  773 + method: 'GET',
  774 + isArray: true
  775 + }
  776 + }
  777 + ),
  778 + eci2: $resource(
  779 + '/eci/spy',
  780 + {},
  781 + {
  782 + list: {
  783 + method: 'GET',
  784 + isArray: true
  785 + }
  786 + }
  787 + ),
  788 + eci3: $resource(
  789 + '/eci/:type',
  790 + {},
  791 + {
  792 + list: {
  793 + method: 'GET',
  794 + isArray: true
  795 + }
  796 + }
  797 + ),
  798 +
  799 +
  800 + validate: { // remoteValidation指令用到的resource
  801 + gbv1: { // 路牌序号验证
  802 + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
  803 + remote: $resource(
  804 + '/gic/validate1',
  805 + {},
  806 + {
  807 + do: {
  808 + method: 'GET'
  809 + }
  810 + }
  811 + )
  812 + },
  813 + gbv2: { // 路牌名称验证
  814 + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
  815 + remote: $resource(
  816 + '/gic/validate2',
  817 + {},
  818 + {
  819 + do: {
  820 + method: 'GET'
  821 + }
  822 + }
  823 + )
  824 + },
  825 +
  826 + cars_zbh: { // 自编号验证
  827 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  828 + remote: $resource( // $resource封装对象
  829 + '/cars_sc/validate_zbh',
  830 + {},
  831 + {
  832 + do: {
  833 + method: 'GET'
  834 + }
  835 + }
  836 + )
  837 + },
  838 +
  839 + cars_sbbh: { // 验证设备编号
  840 + template: {'equipmentCode_eq': '-1'}, // 查询参数模版
  841 + remote: $resource( // $resource封装对象
  842 + '/cars_sc/validate_sbbh',
  843 + {},
  844 + {
  845 + do: {
  846 + method: 'GET'
  847 + }
  848 + }
  849 + )
  850 + },
  851 +
  852 + cars_clbh: { // 车辆编号验证
  853 + template: {'carCode_eq': '-1'}, // 查询参数模版
  854 + remote: $resource( // $resource封装对象
  855 + '/cars_sc/validate_clbh',
  856 + {},
  857 + {
  858 + do: {
  859 + method: 'GET'
  860 + }
  861 + }
  862 + )
  863 + },
  864 +
  865 + cars_cph: { // 车牌号验证
  866 + template: {'carPlate_eq': '-1'}, // 查询参数模版
  867 + remote: $resource( // $resource封装对象
  868 + '/cars_sc/validate_cph',
  869 + {},
  870 + {
  871 + do: {
  872 + method: 'GET'
  873 + }
  874 + }
  875 + )
  876 + },
  877 +
  878 + ee_gh: { // 工号不能重复
  879 + template: {'companyCode_eq': '-1', 'jobCode_eq': '-1'}, // 查询参数模版
  880 + remote: $resource( // $resource封装对象
  881 + '/ee/validate_gh',
  882 + {},
  883 + {
  884 + do: {
  885 + method: 'GET'
  886 + }
  887 + }
  888 + )
  889 + },
  890 +
  891 + cc_cars: { // 车辆不能重复配置
  892 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
  893 + remote: $resource( // $resource封装对象
  894 + '/cci/validate_cars',
  895 + {},
  896 + {
  897 + do: {
  898 + method: 'GET'
  899 + }
  900 + }
  901 + )
  902 + },
  903 + ec_jsy: { // 驾驶员不能重复配置
  904 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'jsy.id_eq': -1}, // 查询参数模版
  905 + remote: $resource( // $resource封装对象
  906 + '/eci/validate_jsy',
  907 + {},
  908 + {
  909 + do: {
  910 + method: 'GET'
  911 + }
  912 + }
  913 + )
  914 + },
  915 + ec_spy: { // 售票员不能重复配置
  916 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'spy.id_eq': -1}, // 查询参数模版
  917 + remote: $resource( // $resource封装对象
  918 + '/eci/validate_spy',
  919 + {},
  920 + {
  921 + do: {
  922 + method: 'GET'
  923 + }
  924 + }
  925 + )
  926 + },
  927 +
  928 + cde1: { // 车辆设备启用日期验证
  929 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  930 + remote: $resource( // $resource封装对象
  931 + '/cde//validate/qyrq',
  932 + {},
  933 + {
  934 + do: {
  935 + method: 'GET'
  936 + }
  937 + }
  938 + )
  939 + },
  940 + ttc1: { // 时刻表名字验证
  941 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  942 + remote: $resource( // $resource封装对象
  943 + '/tic/validate/equale',
  944 + {},
  945 + {
  946 + do: {
  947 + method: 'GET'
  948 + }
  949 + }
  950 + )
  951 + },
  952 + sheet: { // 时刻表sheet工作区验证
  953 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  954 + remote: $resource( // $resource封装对象
  955 + '/tidc/validate/sheet',
  956 + {},
  957 + {
  958 + do: {
  959 + method: 'POST',
  960 + headers: {
  961 + 'Content-Type': 'application/x-www-form-urlencoded'
  962 + },
  963 + transformRequest: function(obj) {
  964 + var str = [];
  965 + for (var p in obj) {
  966 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  967 + }
  968 + return str.join("&");
  969 + }
  970 + }
  971 + }
  972 + )
  973 + },
  974 + sheetli: { // 时刻表线路标准验证
  975 + template: {'lineinfoid': -1},
  976 + remote: $resource( // $resource封装对象
  977 + '/tidc/validate/lineinfo',
  978 + {},
  979 + {
  980 + do: {
  981 + method: 'GET'
  982 + }
  983 + }
  984 + )
  985 + }
  986 + }
  987 +
  988 + //validate: $resource(
  989 + // '/cars/validate/:type',
  990 + // {},
  991 + // {
  992 + // insideCode: {
  993 + // method: 'GET'
  994 + // }
  995 + // }
  996 + //)
  997 +
  998 +
  999 +
  1000 + }
  1001 +}]);
  1002 +
  1003 +
... ...