import{r as o,bv as x,P as j,d as P,o as c,e as h,w as V,c as k,ac as B,aU as E,af as H,h as L,t as T,__tla as U}from"./index.91e2b97e.js";import{__tla as $}from"./el-tag.b6486cea.js";import{a as q,b as A,__tla as D}from"./el-select.1f459249.js";let y,R=Promise.all([(()=>{try{return U}catch{}})(),(()=>{try{return $}catch{}})(),(()=>{try{return D}catch{}})()]).then(async()=>{y={__name:"index",props:{multiple:{type:Boolean,default:!1},url:String,modelValue:String,modelName:String,fields:[String,String],d:{}},emits:["update:modelValue","update:modelName"],setup(v,{emit:n}){const e=v,N={mounted:(t,l)=>{document.querySelector(".loadSelectPopper .el-select-dropdown .el-select-dropdown__wrap").addEventListener("scroll",function(a){this.scrollHeight-this.scrollTop<=this.clientHeight&&l.value()})}},i=o(!1),s=o(1),_=o(0),f=o(""),m=o([]),g=o([]),d=o([]);function b(){e.multiple?(m.value=e.modelValue?e.modelValue.split(","):[],g.value=e.modelName?e.modelName.split(","):[]):(m.value=e.modelValue?e.modelValue:"",g.value=e.modelName?e.modelName:"")}r().then(()=>{b()});function S(t){f.value=t,s.value=1,d.value=[],r()}function r(){return i.value=!0,x({url:e.to?`/jcxx/${e.to}/index`:e.url,data:{...e.d,keyword:f.value,limit:100,page:s.value}}).then(({data:t})=>{_.value=t.total_page;let l=t.page_data.map(a=>({value:a[e.fields?e.fields[0]:e.to+"_id"],name:a[e.fields?e.fields[1]:e.to+"_name"],origin:a}));d.value=[...d.value,...l],i.value=!1})}function w(){s.value++,!(Number(s.value)>Number(_.value))&&r()}return j(()=>m.value,t=>{if(typeof t=="object"){const l=t.map(a=>d.value.find(({value:p})=>p===a)).sort();n("update:modelValue",l.map(a=>a==null?void 0:a.value).join(",")),n("update:modelName",l.map(a=>a==null?void 0:a.name).join(","))}else{const l=d.value.find(({value:a})=>a===t);n("update:modelValue",t),n("update:modelName",l==null?void 0:l.name)}}),(t,l)=>{const a=q,p=A;return P((c(),h(p,{class:"w-full",modelValue:m.value,"onUpdate:modelValue":l[0]||(l[0]=u=>m.value=u),filterable:"",remote:"","reserve-keyword":"",clearable:"","collapse-tags":"","remote-method":S,"popper-class":"loadSelectPopper",loading:i.value,multiple:v.multiple},{default:V(()=>[(c(!0),k(B,null,E(d.value,u=>(c(),h(a,{key:u.value,label:u.name,value:u.value},{default:V(()=>[H(t.$slots,"default",{item:u.origin},()=>[L(T(u.name),1)])]),_:2},1032,["label","value"]))),128))]),_:3},8,["modelValue","loading","multiple"])),[[N,w]])}}}});export{y as _,R as __tla};
