/** * 工单分配 * */ $(document).ready(function() { autosize($('textarea')); var ID = helper.request.queryString("oid"); //工单编号 if(ID) { getWorkOrderInfo(ID); } //确定点击按钮 $("#clgd").click(function() { dealWorkOrder(ID); }); //tree下拉框效果 $(".inpBox .tree").click(function() { if($(this).parent().find(".addTree").is(":hidden")) { $(this).parent().find(".addTree").show(); } else { $(this).parent().find(".addTree").hide(); } }); //普通下拉框效果 $(".inpBox .select").click(function() { if($(this).parent().find(".xl_common").is(":hidden")) { $(this).parent().find(".xl_common").show(); } else { $(this).parent().find(".xl_common").hide(); } }); $(".xl").click(function() { if($(this).parent().find(".addTree").is(":hidden")) { $(this).parent().find(".addTree").show(); } else { $(this).parent().find(".addTree").hide(); } if($(this).parent().find(".xl_common").is(":hidden")) { $(this).parent().find(".xl_common").show(); } else { $(this).parent().find(".xl_common").hide(); } }); // $(".inpBox").mouseleave(function() { // $(this).children(".addTree").hide(); // $(this).children(".xl_common").hide(); // }); //清除 $(".Cleans ").click(function () { $('.inps').val(""); $("#PID").val(""); $("#Dpment").val(""); }) $(".xl_box").on("click", "li", function() { var obj = $(this).parent().parent().parent(); obj.find("input").eq(0).val($(this).text()); obj.find("input").eq(1).val($(this).attr("itemid")); obj.find(".xl_common").hide(); }); getBM($("#zrbmtree")); $('#btn_cha').click(function(){ initTable(); }) }) //获取部门 var setting = { data: { key: { name: "text" }, simpleData: { enable: true, idKey: "id", pIdKey: "ParentId", rootPId: 0 } }, callback: { onClick: zTreeOnClick } }; function darptSearch() { $('.xlAdd').css('display', 'none'); $(".selDpart1").css('display', 'block'); depart(); } function getBM(obj) { $.getJSON(huayi.config.callcenter_url + 'Department/GetDeptList', { token: $.cookie("token"), keywords:$('.inps').val(), }, function(result) { if(result.state.toLowerCase() == "success") { // alert(111111); var treeObj = $.fn.zTree.init(obj, setting, result.data); treeObj.expandAll(false); } }) } function zTreeOnClick(event, treeId, treeNode) { if(event) { event.stopPropagation(); } var obj = $("#" + event.data.treeId).parent(); obj.parent().find("input").eq(0).val(treeNode.text); obj.parent().find("input").eq(1).val(treeNode.id); obj.hide(); getRY($(".clid"), $("#clbm").val()); }; $("#sponsor").on('click', 'li', function() { $(".selDpart1").css('display', 'none'); $(".tree").val($(this).html()); $("#Dpment").val($(this).attr("index")); $(".Cleans").show(); getRY($(".clid"), $("#clbmname").val()); }) function depart() { $("#sponsor").empty(); $.getJSON(huayi.config.callcenter_url + "WorkOrderNew/GetModelDeptName", { "token": $.cookie("token"), F_DeptName: $('.inps').val(), }, function(data) { if(data.state.toLowerCase() == "success") { var content = data.data; $(content).each(function(i, n) { $("