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