2 lines
2.3 KiB
Java
2 lines
2.3 KiB
Java
import{u as k,J as F,f as D}from"./index-BI6CMai0.js";import{f as h,w as m,ah as g,aC as S,as as v,aF as w,ar as I,F as T,aD as q,G as B,av as H}from"./vue-vendor-C7Zq48Yl.js";import{h as N}from"./main.index-Cs5ETdXF.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./vxe-table-vendor-B88kchpX.js";import"./usePopBiz-CG0vVpgI.js";import"./useMethods-DVip17X8.js";import"./index-Dg4HCEvo.js";var y=(c,p,n)=>new Promise((a,o)=>{var i=l=>{try{e(n.next(l))}catch(u){o(u)}},s=l=>{try{e(n.throw(l))}catch(u){o(u)}},e=l=>l.done?a(l.value):Promise.resolve(l.value).then(i,s);e((n=n.apply(c,p)).next())});const{createMessage:O}=k(),J={name:"JOnlineSearchSelect",props:{placeholder:{type:String,default:"",required:!1},value:{type:String,required:!1},fieldId:{type:String,required:!0}},emits:["update:value"],setup(c,{emit:p}){let n=h(""),a=h([]),o=!0,i=!1,s="";const e=h(1);m(()=>c.value,t=>{t?n.value=t:n.value=void 0},{immediate:!0}),m(()=>c.fieldId,()=>{f()},{immediate:!0});const l=F(t=>{s=t,e.value=1,o=!0,u(t)},800);function u(t=""){return y(this,null,function*(){let d={keyword:t,fieldId:c.fieldId,pageSize:10,pageNo:e.value};yield D.get({url:"/online/cgreport/api/getReportDictList",params:d},{isTransformResponse:!1}).then(r=>{r.success?r.result&&r.result.length>0?(e.value==1?a.value=[...r.result]:a.value.push(...r.result),e.value++):(e.value==1&&(a.value=[]),o=!1):O.warning(r.message)}).catch(()=>{e.value!=1&&e.value--})})}function C(t){p("update:value",t),(!t||t=="")&&f()}function f(){a.value=[],e.value=1,o=!0,s="",u()}return{selectOptions:a,handleSearch:l,handleChange:C,selected:n,handlePopupScroll:t=>y(null,null,function*(){const{target:d}=t,{scrollTop:r,scrollHeight:x,clientHeight:P}=d;!i&&o&&r+P>=x-10&&(i=!0,u(s).finally(()=>{i=!1}))})}}};function L(c,p,n,a,o,i){const s=g("a-select-option"),e=g("a-select");return v(),S(e,{value:a.selected,placeholder:n.placeholder,"show-search":"","default-active-first-option":!1,"show-arrow":!0,"filter-option":!1,"not-found-content":null,onSearch:a.handleSearch,onChange:a.handleChange,onPopupScroll:a.handlePopupScroll,allowClear:""},{default:w(()=>[(v(!0),I(T,null,q(a.selectOptions,l=>(v(),S(s,{key:l.value},{default:w(()=>[B(H(l.text),1)]),_:2},1024))),128))]),_:1},8,["value","placeholder","onSearch","onChange","onPopupScroll"])}const V=N(J,[["render",L]]);export{V as default};
|