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