161 lines
7.4 KiB
Plaintext
161 lines
7.4 KiB
Plaintext
@{
|
||
ViewBag.Title = "Index";
|
||
Layout = "~/Views/Shared/_Index.cshtml";
|
||
}
|
||
<script>
|
||
layui.use(['jquery', 'form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||
var $ = layui.jquery,
|
||
form = layui.form,
|
||
table = layui.table,
|
||
commonTable = layui.commonTable,
|
||
common = layui.common;
|
||
//加载数据
|
||
wcLoading.close();
|
||
var value = $.request("value");
|
||
var currentWindow = common.parentWindow();
|
||
var name = $.request("name");
|
||
var ids = $.request("ids");
|
||
commonTable.rendertable({
|
||
elem: '#currentTableId',
|
||
id: 'currentTableId',
|
||
url: '/SystemOrganize/User/GetListJson',
|
||
search: false,
|
||
height: 'full-110',
|
||
where: { ids: (!!ids ? ids : "") },
|
||
limit: 99999,//每页数据 默认
|
||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||
layout: ['count'] //自定义分页布局
|
||
, first: false //不显示首页
|
||
, last: false //不显示尾页
|
||
},
|
||
toolbar: false,//工具栏
|
||
cols: [[
|
||
{ type: 'checkbox' },
|
||
|
||
{ field: 'F_Account', title: '账户', width: 150, sort: true },
|
||
{ field: 'F_RealName', title: '姓名', width: 120, sort: true },
|
||
{
|
||
field: 'F_CompanyName', title: '公司名称', width: 150, sort: true
|
||
},
|
||
{
|
||
field: 'F_OrganizeName', title: '部门名称', width: 200, sort: true
|
||
},
|
||
{
|
||
field: 'F_ManagerName', title: '直属上级', width: 200, sort: true
|
||
},
|
||
{
|
||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true,
|
||
templet: function (d) {
|
||
if (d.F_EnabledMark == true) {
|
||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||
} else {
|
||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||
}
|
||
}
|
||
},
|
||
]]
|
||
});
|
||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId");
|
||
// 监听双击事件
|
||
table.on('rowDouble(currentTableFilter)', function (obj) {
|
||
var pvalue = obj.data.F_Id;
|
||
var pname = obj.data.F_RealName;
|
||
var pcode = obj.data.F_Account;
|
||
common.modalConfirm("注:您确定要选择{账号:" + pcode + ",姓名:" + pname + "}的数据吗?", function (r) {
|
||
if (r) {
|
||
if (!!pvalue) {
|
||
currentWindow.$('#' + value).val(pvalue);
|
||
}
|
||
if (!!pname) {
|
||
currentWindow.$('#' + name).val(pname);
|
||
}
|
||
common.modalClose();
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
// 监听搜索操作
|
||
form.on('submit(data-search-btn)', function (data) {
|
||
//执行搜索重载
|
||
commonTable.reloadtable({
|
||
elem: 'currentTableId',
|
||
page: false,
|
||
where: { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword }
|
||
});
|
||
return false;
|
||
});
|
||
// 监听清除操作
|
||
form.on('submit(data-clear-btn)', function (data) {
|
||
ids = "";
|
||
//执行搜索重载
|
||
commonTable.reloadtable({
|
||
elem: 'currentTableId',
|
||
page: false,
|
||
where: { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword }
|
||
});
|
||
return false;
|
||
});
|
||
// 监听提交操作
|
||
form.on('submit(saveBtn)', function (data) {
|
||
var checkStatus = table.checkStatus("currentTableId").data;
|
||
var pvalue = [];
|
||
var pname = [];
|
||
var pcode = [];
|
||
for (var i = 0; i < checkStatus.length; i++) {
|
||
pvalue.push(checkStatus[i].F_Id);
|
||
pname.push(checkStatus[i].F_RealName);
|
||
pcode.push(checkStatus[i].F_Account);
|
||
}
|
||
if (pvalue.length == 0) {
|
||
common.modalConfirm("注:您确定要清除选择的数据吗?", function (r) {
|
||
if (r) {
|
||
currentWindow.$('#' + name).val(null);
|
||
currentWindow.$('#' + value).val(null);
|
||
common.modalClose();
|
||
}
|
||
});
|
||
}
|
||
else {
|
||
common.modalConfirm("注:您确定要选择{账号" + pcode.join(",") + ",姓名:" + pname.join(",") + "}的数据吗?", function (r) {
|
||
if (r) {
|
||
if (!!pvalue) {
|
||
currentWindow.$('#' + value).val(pvalue.join(","));
|
||
}
|
||
if (!!pname) {
|
||
currentWindow.$('#' + name).val(pname.join(","));
|
||
}
|
||
common.modalClose();
|
||
}
|
||
});
|
||
}
|
||
return false;
|
||
});
|
||
});
|
||
</script>
|
||
<div class="layuimini-container">
|
||
<div class="layuimini-main">
|
||
<fieldset class="table-search-fieldset">
|
||
@*<legend>搜索信息</legend>*@
|
||
<div>
|
||
<form class="layui-form layui-form-pane" action="">
|
||
<div class="layui-form-item">
|
||
<div class="layui-inline">
|
||
<label class="layui-form-label">关键字:</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||
</div>
|
||
</div>
|
||
<div class="layui-inline">
|
||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||
<button type="submit" class="layui-btn layui-btn-danger" lay-submit lay-filter="data-clear-btn"><i class="layui-icon"></i> 清 除</button>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item layui-hide">
|
||
<button class="layui-btn" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</fieldset>
|
||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||
</div>
|
||
</div> |