100 lines
3.2 KiB
Plaintext
100 lines
3.2 KiB
Plaintext
|
|
@{
|
|
ViewBag.Title = "kemu";
|
|
}
|
|
|
|
<div class="l-clear"></div>
|
|
<div id="maingrid"></div>
|
|
<div style="display:none;"></div>
|
|
|
|
@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("kemuquestionMessage")?id=" +id,
|
|
title: item.text,
|
|
width: 500,
|
|
height: 300
|
|
});
|
|
}
|
|
function del(item) {
|
|
var r = liger.get("maingrid").getSelectedRow();
|
|
if (!r) {
|
|
$.ligerDialog.alert("请选择要修改的数据!");
|
|
return;
|
|
}
|
|
id = r.id;
|
|
|
|
if (confirm("确定删除") == true) {
|
|
$.ajax({
|
|
url: "@Url.Action("deletekemuquestion")", 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() {
|
|
|
|
$("#maingrid").ligerGrid({
|
|
height: '100%',
|
|
columns: [
|
|
{ display: '编号', name: 'id', align: 'left', width: 60 },
|
|
{ display: '问题名称', name: 'title', align: 'left', width: 200 },
|
|
{ display: '问题内容', name: 'content', align: 'left', width: 300 },
|
|
{ display: '问题答案', name: 'answer', align: 'left', width: 200 },
|
|
{ display: '是否启用', name: 'zt', width: 80,render: function (r, i, v) {
|
|
if (v == 1)
|
|
return "正常";
|
|
else
|
|
return "禁用";
|
|
} }
|
|
],
|
|
url: "@Url.Action("kemuquestionAll")",
|
|
pageSize: 30,
|
|
rownumbers: true,
|
|
usePager:false,
|
|
toolbar: {
|
|
items: [
|
|
{ text: '增加', click: edit, icon: 'add' },
|
|
{ line: true },
|
|
{ text: '修改', click: edit, icon: 'modify' },
|
|
{ line: true },
|
|
{ text: '删除', click: del, icon: 'delete' }
|
|
]
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|
|
|
|
|
|
|