ImportEditCtrl.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. angular.module('push')
  2. .controller('ImportEditCtrl', function ($scope,MyCollectionService,$ionicPopup,$ionicModal,$stateParams,CommonService,UserService){
  3. $scope.params=JSON.parse($stateParams.listparams)
  4. $scope.params.params.nodeId=localStorage.node
  5. $scope.params.params.uid=localStorage.uid
  6. // console.log($scope.params.params)
  7. $scope.tashow=["id","reqId","errorRemark","errorMsg"]
  8. $scope.sss=/1[3|4|5|7|8|9][0-9]{9}/
  9. MyCollectionService.postentrydetail( $scope.params.params).then(function (res) {
  10. // console.log(res)
  11. if(res.code==3350){
  12. $scope.tadata=res.data
  13. // console.log( $scope.tadata)
  14. }else {
  15. $ionicPopup.alert({
  16. title: '提示',
  17. template: res.message
  18. });
  19. }
  20. })
  21. //返回
  22. $scope.goback=function(){
  23. $scope.go('Import',{listparams:$scope.params.params.fileType});
  24. }
  25. //保存
  26. $scope.saveCompanyInfo=function () {
  27. // console.log(JSON.parse(JSON.stringify($scope.tadata)))
  28. var deal=JSON.parse(JSON.stringify($scope.tadata))
  29. deal.splice(0,1)
  30. var params= {
  31. basicInfos:deal,
  32. nodeId:UserService.node
  33. }
  34. // console.log(params)
  35. var urlparams=['entry/edit/basic',
  36. 'entry/edit/tax',
  37. 'entry/edit/patent',
  38. 'entry/edit/college/univers/res',
  39. 'entry/edit/financial',
  40. 'entry/edit/personnel',
  41. 'entry/edit/expert',
  42. 'entry/edit/policy']
  43. // console.log(urlparams[$scope.params.params.fileType-1])
  44. MyCollectionService.postentryEdit(urlparams[$scope.params.params.fileType-1],params).then(function (res) {
  45. // console.log(res)
  46. if(res.code==3350){
  47. CommonService.showMessage(res.message, $scope);
  48. setTimeout( function () {
  49. $scope.go('Import',{listparams:$scope.params.params.fileType});
  50. },1000)
  51. }else {
  52. $ionicPopup.alert({
  53. title: '提示',
  54. template: res.message
  55. });
  56. }
  57. })
  58. }
  59. })