229 lines
8.7 KiB
Plaintext
229 lines
8.7 KiB
Plaintext
@using Core.Web.WebHelper
|
||
@{
|
||
ViewBag.Title = "Index";
|
||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||
}
|
||
<div class="x-body" id="contentBody">
|
||
<div class="layui-btn-group" style="padding-bottom:10px;">
|
||
|
||
@Html.Action("ToolBar", "Home",
|
||
new {
|
||
area="",
|
||
rightcode = (ViewBag.rightCode as string),
|
||
otherToolBars =new Core.Web.WebHelper.ToolBar[]
|
||
{ new Core.Web.WebHelper.ToolBar(ToolBarConfig.CONST_Other1, "向上", "layui-btn-warm","layui-icon-up") ,
|
||
new Core.Web.WebHelper.ToolBar(ToolBarConfig.CONST_Other2, "向下", "layui-btn-warm" ,"layui-icon-down"),
|
||
new Core.Web.WebHelper.ToolBar(ToolBarConfig.CONST_Other3, "配置事业部", "layui-btn-normal" ,"")
|
||
}
|
||
}
|
||
)
|
||
</div>
|
||
<div id="mytoolbar">
|
||
编码:
|
||
<div class="layui-inline">
|
||
<input type="text" name="txt_msgcode" placeholder="请输入编码" class="layui-input">
|
||
</div>
|
||
消息类型:
|
||
<div class="layui-inline">
|
||
<input type="text" name="txt_title" placeholder="请输入类型" class="layui-input">
|
||
</div>
|
||
发送类型:
|
||
<div class="layui-inline">
|
||
<select name="slt_sendtype" style="height:35px;">
|
||
<option value="">--请选择--</option>
|
||
<option value="eid">工号</option>
|
||
<option value="role">角色</option>
|
||
<option value="all">所有人</option>
|
||
</select>
|
||
</div>
|
||
状态:
|
||
<div class="layui-inline">
|
||
<select name="slt_status" style="height:35px;">
|
||
<option value="">--请选择--</option>
|
||
<option value="1">正常</option>
|
||
<option value="0">禁用</option>
|
||
</select>
|
||
</div>
|
||
<button class="layui-btn" data-type="reload">搜索</button>
|
||
</div>
|
||
<table class="layui-hide" id="tabl1" lay-filter="tabl1"></table>
|
||
</div>
|
||
<!--确定宽度-->
|
||
|
||
<script>
|
||
var table;
|
||
$(function () {
|
||
//var tempwidth = 1410;
|
||
//var tempheight = 1115;
|
||
//var width = $(window).width();
|
||
//var height = Math.ceil(width * (tempheight / tempwidth));
|
||
//$("body").height($(window).height() + 150);
|
||
|
||
//$(window).resize(function () {//自动适应大小
|
||
// console.log("resize");
|
||
// table.resize('tab_kefuzhuangtaiyi1');
|
||
//});
|
||
});
|
||
</script>
|
||
<script>
|
||
var selectRow = {};
|
||
var winindex;
|
||
var layer;
|
||
var rowid;
|
||
//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
|
||
layui.use('element', function () {
|
||
var element = layui.element;
|
||
element.on('tab(tonghuajiankong)', function (n) {
|
||
$(".bodytable").addClass("hidden");
|
||
$("#kefuzhuangtai" + (n.index + 1)).removeClass("hidden");
|
||
});
|
||
element.on('tab(maintab)', function (n) {
|
||
if (n.index == 0)
|
||
$("#bottomcard").removeClass("hidden");
|
||
else
|
||
$("#bottomcard").addClass("hidden");
|
||
});
|
||
});
|
||
layui.use(['laypage', 'layer', 'table', 'laydate'], function () {
|
||
var laydate = layui.laydate;
|
||
layer = layui.layer;
|
||
table = layui.table;
|
||
table.render({
|
||
id: 'testReload'//列表别名ID
|
||
, elem: '#tabl1'
|
||
, url: 'GetTypeList'
|
||
, method: 'POST'
|
||
, height: "full-150"
|
||
, cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
||
, page: false
|
||
//, limit: 30
|
||
//, height: "full-250"
|
||
//, size:"sm"
|
||
, cols: [[
|
||
{ field: 'numbers', type: 'numbers' }
|
||
//, { field: 'id', title: 'ID', width: 80 }
|
||
, { field: 'msgcode', title: '编码', width: 100 }
|
||
, { field: 'title', title: '消息类型' }
|
||
, { field: 'content', title: '描述' }
|
||
, {
|
||
field: 'sendtype', title: '类型', width: 80, templet: function (d) {
|
||
if (d.sendtype == "all") {
|
||
return "所有人";
|
||
} else if (d.sendtype == "eid") {
|
||
return "工号";
|
||
} else if (d.sendtype == "role") {
|
||
return "角色";
|
||
}
|
||
}
|
||
}
|
||
, { field: 'sendConfig', title: '推送配置' }
|
||
, { field: 'sort', title: '排序' }
|
||
, {
|
||
field: 'status', title: '状态', width: 80, templet: function (d) {
|
||
if (d.status == 1) {
|
||
return "<font color='#5FB878'>正常</font>";
|
||
} else if (d.status == 0) {
|
||
return "<font color='#c2c2c2'>禁用</font>";
|
||
}
|
||
}
|
||
}
|
||
, { field: 'ctime', title: '时间', width: 200 }
|
||
]],
|
||
done: function () {
|
||
if (rowid != null && rowid != "")
|
||
$("#contentBody").find("td[data-field='ROLEID']:contains('" + rowid + "')").click();
|
||
}, page: {
|
||
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip', 'refresh'] //自定义分页布局
|
||
, groups: 5 //只显示 1 个连续页码
|
||
}, where: GetParams("mytoolbar")
|
||
|
||
});
|
||
//监听行单击事件(单击事件为:rowDouble)
|
||
table.on('row(tabl1)', function (obj) {
|
||
var data = obj.data;
|
||
obj.tr.addClass('self-table-click').siblings().removeClass('self-table-click');
|
||
selectRow = data;
|
||
});
|
||
$('#mytoolbar .layui-btn').on('click', function (data) {
|
||
var param = GetParams("mytoolbar");
|
||
table.reload('testReload', {
|
||
page: {
|
||
curr: 1 //重新从第 1 页开始
|
||
},
|
||
where: param
|
||
});
|
||
});
|
||
var active = {
|
||
|
||
add: function () {
|
||
winindex = layer.open({
|
||
type: 2,
|
||
content: 'Edit',
|
||
title: "添加",
|
||
area: ['500px', '600px']
|
||
});
|
||
}, edit: function () {
|
||
if (selectRow.PKID === "undefined" || selectRow.id == null) {
|
||
layer.alert("请先选中一条记录!", { title: '提示' });
|
||
return;
|
||
}
|
||
winindex = layer.open({
|
||
title: '编辑员工',
|
||
type: 2,
|
||
content: 'Edit?id=' + selectRow.id,
|
||
area: ['600px', '600px']
|
||
});
|
||
}, delete: function () {
|
||
if (selectRow.id == "undefined" || selectRow.id == null) {
|
||
layer.alert("请先选中一条记录!", { title: '提示' });
|
||
return;
|
||
}
|
||
layer.confirm('你确定要删除这条记录吗?', { icon: 3, title: '提示' }, function (index) {
|
||
//do something
|
||
var loadingindex = layer.load(3, { shade: false });
|
||
var data = { id: selectRow.id };
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "Delete",
|
||
data: data,
|
||
dataType: "json",
|
||
success: function (da) {
|
||
layer.close(loadingindex);
|
||
if (da.result == true) {
|
||
layer.msg('操作成功!', { icon: 1 });
|
||
TableReload();
|
||
} else {
|
||
layer.msg(da.msg, { icon: 2 });
|
||
}
|
||
},
|
||
error: function () {
|
||
layer.close(loadingindex);
|
||
layer.msg('操作失败!', { icon: 2 });
|
||
}
|
||
});
|
||
//layer.close(index);
|
||
});
|
||
|
||
}
|
||
};
|
||
$('.layui-btn').on('click', function () {
|
||
var othis = $(this), method = othis.data('method');
|
||
console.log(method);
|
||
active[method] ? active[method].call(this, othis) : '';
|
||
|
||
});
|
||
});
|
||
function Closed() {
|
||
layer.close(winindex);
|
||
}
|
||
function TableReload() {
|
||
table.reload('testReload', {
|
||
page: {
|
||
curr: 1 //重新从第 1 页开始
|
||
}
|
||
});
|
||
}
|
||
|
||
</script>
|
||
|