var e=(e,a,t)=>new Promise(((o,s)=>{var l=e=>{try{n(t.next(e))}catch(a){s(a)}},r=e=>{try{n(t.throw(e))}catch(a){s(a)}},n=e=>e.done?o(e.value):Promise.resolve(e.value).then(l,r);n((t=t.apply(e,a)).next())}));import{_ as a}from"./uni-search-bar.48a9b35c.js";import{s as t,M as o,c as s,r as l,D as r,I as n,d as u,e as i,f as d,a as c,g as p,u as m,m as f,b as g,p as v}from"./index-45b322f7.js";import{_ as y}from"./su-sticky.dcc8e273.js";import{_ as I}from"./uni-load-more.575c3b96.js";import{_ as h}from"./s-layout.940eafb4.js";import{i as _}from"./itemList.bfc32ea9.js";import{_ as b}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-icons.c22fa7d9.js";import"./index.f474d5f6.js";const P=b({__name:"applierSelect",setup(b){const P=t.$store("order"),j=o({supplierId:"",goodsId:"",currentPageNo:1,pageSize:20,isLastPage:!1,loadStatus:""}),k=s((()=>P.reqInfo.reqPersonId)),x=l([]),C=l(""),S=s((()=>""==C.value?"*":C.value));function w(){L(),D()}function z(){C.value="",L(),D()}function A(a){if(a!=k.value){let o=x.value.find((e=>e.id==a));P.modifyApplier(o),function(a){e(this,null,(function*(){console.log("切换申请人后重新获取组织信息："+a);const e=yield t.$api.baseData.getOrgRelationByApplier({userId:a});0==e.errorCode&&P.modifyApplyOrg(e.data)}))}(a)}t.$router.back()}function D(){return e(this,null,(function*(){j.loadStatus="loading";const e=yield t.$api.baseData.getApplierList({number:S.value,name:S.value,pageSize:j.pageSize,pageNo:j.currentPageNo});0==e.errorCode&&(e.data.rows.forEach((e=>e.type="subLevelType")),x.value.push(...e.data.rows),j.isLastPage=e.data.lastPage,e.data.lastPage?j.loadStatus="noMore":j.loadStatus="more")}))}function L(){j.currentPageNo=1,x.value=[]}return r((e=>{L(),j.materialId=e.materialId,j.bizTypeId=e.bizTypeId,j.supplierId=e.supplierId,j.goodsId=e.goodsId,D()})),n((()=>{j.currentPageNo+=1,D()})),(e,t)=>{const o=c(g("uni-search-bar"),a),s=v,l=c(g("su-sticky"),y),r=c(g("uni-load-more"),I),n=c(g("s-layout"),h);return u(),i(n,null,{default:d((()=>[p(l,{bgColor:"#fff",stickyToTop:!1},{default:d((()=>[p(s,{class:"search-block ss-flex ss-row-center"},{default:d((()=>[p(o,{class:"search-bar",placeholder:"请搜索人员编号/姓名",onConfirm:w,onCancel:z,modelValue:C.value,"onUpdate:modelValue":t[0]||(t[0]=e=>C.value=e)},null,8,["modelValue"])])),_:1})])),_:1}),p(s,null,{default:d((()=>[p(_,{listData:x.value,selectedItemId:m(k),onClickEntry:A},null,8,["listData","selectedItemId"])])),_:1}),x.value.length>0?(u(),i(r,{key:0,status:j.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:e.loadmore},null,8,["status","onClick"])):f("",!0)])),_:1})}}},[["__scopeId","data-v-fb70336f"]]);export{P as default};
