| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- $(document).ready(function() {
- tree();
- })
- $(".inps").focus(function () {
- $(".xlAdd").css("display", "block");
- });
- $(".xl").click(function () {
- if ($(".xlAdd").css("display") == "block") {
- $(".xlAdd").css("display", "none");
- } else {
- $(".xlAdd").css("display", "block");
- }
- });
- $(".addTree").mouseleave(function () {
- $(this).css("display", "none");
- });
- //清除
- $(".Cleans ").click(function () {
- $(".inps").val("");
- $("#PID").val("");
- });
- function tree() {
- $.get(
- huayi.config.callcenter_url + "Department/GetDeptList",
- {
- token: $.cookie("token"),
- // "pid": pid
- },
- function (result) {
- result = $.parseJSON(result);
- $.fn.zTree.init($("#addTreeDemo"), setting1, result.data); //实例化树形图
- }
- );
- }
- var setting1 = {
- data: {
- key: {
- name: "F_DeptName",
- },
- simpleData: {
- enable: true,
- idKey: "F_DeptId",
- pIdKey: "F_PartentId",
- rootPId: 0,
- },
- },
- callback: {
- onClick: zTreeOnClick,
- },
- };
- function zTreeOnClick(event, treeId, treeNode) {
- if (treeNode.level >= 1) {
- $(".inps").val(treeNode.F_DeptName);
- $("#PID").val(treeNode.F_DeptId);
- $(".Cleans").show();
- }
- }
- function Close() {
- $(".lyxz").removeClass("cx");
- if ($("audio").length > 0) {
- $("audio")[0].pause();
- }
- }
- function darptSearch() {
- $(".xlAdd").css("display", "none");
- $(".selDpart1").css("display", "block");
- depart();
- }
- $("#sponsor").on("click", "li", function () {
- $(".selDpart1").css("display", "none");
- $(".inps").val($(this).html());
- $("#PID").val($(this).attr("index"));
- $(".Cleans").show();
- });
- ///部门
- function depart() {
- $("#sponsor").empty();
- $.getJSON(
- huayi.config.callcenter_url + "Department/GetDeptListByDept",
- {
- token: $.cookie("token"),
- dept: $(".inps").val(),
- },
- function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $(
- "<li index='" +
- n.F_DeptId +
- "'>" +
- n.F_DeptName +
- "</li>"
- ).appendTo("#sponsor");
- });
- }
- }
- );
- }
|