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