var piData = null; function treeNodeSelFn(e, node) { $("#rec_div").html(""); $(".res_tip").hide(); if ($.tree.reference("rec_div") != null) $.tree.reference("rec_div").destroy(); if (e.node == null || e.node == undefined) return; var id = e.node.id; //if (e.node.pid == "o_0") return; if (id.indexOf("o_") != -1) { id = id.replace("o_", ""); $("#hType").val("o"); getJsonAjax("../handler/GetPurview.ashx?type=modular", function (data) { $("#rec_div").tree({ data: { type: "json", opts: { "static": data } }, ui: { theme_name: "checkbox" }, plugins: { checkbox: {} } }); $.tree.reference("rec_div").open_all(); getJsonAjax("../handler/GetPurview.ashx?type=pms&oId=" + id, function (data) { checkInit(data); }, null, true); }); } $("#hId").val(id); $("#rec_div").show(); $(".res_tip").show(); $("#sp_post").html(e.node.name); } //check已选择 function checkInit(str) { checkReset(); if (!str || str == "") return false; var sArr = str.split(','); for (var i = 0; i < sArr.length; i++) { var sId = sArr[i]; if ($("#jt_" + sId).find("ul").length < 1) { jQuery.tree.plugins.checkbox.check("#jt_" + sId); } } } //重置 function checkReset() { //得到所有选中的节点集合 var sArr = $(".checked,.undetermined"); for (var i = 0; i < sArr.length; i++) { sArr[i].className = ""; } } //查找父级 function checkRights(source, target) { var tmp = source.replace(target, ""); if (tmp.indexOf(target) != -1) return false; else return true; } //获取已选择 function getResult() { //取得所有选中的节点,返回节点对象的集合 //,.undetermined var menu = $(".checked,.undetermined"); var sArr = new Array(); var sId; for (var i = 0; i < menu.length; i++) { sId = menu[i].parentNode.id; if (sId.indexOf("root") != -1) continue; sArr.push(sId.replace("jt_", "")); } return sArr.join(','); } function expandAll() { $.tree.reference("rec_div").open_all(); } function unexpandAll() { $.tree.reference("rec_div").close_all(); } //function saveSettingFn() { // //$("#") // if ($("#hType").val() == "p") { // var id = $("#hId").val(); // var mId = $("#selModules").val(); // var index = $("#selIndex").val(); // var obj = $("#selView2")[0]; // var len = obj.options.length; // var sArr = new Array(); // for (var i = 0; i < len; i++) { // sArr.push(obj.options[i].value); // } // getAjax("save_postsetting", "pId=" + id + "&mId=" + mId + "&index=" + index+"&noshow="+sArr.join(","), function (data) { // resultShow(data); // }); // } //} function savePermission() { var setId = $("#hId").val(); var oId = $("#hOId").val(); var setValue = getResult(); if (setId == "") { alert("请选择要分配权限的用户,如果您当前还没相应用户,请添加!"); return false; } postPermissionAjax("../handler/SetPurview.ashx", "type=pms&setid=" + setId + "&oId=" + oId + "&v=" + setValue, function (data) { resultShow(data.result); }, null, true); //if ($("#hType").val() == "p") { //} else { // postPermissionAjax("../handler/SetPurview.ashx", "type=orgrights&setid=" + setId + "&v=" + setValue, function (data) { // resultShow(data.result); // }, null, true); //} } function viewLeftFn() { var idx = $("#selView")[0].selectedIndex; if (idx == -1) return; var txt = $("#selView option:selected").text(); var v = $("#selView").val(); $("#selView option:selected").remove(); $("#selView2").prepend(""); } function clearView() { var obj = $("#selView2")[0]; var len = obj.options.length; var txt = ""; var v = ""; for (var i = 0; i < len; i++) { txt = obj.options[i].text; v = obj.options[i].value; $("#selView").prepend(""); } $("#selView2").empty(); } $(document).ready(function () { });