incidentConfigCtrl.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. "use strict";
  2. app.controller("incidentConfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "$window", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_sysinfo", "api_sysinfo", "api_wx_role", function (t, a, n, e, i, s, r, o, l, u, d, c, g, api_sysinfo, api_wx_role) {
  3. a.langs = l.getAllLangs(), a.lang = "zh-cn", l.setCurrentLang(a.lang);
  4. a.roleList = [];//微信配置角色列表
  5. var f = {
  6. idx: 0,
  7. sum: 1000
  8. };
  9. a.changeAutoCloseIncidentHour = function(e){
  10. var v = parseFloat(e.target.value)?parseFloat(e.target.value):0;
  11. a.myData.forEach(vv => {
  12. if(vv.keyconfig == 'autoCloseIncidentHour'){
  13. vv.valueconfig = v > 0 ? v : '';
  14. }
  15. });
  16. }
  17. a.savesystem = function () {
  18. api_sysinfo.addData("systemConfiguration", { systemConfiguration: a.myData }).then(function (t) {
  19. console.log(t);
  20. t.status == 200 ? o.swal({
  21. title: "保存成功!",
  22. type: "success",
  23. confirmButtonColor: "#007AFF"
  24. }) : o.swal({
  25. title: "操作异常!",
  26. text: "系统异常,请稍后重试,或者联系管理员!",
  27. type: "error"
  28. })
  29. t.status == 200 && a.refreshData("expand-right", f);
  30. })
  31. }, a.ldloading = {}, a.refreshData = function (t, n) {
  32. a.ldloading[t.replace("-", "_")] = !0, angular.isUndefined(n) && (n = f), a.myData = [];
  33. api_sysinfo.fetchDataList("systemConfiguration", n).then(function (n) {
  34. if (n.status == 200) {
  35. var e = c.stripRestangular(n);
  36. e.list.forEach(vv => {
  37. if(vv.keyconfig == 'autoCloseIncidentHour'){
  38. vv.valueconfig = vv.valueconfig ? parseInt(vv.valueconfig) : '';
  39. vv.autoClose = vv.valueconfig > 0 ? 1 : 0;
  40. }
  41. });
  42. a.myData = e.list, a.ldloading[t.replace("-", "_")] = !1
  43. console.log(a.myData)
  44. //左边xxx,右边yyy
  45. // a.maintenance = {};//xxx
  46. // a.repairs = {};//yyy
  47. // angular.forEach(a.myData, function (v) {
  48. // if (v.id == 1) {
  49. // a.maintenance = v;;//微信运维
  50. // }
  51. // if (v.id == 2) {
  52. // a.repairs = v;;//微信报修
  53. // }
  54. // })
  55. } else {
  56. console.log(n.status);
  57. }
  58. }, function () {
  59. a.ldloading[t.replace("-", "_")] = !1
  60. })
  61. }, a.refreshData("expand-right", f)
  62. }]);