123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import{E as f}from"./index.DXluV3p1.js";import{a as P,r as h,w as C,f as _,ao as p,K as I,o as g,L as n,b as t,T as r,R as i,c as E,S as L,a9 as q,Q as V}from"./vue.fY72QXCX.js";import{_ as A}from"./_plugin-vue_export-helper.DlAUqK2U.js";const K={class:"form-content"},M={class:"form-content"},O={class:"form-content"},Q={class:"form-content"},R={class:"form-content"},U={class:"form-content"},Y={class:"table-container"},j={class:"detail-table"},G={class:"accessories-info"},H={class:"form-content"},J={class:"remark-info"},X={class:"form-content"},Z=P({__name:"SettlementDialog",props:{visible:{type:Boolean},settlementData:{},modelValue:{}},emits:["update:visible","update:modelValue"],setup(D,{emit:W}){const m=D,w=W,b=h(!1),a=h({});C(()=>m.visible,o=>{b.value=o,o&&(a.value=m.modelValue||m.settlementData||{})}),C(()=>m.modelValue,o=>{console.log("val:::",o),o&&(a.value=o,console.log("formData.value:::",a.value))},{immediate:!0});const B=_(()=>{var o,e,l,s;return((e=(o=a.value)==null?void 0:o.app_user_borrower)==null?void 0:e.name)||((s=(l=a.value)==null?void 0:l.borrower_info)==null?void 0:s.name)||""}),T=_(()=>{var o,e,l,s;return((e=(o=a.value)==null?void 0:o.app_user_borrower)==null?void 0:e.user_code)||((s=(l=a.value)==null?void 0:l.borrower_info)==null?void 0:s.user_code)||""}),N=_(()=>{var o,e;return((o=a.value)==null?void 0:o.borrow_type_label)||((e=a.value)==null?void 0:e.borrow_type)||""}),S=_(()=>{var o,e;return((e=(o=a.value)==null?void 0:o.items)==null?void 0:e.filter(l=>(l==null?void 0:l.device)!==null))||[]}),x=()=>{w("update:visible",!1),w("update:modelValue",a.value)},v=h(null),z=()=>{try{if(!v.value){f.error("打印区域未找到");return}const o=v.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(`
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>设备借用单打印</title>
- <style>
- /* 打印样式 */
- @media print {
- body {
- font-family: Arial, sans-serif;
- padding: 20px;
- margin: 0;
- }
- .no-print {
- display: none !important;
- }
- /* 表单布局优化 */
- .el-form {
- width: 100%;
- }
- .el-row {
- display: flex !important;
- flex-wrap: nowrap !important;
- margin: 0 -8px;
- }
- .el-col {
- padding: 0 8px;
- flex: 1;
- }
- /* 表单项样式 */
- .el-form-item {
- margin-bottom: 12px;
- page-break-inside: avoid;
- }
- .el-form-item__label {
- font-weight: bold;
- margin-bottom: 4px;
- display: block;
- }
- .el-form-item__content {
- line-height: 1.5;
- }
- /* 表格样式优化 */
- table {
- page-break-inside: auto;
- width: 100% !important;
- border-collapse: collapse;
- margin: 20px 0;
- table-layout: fixed;
- }
- tr {
- page-break-inside: avoid;
- page-break-after: auto;
- }
- th, td {
- border: 1px solid #000;
- padding: 8px;
- text-align: center;
- word-break: break-all;
- }
- /* 隐藏Element Plus的默认样式 */
- .el-input__inner {
- border: none !important;
- padding: 0 !important;
- }
- .el-form--label-top .el-form-item__label {
- padding: 0;
- }
- /* 标题样式 */
- h2 {
- text-align: center;
- margin-bottom: 30px;
- font-size: 24px;
- }
- /* 明细表标题 */
- .detail-title {
- font-weight: bold;
- margin: 20px 0 10px;
- font-size: 16px;
- }
- /* 配件信息和备注 */
- .accessories-info,
- .remark-info {
- margin-top: 20px;
- }
- .accessories-info .el-input,
- .remark-info .el-input {
- width: 100%;
- }
- }
- /* 屏幕预览样式 */
- @media screen {
- body {
- background-color: #fff;
- padding: 20px;
- }
- }
- </style>
- </head>
- <body>
- <h2 style="text-align: center; margin-bottom: 30px;">设备借用单</h2>
- </body>
- </html>
- `);const s=l.body;s.appendChild(o);const c=l.createElement("button");if(c.className="no-print",c.textContent="打印",c.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;
- `,c.onclick=()=>{try{if(e.contentWindow)e.contentWindow.print();else throw new Error("打印窗口未准备好")}catch(u){console.error("打印过程出错:",u),f.error("打印失败,请重试")}},s.appendChild(c),e.contentWindow)e.contentWindow.focus(),setTimeout(()=>{try{if(e.contentWindow)e.contentWindow.print();else throw new Error("打印窗口未准备好")}catch(u){console.error("打印过程出错:",u),f.error("打印失败,请重试")}finally{document.body.removeChild(e)}},500);else throw new Error("打印窗口未准备好")}catch(o){console.error("打印准备过程出错:",o),f.error("打印准备失败,请重试")}};return(o,e)=>{const l=p("el-form-item"),s=p("el-col"),c=p("el-row"),u=p("el-form"),y=p("el-button"),F=p("el-dialog");return g(),I(F,{modelValue:b.value,"onUpdate:modelValue":e[0]||(e[0]=d=>b.value=d),title:"领取设备结算单",width:"75%","close-on-click-modal":!1,onClose:x},{footer:n(()=>[r(y,{onClick:x},{default:n(()=>e[5]||(e[5]=[V("关闭",-1)])),_:1,__:[5]}),r(y,{type:"primary",onClick:z},{default:n(()=>e[6]||(e[6]=[V("打印",-1)])),_:1,__:[6]})]),default:n(()=>[t("div",{ref_key:"printContent",ref:v,class:"print-container"},[r(u,{model:a.value,"label-width":"110px","label-position":"top",class:"print-form"},{default:n(()=>[r(c,{gutter:16},{default:n(()=>[r(s,{span:8},{default:n(()=>[r(l,{label:"借用单编号"},{default:n(()=>[t("div",K,i(a.value.application_no),1)]),_:1})]),_:1}),r(s,{span:8},{default:n(()=>[r(l,{label:"借用人"},{default:n(()=>[t("div",M,i(B.value),1)]),_:1})]),_:1}),r(s,{span:8},{default:n(()=>[r(l,{label:"学号/工号"},{default:n(()=>[t("div",O,i(T.value),1)]),_:1})]),_:1})]),_:1}),r(c,{gutter:16},{default:n(()=>[r(s,{span:8},{default:n(()=>[r(l,{label:"借用性质"},{default:n(()=>[t("div",Q,i(N.value),1)]),_:1})]),_:1}),r(s,{span:8},{default:n(()=>[r(l,{label:"借出时间"},{default:n(()=>[t("div",R,i(a.value.expected_start_time),1)]),_:1})]),_:1}),r(s,{span:8},{default:n(()=>[r(l,{label:"预计归还时间"},{default:n(()=>[t("div",U,i(a.value.expected_end_time),1)]),_:1})]),_:1})]),_:1}),e[4]||(e[4]=t("div",{class:"detail-title"},"借用明细表",-1)),t("div",Y,[t("table",j,[e[1]||(e[1]=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,[(g(!0),E(L,null,q(S.value,(d,k)=>(g(),E("tr",{key:k},[t("td",null,i(k+1),1),t("td",null,i(d.device_code),1),t("td",null,i(d.device_category_name),1),t("td",null,i(d.device_name),1),t("td",null,i(d.quantity),1),t("td",null,i(d.device_specification),1),t("td",null,i(d.device_storage_location||"-"),1),t("td",null,i(d.remark||"-"),1)]))),128))])])]),t("div",G,[e[2]||(e[2]=t("div",{class:"detail-title"},"配件信息",-1)),t("div",H,i(a.value.accessories||"-"),1)]),t("div",J,[e[3]||(e[3]=t("div",{class:"detail-title"},"备注",-1)),t("div",X,i(a.value.remark||"-"),1)])]),_:1,__:[4]},8,["model"])],512)]),_:1},8,["modelValue"])}}}),oe=A(Z,[["__scopeId","data-v-1dd018fc"]]);export{oe as default};
|