Commit e3a504454b383aaff993766ffa9b06f7cef723c6

Authored by 徐烜
1 parent 878448d5

1、修正车辆信息修改报错(未设置报废字段)

2、修正人员信息新建问题(工号出现undefined)
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -248,12 +248,7 @@
248 248 <label class="col-md-2 control-label">报废号:</label>
249 249 <div class="col-md-4">
250 250 <input type="text" name="scrapCode" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode"
251   - required placeholder="请输入报废号"/>
252   - </div>
253   -
254   - <!-- 隐藏块,显示验证信息 -->
255   - <div class="alert alert-danger well-sm" ng-show="myForm.scrapCode.$error.required">
256   - 报废号必须填写
  251 + placeholder="请输入报废号"/>
257 252 </div>
258 253 </div>
259 254  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
... ... @@ -361,8 +361,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
361 361 '$stateParams',
362 362 '$state',
363 363 'DataStore',
364   - '$scope',
365   - function(service, $stateParams, $state, DataStore, $scope) {
  364 + function(service, $stateParams, $state, DataStore) {
366 365 var self = this;
367 366 var Cars = service.getQueryClass();
368 367  
... ... @@ -388,13 +387,11 @@ angular.module(&#39;ScheduleApp&#39;).controller(
388 387  
389 388 // 获取传过来的id,有的话就是修改,获取一遍数据
390 389 var id = $stateParams.id;
391   - var _equipmentCode_temp;
392 390 if (id) {
393 391 self.busInfoForSave = Cars.get({id: id}, function(obj) {
394 392 if (!obj.scrapState) { // 防止null值
395 393 obj.scrapState = false;
396 394 }
397   - _equipmentCode_temp = obj.equipmentCode;
398 395 });
399 396 } else {
400 397 self.busInfoForSave.scrapState = false;
... ... @@ -402,13 +399,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
402 399  
403 400 // 提交方法
404 401 self.submit = function() {
405   - console.log(self.busInfoForSave);
406   -
407   - // 报废的车辆,修改原来的车辆终端号
408   - if (self.busInfoForSave.scrapState) {
409   - self.busInfoForSave.equipmentCode = "BF-" + _equipmentCode_temp;
410   - }
411   -
  402 + // console.log(self.busInfoForSave);
412 403  
413 404 // 保存或者更新
414 405 self.busInfoForSave.$save(function() {
... ... @@ -417,16 +408,6 @@ angular.module(&#39;ScheduleApp&#39;).controller(
417 408 });
418 409 };
419 410  
420   - $scope.$watch(
421   - function() {
422   - return self.busInfoForSave.scrapState;
423   - },
424   - function(n) {
425   - if (!n) {
426   - self.busInfoForSave.scrapCode = "BF-" + _equipmentCode_temp;
427   - }
428   - }
429   - );
430 411 }
431 412 ]
432 413 );
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js
... ... @@ -34,7 +34,8 @@ angular.module(&#39;ScheduleApp&#39;).factory(
34 34 {name: "personnelType", desc: "性别"},
35 35 {name: "company", desc: "所在公司"},
36 36 {name: "brancheCompany", desc: "分公司"},
37   - {name: "posts", desc: "工种"}
  37 + {name: "posts", desc: "工种"},
  38 + {name: "updateDate", desc: "更新时间"}
38 39 ];
39 40 // 排序字段
40 41 var orderColumns = {
... ... @@ -383,6 +384,10 @@ angular.module(&#39;ScheduleApp&#39;).controller(
383 384 }
384 385 delete self.employeeInfoForSave.destroy_temp;
385 386  
  387 + // 重新设置一下jobCodeori, $watch有时候会失效
  388 + self.employeeInfoForSave.jobCode =
  389 + self.employeeInfoForSave.companyCode + "-" + self.employeeInfoForSave.jobCodeori;
  390 +
386 391 console.log(self.employeeInfoForSave);
387 392  
388 393 // 保存或更新
... ... @@ -394,11 +399,15 @@ angular.module(&#39;ScheduleApp&#39;).controller(
394 399  
395 400 $scope.$watch(
396 401 function() {
397   - return self.employeeInfoForSave.jobCodeori;
  402 + return self.employeeInfoForSave;
398 403 },
399   - function(n, o) {
400   - // 员工编号=公司编码_工号
401   - self.employeeInfoForSave.jobCode = self.employeeInfoForSave.companyCode + "-" + n;
  404 + function(newValue) {
  405 + var _companyCode = newValue["companyCode"];
  406 + var _jobCodeori = newValue["jobCodeori"];
  407 + if (_companyCode && _jobCodeori) {
  408 + // 员工编号=公司编码_工号
  409 + self.employeeInfoForSave.jobCode = _companyCode + "-" + _jobCodeori;
  410 + }
402 411 },
403 412 true
404 413 );
... ...