!function(n){n.fn.niceSelect=function(e){if("string"==typeof e)return"update"==e?this.each(function(e,t){var s=n(this),l=n(this).next(".nice-select"),c=l.hasClass("open");l.length&&(l.remove(),a(s,e),c&&s.next().trigger("click"))}):"destroy"==e?(this.each(function(){var e=n(this),t=n(this).next(".nice-select");t.length&&(t.remove(),e.css("display",""))}),0==n(".nice-select").length&&n(document).off(".nice_select")):console.log('Method "'+e+'" does not exist.'),this;function a(e,t){var s=e.attr("search")?'':"";e.after(n("
").addClass("nice-select").addClass(e.attr("class")||"").addClass(e.attr("disabled")?"disabled":"").addClass(e.attr("multiple")?"has-multiple":"").attr("tabindex",e.attr("disabled")?null:"0").css("zIndex",1001-t).html(s+(e.attr("multiple")?'
暂无匹配结果
':'
暂无匹配结果
')));var c=e.next(),l=e.find("option");if(e.attr("multiple")){var a=e.find("option:selected"),i="";a.each(function(){$selected_option=n(this),$selected_text=$selected_option.data("display")||$selected_option.text(),$selected_option.val()&&(i+=''+$selected_text+"")}),$select_placeholder=e.data("js-placeholder")||e.attr("js-placeholder"),$select_placeholder=$select_placeholder||"Select",console.log($select_placeholder),i=""===i?$select_placeholder:i,c.find(".multiple-options").html(i)}else{a=e.find("option:selected");c.find(".current").html(a.data("display")||a.text())}l.each(function(e){var t=n(this),s=t.data("display"),l=t.data("url")?' '+t.text()+"":t.text();c.find("ul").append(n("
  • ").attr("data-value",t.val()).attr("data-display",s||null).addClass("option"+(t.is(":selected")?" selected":"")+(t.is(":disabled")?" disabled":"")).html(l))}),c.find("ul").outerWidth()&&c.css("width",c.find("ul").outerWidth())}this.hide(),this.each(function(e,t){var s=n(this);s.next().hasClass("nice-select")||a(s,e)}),n(document).off(".nice_select"),n(document).on("click.nice_select",".nice-select",function(e){var t=n(this);n(".nice-select").not(t).removeClass("open"),t.toggleClass("open"),t.hasClass("open")?(t.find(".option"),t.find(".nice-select-search").val(""),t.find(".nice-select-search").focus(),t.find(".focus").removeClass("focus"),t.find(".selected").addClass("focus"),t.find("ul li").show(),t.removeClass("empty")):t.focus()}),n(document).on("click",".nice-select-search-box",function(e){return e.stopPropagation(),!1}),n(document).on("keyup.nice-select-search",".nice-select",function(){var e=n(this),t=e.find(".nice-select-search").val(),s=e.find("ul li");if(e.removeClass("empty"),""==t)s.show();else if(e.hasClass("open")){t=t.toLowerCase();var l=new RegExp(t);if(0'+e+"",$selected_values.push($selected_option.data("value"))}),$select_placeholder=s.prev("select").data("js-placeholder")||s.prev("select").attr("js-placeholder"),console.log(s.prev("select")),$select_placeholder=$select_placeholder||"Select",$selected_html=""===$selected_html?$select_placeholder:$selected_html,s.find(".multiple-options").html($selected_html),s.prev("select").val($selected_values).trigger("change");else{s.find(".selected").removeClass("selected"),t.addClass("selected");var l=t.data("display")||t.text();s.find(".current").text(l),s.prev("select").val(t.data("value")).trigger("change")}}),n(document).on("keydown.nice_select",".nice-select",function(e){var t=n(this),s=n(t.find(".focus")||t.find(".list .option.selected"));if(32==e.keyCode||13==e.keyCode)return t.hasClass("open")?s.trigger("click"):t.trigger("click"),!1;if(40==e.keyCode){if(t.hasClass("open")){var l=s.nextAll(".option:not(.disabled)").first();0