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

118 lines
3.6 KiB
Plaintext

@{
ViewBag.Title = "行政区划维护";
}
<div id="layout" style="margin-left: 8px;">
<div position="top">
</div>
<div position="left" title="行政区划">
<div id="xzqh">
</div>
</div>
<div position="center" title="维护">
<div id="weihu">
</div>
</div>
</div>
@section scripts{
<script type="text/javascript">
var xzqh;
var sf_save = true;
var menu = $.ligerMenu({ top: 100, left: 100, width: 120, items:
[
{ text: '增加', click: itemclick, icon: 'add' }
]
});
$(function() {
$("#layout").ligerLayout({ leftWidth: '280', topHeight: 1, centerWidth: '280' });
var main = [
{ display: "上级编号", name: "pid", newline: true, type: "text" },
{ display: "本级编号", name: "dqid", newline: true, type: "text", readonly :true },
{ display: "名称", name: "text", newline: true, type: "text" },
{ display: "类型", name: "type", newline: true, type: "hidden" },
];
$("#weihu").ligerForm({
inputWidth: 120, labelWidth: 90, space: 4, labelAlign: "right",
validate: false, fields: main, buttons: [
{ text: '保存', width: 60, click: f_save }]
});
var data = null;
$.ajax({
type: "get", cache: "false", async: false, dataType: "json",
url: "@Url.Action("getDqModelList")",
success: function (result) {
data = result;
},error: function(msg) {
return;
}
});
xzqh = $("#xzqh").ligerTree({
checkbox: false ,
data: data,
idFieldName: 'dqid',
slide: false,
parentIDFieldName: 'pid',
onSelect: function (data, rowindex, rowobj) {
if (data.data.children != null) {
if (data.data.children.length > 0) {
sf_save = false;
} else {
sf_save = true;
}
} else {
sf_save = true;
}
liger.get("weihu").setData(data.data);
},
onContextmenu: function (node, e){
actionNodeID = node.data.dqid;
menu.show({ top: e.pageY, left: e.pageX });
return false;
}
});
treeManager = $("#xzqh").ligerGetTreeManager();
treeManager.collapseAll();
});
function f_save() {
if (!sf_save) {
$.ligerDialog.error("已有下级不能修改保存!");
return;
}
var data = liger.get("weihu").getData();
$.ajax({
type: "post", cache: "false", async: false, dataType: "json",
url: "@Url.Action("saveDqModel")",
data:data,
success: function (result) {
alert("保存成功!");
}, error: function (msg) {
alert("保存失败!");
return;
}
});
}
function itemclick(data) {
sf_save = true;
var data = {};
data.pid = actionNodeID;
data.dqid = "";
data.text = "";
liger.get("weihu").setData(data);
}
</script>
}