import{_ as w,d as U,aV as F,bU as g,x as i,A as I,z as M,r as d,o as T,G as R,D as v,l as f,m as N,h as j,M as q,ar as z,aZ as _}from"./index.js";import{h as A}from"./index.8d1ab27f.js";import{I as G}from"./index.6f39cafb.js";const P={class:"flex w-full justify-end mt-[10px]"},S=U({__name:"choose-modal",props:{visible:{type:Boolean,required:!0},data:{type:null,required:!0}},emits:["refresh"],setup(r,{emit:y}){const l=r,o=F(l,"visible"),C=g({success(){_.success("\u7ED1\u5B9A\u6210\u529F!"),o.value=!1,y("refresh")}}),c=i(null),e=i({companyNo:"",supplierNo:"",companyName:"",supplierName:""});i(null);async function h(){const{id:u,InvCode:a,invoice_code:s,invoice_type:t,invoice_total:n,invoice_number:b,invoice_subtotal:D,check_code:k,open_date:x,status:E}=l.data,{companyNo:p,supplierNo:m}=e.value;if(!p||!m){_.warning("\u8BF7\u9009\u62E9\u8D2D\u4E70\u65B9\u516C\u53F8\u548C\u9500\u552E\u65B9\u516C\u53F8");return}const V={id:u,InvCode:a,invoice_code:s,invoice_number:b,invoice_type:t,invoice_total:n,open_date:x,invoice_subtotal:D,check_code:k,status:E,companyNo:p,supplierNo:m};C.run(A(V))}const B=()=>e.value={companyNo:"",supplierNo:"",companyName:"",supplierName:""};return I(()=>o.value,()=>{if(!o.value)return;const{companyNo:u,supplierNo:a,companyName:s,supplierName:t}=l.data||{};e.value.companyNo=u,e.value.supplierNo=a,e.value.companyName=s,e.value.supplierName=t,M(()=>c.value.initialData())},{immediate:!0}),(u,a)=>{const s=d("ElButton"),t=d("ElDialog");return T(),R(t,{modelValue:N(o),"onUpdate:modelValue":a[1]||(a[1]=n=>z(o)?o.value=n:null),center:"",onClose:B,"close-on-click-modal":!1,"close-on-press-escape":!1},{default:v(()=>[f(N(G),{ref_key:"invoiceCompanyUpdateRef",ref:c,data:e.value,"onUpdate:data":a[0]||(a[0]=n=>e.value=n),invNumber:r.data.invoice_number,type:"purchase"},null,8,["data","invNumber"]),j("div",P,[f(s,{type:"primary",size:"small",onClick:h},{default:v(()=>[q(" \u4FDD\u5B58 ")]),_:1})])]),_:1},8,["modelValue"])}}});var K=w(S,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/purchaseNew/inputInvoicePool/choose-modal.vue"]]);export{K as default};
