|
@@ -1,5 +1,5 @@
|
1
|
1
|
"use strict";
|
2
|
|
-app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "$window", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_sysinfo", "api_is_category", function (t, a, n, e, i, s, r, o, l, u, d, c, g, api_is_category) {
|
|
2
|
+app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "$window", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_sysinfo", "api_is_category", "api_wx_role", function (t, a, n, e, i, s, r, o, l, u, d, c, g, api_is_category, api_wx_role) {
|
3
|
3
|
a.langs = l.getAllLangs(), a.lang = "zh-cn", l.setCurrentLang(a.lang);
|
4
|
4
|
var f = (t.user, r._, {
|
5
|
5
|
idx: 0,
|
|
@@ -10,6 +10,21 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
10
|
10
|
var v = parseFloat(e.target.value)?parseFloat(e.target.value):0;
|
11
|
11
|
a.autoCloseIncidentHour.valueconfig = v > 0 ? v : 0;
|
12
|
12
|
}
|
|
13
|
+ // 获取角色
|
|
14
|
+ a.roleList = [];
|
|
15
|
+ a.getRoleList = function(integralRole){
|
|
16
|
+ api_wx_role.getWxRole({ "idx": 0, "sum": 1000 }).then(function (data) {
|
|
17
|
+ a.roleList = data.list || [];
|
|
18
|
+ angular.forEach(a.myData, function (v, i) {
|
|
19
|
+ if (v.keyconfig == 'integralRole') {
|
|
20
|
+ a.integralRole.valueconfig = a.roleList.filter(function (vv) {
|
|
21
|
+ return v.valueconfig.indexOf(vv.id) > -1;
|
|
22
|
+ });
|
|
23
|
+ console.log(a.integralRole.valueconfig)
|
|
24
|
+ }
|
|
25
|
+ })
|
|
26
|
+ });
|
|
27
|
+ }
|
13
|
28
|
//保存
|
14
|
29
|
a.savesystem = function () {
|
15
|
30
|
var arr = {};
|
|
@@ -29,6 +44,18 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
29
|
44
|
arr.systemConfiguration.push(a.wxIncidentWithCmdb);//是否需要绑定资产
|
30
|
45
|
arr.systemConfiguration.push(a.ifWorking);//是否开通上下班
|
31
|
46
|
arr.systemConfiguration.push(a.integralMechanism);//积分机制
|
|
47
|
+ if(a.integralMechanism.valueconfig == 1){
|
|
48
|
+ if(Array.isArray(a.integralRole.valueconfig)){
|
|
49
|
+ var integralRole = a.myData.find(v => v.keyconfig == 'integralRole');
|
|
50
|
+ arr.systemConfiguration.push(Object.assign({}, integralRole, {valueconfig: a.integralRole.valueconfig.map(v => v.id).toString()}));//积分控制角色
|
|
51
|
+ }else{
|
|
52
|
+ arr.systemConfiguration.push(a.integralRole);//积分控制角色
|
|
53
|
+ }
|
|
54
|
+ }else{
|
|
55
|
+ var integralRole = a.myData.find(v => v.keyconfig == 'integralRole');
|
|
56
|
+ arr.systemConfiguration.push(Object.assign({}, integralRole, {valueconfig: ''}));//积分控制角色
|
|
57
|
+ a.integralRole.valueconfig = [];
|
|
58
|
+ }
|
32
|
59
|
arr.systemConfiguration.push(a.ifRoom);//是否增加房间号选择
|
33
|
60
|
arr.systemConfiguration.push(a.requesterLgoinType);//保修人登录方式
|
34
|
61
|
arr.systemConfiguration.push(a.autoCloseIncidentHour);//自动关单小时
|
|
@@ -58,6 +85,9 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
58
|
85
|
case "integralMechanism": //积分机制
|
59
|
86
|
sessionStorage.setItem("integralMechanism", v.valueconfig);
|
60
|
87
|
break;
|
|
88
|
+ case "integralRole": //积分控制角色
|
|
89
|
+ sessionStorage.setItem("integralRole", v.valueconfig);
|
|
90
|
+ break;
|
61
|
91
|
}
|
62
|
92
|
});
|
63
|
93
|
o.swal({
|
|
@@ -78,8 +108,13 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
78
|
108
|
})
|
79
|
109
|
}
|
80
|
110
|
})
|
81
|
|
- }, a.ldloading = {}, a.refreshData = function (t, n) {
|
82
|
|
- a.ldloading[t.replace("-", "_")] = !0, angular.isUndefined(n) && (n = f), a.myData = [], g.fetchDataList("systemConfiguration", n).then(function (n) {
|
|
111
|
+ };
|
|
112
|
+ a.ldloading = {};
|
|
113
|
+ a.refreshData = function (t, n) {
|
|
114
|
+ a.ldloading[t.replace("-", "_")] = !0;
|
|
115
|
+ angular.isUndefined(n) && (n = f);
|
|
116
|
+ a.myData = [];
|
|
117
|
+ g.fetchDataList("systemConfiguration", n).then(function (n) {
|
83
|
118
|
if (n.status == 200) {
|
84
|
119
|
var e = c.stripRestangular(n);
|
85
|
120
|
a.myData = e.list, a.ldloading[t.replace("-", "_")] = !1
|
|
@@ -88,6 +123,8 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
88
|
123
|
a.cacheConfig = [];//缓存配置
|
89
|
124
|
a.linkConfig = [];//链接配置
|
90
|
125
|
a.repairMain = {};//报修主体
|
|
126
|
+
|
|
127
|
+ a.integralRole = {valueconfig:[]};
|
91
|
128
|
console.log(a.myData,77777)
|
92
|
129
|
angular.forEach(a.myData, function (v, i) {
|
93
|
130
|
if (v.keyconfig == 'pwd' || v.keyconfig == 'conversationSeconds' || v.keyconfig == 'formUri' || v.keyconfig == 'localhost' || v.keyconfig == 'verificationPath' || v.keyconfig == 'docpath') {
|
|
@@ -120,6 +157,11 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
120
|
157
|
if (v.keyconfig == 'integralMechanism') {
|
121
|
158
|
a.integralMechanism = v;//积分机制
|
122
|
159
|
}
|
|
160
|
+ if (v.keyconfig == 'integralRole') {
|
|
161
|
+ // a.integralRole = v;//积分控制角色
|
|
162
|
+ console.log(v);
|
|
163
|
+ a.getRoleList(v);
|
|
164
|
+ }
|
123
|
165
|
if (v.keyconfig == 'ifRoom') {
|
124
|
166
|
a.ifRoom = v;//是否增加房间号选择
|
125
|
167
|
}
|
|
@@ -137,5 +179,6 @@ app.controller("sysconfigCtrl", ["$rootScope", "$scope", "$state", "$timeout", "
|
137
|
179
|
}, function () {
|
138
|
180
|
a.ldloading[t.replace("-", "_")] = !1
|
139
|
181
|
})
|
140
|
|
- }, a.refreshData("expand-right", f)
|
|
182
|
+ };
|
|
183
|
+ a.refreshData("expand-right", f);
|
141
|
184
|
}]);
|