| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- getReactionCategory()
- $("#reflectCategory").bind("input propertychange", function() {
-
-
- $(".layui-dropdown").hide();
- if($("#reflectCategory").val() == "") {
- $(".reflectCategoryList-wrapper").hide();
- return;
- }
- getSearchReactionCategory()
- // var debounceGetSearchReactionCategory = debounce(getSearchReactionCategory, 500)
- $(".reflectCategoryList-wrapper").show();
- // debounceGetSearchReactionCategory($("#reflectCategory").val())
- })
- $("#reflectCategoryList").on("click", "li", function() {
- $(".reflectCategoryList-wrapper").hide();
- $("#reflectCategory").val($(this).attr("indexName"));
- $("#keyvalue").val($(this).attr("index"));
- });
- // 获取反映类别数据,多级下拉选项
- function getReactionCategory(pid = 38) {
- $.get(
- huayi.config.callcenter_url + "KeyValue/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);
- $("#keyvalue").val(obj.id);
- $(".CleansReactionCategory").show();
- },
- });
- });
- }
- );
- }
- // 搜索获取反映类别数据
- function getSearchReactionCategory(key) {
- $("#reflectCategoryList").empty();
- $.get(
- huayi.config.callcenter_url + "KeyValue/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) {
- $(
- "<li index='" +
- e.id +
- "' indexName='" +
- e.name +
- "'>" +
- e.names +
- "</li>"
- ).appendTo("#reflectCategoryList");
- });
- } else {
- $("<li index='' indexName=''>没有相关数据</li>").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);
- };
- }
|