import{_ as g,d as h,cc as N,n as k,dL as R,Q as U,cB as q,S,r as p,o as f,A as v,y as o,h as a,i as u,cd as j,c as L,F as M,z,a as H,e as I,H as Q,cm as A,em as $}from"./index.js";import{o as G}from"./status.4c13d767.js";import{v as J,r as B}from"./verification.611d3025.js";const K={class:"flex justify-end mt-[20px]"},O=h({__name:"approval-modal",emits:["onBatchApprovalComplete"],setup(P,{expose:E,emit:V}){const b=V,d=N(!1),F=k(null),e=R({status:"2",open_type:"",remark:""}),_=U(J(B("remark","\u8BF7\u8F93\u5165\u5907\u6CE8"),B("status","\u8BF7\u9009\u62E9\u5BA1\u6838\u72B6\u6001"),B("open_type","\u8BF7\u9009\u62E9\u5F00\u7968\u65B9\u5F0F"))),m=k([]),{run:C,loading:y}=q({success:()=>{d.value=!1,b("onBatchApprovalComplete")}});function x(){F.value.validate(c=>{if(!c)return;const t=m.value.map(({invNo:s})=>s),{open_type:r,status:n,remark:i}=e;if(r!=="3"&&n==="2"){if(m.value.some(({is_ticket:s})=>String(s)!=="1")){A.error("\u52FE\u9009\u7684\u53D1\u7968\u7533\u8BF7\u5FC5\u987B\u5168\u90E8\u652F\u6301\u91D1\u7A0E\u5F00\u7968");return}if(m.value.some(({inv_type:s})=>s==="special_electronic")){A.error("\u91D1\u7A0E\u6682\u4E0D\u652F\u6301\u5F00\u5177\u7535\u5B50\u4E13\u7968");return}}C($({invNos:t,status:n,remark:i,open_type:n==="2"?r:"0"}))})}return S(()=>{_.open_type.required=e.status==="2",_.remark.required=e.status==="8"}),E({onDisplay:c=>{m.value=c,d.value=!0}}),(c,t)=>{const r=p("el-option"),n=p("el-select"),i=p("el-form-item"),s=p("el-input"),w=p("el-button"),D=p("el-dialog");return f(),v(D,{title:"\u8BF7\u9009\u62E9\u6279\u91CF\u5BA1\u6838\u72B6\u6001",center:"",modelValue:d.value,"onUpdate:modelValue":t[3]||(t[3]=l=>d.value=l),width:"450px","close-on-click-modal":!1,"close-on-press-escape":!1,onClose:t[4]||(t[4]=l=>{u(e).status="2",u(e).open_type="",u(e).remark="",m.value=[],y.value=!1})},{default:o(()=>[a(u(j),{model:u(e),rules:_,ref_key:"formRef",ref:F,"label-width":"100px"},{default:o(()=>[a(i,{label:"\u5BA1\u6838\u72B6\u6001",prop:"status"},{default:o(()=>[a(n,{style:{width:"100%"},modelValue:u(e).status,"onUpdate:modelValue":t[0]||(t[0]=l=>u(e).status=l)},{default:o(()=>[a(r,{label:"\u901A\u8FC7",value:"2"}),a(r,{label:"\u9A73\u56DE",value:"8"})]),_:1},8,["modelValue"])]),_:1}),u(e).status==="2"?(f(),v(i,{key:0,label:"\u5F00\u7968\u65B9\u5F0F",prop:"open_type"},{default:o(()=>[a(n,{style:{width:"100%"},modelValue:u(e).open_type,"onUpdate:modelValue":t[1]||(t[1]=l=>u(e).open_type=l)},{default:o(()=>[(f(!0),L(M,null,z(u(G),l=>(f(),v(r,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):H("v-if",!0),a(i,{label:"\u5907\u6CE8",prop:"remark"},{default:o(()=>[a(s,{type:"textarea",modelValue:u(e).remark,"onUpdate:modelValue":t[2]||(t[2]=l=>u(e).remark=l)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"]),I("div",K,[a(w,{type:"primary",onClick:x,loading:u(y)},{default:o(()=>t[5]||(t[5]=[Q("\u4FDD\u5B58")])),_:1},8,["loading"])])]),_:1},8,["modelValue"])}}});var Z=g(O,[["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSales/invoiceApply/components/approval-modal.vue"]]);export{Z as default};
