import{d as C,f,e as m,h as A,U as p,a2 as w,ad as y,ag as b}from"./vue-vendor-CxLCUzY4.js";import{af as $}from"./antd-vue-vendor-CahNzUUa.js";import{r as _,a as r,p as D,b as O}from"./areaDataUtil-Dk3xkGfK.js";import{a5 as k,N as P,F as t,_ as V}from"./index-Cy4uayzW.js";import"./china-area-data-vendor-ByvEpbzN.js";import"./vxe-table-vendor-Cdi8WfTx.js";const B=C({name:"JAreaLinkage",components:{Cascader:$},inheritAttrs:!1,props:{value:t.oneOfType([t.object,t.array,t.string]),showArea:t.bool.def(!0),showAll:t.bool.def(!1),saveCode:t.oneOf(["province","city","region","all"]).def("all")},emits:["options-change","change","update:value"],setup(n,{emit:i,refs:d}){const g=f([]),u=k(),o=f([]),l=m(()=>{if(n.showArea&&n.showAll)return _;if(n.showArea&&!n.showAll)return r;if(!n.showArea&&!n.showAll)return D;if(!n.showArea&&n.showAll)return O});A(()=>{n.value?v():o.value=[]});function v(){let e=n.value?n.value:[];if(e&&typeof e=="string"&&e!="null"&&e!="undefined"){const a=e.split(",");o.value=c(a)}else P(e)&&(e.length?o.value=c(e):o.value=[])}function c(e){let a=[];if(n.saveCode==="region"){const s=e[0];["82","81"].includes(s.substring(0,2))?a=[`${s.substring(0,2)}0000`,s]:a=[`${s.substring(0,2)}0000`,`${s.substring(0,2)}${s.substring(2,4)}00`,s]}else if(n.saveCode==="city"){const s=e[0];a=[`${s.substring(0,2)}0000`,s]}else n.saveCode==="province"?a=[e[0]]:a=e;return a}function h(e,...a){if(e!=null&&e.length){let s=[];n.saveCode==="region"?s=[e[e.length-1]]:n.saveCode==="city"?s=[e[1]]:n.saveCode==="province"?s=[e[0]]:s=e,i("change",s),i("update:value",s)}else i("change",e),i("update:value",e)}return{cascaderValue:o,attrs:u,regionData:r,getOptions:l,handleChange:h}}});function T(n,i,d,g,u,o){const l=p("Cascader");return w(),y(l,b(n.attrs,{value:n.cascaderValue,options:n.getOptions,onChange:n.handleChange}),null,16,["value","options","onChange"])}const U=V(B,[["render",T]]);export{U as default};
