"use strict"; 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) { a.langs = l.getAllLangs(), a.lang = "zh-cn", l.setCurrentLang(a.lang); a.roleList = [];//微信配置角色列表 var f = { idx: 0, sum: 1000 }; a.changeAutoCloseIncidentHour = function(e){ var v = parseFloat(e.target.value)?parseFloat(e.target.value):0; a.myData.forEach(vv => { if(vv.keyconfig == 'autoCloseIncidentHour'){ vv.valueconfig = v > 0 ? v : ''; } }); } a.savesystem = function () { api_sysinfo.addData("systemConfiguration", { systemConfiguration: a.myData }).then(function (t) { console.log(t); t.status == 200 ? o.swal({ title: "保存成功!", type: "success", confirmButtonColor: "#007AFF" }) : o.swal({ title: "操作异常!", text: "系统异常,请稍后重试,或者联系管理员!", type: "error" }) t.status == 200 && a.refreshData("expand-right", f); }) }, a.ldloading = {}, a.refreshData = function (t, n) { a.ldloading[t.replace("-", "_")] = !0, angular.isUndefined(n) && (n = f), a.myData = []; api_sysinfo.fetchDataList("systemConfiguration", n).then(function (n) { if (n.status == 200) { var e = c.stripRestangular(n); e.list.forEach(vv => { if(vv.keyconfig == 'autoCloseIncidentHour'){ vv.valueconfig = vv.valueconfig ? parseInt(vv.valueconfig) : ''; vv.autoClose = vv.valueconfig > 0 ? 1 : 0; } }); a.myData = e.list, a.ldloading[t.replace("-", "_")] = !1 console.log(a.myData) //左边xxx,右边yyy // a.maintenance = {};//xxx // a.repairs = {};//yyy // angular.forEach(a.myData, function (v) { // if (v.id == 1) { // a.maintenance = v;;//微信运维 // } // if (v.id == 2) { // a.repairs = v;;//微信报修 // } // }) } else { console.log(n.status); } }, function () { a.ldloading[t.replace("-", "_")] = !1 }) }, a.refreshData("expand-right", f) }]);