Commit 38ca936ff98e06db92e622cce3934a5bd1ee3666
1 parent
404e0e2f
Update
Showing
11 changed files
with
154 additions
and
144 deletions
src/main/java/com/bsth/controller/schedule/BController.java
| 1 | 1 | package com.bsth.controller.schedule; |
| 2 | 2 | |
| 3 | +import com.bsth.common.Constants; | |
| 3 | 4 | import com.bsth.common.ResponseCode; |
| 5 | +import com.bsth.entity.schedule.BEntity; | |
| 6 | +import com.bsth.entity.sys.SysUser; | |
| 4 | 7 | import com.bsth.service.schedule.BService; |
| 5 | 8 | import com.bsth.service.schedule.ScheduleException; |
| 9 | +import com.bsth.service.sys.SysUserService; | |
| 6 | 10 | import com.google.common.base.Splitter; |
| 7 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 12 | import org.springframework.data.domain.PageRequest; |
| 9 | 13 | import org.springframework.data.domain.Sort; |
| 10 | 14 | import org.springframework.web.bind.annotation.*; |
| 11 | 15 | |
| 16 | +import javax.servlet.http.HttpSession; | |
| 12 | 17 | import java.io.Serializable; |
| 13 | -import java.util.ArrayList; | |
| 14 | -import java.util.HashMap; | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 18 | +import java.util.*; | |
| 17 | 19 | |
| 18 | 20 | /** |
| 19 | 21 | * 基础控制器。 |
| ... | ... | @@ -21,12 +23,24 @@ import java.util.Map; |
| 21 | 23 | public class BController<T, ID extends Serializable> { |
| 22 | 24 | @Autowired |
| 23 | 25 | protected BService<T, ID> bService; |
| 26 | + @Autowired | |
| 27 | + private SysUserService sysUserService; | |
| 24 | 28 | |
| 25 | 29 | // CRUD 操作 |
| 26 | 30 | // Create操作 |
| 27 | 31 | @RequestMapping(method = RequestMethod.POST) |
| 28 | - public Map<String, Object> save(@RequestBody T t) { | |
| 29 | - T t_saved = bService.save(t); | |
| 32 | + public Map<String, Object> save(@RequestBody T t, HttpSession httpSession) { | |
| 33 | + // 判定T是否是BEntity的子类,增加新的字段 | |
| 34 | + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME)); | |
| 35 | + SysUser sysUser = sysUserService.findByUserName(userName); | |
| 36 | + BEntity t_b = null; | |
| 37 | + if (t instanceof BEntity) { | |
| 38 | + t_b = (BEntity) t; | |
| 39 | + t_b.setCreateBy(sysUser); | |
| 40 | + t_b.setCreateDate(new Date()); | |
| 41 | + } | |
| 42 | + | |
| 43 | + T t_saved = bService.save((T) t_b); | |
| 30 | 44 | Map<String, Object> rtn = new HashMap<>(); |
| 31 | 45 | rtn.put("status", ResponseCode.SUCCESS); |
| 32 | 46 | rtn.put("data", t_saved); |
| ... | ... | @@ -34,8 +48,21 @@ public class BController<T, ID extends Serializable> { |
| 34 | 48 | } |
| 35 | 49 | // Update操作 |
| 36 | 50 | @RequestMapping(value="/{id}", method = RequestMethod.POST) |
| 37 | - public Map<String, Object> update(@RequestBody T t) { | |
| 38 | - return save(t); | |
| 51 | + public Map<String, Object> update(@RequestBody T t, HttpSession httpSession) { | |
| 52 | + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME)); | |
| 53 | + SysUser sysUser = sysUserService.findByUserName(userName); | |
| 54 | + BEntity t_b = null; | |
| 55 | + if (t instanceof BEntity) { | |
| 56 | + t_b = (BEntity) t; | |
| 57 | + t_b.setUpdateBy(sysUser); | |
| 58 | + t_b.setUpdateDate(new Date()); | |
| 59 | + } | |
| 60 | + | |
| 61 | + T t_updated = bService.save((T) t_b); | |
| 62 | + Map<String, Object> rtn = new HashMap<>(); | |
| 63 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 64 | + rtn.put("data", t_updated); | |
| 65 | + return rtn; | |
| 39 | 66 | } |
| 40 | 67 | // Research操作 |
| 41 | 68 | @RequestMapping(value = "/{id}", method = RequestMethod.GET) |
| ... | ... | @@ -97,9 +124,10 @@ public class BController<T, ID extends Serializable> { |
| 97 | 124 | |
| 98 | 125 | // Delete操作 |
| 99 | 126 | @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) |
| 100 | - public Map<String, Object> delete(@PathVariable("id") ID id) { | |
| 127 | + public Map<String, Object> delete(@PathVariable("id") ID id, HttpSession httpSession) { | |
| 101 | 128 | Map<String, Object> rtn = new HashMap<>(); |
| 102 | 129 | try { |
| 130 | + // 由于种种原因,这里不保存用户和操作时间了 | |
| 103 | 131 | bService.delete(id); |
| 104 | 132 | rtn.put("status", ResponseCode.SUCCESS); |
| 105 | 133 | } catch (ScheduleException exp) { | ... | ... |
src/main/java/com/bsth/entity/schedule/BEntity.java
0 → 100644
| 1 | +package com.bsth.entity.schedule; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.SysUser; | |
| 4 | + | |
| 5 | +import javax.persistence.*; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by xu on 16/12/14. | |
| 10 | + */ | |
| 11 | +@MappedSuperclass | |
| 12 | +public class BEntity { | |
| 13 | + | |
| 14 | + /** 创建人 */ | |
| 15 | + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
| 16 | + private SysUser createBy; | |
| 17 | + /** 修改人 */ | |
| 18 | + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
| 19 | + private SysUser updateBy; | |
| 20 | + | |
| 21 | + /** 创建日期 */ | |
| 22 | + @Column(updatable = false, name = "create_date") | |
| 23 | + private Date createDate; | |
| 24 | + /** 修改日期 */ | |
| 25 | + @Column(name = "update_date") | |
| 26 | + private Date updateDate; | |
| 27 | + | |
| 28 | + public SysUser getCreateBy() { | |
| 29 | + return createBy; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setCreateBy(SysUser createBy) { | |
| 33 | + this.createBy = createBy; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public SysUser getUpdateBy() { | |
| 37 | + return updateBy; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setUpdateBy(SysUser updateBy) { | |
| 41 | + this.updateBy = updateBy; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public Date getCreateDate() { | |
| 45 | + return createDate; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setCreateDate(Date createDate) { | |
| 49 | + this.createDate = createDate; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public Date getUpdateDate() { | |
| 53 | + return updateDate; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setUpdateDate(Date updateDate) { | |
| 57 | + this.updateDate = updateDate; | |
| 58 | + } | |
| 59 | +} | ... | ... |
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
| ... | ... | @@ -2,7 +2,6 @@ package com.bsth.entity.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.Cars; |
| 4 | 4 | import com.bsth.entity.Line; |
| 5 | -import com.bsth.entity.sys.SysUser; | |
| 6 | 5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 7 | 6 | |
| 8 | 7 | import javax.persistence.*; |
| ... | ... | @@ -21,7 +20,7 @@ import java.util.Date; |
| 21 | 20 | }) |
| 22 | 21 | }) |
| 23 | 22 | @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) |
| 24 | -public class CarConfigInfo implements Serializable { | |
| 23 | +public class CarConfigInfo extends BEntity implements Serializable { | |
| 25 | 24 | |
| 26 | 25 | /** 主健Id */ |
| 27 | 26 | @Id |
| ... | ... | @@ -59,20 +58,6 @@ public class CarConfigInfo implements Serializable { |
| 59 | 58 | @Column(nullable = false) |
| 60 | 59 | private Boolean isCancel = false; |
| 61 | 60 | |
| 62 | - /** 创建人 */ | |
| 63 | - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
| 64 | - private SysUser createBy; | |
| 65 | - /** 修改人 */ | |
| 66 | - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
| 67 | - private SysUser updateBy; | |
| 68 | - | |
| 69 | - /** 创建日期 */ | |
| 70 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 71 | - private Date createDate; | |
| 72 | - /** 修改日期 */ | |
| 73 | - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 74 | - private Date updateDate; | |
| 75 | - | |
| 76 | 61 | public CarConfigInfo() {} |
| 77 | 62 | public CarConfigInfo(Object id, Object xlid, Object xlname, Object clid) { |
| 78 | 63 | if (id != null) { |
| ... | ... | @@ -164,38 +149,6 @@ public class CarConfigInfo implements Serializable { |
| 164 | 149 | this.isSwitch = isSwitch; |
| 165 | 150 | } |
| 166 | 151 | |
| 167 | - public SysUser getCreateBy() { | |
| 168 | - return createBy; | |
| 169 | - } | |
| 170 | - | |
| 171 | - public void setCreateBy(SysUser createBy) { | |
| 172 | - this.createBy = createBy; | |
| 173 | - } | |
| 174 | - | |
| 175 | - public SysUser getUpdateBy() { | |
| 176 | - return updateBy; | |
| 177 | - } | |
| 178 | - | |
| 179 | - public void setUpdateBy(SysUser updateBy) { | |
| 180 | - this.updateBy = updateBy; | |
| 181 | - } | |
| 182 | - | |
| 183 | - public Date getCreateDate() { | |
| 184 | - return createDate; | |
| 185 | - } | |
| 186 | - | |
| 187 | - public void setCreateDate(Date createDate) { | |
| 188 | - this.createDate = createDate; | |
| 189 | - } | |
| 190 | - | |
| 191 | - public Date getUpdateDate() { | |
| 192 | - return updateDate; | |
| 193 | - } | |
| 194 | - | |
| 195 | - public void setUpdateDate(Date updateDate) { | |
| 196 | - this.updateDate = updateDate; | |
| 197 | - } | |
| 198 | - | |
| 199 | 152 | public Boolean getIsCancel() { |
| 200 | 153 | return isCancel; |
| 201 | 154 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
| ... | ... | @@ -3,13 +3,12 @@ package com.bsth.entity.schedule; |
| 3 | 3 | import com.bsth.entity.Cars; |
| 4 | 4 | import com.bsth.entity.Line; |
| 5 | 5 | import com.bsth.entity.Personnel; |
| 6 | -import com.bsth.entity.sys.SysUser; | |
| 7 | 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 8 | 7 | import org.hibernate.annotations.Formula; |
| 9 | 8 | |
| 10 | 9 | import javax.persistence.*; |
| 11 | 10 | import javax.validation.constraints.NotNull; |
| 12 | -import java.util.Date; | |
| 11 | +import java.io.Serializable; | |
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * 人员配置信息。 |
| ... | ... | @@ -24,7 +23,7 @@ import java.util.Date; |
| 24 | 23 | }) |
| 25 | 24 | }) |
| 26 | 25 | @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) |
| 27 | -public class EmployeeConfigInfo { | |
| 26 | +public class EmployeeConfigInfo extends BEntity implements Serializable { | |
| 28 | 27 | |
| 29 | 28 | /** 主键Id */ |
| 30 | 29 | @Id |
| ... | ... | @@ -55,20 +54,6 @@ public class EmployeeConfigInfo { |
| 55 | 54 | @Column(nullable = false) |
| 56 | 55 | private Boolean isCancel = false; |
| 57 | 56 | |
| 58 | - /** 创建人 */ | |
| 59 | - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
| 60 | - private SysUser createBy; | |
| 61 | - /** 修改人 */ | |
| 62 | - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | |
| 63 | - private SysUser updateBy; | |
| 64 | - | |
| 65 | - /** 创建日期 */ | |
| 66 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 67 | - private Date createDate; | |
| 68 | - /** 修改日期 */ | |
| 69 | - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 70 | - private Date updateDate; | |
| 71 | - | |
| 72 | 57 | public EmployeeConfigInfo() {} |
| 73 | 58 | |
| 74 | 59 | public EmployeeConfigInfo(Object id, Object xlid, Object xlname, Object jsyid, Object spyid) { |
| ... | ... | @@ -156,36 +141,4 @@ public class EmployeeConfigInfo { |
| 156 | 141 | public void setIsCancel(Boolean isCancel) { |
| 157 | 142 | this.isCancel = isCancel; |
| 158 | 143 | } |
| 159 | - | |
| 160 | - public SysUser getCreateBy() { | |
| 161 | - return createBy; | |
| 162 | - } | |
| 163 | - | |
| 164 | - public void setCreateBy(SysUser createBy) { | |
| 165 | - this.createBy = createBy; | |
| 166 | - } | |
| 167 | - | |
| 168 | - public SysUser getUpdateBy() { | |
| 169 | - return updateBy; | |
| 170 | - } | |
| 171 | - | |
| 172 | - public void setUpdateBy(SysUser updateBy) { | |
| 173 | - this.updateBy = updateBy; | |
| 174 | - } | |
| 175 | - | |
| 176 | - public Date getCreateDate() { | |
| 177 | - return createDate; | |
| 178 | - } | |
| 179 | - | |
| 180 | - public void setCreateDate(Date createDate) { | |
| 181 | - this.createDate = createDate; | |
| 182 | - } | |
| 183 | - | |
| 184 | - public Date getUpdateDate() { | |
| 185 | - return updateDate; | |
| 186 | - } | |
| 187 | - | |
| 188 | - public void setUpdateDate(Date updateDate) { | |
| 189 | - this.updateDate = updateDate; | |
| 190 | - } | |
| 191 | 144 | } | ... | ... |
src/main/java/com/bsth/entity/sys/SysUser.java
| 1 | 1 | package com.bsth.entity.sys; |
| 2 | 2 | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| 4 | + | |
| 5 | +import javax.persistence.*; | |
| 3 | 6 | import java.util.Date; |
| 4 | 7 | import java.util.LinkedHashSet; |
| 5 | 8 | import java.util.Set; |
| 6 | 9 | |
| 7 | -import javax.persistence.Column; | |
| 8 | -import javax.persistence.Entity; | |
| 9 | -import javax.persistence.FetchType; | |
| 10 | -import javax.persistence.GeneratedValue; | |
| 11 | -import javax.persistence.GenerationType; | |
| 12 | -import javax.persistence.Id; | |
| 13 | -import javax.persistence.ManyToMany; | |
| 14 | -import javax.persistence.Table; | |
| 15 | - | |
| 16 | 10 | @Entity |
| 17 | 11 | @Table(name = "bsth_c_sys_user") |
| 12 | +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) | |
| 18 | 13 | public class SysUser { |
| 19 | 14 | |
| 20 | 15 | @Id | ... | ... |
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
| ... | ... | @@ -83,7 +83,9 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn |
| 83 | 83 | Map<String, Object> param = new HashMap<>(); |
| 84 | 84 | if (employeeConfigInfo.getIsCancel()) { |
| 85 | 85 | validate_jsy(employeeConfigInfo); |
| 86 | - validate_spy(employeeConfigInfo); | |
| 86 | + if (employeeConfigInfo.getSpy() != null) { | |
| 87 | + validate_spy(employeeConfigInfo); | |
| 88 | + } | |
| 87 | 89 | employeeConfigInfo.setIsCancel(false); |
| 88 | 90 | } else { |
| 89 | 91 | param.clear(); | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
| ... | ... | @@ -17,15 +17,18 @@ |
| 17 | 17 | <td></td> |
| 18 | 18 | <td> |
| 19 | 19 | <div> |
| 20 | - <sa-Select3 model="ctrl.searchCondition()" | |
| 21 | - name="xl" | |
| 22 | - placeholder="请输拼音..." | |
| 23 | - dcvalue="{{ctrl.searchCondition()['xl.lineCode_eq']}}" | |
| 20 | + <sa-Select5 name="xl" | |
| 21 | + model="ctrl.searchCondition()" | |
| 22 | + cmaps="{'xl.lineCode_eq' : 'lineCode'}" | |
| 24 | 23 | dcname="xl.lineCode_eq" |
| 25 | 24 | icname="lineCode" |
| 26 | - icnames="name" | |
| 27 | - datatype="xl"> | |
| 28 | - </sa-Select3> | |
| 25 | + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" | |
| 26 | + iterobjname="item" | |
| 27 | + iterobjexp="item.name" | |
| 28 | + searchph="请输拼音..." | |
| 29 | + searchexp="this.name" | |
| 30 | + required > | |
| 31 | + </sa-Select5> | |
| 29 | 32 | </div> |
| 30 | 33 | </td> |
| 31 | 34 | <td> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
| ... | ... | @@ -169,8 +169,8 @@ angular.module('ScheduleApp').controller( |
| 169 | 169 | }; |
| 170 | 170 | self.toggleBusConfig = function(id) { |
| 171 | 171 | BusConfig.delete({id: id}, function(result) { |
| 172 | - if (result.message) { // 暂时这样做,之后全局拦截 | |
| 173 | - alert("失败:" + result.message); | |
| 172 | + if (result.msg) { // 暂时这样做,之后全局拦截 | |
| 173 | + alert("失败:" + result.msg); | |
| 174 | 174 | } else { |
| 175 | 175 | self.doPage(); |
| 176 | 176 | } |
| ... | ... | @@ -222,9 +222,17 @@ angular.module('ScheduleApp').controller( |
| 222 | 222 | |
| 223 | 223 | // 提交方法 |
| 224 | 224 | self.submit = function() { |
| 225 | - self.busConfigForSave.$save(function() { | |
| 226 | - $state.go("busConfig"); | |
| 227 | - }); | |
| 225 | + if (id) { | |
| 226 | + // 更新 | |
| 227 | + self.busConfigForSave.$save({id: id}, function() { | |
| 228 | + $state.go("busConfig"); | |
| 229 | + }); | |
| 230 | + } else { | |
| 231 | + // 保存 | |
| 232 | + self.busConfigForSave.$save(function() { | |
| 233 | + $state.go("busConfig"); | |
| 234 | + }); | |
| 235 | + } | |
| 228 | 236 | }; |
| 229 | 237 | }]); |
| 230 | 238 | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/edit.html
| ... | ... | @@ -121,8 +121,8 @@ |
| 121 | 121 | </sa-Select5> |
| 122 | 122 | <input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id" |
| 123 | 123 | remote-Validation |
| 124 | - remotevtype="ec_jsy" | |
| 125 | - remotevparam="{{ {'id_eq': ctrl.employeeConfigForSave.id, 'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}" | |
| 124 | + remotevtype="ec_spy" | |
| 125 | + remotevparam="{{ {'id_eq': ctrl.employeeConfigForSave.id, 'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'spy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}" | |
| 126 | 126 | /> |
| 127 | 127 | </div> |
| 128 | 128 | <!-- 隐藏块,显示验证信息 --> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
| ... | ... | @@ -18,17 +18,18 @@ |
| 18 | 18 | <td></td> |
| 19 | 19 | <td> |
| 20 | 20 | <div> |
| 21 | - <sa-Select3 model="ctrl.searchCondition()" | |
| 22 | - name="xl" | |
| 23 | - placeholder="请输拼音..." | |
| 24 | - dcvalue="{{ctrl.searchCondition()['xl.lineCode_eq']}}" | |
| 21 | + <sa-Select5 name="xl" | |
| 22 | + model="ctrl.searchCondition()" | |
| 23 | + cmaps="{'xl.lineCode_eq' : 'lineCode'}" | |
| 25 | 24 | dcname="xl.lineCode_eq" |
| 26 | 25 | icname="lineCode" |
| 27 | - dcname2="xl.company_eq" | |
| 28 | - icname2="company" | |
| 29 | - icnames="name" | |
| 30 | - datatype="xl"> | |
| 31 | - </sa-Select3> | |
| 26 | + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" | |
| 27 | + iterobjname="item" | |
| 28 | + iterobjexp="item.name" | |
| 29 | + searchph="请输拼音..." | |
| 30 | + searchexp="this.name" | |
| 31 | + required > | |
| 32 | + </sa-Select5> | |
| 32 | 33 | </div> |
| 33 | 34 | </td> |
| 34 | 35 | <td></td> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/module.js
| ... | ... | @@ -170,8 +170,8 @@ angular.module('ScheduleApp').controller( |
| 170 | 170 | |
| 171 | 171 | self.toggleEmpConfig = function(id) { |
| 172 | 172 | EmpConfig.delete({id: id}, function(result) { |
| 173 | - if (result.message) { // 暂时这样做,之后全局拦截 | |
| 174 | - alert("失败:" + result.message); | |
| 173 | + if (result.msg) { // 暂时这样做,之后全局拦截 | |
| 174 | + alert("失败:" + result.msg); | |
| 175 | 175 | } else { |
| 176 | 176 | self.doPage(); |
| 177 | 177 | } |
| ... | ... | @@ -220,9 +220,17 @@ angular.module('ScheduleApp').controller( |
| 220 | 220 | self.employeeConfigForSave.spy = null; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - self.employeeConfigForSave.$save(function() { | |
| 224 | - $state.go("employeeConfig"); | |
| 225 | - }); | |
| 223 | + if (id) { | |
| 224 | + // 更新 | |
| 225 | + self.employeeConfigForSave.$save({id: id}, function() { | |
| 226 | + $state.go("employeeConfig"); | |
| 227 | + }); | |
| 228 | + } else { | |
| 229 | + // 保存 | |
| 230 | + self.employeeConfigForSave.$save(function() { | |
| 231 | + $state.go("employeeConfig"); | |
| 232 | + }); | |
| 233 | + } | |
| 226 | 234 | }; |
| 227 | 235 | }]); |
| 228 | 236 | ... | ... |