ruleLibraryCtrl.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. angular.module('app.storage').controller("rulelibraryCtrl", function($scope,safeProduceNotifyService,$state, $http,$rootScope, $stateParams, APP_CONFIG) {
  3. //安全生产通告列表
  4. $scope.pageInfo = {pageNum : 1, pageSize : 10};
  5. $scope.search = {fileName:""};
  6. $scope.loadData = function() {
  7. safeProduceNotifyService.getPageInfo($scope.pageInfo.pageNum, $scope.pageInfo.pageSize,$scope.search.fileName)
  8. .then(function(data){
  9. $scope.pageInfo = data;
  10. },function(data){
  11. console.log(data);
  12. });
  13. };
  14. $scope.loadData();
  15. // 翻页
  16. $scope.goPage = function(pageNum) {
  17. $scope.pageInfo.pageNum = pageNum;
  18. $scope.loadData();
  19. };
  20. // 显示增加页面
  21. $scope.showAddNotify=function () {
  22. $state.go('app.storage.safeproduce.safeleveledit', {id:0,isNotEdit:false,topRow:$rootScope.orgInfo.orgName+"通告:\n"});
  23. };
  24. //修改编辑页面
  25. $scope.showEditNotify = function (id) {
  26. $state.go('app.storage.safeproduce.safeleveledit', {id:id,isNotEdit:false});
  27. };
  28. // 查看页面
  29. $scope.showViewNotify = function(id) {
  30. $state.go('app.storage.safeproduce.safeleveledit', {id:id,isNotEdit:true});
  31. };
  32. // 根据id删除信息
  33. $scope.removeNotify = function(id) {
  34. if (!confirm("确定要删除吗?")) {
  35. return;
  36. }
  37. safeProduceNotifyService.removeById(id).then(function (data) {
  38. if(data.status == "success"){
  39. alert("删除成功");
  40. $scope.loadData();
  41. }else{
  42. alert("删除失败");
  43. }
  44. });
  45. }
  46. });