136 lines
5.0 KiB
Plaintext
136 lines
5.0 KiB
Plaintext
|
|
@{
|
|
ViewBag.Title = "kemu5";
|
|
}
|
|
|
|
<div class="l-clear"></div>
|
|
<div id="maingrid"></div>
|
|
<div style="display:none;"></div>
|
|
|
|
@using Newtonsoft.Json;
|
|
@section scripts{
|
|
<script type="text/javascript">
|
|
var openf;
|
|
function save(item) {
|
|
var rows = liger.get("maingrid").getSelectedRows();
|
|
if (rows.length == 0) {
|
|
$.ligerDialog.alert("请选择要修改的数据!");
|
|
return;
|
|
}
|
|
var ids = "";
|
|
for (var i in rows) {
|
|
ids += rows[i].ID + ",";
|
|
}
|
|
ids = ids.substr(0, ids.length - 1);
|
|
|
|
$.ajax({
|
|
url: "@Url.Action("savekemu5")", type: "post", dataType: "json", data: { ids: ids },
|
|
success: function (d) {
|
|
$.ligerDialog.closeWaitting();
|
|
$.ligerDialog.alert(d.Message, function () {
|
|
if (d.State == 1) {
|
|
//不刷新 选中或取消 会跟后台数据一致
|
|
//liger.get("maingrid").reload();
|
|
return;
|
|
}
|
|
});
|
|
},
|
|
beforeSend: function () {
|
|
$.ligerDialog.waitting("正在保存请稍后……");
|
|
}
|
|
});
|
|
}
|
|
function init() {
|
|
liger.get("maingrid").reload();
|
|
openf.close();
|
|
}
|
|
$(function () {
|
|
//var areaD2 =@Html.Raw(ViewBag.areaD2);
|
|
|
|
//$("#maingrid").ligerGrid({
|
|
// height: '100%',
|
|
// columns: [
|
|
// { display: '编号', name: 'ID', align: 'left', width: 60 },
|
|
// // @*{
|
|
display: '上级地区', name: 'pid', width: 120, render: function (r, i, v) {
|
|
if (v) {
|
|
var json=@Html.Raw(JsonConvert.SerializeObject(ViewBag.areaD));
|
|
for(i in json){
|
|
if(json[i]["Value"]==v)
|
|
return json[i]["Text"];
|
|
}
|
|
}
|
|
}
|
|
},*@
|
|
// { display: '部门名称', name: 'BuMenName', id: 'treeid', align: 'left', width: 300 }
|
|
//],
|
|
//url: "@Url.Action("kemu5All")",
|
|
////data: areaD2,
|
|
//pageSize: 30,
|
|
//rownumbers: true,
|
|
//usePager: false,
|
|
//checkbox: true,
|
|
//tree: {
|
|
// columnId: 'treeid',
|
|
// idField: 'ID',
|
|
// parentIDField: 'DirID',
|
|
// //delay:true,
|
|
// //isExpand: false,
|
|
// //checkbox: true,
|
|
//},
|
|
//toolbar: {
|
|
// items: [
|
|
// { text: '保存', click: save, icon: 'save' }
|
|
// ]
|
|
//},
|
|
//onAfterShowData: function () {
|
|
// //liger.get("maingrid").collapseAll();
|
|
//},
|
|
//isChecked: function (rowdata) {
|
|
// // var ids = "@ViewBag.ids".split(',');
|
|
// if (ids.indexOf(rowdata.ID.toString()) != -1) {
|
|
// console.log(ids.indexOf(rowdata.ID));
|
|
// return true;
|
|
// }
|
|
// }
|
|
//});
|
|
|
|
$("#maingrid").ligerGrid({
|
|
height: '100%',
|
|
columns: [
|
|
{ display: "ID", name: "ID", width: "5%" },
|
|
{ display: "用户名", name: "UserName", width: "20%" },
|
|
{ display: "真实姓名", name: "TrueName", width: "20%" },
|
|
{ display: "部门", name: "Department", width: "20%" },
|
|
{ display: "职务", name: "ZhiWei", width: "20%" }
|
|
],
|
|
url: "@Url.Action("kemu5All")",
|
|
pageSize: 30,
|
|
rownumbers: true,
|
|
usePager: false,
|
|
checkbox: true,
|
|
toolbar: {
|
|
items: [
|
|
{ text: '保存', click: save, icon: 'save' }
|
|
]
|
|
},
|
|
onAfterShowData: function () {
|
|
//liger.get("maingrid").collapseAll();
|
|
},
|
|
isChecked: function (rowdata) {
|
|
var ids = "@ViewBag.ids".split(',');
|
|
if (ids.indexOf(rowdata.ID.toString()) != -1) {
|
|
console.log(ids.indexOf(rowdata.ID));
|
|
return true;
|
|
}
|
|
},
|
|
groupColumnName: 'Department',
|
|
groupRender: function (grouptitle, groupdata) {
|
|
return '部门 :【' + grouptitle + '】 人数:【' + groupdata.length + '】';
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|