var v=Object.defineProperty,m=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var c=(e,l,t)=>l in e?v(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,i=(e,l)=>{for(var t in l||(l={}))_.call(l,t)&&c(e,t,l[t]);if(d)for(var t of d(l))f.call(l,t)&&c(e,t,l[t]);return e},n=(e,l)=>m(e,S(l));import{N as y,a6 as I,_ as R,m as p,o as w,e as z,n as h,f as D}from"./index.9ed4dad3.js";var b={props:{level:{type:Number,default:3},dimension:{type:String,defalit:"CQ"}},computed:n(i({},y({selectRoadId:e=>e.road.selectRoadId,allRoads:e=>e.road.allRoads})),{waySelected:{get(){return JSON.stringify(localStorage.setItem("sousuId",this.selectRoadId)),this.selectRoadId||[]},set(e){const l=e||[];let t={};this.setSelectRoadId(l),l.length>0&&(t=this.allRoads.filter(a=>a.organizationId==l[l.length-1])[0]);let o="";t.level==="1"?o=t.organizationId:t.level==="2"?o=t.pnode:t.level==="3"&&(o=t.provinceId),this.setSelectProvince(o),this.setSelectLevel((t==null?void 0:t.level)||0),this.setSelectCode((t==null?void 0:t.authCode)||0),this.getSelectAllRoad(t)}},options(){return x(this.allRoads,this.level)},changeDateTime(){return this.$store.state.appDate}}),data(){return{appDate:"",elProps:{label:"organizationName",value:"organizationId",checkStrictly:!0,expandTrigger:"hover"},isClearable:!0}},methods:n(i({},I("road",["setSelectRoadId","setSelectLevel","setSelectCode","setSelectAllRoad","setSelectProvince"])),{changeProvince(e){e?(this.waySelected=[e],this.setSelectLevel(1),this.setSelectRoadId([e])):(this.waySelected=[],this.setSelectLevel(0),this.setSelectRoadId([]))},handelDateApp(e){this.$store.commit("changeDate",e)},getSelectAllRoad(e){const l=Object.keys(e).length&&[e]||this.allRoads;if(!l.length)return;const t=[],o=a=>{a.map(s=>{Number(s.level)===3?t.push(s.organizationId):s.children&&o(s.children)})};o(l),this.setSelectAllRoad(t)},initSelectOrg(){var l;this.waySelected=[];const{allRoads:e}=this;if(!(!e||e.length<1))if((l=this.$route.query)!=null&&l.road)this.waySelected=[this.$route.query.road];else{const t=e.filter(s=>s.level==="3"),o=e.filter(s=>s.level==="2"),a=e.filter(s=>s.level==="1");t.length===1?this.waySelected=[a[0].organizationId,o[0].organizationId,t[0].organizationId]:o.length===1?this.waySelected=[a[0].organizationId,o[0].organizationId]:a.length===1&&(this.waySelected=[a[0].organizationId])}}}),mounted(){this.appDate=this.$store.state.appDate,localStorage.getItem("orglen"),localStorage.getItem("orgId"),this.initSelectOrg(),this.dimension},watch:{changeDateTime(e){this.appDate=e},allRoads:{handler(e){this.initSelectOrg()},immediate:!0},"$route.query.road":{handler(e){this.initSelectOrg()},immediate:!0},"$route.query.month":{handler(e){e&&this.handelDateApp(new Date(e))},immediate:!0}}};function x(e,l){let t=[];if(!Array.isArray(e))return t;let o={};return e.forEach(a=>{delete a.children}),e.forEach(a=>{o[a.organizationId]=a}),e.forEach(a=>{let s=o[a.pnode];s?(s.children||(s.children=[])).push(a):t.push(a)}),t[0],t}const C={class:"way-filter"},A={class:"dateTime"};function N(e,l,t,o,a,s){const u=p("el-cascader"),g=p("el-date-picker");return w(),z("div",C,[h(u,{modelValue:s.waySelected,"onUpdate:modelValue":l[0]||(l[0]=r=>s.waySelected=r),options:s.options,placeholder:"\u5168\u56FD",size:"mini","popper-append-to-body":!1,props:a.elProps,clearable:a.isClearable,"popper-class":"wayPoper",ref:"cascader",style:{width:"230px"}},null,8,["modelValue","options","props","clearable"]),D("div",A,[h(g,{modelValue:a.appDate,"onUpdate:modelValue":l[1]||(l[1]=r=>a.appDate=r),type:"month",size:"small",clearable:!1,"popper-class":"n_date__popper",style:{width:"128px",cursor:"pointer"},onChange:s.handelDateApp,editable:!1},null,8,["modelValue","onChange"])])])}var k=R(b,[["render",N],["__scopeId","data-v-7ccd9050"]]);export{k as W};