(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof exports==="object"){module.exports=e}else{e(jQuery)}})(function(u){function h(l,e,s,o,f){if(!f)f=BACKEND_URL+"/tool/area/index";u.get(f,{pid:e},function(e){if(e.Code!=1){return App.message({text:e.Info,type:"error"})}if(e.Data.listData.length<1){while(u(l).next("select").length>0)u(l).next("select").remove();u(l).remove();return}u(l).show(a);var t=u(l).data("exclude");var a='<option value=""> - '+(App.i18n.PLEASE_SELECT?App.i18n.PLEASE_SELECT:"请选择")+" - </option>";for(var i=0;i<e.Data.listData.length;i++){var n=e.Data.listData[i];var r=s==n.id?" selected":"";if(t==n.id)r+=" disabled";a+='<option value="'+n.id+'"'+r+">"+n.name+"</option>"}u(l).html(a);c(l,o,f).trigger("change")},"json")}function c(f,c,d){if(u(f).data("bindEvent")){return u(f)}u(f).data("bindEvent",true);return u(f).on("change",function(){var e=u(this).val();var t=u(this).attr("name");var a=u(this).attr("class");var i=Number(u(this).attr("pos")||0);var n=u(this).data("target");var r=u(this).data("exclude");if(e==""||e=="0"){if(i==0&&n)u(n).val(e);while(u(f).next("select").length>0)u(f).next("select").remove();return}if(n)u(n).val(e);var l=i+1;if(u(this).next("select").length<1){var s=' pos="'+l+'"';if(t)s+=' name="'+t+'"';if(a)s+=' class="'+a+'"';if(n)s+=' data-target="'+n+'"';if(r)s+=' data-exclude="'+r+'"';u(this).after("<select"+s+' style="display:none"></select>')}var o="";if(u.isArray(c)&&c.length>l)o=c[l];h(u(this).next("select")[0],e,o,c,d)})}function e(e,t,a){if(t==null){t=u(e).data("selected")||[];if(t&&!u.isArray(t))t=String(t).split(",")}if(a==null){a=u(e).data("url")}var i=t&&t.length>0?t[0]:"";h(e,0,i,t,a)}window.CascadeSelect={init:e};u.fn.cascadeSelect=function(){u(this).each(function(){e(this)})};return window.CascadeSelect});