import{a as A,f as m,r as b,w as T,aj as f,J as E,o as c,K as a,b as t,S as i,c as x,Q as r,R as J,a9 as K,L as P,an as S,M as F,P as D}from"./vue.D1BjjNmv.js";import{R as O}from"./api.C6frSrqD.js";import{E as _}from"./index.Bvt3RIe2.js";import{_ as Q}from"./_plugin-vue_export-helper.DlAUqK2U.js";const Y={class:"form-content"},G={class:"form-content"},H={class:"form-content"},X={class:"form-content"},Z={class:"form-content"},ee={class:"form-content"},te={class:"table-container"},oe={class:"detail-table"},le={class:"accessories-info"},ne={class:"form-content"},ae={class:"remark-info"},re={class:"form-content"},ie={key:0},se={key:1},de={class:"form-content"},ue={class:"form-content"},ce=A({__name:"SettlementDialog",props:{visible:{type:Boolean},settlementData:{},modelValue:{}},emits:["update:visible","update:modelValue"],setup(I,{emit:M}){const p=I,g=M,W=m(()=>{var o;return((o=p.modelValue)==null?void 0:o.mode)==="settlement"}),z=m(()=>{var o;return((o=p.modelValue)==null?void 0:o.mode)==="renew"}),y=b(!1),n=b({}),h=b(""),k=b(1);T(()=>p.visible,o=>{y.value=o,o&&(n.value=p.modelValue||p.settlementData||{})}),T(()=>p.modelValue,o=>{console.log("val:::",o),o&&(n.value=o,console.log("formData.value:::",n.value))},{immediate:!0});const R=m(()=>{var o,e,l,s;return((e=(o=n.value)==null?void 0:o.app_user_borrower)==null?void 0:e.name)||((s=(l=n.value)==null?void 0:l.borrower_info)==null?void 0:s.name)||""}),U=m(()=>{var o,e,l,s;return((e=(o=n.value)==null?void 0:o.app_user_borrower)==null?void 0:e.user_code)||((s=(l=n.value)==null?void 0:l.borrower_info)==null?void 0:s.user_code)||""}),L=m(()=>{var o,e;return((o=n.value)==null?void 0:o.borrow_type_label)||((e=n.value)==null?void 0:e.borrow_type)||""}),w=m(()=>{var o,e;return((e=(o=n.value)==null?void 0:o.items)==null?void 0:e.filter(l=>(l==null?void 0:l.device)!==null))||[]}),B=()=>{g("update:visible",!1),g("update:modelValue",n.value)};async function $(){console.log("filteredItems::",w.value.length),console.log("formData.value::",n.value);for(let o=0;o{try{if(!C.value){_.error("打印区域未找到");return}const o=C.value.cloneNode(!0),e=document.createElement("iframe");if(e.style.position="absolute",e.style.width="0px",e.style.height="0px",e.style.left="-9999px",document.body.appendChild(e),!e.contentWindow||!e.contentWindow.document)throw new Error("iframe初始化失败");const l=e.contentWindow.document;l.write(` 设备借用单打印

设备借用单

`);const s=l.body;s.appendChild(o);const u=l.createElement("button");if(u.className="no-print",u.textContent="打印",u.style.cssText=` position: fixed; top: 20px; right: 20px; padding: 10px 20px; background: #409EFF; color: white; border: none; border-radius: 4px; cursor: pointer; z-index: 9999; `,u.onclick=()=>{try{if(e.contentWindow)e.contentWindow.print();else throw new Error("打印窗口未准备好")}catch(v){console.error("打印过程出错:",v),_.error("打印失败,请重试")}},s.appendChild(u),e.contentWindow)e.contentWindow.focus(),setTimeout(()=>{try{if(e.contentWindow)e.contentWindow.print();else throw new Error("打印窗口未准备好")}catch(v){console.error("打印过程出错:",v),_.error("打印失败,请重试")}finally{document.body.removeChild(e)}},500);else throw new Error("打印窗口未准备好")}catch(o){console.error("打印准备过程出错:",o),_.error("打印准备失败,请重试")}};return(o,e)=>{const l=f("el-form-item"),s=f("el-col"),u=f("el-row"),v=f("el-form"),V=f("el-button"),q=f("el-dialog");return c(),E(q,{modelValue:y.value,"onUpdate:modelValue":e[2]||(e[2]=d=>y.value=d),title:W.value?"领取设备结算单":"续借",width:"75%","close-on-click-modal":!1,onClose:B},{footer:a(()=>[i(V,{onClick:B},{default:a(()=>e[11]||(e[11]=[D("关闭")])),_:1}),W.value?(c(),E(V,{key:0,type:"primary",onClick:j},{default:a(()=>e[12]||(e[12]=[D("打印")])),_:1})):F("",!0),z.value?(c(),E(V,{key:1,type:"primary",onClick:$},{default:a(()=>e[13]||(e[13]=[D("提交")])),_:1})):F("",!0)]),default:a(()=>[t("div",{ref_key:"printContent",ref:C,class:"print-container"},[i(v,{model:n.value,"label-width":"110px","label-position":"top",class:"print-form"},{default:a(()=>[i(u,{gutter:16},{default:a(()=>[i(s,{span:8},{default:a(()=>[i(l,{label:"借用单编号"},{default:a(()=>[t("div",Y,r(n.value.application_no),1)]),_:1})]),_:1}),i(s,{span:8},{default:a(()=>[i(l,{label:"借用人"},{default:a(()=>[t("div",G,r(R.value),1)]),_:1})]),_:1}),i(s,{span:8},{default:a(()=>[i(l,{label:"学号/工号"},{default:a(()=>[t("div",H,r(U.value),1)]),_:1})]),_:1})]),_:1}),i(u,{gutter:16},{default:a(()=>[i(s,{span:8},{default:a(()=>[i(l,{label:"借用性质"},{default:a(()=>[t("div",X,r(L.value),1)]),_:1})]),_:1}),i(s,{span:8},{default:a(()=>[i(l,{label:"借出时间"},{default:a(()=>[t("div",Z,r(n.value.expected_start_time),1)]),_:1})]),_:1}),i(s,{span:8},{default:a(()=>[i(l,{label:"预计归还时间"},{default:a(()=>[t("div",ee,r(n.value.expected_end_time),1)]),_:1})]),_:1})]),_:1}),e[10]||(e[10]=t("div",{class:"detail-title"},"借用明细表",-1)),t("div",te,[t("table",oe,[e[3]||(e[3]=t("thead",null,[t("tr",null,[t("th",{width:"60"},"序号"),t("th",null,"设备编号"),t("th",null,"设备分类"),t("th",null,"设备名称"),t("th",null,"借用数量"),t("th",null,"规格型号"),t("th",null,"存放位置"),t("th",null,"备注")])],-1)),t("tbody",null,[(c(!0),x(J,null,K(w.value,(d,N)=>(c(),x("tr",{key:N},[t("td",null,r(N+1),1),t("td",null,r(d.device_code),1),t("td",null,r(d.device_category_name),1),t("td",null,r(d.device_name),1),t("td",null,r(d.quantity),1),t("td",null,r(d.device_specification),1),t("td",null,r(d.device_storage_location||"-"),1),t("td",null,r(d.remark||"-"),1)]))),128))])])]),t("div",le,[e[4]||(e[4]=t("div",{class:"detail-title"},"配件信息",-1)),t("div",ne,r(n.value.accessories||"-"),1)]),t("div",ae,[e[5]||(e[5]=t("div",{class:"detail-title"},"备注",-1)),t("div",re,r(n.value.remark||"-"),1)]),z.value?(c(),x("div",ie,[e[6]||(e[6]=t("div",{style:{"margin-bottom":"8px","font-weight":"bold"}},"续借时间(天)",-1)),P(t("input",{"onUpdate:modelValue":e[0]||(e[0]=d=>k.value=d),type:"number",min:"1",placeholder:"请输入续借天数",style:{width:"100%",border:"1px solid #dcdfe6",padding:"8px","box-sizing":"border-box"}},null,512),[[S,k.value,void 0,{number:!0}]]),e[7]||(e[7]=t("div",{style:{"margin-bottom":"8px","font-weight":"bold"}},"续借理由",-1)),P(t("textarea",{"onUpdate:modelValue":e[1]||(e[1]=d=>h.value=d),placeholder:"请输入续借理由",rows:"3",style:{width:"100%",border:"1px solid #dcdfe6",padding:"8px",resize:"vertical","box-sizing":"border-box"}},null,512),[[S,h.value]])])):(c(),x("div",se,[e[8]||(e[8]=t("div",{style:{"margin-bottom":"8px","font-weight":"bold"}},"续借时间(天)",-1)),t("div",de,r(n.value.renewal_days||"-"),1),e[9]||(e[9]=t("div",{style:{"margin-bottom":"8px","font-weight":"bold"}},"续借理由",-1)),t("div",ue,r(n.value.return_remark||"-"),1)]))]),_:1},8,["model"])],512)]),_:1},8,["modelValue","title"])}}}),ve=Q(ce,[["__scopeId","data-v-29deb524"]]);export{ve as default};