168 lines
5.7 KiB
JavaScript
168 lines
5.7 KiB
JavaScript
/*!
|
||
* 版 本 1.0
|
||
* Copyright (c) 2014-2019
|
||
* 创建人:phq
|
||
* 日 期:2019/10/15 9:28
|
||
* 描 述:通知中心
|
||
*/
|
||
|
||
var INFORMTYPE_ORDINARY = 1;//普通通知
|
||
var INFORMTYPE_system = 2;//系统通知
|
||
var INFORMTYPE;//通知类型
|
||
|
||
$(function () {
|
||
commHelper.getAjax("/api/supervision/taskinfo/inform/num", {}, function (res) {
|
||
if (res.data.informNum == 0) {
|
||
$("#informNum").css("display", "none");
|
||
} else {
|
||
$("#informNum").text(res.data.informNum);
|
||
$("#informNum").css("display", "block");
|
||
}
|
||
if (res.data.sysinformNum == 0) {
|
||
$("#sysinformNum").css("display", "none");
|
||
} else {
|
||
$("#sysinformNum").text(res.data.sysinformNum);
|
||
$("#sysinformNum").css("display", "block");
|
||
}
|
||
if (res.data.informAllNum == 0) {
|
||
top.$("#informAllNum").css("display", "none");
|
||
} else {
|
||
top.$("#informAllNum").text(res.data.informAllNum);
|
||
top.$("#informAllNum").css("display", "block");
|
||
}
|
||
});
|
||
$("#informNum").next().trigger("click");
|
||
});
|
||
|
||
//region 表格渲染
|
||
function createGrid(informType) {
|
||
grid = $("#maingrid").datagrid({
|
||
url: commHelper.getRequestPartUrl() + '/api/supervision/taskinfo/inform/page',
|
||
queryParams: {
|
||
informType: informType
|
||
},
|
||
method: "get",
|
||
rownumbers: true,
|
||
fitColumns: true,
|
||
fit: true,
|
||
singleSelect: true,
|
||
columns: [[
|
||
{
|
||
field: 'title', title: '标题', width: 100,
|
||
formatter: function (value, row, index) {
|
||
if (row.taskType == 1) {
|
||
if (row.isRead) {
|
||
return "由" + row.fromDepId + "的" + row.fromUser + "发来了一条催办消息";
|
||
} else {
|
||
return "<img src='/images/main/yuan_01_14x14.png'/><span style='font-weight: 600'> 由" + row.fromDepId + "的" + row.fromUser + "发来了一条催办通知";
|
||
}
|
||
} else if (row.taskType == 3) {
|
||
if (row.isRead) {
|
||
return "由" + row.fromDepId + "的" + row.fromUser + "发来了一条进度上报消息";
|
||
} else {
|
||
return "<img src='/images/main/yuan_01_14x14.png'/><span style='font-weight: 600'> 由" + row.fromDepId + "的" + row.fromUser + "发来了一条进度上报通知";
|
||
}
|
||
} else {
|
||
if (row.isRead) {
|
||
return "由系统发来了一条需要进行事项反馈的通知";
|
||
} else {
|
||
return "<img src='/images/main/yuan_01_14x14.png'/><span style='font-weight: 600'> 由系统发来了一条需要进行事项反馈的通知";
|
||
}
|
||
}
|
||
}
|
||
},
|
||
{ field: 'addTime', title: '时间', width: 70 }
|
||
]],
|
||
onDblClickRow: function (rowIndex, rowData) {
|
||
ShowTaskInfoOnDbClick(rowData);
|
||
},
|
||
onLoadSuccess: function () {
|
||
$(this).datagrid("fixRownumber");//加载数据需要全的
|
||
},
|
||
pagination: true,
|
||
toolbar: "#toolbar"
|
||
});
|
||
}
|
||
|
||
//endregion
|
||
|
||
//region 表格行双击事件
|
||
function ShowTaskInfoOnDbClick(rowData) {
|
||
var dialogDefaultSetting = {
|
||
title: "事项详情",
|
||
draggable: true,
|
||
onClose: function () {
|
||
getNum();
|
||
}
|
||
};
|
||
var defaultOtherSetting;
|
||
if (rowData.taskType == 4) {
|
||
defaultOtherSetting = {
|
||
url: $.CombineURL("/admin/supervision/project_assist/project_assist_details.html?taskId=" + rowData.taskid + "&sourceType=true")
|
||
};
|
||
} else {
|
||
defaultOtherSetting = {
|
||
url: $.CombineURL("/admin/supervision/project_handled/project_handled_details.html?taskId=" + rowData.taskid)
|
||
};
|
||
}
|
||
|
||
commHelper.openPanelExtend(dialogDefaultSetting, defaultOtherSetting);
|
||
commHelper.postAjax("/api/supervision/taskinfo/accept/" + rowData.id, {}, function (res) {
|
||
});
|
||
}
|
||
|
||
//endregion
|
||
|
||
//region 表格刷新
|
||
function refresh() {
|
||
$("#maingrid").datagrid('reload', { informType: INFORMTYPE });
|
||
}
|
||
|
||
function refreshBindForEnter() {
|
||
if ($("#roleName").is(":focus")) {
|
||
refresh();
|
||
}
|
||
}
|
||
//endregion
|
||
|
||
//消息分类样式修改
|
||
function informTeb(obj) {
|
||
$(".switch_tabble_bottom").css("display", "none");
|
||
$(obj).parent("li").find(".switch_tabble_bottom").css("display", "block");
|
||
var informType = $(obj).attr("inform_type");
|
||
INFORMTYPE = informType;
|
||
createGrid(informType);
|
||
}
|
||
|
||
function getNum() {
|
||
refresh();
|
||
commHelper.getAjax("/api/supervision/taskinfo/inform/num", {}, function (res) {
|
||
if (res.data.informNum == 0) {
|
||
$("#informNum").css("display", "none");
|
||
} else {
|
||
$("#informNum").text(res.data.informNum);
|
||
$("#informNum").css("display", "block");
|
||
}
|
||
if (res.data.sysinformNum == 0) {
|
||
$("#sysinformNum").css("display", "none");
|
||
} else {
|
||
$("#sysinformNum").text(res.data.sysinformNum);
|
||
$("#sysinformNum").css("display", "block");
|
||
}
|
||
if (res.data.informAllNum == 0) {
|
||
top.$("#informAllNum").css("display", "none");
|
||
} else {
|
||
top.$("#informAllNum").text(res.data.informAllNum);
|
||
top.$("#informAllNum").css("display", "block");
|
||
}
|
||
})
|
||
}
|
||
|
||
//全部已读
|
||
function readAll() {
|
||
commHelper.postAjax("/api/supervision/taskinfo/readAll/" + INFORMTYPE, {}, function (res) {
|
||
if (res.flag) {
|
||
getNum();
|
||
}
|
||
})
|
||
} |