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