ComplianceServer/oldcode/Core.Web/Views/InnerUser/Index.cshtml

222 lines
8.0 KiB
Plaintext

@using CRM.Core.Model.Entity
@using Core.Web.WebHelper
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="x-body">
<div class="layui-btn-group" style="padding-bottom:10px;">
@*<button class="layui-btn layui-btn-normal" data-method="add">新增</button>
<button class="layui-btn layui-btn-normal" data-method="edit">编辑</button>
<button class="layui-btn layui-btn-danger" data-method="delete">删除</button>
<button class="layui-btn layui-btn-normal" data-method="other1"><i class="layui-icon">&#xe613;</i>分配角色</button>*@
@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-normal" ,"layui-icon-group"),
new Core.Web.WebHelper.ToolBar(ToolBarConfig.CONST_Other2, "员工信息同步", "layui-btn-normal" ,"layui-icon-refresh")
}
}
)
</div>
<div id="mytoolbar">
姓名/工号:
<div class="layui-inline">
<input type="text" name="txt_name" placeholder="请输入姓名/工号" class="layui-input">
</div>
账号状态:<div class="layui-inline">
<select name="slt_isdismiss" style="height:35px;">
<option value="">请选择</option>
<option value="0" selected>正常</option>
<option value="1">停用</option>
</select>
</div>
角色:<div class="layui-inline">
@Html.DropDownList("slt_roleId", ViewBag.rolelist as List<SelectListItem>, new { @style = "height:35px;" })
</div>
<button class="layui-btn" data-type="reload">搜索</button>
</div>
<table class="layui-hide" id="tabl1" lay-filter="tabl1"></table>
</div>
<script>
var selectRow = {};
var layer;
var table;
var winindex;
layui.use(['table', 'laydate'], function () {
layer = layui.layer;
table = layui.table
, laydate = layui.laydate;
laydate.render({
elem: '#start'
});
laydate.render({
elem: '#end'
});
table.render({
id: 'testReload',//列表别名ID
elem: '#tabl1',//表ID
url: 'GetList',
method: 'POST',
cols: [[
{ field: 'numbers', title: '编号', type: "numbers" }
, { field: 'EID', title: '工号' }
, { field: 'UNAME', title: '姓名' }
, { field: 'GENDER', title: '性别', templet: "#gender" }
, { field: 'ISDISMISS', title: '账号状态', templet: '#auditTpl' }
, { field: 'ROLESNAMES', title: '角色' }
]]
, page: {
layout: ['limit', 'count', 'prev', 'page', 'next', 'skip', 'refresh'] //自定义分页布局
, groups: 5 //只显示 1 个连续页码
}, where: GetParams("mytoolbar")
});
$('#mytoolbar .layui-btn').on('click', function (data) {
var param = GetParams("mytoolbar");
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
},
where: param
});
});
//监听行单击事件
table.on('row(tabl1)', function (obj) {
var data = obj.data;
obj.tr.addClass('self-table-click').siblings().removeClass('self-table-click');
selectRow = data;
});
var active = {
edit: function () {
if (selectRow.PKID === "undefined" || selectRow.PKID == null) {
layer.alert("请先选中一条记录!", { title: '提示' });
return;
}
winindex = layer.open({
title: '编辑员工',
type: 2,
content: 'Edit?id=' + selectRow.PKID,
area: ['600px', '600px']
});
}, add: function () {
winindex = layer.open({
title: '添加员工',
type: 2,
content: 'Add',
area: ['600px', '600px']
});
}, delete: function () {
if (selectRow.PKID === "undefined" || selectRow.PKID == null) {
layer.alert("请先选中一条记录!", { title: '提示' });
return;
}
layer.confirm('你确定要删除这条记录吗?', { icon: 3, title: '提示' }, function (index) {
var loadingindex = layer.load(3, { shade: true });
var data = { id: selectRow.PKID };
$.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.retmsg, { icon: 2 });
}
},
error: function () {
layer.close(loadingindex);
layer.msg('操作失败!', { icon: 2 });
}
});
//layer.close(index);
});
}, other1: function () {
if (selectRow.PKID === "undefined" || selectRow.PKID == null) {
layer.alert("请先选中一条记录!", { title: '提示' });
return;
}
winindex = layer.open({
title: '编辑员工',
type: 2,
content: 'Set?id=' + selectRow.PKID,
area: ['400px', '500px']
});
}, other2: function () {
var loadingindex = layer.load(3, { shade: false });
$.ajax({
type: "GET",
url: "Sync",
dataType: "json",
success: function (da) {
layer.close(loadingindex);
if (da.result == true) {
layer.msg('同步成功!', { icon: 1 });
TableReload();
} else {
layer.msg(da.retmsg, { icon: 2 });
}
},
error: function () {
layer.close(loadingindex);
layer.msg('同步失败!', { icon: 2 });
}
});
}
};
$('.layui-btn-group .layui-btn').on('click', function () {
var othis = $(this), method = othis.data('method');
active[method] ? active[method].call(this, othis) : '';
});
});
layui.use('layer', function () {
});
function Closed() {
layer.close(winindex);
}
function TableReload() {
selectRow = {};
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
}
});
}
</script>
<script type="text/html" id="auditTpl">
{{# if(d.ISDISMISS == '0'){ }}
<font color="#07b10c">正常</font>
{{# } else { }}
<font color="#aba5a5">停用</font>
{{# } }}
</script>
<script type="text/html" id="gender">
{{# if(d.GENDER == 'm'){ }}
{{# } else if(d.GENDER == 'f'){ }}
{{# } }}
</script>