mirror of https://gitee.com/stylefeng/guns
parent
3f30c0593a
commit
df79dd9202
@ -0,0 +1,142 @@
|
||||
layui.use(['table', 'form', 'func', 'HttpRequest', 'util'], function () {
|
||||
var $ = layui.$;
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var func = layui.func;
|
||||
var HttpRequest = layui.HttpRequest;
|
||||
var util = layui.util;
|
||||
|
||||
// 系统消息管理
|
||||
var Message = {
|
||||
tableId: "messageTable"
|
||||
};
|
||||
|
||||
// 初始化表格的列
|
||||
Message.initColumn = function () {
|
||||
return [[
|
||||
{type: 'checkbox'},
|
||||
{field: 'messageId', hide: true, title: '主键id'},
|
||||
{field: 'messageTitle', sort: true, title: '消息标题'},
|
||||
// {field: 'messageType', sort: true, title: '消息类型'},
|
||||
// {field: 'priorityLevelValue', sort: true, title: '优先级'},
|
||||
{field: 'priorityLevel', sort: true, title: '优先级', templet: function (d) {
|
||||
if (d.priorityLevel === "high") {
|
||||
return "高";
|
||||
} else if (d.priorityLevel === "middle") {
|
||||
return "中";
|
||||
} else {
|
||||
return "低";
|
||||
}
|
||||
}},
|
||||
{field: 'readFlag', sort: true, title: '阅读状态', templet: function (d) {
|
||||
if (d.readFlag === 0) {
|
||||
return "未读";
|
||||
} else {
|
||||
return "已读";
|
||||
}
|
||||
}},
|
||||
{field: 'messageSendTime', sort: true, title: '收到时间'},
|
||||
{align: 'center', toolbar: '#tableBar', title: '操作'}
|
||||
]];
|
||||
};
|
||||
|
||||
// 点击查询按钮
|
||||
Message.search = function () {
|
||||
var queryData = {};
|
||||
queryData['messageTitle'] = $("#messageTitle").val();
|
||||
//queryData['messageCode'] = $("#messageCode").val();
|
||||
table.reload(Message.tableId, {
|
||||
where: queryData,
|
||||
page: {curr: 1}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 点击查看
|
||||
*
|
||||
* @param data 点击按钮时候的行数据
|
||||
*/
|
||||
Message.openViewDlg = function (data) {
|
||||
func.open({
|
||||
title: '查看消息',
|
||||
// height: 900,
|
||||
content: Feng.ctxPath + '/view/message_view?messageId=' + data.messageId,
|
||||
tableId: Message.tableId
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 导出excel按钮
|
||||
Message.exportExcel = function () {
|
||||
var checkRows = table.checkStatus(Message.tableId);
|
||||
if (checkRows.data.length === 0) {
|
||||
Feng.error("请选择要导出的数据");
|
||||
} else {
|
||||
table.exportFile(tableResult.config.id, checkRows.data, 'xls');
|
||||
}
|
||||
};
|
||||
|
||||
// 点击删除
|
||||
Message.delete = function (data) {
|
||||
var operation = function () {
|
||||
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysMessage/delete", 'post', function (data) {
|
||||
Feng.success("删除成功!");
|
||||
table.reload(Message.tableId);
|
||||
}, function (data) {
|
||||
Feng.error("删除失败!" + data.message + "!");
|
||||
});
|
||||
httpRequest.set(data);
|
||||
httpRequest.start(true);
|
||||
};
|
||||
Feng.confirm("是否删除?", operation);
|
||||
};
|
||||
|
||||
// 标记为已读状态
|
||||
Message.allReadFlag = function () {
|
||||
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysMessage/allMessageReadFlag", 'get', function (data) {
|
||||
table.reload(Message.tableId);
|
||||
Feng.success("标记已读成功!");
|
||||
}, function (data) {
|
||||
table.reload(Message.tableId);
|
||||
Feng.error("标记已读失败!" + data.responseJSON.message);
|
||||
});
|
||||
httpRequest.start();
|
||||
};
|
||||
|
||||
// 渲染表格
|
||||
var tableResult = table.render({
|
||||
elem: '#' + Message.tableId,
|
||||
url: Feng.ctxPath + '/sysMessage/page',
|
||||
page: true,
|
||||
request: {pageName: 'pageNo', limitName: 'pageSize'}, //自定义分页参数
|
||||
height: "full-158",
|
||||
cellMinWidth: 100,
|
||||
cols: Message.initColumn(),
|
||||
parseData: Feng.parseData
|
||||
});
|
||||
|
||||
// 搜索按钮点击事件
|
||||
$('#btnSearch').click(function () {
|
||||
Message.search();
|
||||
});
|
||||
|
||||
// 全部已读点击事件
|
||||
$('#allReadFlag').click(function () {
|
||||
Message.allReadFlag();
|
||||
});
|
||||
|
||||
// 导出excel
|
||||
$('#btnExp').click(function () {
|
||||
Message.exportExcel();
|
||||
});
|
||||
|
||||
// 工具条点击事件
|
||||
table.on('tool(' + Message.tableId + ')', function (obj) {
|
||||
var data = obj.data;
|
||||
var event = obj.event;
|
||||
if (event === 'view') {
|
||||
Message.openViewDlg(data);
|
||||
} else if (event === 'delete') {
|
||||
Message.delete(data);
|
||||
}
|
||||
});
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
<input type="hidden" id="formOpenType_" value="${openType!}">
|
||||
<style type="text/css">
|
||||
.form-read-input{
|
||||
padding: 9px 15px;
|
||||
line-height: 1.3;
|
||||
display: block;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
border-color: #e6e6e6;
|
||||
}
|
||||
.form-read-a{
|
||||
color: #01AAED;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.form-read-a:hover{
|
||||
color: #ff0000;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="${ctxPath}/assets/modular/system/common/form.all.js?v=${constants.getReleaseVersion()}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
@ -0,0 +1,36 @@
|
||||
@layout("/layout/_container.html",{js:["/assets/modular/system/message/message_list.js"]}){
|
||||
|
||||
<div class="layui-body-header">
|
||||
<span class="layui-body-header-title">我的消息</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form toolbar">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<input id="messageTitle" class="layui-input" type="text" placeholder="消息标题"/>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button>
|
||||
<button id="allReadFlag" class="layui-btn icon-btn"><i class="layui-icon">စ</i>全部已读</button>
|
||||
<button id="btnExp" class="layui-btn icon-btn"><i class="layui-icon"></i>导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-table" id="messageTable" lay-filter="messageTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tableBar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="view">查看</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
|
||||
</script>
|
||||
|
||||
@}
|
@ -0,0 +1,52 @@
|
||||
@layout("/layout/_form.html",{js:["/assets/modular/system/message/message_view.js"]}){
|
||||
|
||||
<form class="layui-form" id="messageForm" lay-filter="messageForm">
|
||||
<div class="layui-fluid" style="padding-bottom: 75px;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">基本信息</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item layui-row">
|
||||
<input name="messageId" type="hidden"/>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">消息标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="messageTitle" name="messageTitle" placeholder="请输入消息标题" type="text" class="layui-input" lay-verify="" required viewForm="textinput"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">优先级</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="priorityLevel" name="priorityLevel" placeholder="请输入优先级" type="text" class="layui-input" lay-verify="" required viewForm="textinput"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">收到时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="messageSendTime" name="messageSendTime" placeholder="请输入收到时间" type="text" class="layui-input date-icon date-input" autocomplete="off" viewForm="textinput"/>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">阅读状态</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="readFlag" name="readFlag" placeholder="请输入阅读状态" type="text" class="layui-input" lay-verify="" required viewForm="textinput"/>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">消息内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="messageContent" name="messageContent" placeholder="请输入消息内容" type="text" class="layui-textarea" viewForm='textinput'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-center">
|
||||
<button class="layui-btn" lay-filter="btnSubmit" lay-submit viewForm="button"> 提交 </button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary" ew-event="closeDialog" id="closeBtn"> 取消 </button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@}
|
||||
@include("/modular/system/common/viewHide.html"){}
|
Loading…
Reference in new issue