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