EditController.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. var app = angular.module('app',['baseServices','PwdStrategyService','commonListService','arrayToolService']);
  2. app.controller("EditController",['$scope','BaseService','PwdStrategy','CommonListService','ArrayToolService',function($scope,BaseService,PwdStrategy,CommonListService,ArrayToolService){
  3. $scope.CommonList=CommonListService;
  4. $scope.ArrayTool=ArrayToolService;
  5. $scope.prop={};//prop 等于一个数据源初始化
  6. $scope.prop.forceChangeInitPwd=1;
  7. $scope.prop.pwdRule=1;
  8. $scope.prop.pwdLength=6;
  9. $scope.prop.validity=3;
  10. $scope.prop.handleOverdue=0;
  11. $scope.prop.overdueRemind=0;
  12. $scope.prop.verifyCodeAppear=0;
  13. $scope.prop.errLockAccount=0;
  14. $scope.prop.enable=1;
  15. //初始化数据
  16. if(id!=""){
  17. PwdStrategy.ngjs({action:"getById",id:id},function(data){
  18. $scope.prop=data;
  19. });
  20. }
  21. //保存
  22. $scope.save=function(){
  23. var frm=$('#frmSubmit').form({rules:com.hotent.form.rule.CustomRules});
  24. if(!frm.valid()) return;
  25. PwdStrategy.save($scope.prop,function(data){
  26. if(data.result==1){
  27. $.ligerDialog.confirm(data.message+",是否继续操作", "提示信息",
  28. function(rtn) {
  29. if (rtn) {
  30. window.location.reload();
  31. } else {
  32. window.location.href="list.ht";
  33. }
  34. });
  35. }else{
  36. $.ligerDialog.err("提示信息","保存失败",data.message);
  37. }
  38. });
  39. }
  40. }]);