130 lines
4.5 KiB
Plaintext
130 lines
4.5 KiB
Plaintext
|
|
@{
|
|
ViewBag.Title = "kemu";
|
|
}
|
|
|
|
<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 edit(item) {
|
|
var id;
|
|
if (item.text === "增加") {
|
|
id = "";
|
|
}
|
|
else if (item.text === "修改") {
|
|
var r = liger.get("maingrid").getSelectedRow();
|
|
if (!r) {
|
|
$.ligerDialog.alert("请选择要修改的数据!");
|
|
return;
|
|
}
|
|
id = r.id;
|
|
}
|
|
openf= $.ligerDialog.open({
|
|
url: "@Url.Action("areaMessage")?id=" +id,
|
|
title: item.text,
|
|
width: 380,
|
|
height: 350
|
|
});
|
|
}
|
|
function del(item) {
|
|
var r = liger.get("maingrid").getSelectedRow();
|
|
if (!r) {
|
|
$.ligerDialog.alert("请选择要修改的数据!");
|
|
return;
|
|
}
|
|
id = r.id;
|
|
|
|
if (confirm("确定删除") == true) {
|
|
$.ajax({
|
|
url: "@Url.Action("deletearea")", type: "post", dataType: "json", data: { id: id },
|
|
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: 'name', id: 'treeid', align: 'left', width: 120 },
|
|
{ display: '地区编码', name: 'code', align: 'left', width: 100 },
|
|
{ display: '地区层级', name: 'level', align: 'left', width: 70 },
|
|
{ display: '常用等级', name: 'cy', align: 'left', width: 70 },
|
|
{ display: '用餐标准', name: 'bz', align: 'left', width: 70 },
|
|
{ display: '住宿标准', name: 'bz2', align: 'left', width: 70 },
|
|
{ display: '是否启用', name: 'zt', width: 80,render: function (r, i, v) {
|
|
if (v == 1)
|
|
return "正常";
|
|
else
|
|
return "禁用";
|
|
} }
|
|
],
|
|
url: "@Url.Action("areaAll")",
|
|
//data: areaD2,
|
|
pageSize: 30,
|
|
rownumbers: true,
|
|
usePager:false,
|
|
tree: {
|
|
columnId: 'treeid',
|
|
idField: 'id',
|
|
parentIDField: 'pid',
|
|
//delay:true,
|
|
//isExpand: false,
|
|
//checkbox: true,
|
|
},
|
|
toolbar: {
|
|
items: [
|
|
{ text: '增加', click: edit, icon: 'add' },
|
|
{ line: true },
|
|
{ text: '修改', click: edit, icon: 'modify' },
|
|
{ line: true },
|
|
{ text: '删除', click: del, icon: 'delete' }
|
|
]
|
|
},
|
|
onAfterShowData: function ()
|
|
{
|
|
liger.get("maingrid").collapseAll();
|
|
}
|
|
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|
|
|
|
|
|
|