tijian_tieying/web/dccdc/Views/Dictionaries/AreaInfo.cshtml
2025-02-20 12:14:39 +08:00

186 lines
6.8 KiB
Plaintext

@{
ViewBag.Title = "地区信息维护";
}
<div style="width:100%">
<table class="t1" style="width:100%">
<tr>
<td class="ltd" style="width:100px">地区名称:</td>
<td class="rtd" style="width:120px"><input id="s_checkType" class="l-text" /></td>
<td class="rtd"><div id="search">查询</div></td>
</tr>
</table>
</div>
<div id="areaInfoList">
<!--
areaInfoList
areaInfoModify
-->
</div>
<div id="areaInfoModify" style="display:none">
<form id="editform">
<input id="id" type="hidden" name="id" value="0" />
<table class="t1" style="width:100%">
<tr>
<td class="ltd" width="100px">地区编码:</td>
<td class="rtd"><input id="area_code" class="l-text" name="area_code" /></td>
</tr>
<tr>
<td class="ltd" width="100px">地区名称:</td>
<td class="rtd"><input id="area_name" class="l-text" name="area_name" /></td>
</tr>
<tr>
<td class="ltd">是否启用:</td>
<td class="rtd">
<select id="status" name="status">
<option value="是">是</option>
<option value="否">否</option>
</select>
</td>
</tr>
</table>
</form>
</div>
@section scripts{
<script type="text/javascript">
$(function () {
$("#search").ligerButton({
click: function () {
liger.get("areaInfoList").set("parms", { key: $("#s_checkType").val() });
liger.get("areaInfoList").changePage("first");
liger.get("areaInfoList").reload();
}
});
$("#areaInfoList").ligerGrid({
url: "@Url.Action("getareaInfoList")",
toolbar: {
items: [
{
text: '添加', click: itemclick, icon: 'add'
},
{ line: true },
{ text: '修改', click: itemclick, icon: "edit" },
{ line: true },
{ text: '删除', click: itemclick, icon: 'delete' }
]
},
title: "地区信息列表",
parms: { key: $("#s_checkType").val() },
columns: [
{ name: "area_code", display: "地区编码", width: 60, align: "left", },
{ name: "area_name", display: "地区名称", width: 180, align: "left" },
{ name: "status", display: "启用状态", width: 80, align: "left" }
, { name: "creator", display: "创建者", width: 82, align: "left" }
, { name: "create_time", display: "创建时间", width: 82, align: "left" }
], width: "98%",
height: "100%",
rownumbers: true,
usePager: true,
heightDiff: -20
});
});
function itemclick(item) {
if (item.text == "添加") {
f_clear();
$("#check_type").val("");
$("#id").val("0");
$.ligerDialog.open({
title: "添加地区信息", target: $("#areaInfoModify"), width: 418, height: 155, buttons: [{
text: "确定", onclick: function (item, dialg) {
f_save(dialg);
}
}, { text: "取消", onclick: function (item, dialg) { dialg.hidden(); } }]
});
}
else if (item.text == "修改") {
var r = liger.get("areaInfoList").getSelectedRow();
if (!r) {
$.ligerDialog.alert("请选择要修改的数据!");
return;
}
$("#id").val(r.id);
$("#area_code").val(r.area_code);
$("#area_name").val(r.area_name);
$("#status").val(r.status);
$.ligerDialog.open({
title: "修改地区信息", target: $("#areaInfoModify"), width: 418, height: 155, buttons: [{
text: "确定", onclick: function (item, dialg) {
f_save(dialg);
}
}, { text: "取消", onclick: function (item, dialg) { dialg.hidden(); } }]
});
}
else if (item.text === "删除") {
var r1 = liger.get("areaInfoList").getSelectedRow();
if (!r1) {
$.ligerDialog.alert("请选择要删除的数据!");
return;
} else {
$.ajax({
url: "@Url.Action("delAreaInfo")", type: "post", dataType: "json", data: {id:r1.id},
success: function (d) {
$.ligerDialog.closeWaitting();
$.ligerDialog.alert(d.Message, function () {
if (d.State == 1) {
liger.get("areaInfoList").reload();
return;
}
});
},
beforeSend: function () {
$.ligerDialog.waitting("正在保存请稍后……");
}
});
}
}
}
function f_save(dialg) {
if (!$("#area_code").val()) {
$.ligerDialog.alert("地区代码不能为空!");
return;
}
if (!$("#area_name").val()) {
$.ligerDialog.alert("地区名称不能为空!");
return;
}
var data = $("#editform").serializeArray();
$.ajax(
{
url: "@Url.Action("saveAreaInfo")", type: "post", dataType: "json", data: data,
success: function (d) {
$.ligerDialog.closeWaitting();
$.ligerDialog.alert(d.Message, function () {
if (d.State == 1) {
dialg.hidden();
liger.get("areaInfoList").reload();
}
});
},
beforeSend: function () {
$.ligerDialog.waitting("正在保存请稍后……");
}
});
}
function f_clear()
{
$("#id").val();
$("#area_code").val();
$("#area_name").val();
$("#status").val();
}
</script>
}