|
|
<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<title>消息中心</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
|
</head>
|
<body>
|
|
<div class="layui-fluid" id="LAY-app-message">
|
<div class="layui-card">
|
<div class="layui-tab layui-tab-brief" lay-filter="demo">
|
<ul class="layui-tab-title">
|
<li>通知<span class="layui-badge"></span></li>
|
<li>已阅</li>
|
</ul>
|
<div class="layui-tab-content">
|
|
<div class="layui-tab-item layui-show">
|
<table class="" id="mainTable" lay-filter="mainTable"></table>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../../../Scripts/webConfig.js"></script>
|
|
<script>
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index', //主入口模块
|
}).use(['tree', 'index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element
|
, laypage = layui.laypage
|
, laydate = layui.laydate
|
, util = layui.util
|
, tree = layui.tree
|
var sWhere1 = " and B.HReceiveMan='" + sessionStorage["HUserName"]+"' and B.HReadFlag='0'";
|
|
var option = {
|
elem: '#mainTable'
|
//, toolbar: '#toolbarDemo'
|
, height: 'full-120'
|
, page: true
|
, cellMinWidth: 90
|
, cols: [[
|
{ type: 'radio', fixed: 'left' }
|
, { field: 'HInterID', title: '主内码', hide: true }
|
, { field: 'HEntryID', title: '子内码', hide: true }
|
, { field: 'HContext', title: '主题' }
|
, { field: 'HDeptName', title: '发送部门' }
|
, { field: 'HSendMan', title: '发送人' }
|
, { field: 'HReceiveMan', title: '接收人' }
|
, { field: 'HLevel', title: '紧急程度' }
|
, { field: 'HDescription', title: '详细内容' }
|
, { field: 'HDate', title: '发布时间', templet: "<div>{{d.HDate ==null ?'':layui.util.toDateString(d.HDate, 'yyyy-MM-dd')}}</div>"}
|
]]
|
};
|
Load(sWhere1,0);
|
|
|
//一些事件监听
|
element.on('tab(demo)', function (data) {
|
// console.log(data.index); //得到当前Tab的所在下标
|
if (data.index == 0) {
|
console.log('通知');
|
sWhere1 = " and B.HReceiveMan='" + sessionStorage["HUserName"]+"' and B.HReadFlag='0'";
|
Load(sWhere1, data.index)
|
|
} else if (data.index == 1) {
|
console.log('已阅');
|
sWhere1 = " and B.HReceiveMan='" + sessionStorage["HUserName"]+"' and B.HReadFlag='1'";
|
Load(sWhere1, data.index)
|
}
|
});
|
|
//数据加载
|
function Load(sWhere1,flag)
|
{
|
var index = layer.load(0, { shade: false });
|
//进入页面显示的缓存列表
|
$.ajax({
|
url: GetWEBURL() + 'MsgData',
|
type: "GET",
|
data: { "sWhere": sWhere1 },
|
success: function (data1) {
|
if (data1.data.OA_InformBillMain.length == 1) {
|
if (flag == 0) {
|
$(".layui-badge").html(data1.data.OA_InformBillMain.length);
|
}
|
option.data = data1.data.OA_InformBillMain;
|
table.render(option);
|
layer.close(index);
|
} else {
|
option.data = data1.data.OA_InformBillMain;
|
table.render(option);
|
layer.close(index);
|
}
|
}, error: function () {
|
layer.close(index);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//点击表格数据
|
table.on('row(mainTable)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
var datas = obj.data; //获得当前行数据
|
console.log(datas);
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '阅读明细 ',
|
closeBtn: false,
|
shift: 2,
|
area: ['100%', '100%'],
|
maxmin: true,
|
content: 'MessageDetail.html',
|
end: function () {
|
//刷新页面,
|
location.reload();
|
},
|
success: function (dom) {
|
var a = $(dom[0]).find("iframe").eq(0).contents();
|
a.find("h1").html(datas.HContext);
|
a.find("span").html(datas.HDate);
|
a.find(".layadmin-text").html(datas.HDescription);
|
UpdateMessage(sessionStorage["HUserName"],datas.HInterID, datas.HEntryID);
|
},
|
});
|
});
|
|
//更新公告状态
|
function UpdateMessage(UserName,HInterID, HEntryID)
|
{
|
$.ajax({
|
url: GetWEBURL() + 'UpdateMessage',
|
type: "GET",
|
data: { "UserName": UserName, "HInterID": HInterID, "HEntryID": HEntryID},
|
success: function (data1) {
|
if (data1.count == 1) {
|
|
} else {
|
|
}
|
}, error: function () {
|
layer.close(index);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
});
|
</script>
|
</body>
|
</html>
|