添加7个表格

master
lynn 1 year ago
parent 01ffccaf4c
commit 7bcd8af5ac

@ -0,0 +1,231 @@
<template>
<div>
<xy-dialog title="打印预览" :is-show.sync="isShow" :width="70" @on-ok="print" ok-text="">
<template v-slot:normalContent>
<div class="white-container" ref="printtable">
<div class="form-container">
<h2 class="form-title">苏州市河道管理处会议审批表</h2>
<div class="date-container">
<div class="date-field">
<span>{{ getYear }}</span>
<span>{{ getMonth }}</span>
<span>{{ getDay }}</span>
</div>
</div>
<table class="approval-table">
<tbody>
<tr>
<td class="label">申请部门</td>
<td class="content">{{ getDepartment }}</td>
</tr>
<tr>
<td class="label">会议名称</td>
<td class="content">{{ getMeetingName }}</td>
</tr>
<tr>
<td class="label">会议类别</td>
<td class="content">{{ getMeetingType }}类会议</td>
</tr>
<tr>
<td class="label">会议起止日期及天数</td>
<td class="content">{{ getDuration }}</td>
</tr>
<tr>
<td class="label">会议地点</td>
<td class="content">{{ getLocation }}</td>
</tr>
<tr>
<td class="label">会议规模</td>
<td class="content">代表人数{{ getRepresentativeCount }} 工作人员数{{ getStaffCount }}</td>
</tr>
<tr>
<td class="label">会议经费预算</td>
<td class="content">{{ getTotalBudget }}</td>
</tr>
<tr>
<td class="label">其中住宿费</td>
<td class="content">{{ getAccommodationFee }}</td>
</tr>
<tr>
<td class="label">伙食费</td>
<td class="content">{{ getMealsFee }}</td>
</tr>
<tr>
<td class="label">租场费</td>
<td class="content">{{ getVenueFee }}</td>
</tr>
<tr>
<td class="label">其他费用</td>
<td class="content">{{ getOtherFees }}</td>
</tr>
<tr>
<td class="label">科室负责人审核</td>
<td class="content">{{ getDepartmentApproval }}</td>
</tr>
<tr>
<td class="label">分管领导审核</td>
<td class="content">{{ getSectionApproval }}</td>
</tr>
<tr>
<td class="label">综合科审核</td>
<td class="content">{{ getComprehensiveApproval }}</td>
</tr>
<tr>
<td class="label">单位负责人审核</td>
<td class="content">{{ getUnitApproval }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import html2canvas from 'html2canvas'
import * as printJS from "print-js";
export default {
name: 'PrintMeetingApproval',
data() {
return {
isShow: false,
meetingData: null
}
},
computed: {
getYear() { return this.meetingData?.year || '' },
getMonth() { return this.meetingData?.month || '' },
getDay() { return this.meetingData?.day || '' },
getDepartment() { return this.meetingData?.department || '' },
getMeetingName() { return this.meetingData?.meetingName || '' },
getMeetingType() { return this.meetingData?.meetingType || '' },
getDuration() { return this.meetingData?.duration || '' },
getLocation() { return this.meetingData?.location || '' },
getRepresentativeCount() { return this.meetingData?.representativeCount || '' },
getStaffCount() { return this.meetingData?.staffCount || '' },
getTotalBudget() { return this.meetingData?.totalBudget || '' },
getAccommodationFee() { return this.meetingData?.accommodationFee || '' },
getMealsFee() { return this.meetingData?.mealsFee || '' },
getVenueFee() { return this.meetingData?.venueFee || '' },
getOtherFees() { return this.meetingData?.otherFees || '' },
getDepartmentApproval() { return this.meetingData?.departmentApproval || '' },
getSectionApproval() { return this.meetingData?.sectionApproval || '' },
getComprehensiveApproval() { return this.meetingData?.comprehensiveApproval || '' },
getUnitApproval() { return this.meetingData?.unitApproval || '' }
},
methods: {
getMeetingData(id) {
//
this.meetingData = {
year: '2024',
month: '3',
day: '14',
department: '测试部门',
meetingName: '测试会议',
meetingType: '测试',
duration: '2024-03-14至2024-03-15共2天',
location: '会议室',
representativeCount: '10',
staffCount: '5',
totalBudget: '10000',
accommodationFee: '3000',
mealsFee: '2000',
venueFee: '1000',
otherFees: '4000'
}
},
async print() {
try {
let canvas = await html2canvas(this.$refs['printtable'], {
backgroundColor: null,
useCORS: true,
})
printJS({
printable: canvas.toDataURL(),
type: 'image',
documentTitle: '苏州市河道管理处会议审批表',
style: '@page{margin:auto;}'
})
} catch (error) {
console.error('打印失败:', error)
}
}
}
}
</script>
<style scoped>
.white-container {
background: #fff;
padding: 20px;
}
.form-container {
position: relative;
width: 100%;
padding: 20px;
}
.form-title {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.date-container {
width: 100%;
margin-bottom: 20px;
display: flex;
justify-content: flex-end;
padding-right: 50px;
}
.date-field {
font-size: 16px;
position: static;
}
.approval-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
font-family: SimSun, serif;
}
.approval-table td {
border: 1px solid #000;
padding: 8px 12px;
font-size: 16px;
line-height: 1.5;
}
.approval-table .label {
width: 200px;
background-color: #fff;
text-align: left;
font-weight: normal;
}
.approval-table .content {
text-align: left;
min-height: 24px;
}
@media print {
.white-container {
padding: 0;
}
.form-container {
padding: 0;
}
.approval-table td {
border: 1px solid #000;
}
}
</style>

@ -0,0 +1,190 @@
<template>
<div>
<xy-dialog title="打印预览" :is-show.sync="isShow" :width="70" @on-ok="print" ok-text="">
<template v-slot:normalContent>
<div class="white-container" ref="printtable">
<div class="form-container">
<h2 class="form-title">苏州市河道管理处公务接待申请单</h2>
<table class="approval-table">
<tbody>
<tr>
<td class="label">申请科室</td>
<td class="content" colspan="2">{{ getDepartment }}</td>
<td class="label">申请理由</td>
<td class="content" colspan="2">{{ getReason }}</td>
</tr>
<tr>
<td class="label">申请日期</td>
<td class="content" colspan="2">{{ getApplyDate }}</td>
<td class="content" colspan="3"></td>
</tr>
<tr>
<td class="label" rowspan="2">预计就餐人数</td>
<td class="sub-label">接待人数</td>
<td class="content">{{ getVisitorCount }}</td>
<td class="label" rowspan="2">预计金额<br>()</td>
<td class="sub-label">餐费</td>
<td class="content">{{ getMealsFee }}</td>
</tr>
<tr>
<td class="sub-label">陪同人数</td>
<td class="content">{{ getAccompanyCount }}</td>
<td class="sub-label">住宿费</td>
<td class="content">{{ getAccommodationFee }}</td>
</tr>
<tr>
<td class="label">科室经办人</td>
<td class="content" colspan="2">{{ getHandler }}</td>
<td class="label">综合科意见</td>
<td class="content" colspan="2">{{ getComprehensiveOpinion }}</td>
</tr>
<tr>
<td class="label">分管领导意见</td>
<td class="content" colspan="5">{{ getLeaderOpinion }}</td>
</tr>
<tr>
<td class="label">备注</td>
<td class="content" colspan="5">{{ getRemark }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import html2canvas from 'html2canvas'
import * as printJS from "print-js";
export default {
name: 'PrintReceptionApproval',
data() {
return {
isShow: false,
receptionData: null
}
},
computed: {
getDepartment() { return this.receptionData?.department || '' },
getReason() { return this.receptionData?.reason || '' },
getApplyDate() { return this.receptionData?.applyDate || '' },
getVisitorCount() { return this.receptionData?.visitorCount || '' },
getAccompanyCount() { return this.receptionData?.accompanyCount || '' },
getMealsFee() { return this.receptionData?.mealsFee || '' },
getAccommodationFee() { return this.receptionData?.accommodationFee || '' },
getHandler() { return this.receptionData?.handler || '' },
getComprehensiveOpinion() { return this.receptionData?.comprehensiveOpinion || '' },
getLeaderOpinion() { return this.receptionData?.leaderOpinion || '' },
getRemark() { return this.receptionData?.remark || '' }
},
methods: {
getReceptionData(id) {
//
this.receptionData = {
department: '测试科室',
reason: '业务交流',
applyDate: '2024-03-14',
visitorCount: '5',
accompanyCount: '3',
mealsFee: '1500',
accommodationFee: '2000',
handler: '张三',
comprehensiveOpinion: '',
leaderOpinion: '',
remark: ''
}
},
async print() {
try {
let canvas = await html2canvas(this.$refs['printtable'], {
backgroundColor: null,
useCORS: true,
})
printJS({
printable: canvas.toDataURL(),
type: 'image',
documentTitle: '苏州市河道管理处公务接待申请单',
style: '@page{margin:auto;}'
})
} catch (error) {
console.error('打印失败:', error)
}
}
}
}
</script>
<style scoped>
.white-container {
background: #fff;
padding: 20px;
}
.form-container {
position: relative;
width: 100%;
padding: 20px;
}
.form-title {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
}
.approval-table {
width: 100%;
border-collapse: collapse;
font-family: SimSun, serif;
}
.approval-table td {
border: 1px solid #000;
padding: 8px 12px;
font-size: 16px;
line-height: 1.5;
height: 40px;
}
.approval-table .label {
width: 120px;
background-color: #fff;
text-align: center;
font-weight: normal;
}
.approval-table .sub-label {
width: 100px;
background-color: #fff;
text-align: center;
font-weight: normal;
}
.approval-table .content {
text-align: left;
min-height: 24px;
}
/* 意见栏和备注栏加大高度 */
.approval-table tr:nth-last-child(-n+3) td {
height: 80px;
}
@media print {
.white-container {
padding: 0;
}
.form-container {
padding: 0;
}
.approval-table td {
border: 1px solid #000;
}
}
</style>

@ -0,0 +1,193 @@
<template>
<div>
<xy-dialog title="打印预览" :is-show.sync="isShow" :width="70" @on-ok="print" ok-text="">
<template v-slot:normalContent>
<div class="white-container" ref="printtable">
<div class="form-container">
<h2 class="form-title">苏州市河道管理处公务接待结算单</h2>
<table class="settlement-table">
<tbody>
<tr>
<td class="label">科室</td>
<td class="content" colspan="2">{{ getDepartment }}</td>
<td class="label">事由</td>
<td class="content" colspan="2">{{ getReason }}</td>
</tr>
<tr>
<td class="label">日期</td>
<td class="content" colspan="2">{{ getDate }}</td>
<td class="label">就餐地点</td>
<td class="content" colspan="2">{{ getDiningLocation }}</td>
</tr>
<tr>
<td class="label" rowspan="2">就餐人数</td>
<td class="sub-label">接待人数</td>
<td class="content">{{ getVisitorCount }}</td>
<td class="label" rowspan="2">金额()</td>
<td class="sub-label">餐费</td>
<td class="content">{{ getMealsFee }}</td>
</tr>
<tr>
<td class="sub-label">陪同人数</td>
<td class="content">{{ getAccompanyCount }}</td>
<td class="sub-label">住宿费</td>
<td class="content">{{ getAccommodationFee }}</td>
</tr>
<tr>
<td class="label">科室经办人</td>
<td class="content" colspan="2">{{ getHandler }}</td>
<td class="label">综合科意见</td>
<td class="content" colspan="2">{{ getComprehensiveOpinion }}</td>
</tr>
<tr>
<td class="label">分管领导意见</td>
<td class="content" colspan="5">{{ getLeaderOpinion }}</td>
</tr>
<tr>
<td class="label">备注</td>
<td class="content" colspan="5">{{ getRemark }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import html2canvas from 'html2canvas'
import * as printJS from "print-js";
export default {
name: 'PrintReceptionSettlement',
data() {
return {
isShow: false,
settlementData: null
}
},
computed: {
getDepartment() { return this.settlementData?.department || '' },
getReason() { return this.settlementData?.reason || '' },
getDate() { return this.settlementData?.date || '' },
getDiningLocation() { return this.settlementData?.diningLocation || '' },
getVisitorCount() { return this.settlementData?.visitorCount || '' },
getAccompanyCount() { return this.settlementData?.accompanyCount || '' },
getMealsFee() { return this.settlementData?.mealsFee || '' },
getAccommodationFee() { return this.settlementData?.accommodationFee || '' },
getHandler() { return this.settlementData?.handler || '' },
getComprehensiveOpinion() { return this.settlementData?.comprehensiveOpinion || '' },
getLeaderOpinion() { return this.settlementData?.leaderOpinion || '' },
getRemark() { return this.settlementData?.remark || '' }
},
methods: {
getSettlementData(id) {
//
this.settlementData = {
department: '测试科室',
reason: '业务交流',
date: '2024-03-14',
diningLocation: '餐厅',
visitorCount: '5',
accompanyCount: '3',
mealsFee: '1500',
accommodationFee: '2000',
handler: '张三',
comprehensiveOpinion: '',
leaderOpinion: '',
remark: ''
}
},
async print() {
try {
let canvas = await html2canvas(this.$refs['printtable'], {
backgroundColor: null,
useCORS: true,
})
printJS({
printable: canvas.toDataURL(),
type: 'image',
documentTitle: '苏州市河道管理处公务接待结算单',
style: '@page{margin:auto;}'
})
} catch (error) {
console.error('打印失败:', error)
}
}
}
}
</script>
<style scoped>
.white-container {
background: #fff;
padding: 20px;
}
.form-container {
position: relative;
width: 100%;
padding: 20px;
}
.form-title {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
}
.settlement-table {
width: 100%;
border-collapse: collapse;
font-family: SimSun, serif;
}
.settlement-table td {
border: 1px solid #000;
padding: 8px 12px;
font-size: 16px;
line-height: 1.5;
height: 40px;
}
.settlement-table .label {
width: 120px;
background-color: #fff;
text-align: center;
font-weight: normal;
}
.settlement-table .sub-label {
width: 100px;
background-color: #fff;
text-align: center;
font-weight: normal;
}
.settlement-table .content {
text-align: left;
min-height: 24px;
}
/* 意见栏和备注栏加大高度 */
.settlement-table tr:nth-last-child(-n+3) td {
height: 80px;
}
@media print {
.white-container {
padding: 0;
}
.form-container {
padding: 0;
}
.settlement-table td {
border: 1px solid #000;
}
}
</style>

@ -0,0 +1,263 @@
<template>
<div>
<xy-dialog title="打印预览" :is-show.sync="isShow" :width="70" @on-ok="print" ok-text="">
<template v-slot:normalContent>
<div class="white-container" ref="printtable">
<div class="form-container">
<h2 class="form-title">苏州市河道管理处报销贴单</h2>
<div class="header-info">
<span>科室{{ getDepartment }}</span>
<span class="date">{{ getYear }}{{ getMonth }}{{ getDay }}</span>
</div>
<table class="reimbursement-table">
<tbody>
<tr>
<td class="label">职工姓名</td>
<td class="content">{{ getEmployeeName }}</td>
<td class="label">退休/在职</td>
<td class="content">{{ getEmployeeStatus }}</td>
<td class="label">家属姓名</td>
<td class="content">{{ getFamilyName }}</td>
<td class="label">与本人关系</td>
<td class="content">{{ getRelationship }}</td>
</tr>
<tr>
<td class="label">内容</td>
<td class="label">发票金额</td>
<td class="label">报销比例</td>
<td class="label">实报金额</td>
<td class="label" rowspan="2">报销(领款)</td>
<td class="content sign-cell" colspan="3" rowspan="2">{{ getReimburser }}</td>
</tr>
<tr>
<td class="label">门诊医药费</td>
<td class="content">{{ getOutpatientFee }}</td>
<td class="content">{{ getOutpatientRatio }}</td>
<td class="content">{{ getOutpatientActual }}</td>
</tr>
<tr>
<td class="label">住院医药费</td>
<td class="content">{{ getHospitalFee }}</td>
<td class="content">{{ getHospitalRatio }}</td>
<td class="content">{{ getHospitalActual }}</td>
<td class="label">科室负责人</td>
<td class="content" colspan="3">{{ getDepartmentHead }}</td>
</tr>
<tr>
<td class="label">儿童医药费</td>
<td class="content">{{ getChildrenFee }}</td>
<td class="content">{{ getChildrenRatio }}</td>
<td class="content">{{ getChildrenActual }}</td>
<td class="label">财审科审核</td>
<td class="content" colspan="3">{{ getFinanceApproval }}</td>
</tr>
<tr>
<td class="label">幼托费用</td>
<td class="content">{{ getNurseryFee }}</td>
<td class="content"></td>
<td class="content">{{ getNurseryActual }}</td>
<td class="label">分管领导审核</td>
<td class="content" colspan="3">{{ getLeaderApproval }}</td>
</tr>
<tr>
<td class="label">子女保险费</td>
<td class="content">{{ getChildInsuranceFee }}</td>
<td class="content"></td>
<td class="content">{{ getChildInsuranceActual }}</td>
<td class="label">财务分管领导审核</td>
<td class="content" colspan="3">{{ getFinanceLeaderApproval }}</td>
</tr>
<tr>
<td class="label">合计</td>
<td class="content" colspan="3">{{ getTotalFee }} {{ getTotalActual }}</td>
<td class="label" rowspan="2">单位负责人审批</td>
<td class="content" colspan="3" rowspan="2">{{ getUnitApproval }}</td>
</tr>
<tr>
<td class="label">报销金额(大写)</td>
<td class="content" colspan="3">{{ getAmountInWords }} {{ getThousand }} {{ getHundred }} {{ getTen }} {{ getYuan }} {{ getJiao }} {{ getFen }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import html2canvas from 'html2canvas'
import * as printJS from "print-js";
export default {
name: 'PrintReimbursement',
data() {
return {
isShow: false,
reimbursementData: null
}
},
computed: {
getDepartment() { return this.reimbursementData?.department || '' },
getYear() { return this.reimbursementData?.year || '' },
getMonth() { return this.reimbursementData?.month || '' },
getDay() { return this.reimbursementData?.day || '' },
getEmployeeName() { return this.reimbursementData?.employeeName || '' },
getEmployeeStatus() { return this.reimbursementData?.employeeStatus || '' },
getFamilyName() { return this.reimbursementData?.familyName || '' },
getRelationship() { return this.reimbursementData?.relationship || '' },
getOutpatientFee() { return this.reimbursementData?.outpatientFee || '' },
getOutpatientRatio() { return this.reimbursementData?.outpatientRatio || '' },
getOutpatientActual() { return this.reimbursementData?.outpatientActual || '' },
getHospitalFee() { return this.reimbursementData?.hospitalFee || '' },
getHospitalRatio() { return this.reimbursementData?.hospitalRatio || '' },
getHospitalActual() { return this.reimbursementData?.hospitalActual || '' },
getChildrenFee() { return this.reimbursementData?.childrenFee || '' },
getChildrenRatio() { return this.reimbursementData?.childrenRatio || '' },
getChildrenActual() { return this.reimbursementData?.childrenActual || '' },
getNurseryFee() { return this.reimbursementData?.nurseryFee || '' },
getNurseryActual() { return this.reimbursementData?.nurseryActual || '' },
getChildInsuranceFee() { return this.reimbursementData?.childInsuranceFee || '' },
getChildInsuranceActual() { return this.reimbursementData?.childInsuranceActual || '' },
getTotalFee() { return this.reimbursementData?.totalFee || '' },
getTotalActual() { return this.reimbursementData?.totalActual || '' },
getAmountInWords() { return this.reimbursementData?.amountInWords || '' },
getReimburser() { return this.reimbursementData?.reimburser || '' },
getDepartmentHead() { return this.reimbursementData?.departmentHead || '' },
getThousand() { return '' },
getHundred() { return '' },
getTen() { return '' },
getYuan() { return '' },
getJiao() { return '' },
getFen() { return '' }
},
methods: {
getReimbursementData(id) {
//
this.reimbursementData = {
department: '测试科室',
year: '2024',
month: '3',
day: '14',
employeeName: '张三',
employeeStatus: '在职',
familyName: '李四',
relationship: '配偶',
outpatientFee: '1000',
outpatientRatio: '80%',
outpatientActual: '800',
hospitalFee: '5000',
hospitalRatio: '90%',
hospitalActual: '4500',
childrenFee: '500',
childrenRatio: '70%',
childrenActual: '350',
nurseryFee: '2000',
nurseryActual: '2000',
childInsuranceFee: '1000',
childInsuranceActual: '1000',
totalFee: '9500',
totalActual: '8650',
amountInWords: '捌',
reimburser: '张三',
departmentHead: '李四'
}
},
async print() {
try {
let canvas = await html2canvas(this.$refs['printtable'], {
backgroundColor: null,
useCORS: true,
})
printJS({
printable: canvas.toDataURL(),
type: 'image',
documentTitle: '苏州市河道管理处报销贴单',
style: '@page{margin:auto;}'
})
} catch (error) {
console.error('打印失败:', error)
}
}
}
}
</script>
<style scoped>
.white-container {
background: #fff;
padding: 20px;
}
.form-container {
position: relative;
width: 100%;
padding: 20px;
}
.form-title {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
}
.header-info {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
font-size: 16px;
}
.date {
margin-right: 50px;
}
.reimbursement-table {
width: 100%;
border-collapse: collapse;
font-family: SimSun, serif;
}
.reimbursement-table td {
border: 1px solid #000;
padding: 8px 12px;
font-size: 16px;
line-height: 1.5;
height: 40px;
vertical-align: middle;
}
.reimbursement-table .label {
background-color: #fff;
text-align: center;
font-weight: normal;
width: 120px;
}
.reimbursement-table .content {
text-align: left;
min-height: 24px;
}
.sign-cell {
text-align: center;
vertical-align: middle;
min-height: 80px; /* 确保签名区域有足够的高度 */
}
@media print {
.white-container {
padding: 0;
}
.form-container {
padding: 0;
}
.reimbursement-table td {
border: 1px solid #000;
}
}
</style>

@ -11,6 +11,9 @@
<div class="department-field">
{{ fillDepartment('河道管理处') }}
</div>
<div class="person-name-field">
{{ fillPersonName('林勇') }}
</div>
</div>
</div>
</div>
@ -53,6 +56,11 @@ export default {
const spaces = ' '.repeat(maxLength - departmentName.length);
return departmentName + spaces;
},
fillPersonName(name) {
const maxLength = 15; //
const spaces = ' '.repeat(maxLength - name.length);
return name + spaces;
},
}
}
</script>
@ -83,9 +91,20 @@ img {
.department-field {
position: absolute;
top: 62px; /* 再往上调整10px */
left: 100px; /* 保持水平位置不变 */
font-size: 15px;
top: 60px;
left: 100px;
font-size: 16px;
font-family: SimSun, serif;
white-space: pre;
color: #000;
line-height: 1;
}
.person-name-field {
position: absolute;
top: 60px;
left: 400px;
font-size: 16px;
font-family: SimSun, serif;
white-space: pre;
color: #000;

@ -0,0 +1,204 @@
<template>
<div>
<xy-dialog title="打印预览" :is-show.sync="isShow" :width="70" @on-ok="print" ok-text="">
<template v-slot:normalContent>
<div class="white-container" ref="printtable">
<div class="form-container">
<h2 class="form-title">水电费结算单</h2>
<table class="utility-table">
<tbody>
<tr>
<td class="label">费用发生地点</td>
<td class="content" colspan="3">
<span class="auto-fetch">合同信息直接提取</span>
</td>
</tr>
<tr>
<td class="label">上期读数</td>
<td class="content">
<span class="auto-fetch">系统自动提取</span>
</td>
<td class="label">实际使用水/电量</td>
<td class="content">{{ getUsageAmount }}</td>
</tr>
<tr>
<td class="label"> 日读数</td>
<td class="content">{{ getCurrentReading }}</td>
<td class="label">/电费单价</td>
<td class="content">
<span class="auto-fetch">合同信息直接提取</span>
</td>
</tr>
<tr>
<td class="label">总费用</td>
<td class="content">{{ getTotalAmount }}</td>
<td class="label">大写</td>
<td class="content">{{ getAmountInWords }}</td>
</tr>
<tr>
<td class="label">借水/电单位</td>
<td class="content">
<span class="auto-fetch">合同信息直接提取</span>
</td>
<td class="label">经办人</td>
<td class="content">{{ getHandler }}</td>
</tr>
<tr>
<td class="label">经办科室</td>
<td class="content">{{ getDepartment }}</td>
<td class="label">科室负责人</td>
<td class="content">{{ getDepartmentHead }}</td>
</tr>
<tr>
<td class="label">发票预留电话</td>
<td class="content">{{ getPhone }}</td>
<td class="label">分管领导</td>
<td class="content">{{ getLeader }}</td>
</tr>
</tbody>
</table>
<div class="footer">
<div class="apply-date">
申请日期{{ getApplyDate }}
</div>
</div>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import html2canvas from 'html2canvas'
import * as printJS from "print-js";
export default {
name: 'PrintUtilityBill',
data() {
return {
isShow: false,
utilityData: null
}
},
computed: {
getUsageAmount() { return this.utilityData?.usageAmount || '' },
getCurrentReading() { return this.utilityData?.currentReading || '' },
getTotalAmount() { return this.utilityData?.totalAmount || '' },
getAmountInWords() { return this.utilityData?.amountInWords || '' },
getHandler() { return this.utilityData?.handler || '' },
getDepartment() { return this.utilityData?.department || '' },
getDepartmentHead() { return this.utilityData?.departmentHead || '' },
getPhone() { return this.utilityData?.phone || '' },
getLeader() { return this.utilityData?.leader || '' },
getApplyDate() { return this.utilityData?.applyDate || '' }
},
methods: {
getUtilityData(id) {
//
this.utilityData = {
usageAmount: '1000',
currentReading: '2024-03-14',
totalAmount: '2000',
amountInWords: '贰仟元整',
handler: '张三',
department: '测试科室',
departmentHead: '李四',
phone: '12345678901',
leader: '王五',
applyDate: '2024-03-14'
}
},
async print() {
try {
let canvas = await html2canvas(this.$refs['printtable'], {
backgroundColor: null,
useCORS: true,
})
printJS({
printable: canvas.toDataURL(),
type: 'image',
documentTitle: '水电费结算单',
style: '@page{margin:auto;}'
})
} catch (error) {
console.error('打印失败:', error)
}
}
}
}
</script>
<style scoped>
.white-container {
background: #fff;
padding: 20px;
}
.form-container {
position: relative;
width: 100%;
padding: 20px;
}
.form-title {
text-align: center;
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
}
.utility-table {
width: 100%;
border-collapse: collapse;
font-family: SimSun, serif;
}
.utility-table td {
border: 1px solid #000;
padding: 8px 12px;
font-size: 16px;
line-height: 1.5;
height: 40px;
}
.utility-table .label {
width: 150px;
background-color: #fff;
text-align: left;
font-weight: normal;
}
.utility-table .content {
text-align: left;
min-height: 24px;
}
.auto-fetch {
color: #ff4d4f;
}
.footer {
margin-top: 20px;
text-align: right;
padding-right: 50px;
}
.apply-date {
font-size: 16px;
}
@media print {
.white-container {
padding: 0;
}
.form-container {
padding: 0;
}
.utility-table td {
border: 1px solid #000;
}
}
</style>

@ -150,6 +150,11 @@
<!-- 打印组件放在这里 -->
<printRegistration ref="printRegistration"></printRegistration>
<printTravelExpense ref="printTravelExpense"></printTravelExpense>
<printMeetingApproval ref="printMeetingApproval"></printMeetingApproval>
<printReceptionApproval ref="printReceptionApproval"></printReceptionApproval>
<printReceptionSettlement ref="printReceptionSettlement"></printReceptionSettlement>
<printReimbursement ref="printReimbursement"></printReimbursement>
<printUtilityBill ref="printUtilityBill"></printUtilityBill>
<detailPaymentRegistration ref="detailPaymentRegistration" @success="getFundLogs"></detailPaymentRegistration>
</div>
</template>
@ -165,10 +170,21 @@ import { getBudget } from "@/api/budget/budget";
import {getparameter} from "@/api/system/dictionary";
import {getToken} from "@/utils/auth";
import printTravelExpense from "./components/printTravelExpense";
import printMeetingApproval from "./components/printMeetingApproval";
import printReceptionApproval from "./components/printReceptionApproval";
import printReceptionSettlement from "./components/printReceptionSettlement";
import printReimbursement from "./components/printReimbursement";
import printUtilityBill from "./components/printUtilityBill";
export default {
components: {
printRegistration,
printTravelExpense, //
printTravelExpense,
printMeetingApproval,
printReceptionApproval,
printReceptionSettlement,
printReimbursement,
printUtilityBill,
detailPaymentRegistration,
},
data() {
@ -524,9 +540,8 @@ export default {
this.getFundLogs();
});
},
handlePrint(row) {
async handlePrint(row) {
try {
//
const rowIndex = this.list.findIndex(item => item.id === row.id);
console.log('当前行号:', rowIndex);
@ -536,6 +551,21 @@ export default {
} else if(rowIndex === 1) { //
this.$refs['printTravelExpense'].getDetailFundLog(row.id);
this.$refs['printTravelExpense'].isShow = true;
} else if(rowIndex === 2) { //
this.$refs['printMeetingApproval'].getMeetingData(row.id);
this.$refs['printMeetingApproval'].isShow = true;
} else if(rowIndex === 3) { //
this.$refs['printReceptionApproval'].getReceptionData(row.id);
this.$refs['printReceptionApproval'].isShow = true;
} else if(rowIndex === 4) { //
this.$refs['printReceptionSettlement'].getSettlementData(row.id);
this.$refs['printReceptionSettlement'].isShow = true;
} else if(rowIndex === 5) { //
this.$refs['printReimbursement'].getReimbursementData(row.id);
this.$refs['printReimbursement'].isShow = true;
} else if(rowIndex === 6) { //
this.$refs['printUtilityBill'].getUtilityData(row.id);
this.$refs['printUtilityBill'].isShow = true;
} else {
this.$Message.warning('该行不支持打印功能');
}

Loading…
Cancel
Save