"use strict"; app.controller("wxconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "$window", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_sysinfo", "api_wechat_operate", "api_wx_role", function (t, a, n, e, i, s, r, o, l, u, d, c, g, api_wechat_operate, api_wx_role) { a.langs = l.getAllLangs(), a.lang = "zh-cn", l.setCurrentLang(a.lang); a.roleList = [];//微信配置角色列表 var f = { idx: 0, sum: 10 }; a.savesystem = function (t) { var dataObj = {}; if (a.maintenance.autoCreateUser == 1) {//自动创建 dataObj = { "wechatConfig": [ { "id": 1, "autoCreateUser": a.maintenance.autoCreateUser, "wechatUserRole": a.maintenance.wechatUserRole, "autoCreateRequester": a.maintenance.autoCreateRequester, "reqBind": a.maintenance.reqBind, "userBind": a.maintenance.userBind } // , // { // "id": 2, // "autoCreateUser": a.repairs.autoCreateUser // } ] }; } else { dataObj = { "wechatConfig": [ { "id": 1, "autoCreateUser": a.maintenance.autoCreateUser, "autoCreateRequester": a.maintenance.autoCreateRequester, "reqBind": a.maintenance.reqBind, "userBind": a.maintenance.userBind } // , // { // "id": 2, // "autoCreateUser": a.repairs.autoCreateUser // } ] }; } api_wechat_operate.postWxList(dataObj).then(function (t) { console.log(t); t.status == 200 ? o.swal({ title: "保存成功!", type: "success", confirmButtonColor: "#007AFF" }) : o.swal({ title: "操作异常!", text: "系统异常,请稍后重试,或者联系管理员!", type: "error" }) }) }, a.ldloading = {}, a.refreshData = function (t, n) { a.ldloading[t.replace("-", "_")] = !0, angular.isUndefined(n) && (n = f), a.myData = []; api_wechat_operate.getWechatList(n).then(function (n) { if (n.status == 200) { var e = c.stripRestangular(n); a.myData = e.list, a.ldloading[t.replace("-", "_")] = !1 console.log(a.myData) //左边微信运维,右边微信报修 a.maintenance = {};//微信运维 a.repairs = {};//微信报修 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 }) //获取微信角色列表 api_wx_role.getWxRole({ "idx": 0, "sum": 1000 }) .then(res => { if (res.status == 200) { a.roleList = res.list; } }) .catch(err => { console.log(err) }) }, a.refreshData("expand-right", f) }]);