Commit d6f144d2 by fsn

恢复被影响的dept_info.js代码

parent 14893ac8
/** /**
* 初始化字典详情对话框 * 初始化部门详情对话框
*/ */
var DictInfoDlg = { var DeptInfoDlg = {
dictInfoData : {} deptInfoData : {}
}; };
/** /**
* 清除数据 * 清除数据
*/ */
DictInfoDlg.clearData = function() { DeptInfoDlg.clearData = function() {
this.dictInfoData = {}; this.deptInfoData = {};
} }
/** /**
* 设置对话框中的数据 * 设置对话框中的数据
* *
* @param key 数据的名称 * @param key 数据的名称
* @param val 数据的具体值 * @param val 数据的具体值
*/ */
DictInfoDlg.set = function(key, val) { DeptInfoDlg.set = function(key, val) {
this.dictInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value; this.deptInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this; return this;
} }
/** /**
* 设置对话框中的数据 * 设置对话框中的数据
* *
* @param key 数据的名称 * @param key 数据的名称
* @param val 数据的具体值 * @param val 数据的具体值
*/ */
DictInfoDlg.get = function(key) { DeptInfoDlg.get = function(key) {
return $("#" + key).val(); return $("#" + key).val();
} }
/** /**
* 关闭此对话框 * 关闭此对话框
*/ */
DictInfoDlg.close = function() { DeptInfoDlg.close = function() {
parent.layer.close(window.parent.Dict.layerIndex); parent.layer.close(window.parent.Dept.layerIndex);
} }
/** /**
* 点击部门ztree列表的选项时 * 点击部门ztree列表的选项时
* *
* @param e * @param e
* @param treeId * @param treeId
* @param treeNode * @param treeNode
* @returns * @returns
*/ */
DictInfoDlg.onClickDept = function(e, treeId, treeNode) { DeptInfoDlg.onClickDept = function(e, treeId, treeNode) {
$("#pName").attr("value", instance.getSelectedVal()); $("#pName").attr("value", instance.getSelectedVal());
$("#pid").attr("value", treeNode.id); $("#pid").attr("value", treeNode.id);
} }
/** /**
* 显示部门选择的树 * 显示部门选择的树
* *
* @returns * @returns
*/ */
DictInfoDlg.showDeptSelectTree = function() { DeptInfoDlg.showDeptSelectTree = function() {
var pName = $("#pName"); var pName = $("#pName");
var pNameOffset = $("#pName").offset(); var pNameOffset = $("#pName").offset();
$("#parentDeptMenu").css({ $("#parentDeptMenu").css({
left : pNameOffset.left + "px", left : pNameOffset.left + "px",
top : pNameOffset.top + pName.outerHeight() + "px" top : pNameOffset.top + pName.outerHeight() + "px"
}).slideDown("fast"); }).slideDown("fast");
$("body").bind("mousedown", onBodyDown); $("body").bind("mousedown", onBodyDown);
} }
/** /**
* 隐藏部门选择的树 * 隐藏部门选择的树
*/ */
DictInfoDlg.hideDeptSelectTree = function() { DeptInfoDlg.hideDeptSelectTree = function() {
$("#parentDeptMenu").fadeOut("fast"); $("#parentDeptMenu").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起 $("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
} }
/** /**
* 收集数据 * 收集数据
*/ */
DictInfoDlg.collectData = function() { DeptInfoDlg.collectData = function() {
this.set('id').set('simplename').set('fullname').set('tips').set('num').set('pid'); this.set('id').set('simplename').set('fullname').set('tips').set('num').set('pid');
} }
/** /**
* 提交添加部门 * 提交添加部门
*/ */
DictInfoDlg.addSubmit = function() { DeptInfoDlg.addSubmit = function() {
this.clearData(); this.clearData();
this.collectData(); this.collectData();
//提交信息 //提交信息
var ajax = new $ax(Feng.ctxPath + "/dict/add", function(data){ var ajax = new $ax(Feng.ctxPath + "/dept/add", function(data){
Feng.success("添加成功!"); Feng.success("添加成功!");
window.parent.Dept.table.refresh(); window.parent.Dept.table.refresh();
DictInfoDlg.close(); DeptInfoDlg.close();
},function(data){ },function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!"); Feng.error("添加失败!" + data.responseJSON.message + "!");
}); });
ajax.set(this.dictInfoData); ajax.set(this.deptInfoData);
ajax.start(); ajax.start();
} }
/** /**
* 提交修改 * 提交修改
*/ */
DictInfoDlg.editSubmit = function() { DeptInfoDlg.editSubmit = function() {
this.clearData(); this.clearData();
this.collectData(); this.collectData();
//提交信息 //提交信息
var ajax = new $ax(Feng.ctxPath + "/dict/update", function(data){ var ajax = new $ax(Feng.ctxPath + "/dept/update", function(data){
Feng.success("修改成功!"); Feng.success("修改成功!");
window.parent.Dept.table.refresh(); window.parent.Dept.table.refresh();
DictInfoDlg.close(); DeptInfoDlg.close();
},function(data){ },function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!"); Feng.error("修改失败!" + data.responseJSON.message + "!");
}); });
ajax.set(this.dictInfoData); ajax.set(this.deptInfoData);
ajax.start(); ajax.start();
} }
function onBodyDown(event) { function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "parentDeptMenu" || $( if (!(event.target.id == "menuBtn" || event.target.id == "parentDeptMenu" || $(
event.target).parents("#parentDeptMenu").length > 0)) { event.target).parents("#parentDeptMenu").length > 0)) {
DictInfoDlg.hideDeptSelectTree(); DeptInfoDlg.hideDeptSelectTree();
} }
} }
$(function() { $(function() {
var ztree = new $ZTree("parentDeptMenuTree", "/dept/tree");
ztree.bindOnClick(DeptInfoDlg.onClickDept);
ztree.init();
instance = ztree;
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment