Showing
1 changed file
with
89 additions
and
43 deletions
@@ -14,6 +14,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -14,6 +14,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
14 | exports('noticeIndex', function (data) { | 14 | exports('noticeIndex', function (data) { |
15 | var resTypeSelect = {}; //资源类型下拉框 | 15 | var resTypeSelect = {}; //资源类型下拉框 |
16 | var busIdSelect = {}; //业务类型下拉框 | 16 | var busIdSelect = {}; //业务类型下拉框 |
17 | + var userSelect = {}; //通知用户下拉框 | ||
17 | var busId = ''; | 18 | var busId = ''; |
18 | var resType = ''; | 19 | var resType = ''; |
19 | var userNames = ''; | 20 | var userNames = ''; |
@@ -25,16 +26,19 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -25,16 +26,19 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
25 | //回车搜索 | 26 | //回车搜索 |
26 | $('#notice_search_keyword').keydown(function (e) { | 27 | $('#notice_search_keyword').keydown(function (e) { |
27 | if (e.keyCode === 13) { | 28 | if (e.keyCode === 13) { |
29 | + getChartData(); | ||
28 | reloadTable(); | 30 | reloadTable(); |
29 | } | 31 | } |
30 | }); | 32 | }); |
31 | //查询按钮点击事件 | 33 | //查询按钮点击事件 |
32 | $('#noticeSearchQueryBtn').on('click',function () { | 34 | $('#noticeSearchQueryBtn').on('click',function () { |
35 | + getChartData(); | ||
33 | reloadTable(); | 36 | reloadTable(); |
34 | }) | 37 | }) |
35 | 38 | ||
36 | //发送状态 | 39 | //发送状态 |
37 | form.on('select(notice_search_isSend)', function(){ | 40 | form.on('select(notice_search_isSend)', function(){ |
41 | + getChartData(); | ||
38 | reloadTable(); | 42 | reloadTable(); |
39 | }); | 43 | }); |
40 | 44 | ||
@@ -155,39 +159,81 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -155,39 +159,81 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
155 | } | 159 | } |
156 | }); | 160 | }); |
157 | // 用户下拉框 | 161 | // 用户下拉框 |
158 | - common.userXmSelect({ | 162 | + // common.userXmSelect({ |
163 | + // el: '#notice_user_list', | ||
164 | + // name: 'users', | ||
165 | + // tips: '=接收人=', | ||
166 | + // toolbar: { | ||
167 | + // show: false | ||
168 | + // }, | ||
169 | + // radio: true, | ||
170 | + // on: function (data) { | ||
171 | + // if (data.arr && data.arr.length > 0){ | ||
172 | + // userNames = data.arr[0].username; | ||
173 | + // } else { | ||
174 | + // userNames = ''; | ||
175 | + // } | ||
176 | + // reloadTable(); | ||
177 | + // } | ||
178 | + // }); | ||
179 | + | ||
180 | + $.ajax({ | ||
181 | + url: `${common.domainName}/api-web/notice/getNoticeUsers?access_token=${accessToken}`, | ||
182 | + method: 'GET', | ||
183 | + success: function (response) { | ||
184 | + if (response && response.success){ | ||
185 | + userSelect = xmSelect.render({ | ||
159 | el: '#notice_user_list', | 186 | el: '#notice_user_list', |
160 | name: 'users', | 187 | name: 'users', |
161 | tips: '=接收人=', | 188 | tips: '=接收人=', |
162 | - toolbar: { | ||
163 | - show: false | ||
164 | - }, | 189 | + //开启搜索 |
190 | + filterable: true, | ||
165 | radio: true, | 191 | radio: true, |
192 | + clickClose: true, | ||
193 | + height: '170px', | ||
194 | + tree: { | ||
195 | + show: true, | ||
196 | + showFolderIcon: true, | ||
197 | + showLine: true, | ||
198 | + strict: false, | ||
199 | + indent: 20 | ||
200 | + }, | ||
201 | + model: { | ||
202 | + label: { | ||
203 | + type: 'text' | ||
204 | + } | ||
205 | + }, | ||
206 | + prop: { | ||
207 | + name: 'nickname', | ||
208 | + value: 'username' | ||
209 | + }, | ||
210 | + data: response.data, | ||
166 | on: function (data) { | 211 | on: function (data) { |
167 | if (data.arr && data.arr.length > 0){ | 212 | if (data.arr && data.arr.length > 0){ |
168 | userNames = data.arr[0].username; | 213 | userNames = data.arr[0].username; |
169 | } else { | 214 | } else { |
170 | userNames = ''; | 215 | userNames = ''; |
171 | } | 216 | } |
217 | + getChartData(); | ||
172 | reloadTable(); | 218 | reloadTable(); |
173 | } | 219 | } |
174 | }); | 220 | }); |
221 | + }else{ | ||
222 | + layer.msg('获取资源类型失败', {icon: 2}); | ||
223 | + } | ||
224 | + if(userSelect){ | ||
225 | + //追加样式 | ||
226 | + $('#notice_user_list').find('.xm-body').eq(0).css("width","230px"); | ||
227 | + } | ||
228 | + } | ||
229 | + }); | ||
175 | 230 | ||
176 | //绑定业务下拉选择数据 | 231 | //绑定业务下拉选择数据 |
177 | admin.req({ | 232 | admin.req({ |
178 | - url: domainName + '/api-web/home/business/findAllBusType', | 233 | + url: domainName + '/api-web/notice/getNoticeBusTypes', |
179 | success: function (response) { | 234 | success: function (response) { |
180 | if (response && response.success) { | 235 | if (response && response.success) { |
181 | var busTypeList = response.data; | 236 | var busTypeList = response.data; |
182 | - var bizList = response.data.map(item => { | ||
183 | - return { | ||
184 | - name: item.busTypeName, | ||
185 | - value: item.busId, | ||
186 | - parentId: item.parentId | ||
187 | - } | ||
188 | - }); | ||
189 | - var bizTree=common.pidToChildren(bizList, 'value', 'parentId'); | ||
190 | - | ||
191 | // 影响业务下拉框 | 237 | // 影响业务下拉框 |
192 | busIdSelect = xmSelect.render({ | 238 | busIdSelect = xmSelect.render({ |
193 | el: '#notice_search_busId', | 239 | el: '#notice_search_busId', |
@@ -197,11 +243,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -197,11 +243,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
197 | filterable: true, | 243 | filterable: true, |
198 | radio: true, | 244 | radio: true, |
199 | clickClose: true, | 245 | clickClose: true, |
200 | - toolbar: { | ||
201 | - show: true, | ||
202 | - list: ['ALL', 'REVERSE', 'CLEAR'] | ||
203 | - }, | ||
204 | - height: 'auto', | 246 | + height: '170px', |
205 | tree: { | 247 | tree: { |
206 | show: true, | 248 | show: true, |
207 | showFolderIcon: true, | 249 | showFolderIcon: true, |
@@ -214,14 +256,18 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -214,14 +256,18 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
214 | type: 'text' | 256 | type: 'text' |
215 | } | 257 | } |
216 | }, | 258 | }, |
217 | - height: 'auto', | ||
218 | - data: bizTree, | 259 | + prop: { |
260 | + name: 'busTypeName', | ||
261 | + value: 'busId' | ||
262 | + }, | ||
263 | + data: busTypeList, | ||
219 | on: function (data) { | 264 | on: function (data) { |
220 | if (data.isAdd){ | 265 | if (data.isAdd){ |
221 | - busId = data.arr[0].value; | 266 | + busId = data.arr[0].busId; |
222 | } else { | 267 | } else { |
223 | busId = ''; | 268 | busId = ''; |
224 | } | 269 | } |
270 | + getChartData(); | ||
225 | reloadTable(); | 271 | reloadTable(); |
226 | } | 272 | } |
227 | }); | 273 | }); |
@@ -238,18 +284,12 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -238,18 +284,12 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
238 | } | 284 | } |
239 | }); | 285 | }); |
240 | $.ajax({ | 286 | $.ajax({ |
241 | - url: `${common.domainName}/api-web/manage/restype/list?access_token=${accessToken}`, | 287 | + url: `${common.domainName}/api-web/notice/getNoticeResTypes?access_token=${accessToken}`, |
242 | method: 'GET', | 288 | method: 'GET', |
243 | success: function (res) { | 289 | success: function (res) { |
244 | // 资源类型下拉框 | 290 | // 资源类型下拉框 |
245 | - var resTypeList = res.data.map(item => { | ||
246 | - return { | ||
247 | - name: item.resTypeName, | ||
248 | - value: item.resTypeCode, | ||
249 | - parentId: item.parentId | ||
250 | - } | ||
251 | - }); | ||
252 | - var resTypeTree = common.pidToChildren(resTypeList, "value", "parentId"); | 291 | + if (res && res.success){ |
292 | + var resTypeList = res.data; | ||
253 | resTypeSelect = xmSelect.render({ | 293 | resTypeSelect = xmSelect.render({ |
254 | el: '#notice_search_resType', | 294 | el: '#notice_search_resType', |
255 | name: "resType", | 295 | name: "resType", |
@@ -257,9 +297,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -257,9 +297,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
257 | filterable: true, | 297 | filterable: true, |
258 | radio: true, | 298 | radio: true, |
259 | clickClose: true, | 299 | clickClose: true, |
260 | - toolbar: { | ||
261 | - show: true, | ||
262 | - list: ['ALL', 'REVERSE', 'CLEAR'] | 300 | + prop: { |
301 | + name: 'resTypeName', | ||
302 | + value: 'resTypeCode' | ||
263 | }, | 303 | }, |
264 | tree: { | 304 | tree: { |
265 | show: true, | 305 | show: true, |
@@ -273,14 +313,15 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -273,14 +313,15 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
273 | type: 'text' | 313 | type: 'text' |
274 | } | 314 | } |
275 | }, | 315 | }, |
276 | - height: 'auto', | ||
277 | - data: resTypeTree, | 316 | + height: '170px', |
317 | + data: resTypeList, | ||
278 | on: function (data) { | 318 | on: function (data) { |
279 | if (data.isAdd){ | 319 | if (data.isAdd){ |
280 | - resType = data.arr[0].value; | 320 | + resType = data.arr[0].resTypeCode; |
281 | } else { | 321 | } else { |
282 | resType = ''; | 322 | resType = ''; |
283 | } | 323 | } |
324 | + getChartData(); | ||
284 | reloadTable(); | 325 | reloadTable(); |
285 | } | 326 | } |
286 | }); | 327 | }); |
@@ -288,6 +329,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -288,6 +329,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
288 | //追加样式 | 329 | //追加样式 |
289 | $('#notice_search_resType').find('.xm-body').eq(0).css("width","230px"); | 330 | $('#notice_search_resType').find('.xm-body').eq(0).css("width","230px"); |
290 | } | 331 | } |
332 | + }else{ | ||
333 | + layer.msg('获取资源类型失败', {icon: 2}); | ||
334 | + } | ||
335 | + | ||
291 | } | 336 | } |
292 | }); | 337 | }); |
293 | 338 | ||
@@ -300,7 +345,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -300,7 +345,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
300 | busId: busId, | 345 | busId: busId, |
301 | resType: resType, | 346 | resType: resType, |
302 | isSend: $('#notice_search_isSend').val(), | 347 | isSend: $('#notice_search_isSend').val(), |
303 | - usernames:userNames | 348 | + usernames:userNames, |
349 | + page: 1 | ||
304 | } | 350 | } |
305 | }); | 351 | }); |
306 | } | 352 | } |
@@ -394,10 +440,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -394,10 +440,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
394 | function getChartData() { | 440 | function getChartData() { |
395 | var where = { | 441 | var where = { |
396 | access_token:accessToken, | 442 | access_token:accessToken, |
397 | - // keyword: $('#notice_search_keyword').val(), | ||
398 | - // busId: busId, | ||
399 | - // resType: resType, | ||
400 | - // isSend: $('#notice_search_isSend').val() | 443 | + keyword: $('#notice_search_keyword').val(), |
444 | + busId: busId, | ||
445 | + resType: resType, | ||
446 | + isSend: $('#notice_search_isSend').val() | ||
401 | }; | 447 | }; |
402 | var typeName = new Map(); | 448 | var typeName = new Map(); |
403 | typeName.set("10","告警通知"); | 449 | typeName.set("10","告警通知"); |
@@ -421,8 +467,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -421,8 +467,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
421 | xData.push(typeName.get(v)) | 467 | xData.push(typeName.get(v)) |
422 | }) | 468 | }) |
423 | yData = res.map.countList; | 469 | yData = res.map.countList; |
424 | - loadNoticeChart(noticeTypeChart,xData,yData) | ||
425 | } | 470 | } |
471 | + loadNoticeChart(noticeTypeChart,xData,yData) | ||
426 | } | 472 | } |
427 | }) | 473 | }) |
428 | $.ajax({ | 474 | $.ajax({ |
-
Please register or login to post a comment