Authored by 张凯

杭州-优化通知查询页面

... ... @@ -14,6 +14,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
exports('noticeIndex', function (data) {
var resTypeSelect = {}; //资源类型下拉框
var busIdSelect = {}; //业务类型下拉框
var userSelect = {}; //通知用户下拉框
var busId = '';
var resType = '';
var userNames = '';
... ... @@ -25,16 +26,19 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
//回车搜索
$('#notice_search_keyword').keydown(function (e) {
if (e.keyCode === 13) {
getChartData();
reloadTable();
}
});
//查询按钮点击事件
$('#noticeSearchQueryBtn').on('click',function () {
getChartData();
reloadTable();
})
//发送状态
form.on('select(notice_search_isSend)', function(){
getChartData();
reloadTable();
});
... ... @@ -155,39 +159,81 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
}
});
// 用户下拉框
common.userXmSelect({
el: '#notice_user_list',
name: 'users',
tips: '=接收人=',
toolbar: {
show: false
},
radio: true,
on: function (data) {
if (data.arr && data.arr.length > 0){
userNames = data.arr[0].username;
} else {
userNames = '';
// common.userXmSelect({
// el: '#notice_user_list',
// name: 'users',
// tips: '=接收人=',
// toolbar: {
// show: false
// },
// radio: true,
// on: function (data) {
// if (data.arr && data.arr.length > 0){
// userNames = data.arr[0].username;
// } else {
// userNames = '';
// }
// reloadTable();
// }
// });
$.ajax({
url: `${common.domainName}/api-web/notice/getNoticeUsers?access_token=${accessToken}`,
method: 'GET',
success: function (response) {
if (response && response.success){
userSelect = xmSelect.render({
el: '#notice_user_list',
name: 'users',
tips: '=接收人=',
//开启搜索
filterable: true,
radio: true,
clickClose: true,
height: '170px',
tree: {
show: true,
showFolderIcon: true,
showLine: true,
strict: false,
indent: 20
},
model: {
label: {
type: 'text'
}
},
prop: {
name: 'nickname',
value: 'username'
},
data: response.data,
on: function (data) {
if (data.arr && data.arr.length > 0){
userNames = data.arr[0].username;
} else {
userNames = '';
}
getChartData();
reloadTable();
}
});
}else{
layer.msg('获取资源类型失败', {icon: 2});
}
if(userSelect){
//追加样式
$('#notice_user_list').find('.xm-body').eq(0).css("width","230px");
}
reloadTable();
}
});
//绑定业务下拉选择数据
admin.req({
url: domainName + '/api-web/home/business/findAllBusType',
url: domainName + '/api-web/notice/getNoticeBusTypes',
success: function (response) {
if (response && response.success) {
var busTypeList = response.data;
var bizList = response.data.map(item => {
return {
name: item.busTypeName,
value: item.busId,
parentId: item.parentId
}
});
var bizTree=common.pidToChildren(bizList, 'value', 'parentId');
// 影响业务下拉框
busIdSelect = xmSelect.render({
el: '#notice_search_busId',
... ... @@ -197,11 +243,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
filterable: true,
radio: true,
clickClose: true,
toolbar: {
show: true,
list: ['ALL', 'REVERSE', 'CLEAR']
},
height: 'auto',
height: '170px',
tree: {
show: true,
showFolderIcon: true,
... ... @@ -214,14 +256,18 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
type: 'text'
}
},
height: 'auto',
data: bizTree,
prop: {
name: 'busTypeName',
value: 'busId'
},
data: busTypeList,
on: function (data) {
if (data.isAdd){
busId = data.arr[0].value;
busId = data.arr[0].busId;
} else {
busId = '';
}
getChartData();
reloadTable();
}
});
... ... @@ -238,56 +284,55 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
}
});
$.ajax({
url: `${common.domainName}/api-web/manage/restype/list?access_token=${accessToken}`,
url: `${common.domainName}/api-web/notice/getNoticeResTypes?access_token=${accessToken}`,
method: 'GET',
success: function (res) {
// 资源类型下拉框
var resTypeList = res.data.map(item => {
return {
name: item.resTypeName,
value: item.resTypeCode,
parentId: item.parentId
}
});
var resTypeTree = common.pidToChildren(resTypeList, "value", "parentId");
resTypeSelect = xmSelect.render({
el: '#notice_search_resType',
name: "resType",
tips: '=资源类型=',
filterable: true,
radio: true,
clickClose: true,
toolbar: {
show: true,
list: ['ALL', 'REVERSE', 'CLEAR']
},
tree: {
show: true,
showFolderIcon: true,
showLine: true,
strict: false,
indent: 20
},
model: {
label: {
type: 'text'
}
},
height: 'auto',
data: resTypeTree,
on: function (data) {
if (data.isAdd){
resType = data.arr[0].value;
} else {
resType = '';
if (res && res.success){
var resTypeList = res.data;
resTypeSelect = xmSelect.render({
el: '#notice_search_resType',
name: "resType",
tips: '=资源类型=',
filterable: true,
radio: true,
clickClose: true,
prop: {
name: 'resTypeName',
value: 'resTypeCode'
},
tree: {
show: true,
showFolderIcon: true,
showLine: true,
strict: false,
indent: 20
},
model: {
label: {
type: 'text'
}
},
height: '170px',
data: resTypeList,
on: function (data) {
if (data.isAdd){
resType = data.arr[0].resTypeCode;
} else {
resType = '';
}
getChartData();
reloadTable();
}
reloadTable();
});
if(busIdSelect){
//追加样式
$('#notice_search_resType').find('.xm-body').eq(0).css("width","230px");
}
});
if(busIdSelect){
//追加样式
$('#notice_search_resType').find('.xm-body').eq(0).css("width","230px");
}else{
layer.msg('获取资源类型失败', {icon: 2});
}
}
});
... ... @@ -300,7 +345,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
busId: busId,
resType: resType,
isSend: $('#notice_search_isSend').val(),
usernames:userNames
usernames:userNames,
page: 1
}
});
}
... ... @@ -394,10 +440,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
function getChartData() {
var where = {
access_token:accessToken,
// keyword: $('#notice_search_keyword').val(),
// busId: busId,
// resType: resType,
// isSend: $('#notice_search_isSend').val()
keyword: $('#notice_search_keyword').val(),
busId: busId,
resType: resType,
isSend: $('#notice_search_isSend').val()
};
var typeName = new Map();
typeName.set("10","告警通知");
... ... @@ -421,8 +467,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect'
xData.push(typeName.get(v))
})
yData = res.map.countList;
loadNoticeChart(noticeTypeChart,xData,yData)
}
loadNoticeChart(noticeTypeChart,xData,yData)
}
})
$.ajax({
... ...