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