import{B as y}from"./api.B6TjG0We.js";import{E as u}from"./index.Df8UJ10K.js";import{a as w,r as d,aj as g,J as j,o as V,K as s,b as l,c as D,M as R,P as t,Q as n,S as m}from"./vue.D1BjjNmv.js";const N={key:0,style:{"margin-top":"16px"}},A=w({name:"BorrowApprovalDialog"}),U=w({...A,setup(E,{expose:x}){const a=d(!1),o=d({}),p=d(!1),r=d("");function k(i){o.value=i,a.value=!0,p.value=!1,r.value=""}x({openApprovalDialog:k});async function B(){try{await y(o.value.id,"approve","同意借用"),u.success("审批通过"),a.value=!1}catch{u.error("审批失败")}}function C(){if(!p.value){p.value=!0;return}if(!r.value.trim()){u.warning("请填写拒绝原因");return}try{y(o.value.id,"reject",r.value),u.success("审批拒绝"),a.value=!1}catch{u.error("拒绝失败")}}return(i,e)=>{const _=g("el-input"),f=g("el-button"),b=g("el-dialog");return V(),j(b,{modelValue:a.value,"onUpdate:modelValue":e[2]||(e[2]=v=>a.value=v),title:"借用审批",width:"600px","close-on-click-modal":!1},{footer:s(()=>[m(f,{onClick:e[1]||(e[1]=v=>a.value=!1)},{default:s(()=>e[11]||(e[11]=[t("关闭")])),_:1}),m(f,{type:"danger",onClick:C},{default:s(()=>e[12]||(e[12]=[t("拒绝")])),_:1}),m(f,{type:"primary",onClick:B},{default:s(()=>e[13]||(e[13]=[t("通过")])),_:1})]),default:s(()=>[l("div",null,[l("p",null,[e[3]||(e[3]=l("strong",null,"申请编号：",-1)),t(n(o.value.application_no),1)]),l("p",null,[e[4]||(e[4]=l("strong",null,"借用人：",-1)),t(n(o.value.emergency_contact),1)]),l("p",null,[e[5]||(e[5]=l("strong",null,"课程：",-1)),t(n(o.value.purpose),1)]),l("p",null,[e[6]||(e[6]=l("strong",null,"学号/工号：",-1)),t(n(o.value.borrower_info.user_code),1)]),l("p",null,[e[7]||(e[7]=l("strong",null,"联系方式：",-1)),t(n(o.value.emergency_phone),1)]),l("p",null,[e[8]||(e[8]=l("strong",null,"个人/团队：",-1)),t(n(o.value.team_type_label),1)]),l("p",null,[e[9]||(e[9]=l("strong",null,"归还时间:",-1)),t(n(o.value.expected_end_time),1)]),l("p",null,[e[10]||(e[10]=l("strong",null,"存放仓库：",-1)),t(n(o.value.return_location),1)])]),p.value?(V(),D("div",N,[m(_,{type:"textarea",modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=v=>r.value=v),placeholder:"请输入拒绝原因",rows:"3"},null,8,["modelValue"])])):R("",!0)]),_:1},8,["modelValue"])}}});export{U as default};
