values.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. myApp.controller("values", ["$scope", "$http", "NgTableParams", function ($scope, $http, NgTableParams) {
  2. UEDITOR_CONFIG.autoHeightEnabled=false;
  3. window.hub.stop();
  4. var self = this;
  5. self.data = {};
  6. this.load = function() {
  7. $http.get("/values/list").then(function(res) {
  8. self.tableParams = new NgTableParams({}, {
  9. filterDelay: 0,
  10. dataset:res.data.Data
  11. });
  12. });
  13. }
  14. self.load();
  15. $scope.closeAll = function() {
  16. layer.closeAll();
  17. setTimeout(function() {
  18. $("#modal").css("display", "none");
  19. }, 500);
  20. }
  21. $scope.submit = function (values) {
  22. $scope.request("/values", values, function (data) {
  23. swal(data.Message, null, 'info');
  24. $scope.values = {};
  25. $scope.closeAll();
  26. self.load();
  27. });
  28. }
  29. self.edit = function (row) {
  30. layer.open({
  31. type: 1,
  32. zIndex: 20,
  33. title: '修改变量',
  34. area: (window.screen.width > 800 ? 800 : window.screen.width) + 'px',
  35. content: $("#modal"),
  36. success: function(layero, index) {
  37. $scope.values = row;
  38. },
  39. end: function() {
  40. $("#modal").css("display", "none");
  41. }
  42. });
  43. }
  44. self.add = function() {
  45. layer.open({
  46. type: 1,
  47. zIndex: 20,
  48. title: '添加变量',
  49. area: (window.screen.width > 800 ? 800 : window.screen.width) + 'px',
  50. content: $("#modal"),
  51. success: function(layero, index) {
  52. $scope.values = {};
  53. },
  54. end: function() {
  55. $("#modal").css("display", "none");
  56. }
  57. });
  58. }
  59. }]);