$(document).ready(function () { getReactionCategory(); $("#reflectCategory").bind("input propertychange", function () { $(".layui-dropdown").hide(); $(".CleansReactionCategory").show(); if ($("#reflectCategory").val() == "") { $(".reflectCategoryList-wrapper").hide(); return; } $(".reflectCategoryList-wrapper").show(); var debounceGetSearchReactionCategory = debounce( getSearchReactionCategory, 500 ); debounceGetSearchReactionCategory($("#reflectCategory").val()); }); $("#reflectCategoryList").on("click", "li", function () { $(".reflectCategoryList-wrapper").hide(); $("#reflectCategory").val($(this).attr("indexName")); $("#keyid").val($(this).attr("index")); }); }); // 查看工单详情 function View(val, row) { var workId = val; var workIdCode = workId.slice(0, 4); var workIdAddress = workId.slice(4, 10); var workIdDate = workId.slice(10, 16); var workIdSerialNumber = workId.slice(16); return ( '
' + '' + workIdCode + "" + '' + workIdAddress + "" + '' + workIdDate + "" + '' + workIdSerialNumber + "" + "
" ); } //查看详情 function ckxq(str) { layer.open({ type: 2, content: "../CommonHtml/WorkDatil.html?wid=" + str, //iframe的url,no代表不显示滚动条 title: "工单详情", area: ["100%", "100%"], //宽高 maxmin: true, shade: 0, }); } function getReactionCategory(pid = 38) { $.get( huayi.config.callcenter_url + "Dictionary/GetZTreeNew", { token: $.cookie("token"), pid: pid, }, function (result) { result = $.parseJSON(result); var content = JSON.parse(result.data); layui.use("dropdown", function () { var dropdown = layui.dropdown; dropdown.render({ elem: "#reflectCategory", //可绑定在任意元素中,此处以上述按钮为例 data: content, id: "reflectCategory", isclickparent: true, //菜单被点击的事件 click: function (obj) { $("#reflectCategory").val(obj.title); $("#keyid").val(obj.id); $(".CleansReactionCategory").show(); }, }); }); } ); } function getSearchReactionCategory(key) { $("#reflectCategoryList").empty(); $.get( huayi.config.callcenter_url + "Dictionary/GetKeyListNew", { token: $.cookie("token"), key: key, }, function (result) { result = $.parseJSON(result); if (result.state.toLowerCase() === "success") { var content = result.data; if (content.length > 0) { content.forEach(function (e, i) { $( "
  • " + e.names + "
  • " ).appendTo("#reflectCategoryList"); }); } else { $("
  • 没有相关数据
  • ").appendTo( "#reflectCategoryList" ); } } } ); } function debounce(fun, delay) { return function (args) { var that = this; var _args = args; clearTimeout(fun.id); fun.id = setTimeout(function () { fun.call(that, _args); }, delay); }; } $(".CleansReactionCategory").click(function () { $("#reflectCategory").val(""); $("#keyid").val(""); $(".CleansReactionCategory").hide(); });