From 5d9726ee8fbf5c6648aa6e822b5509b51cfd758c Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期三, 20 八月 2025 17:43:00 +0800 Subject: [PATCH] 点检工单新增批量打印以及导出功能 --- src/views/eam/maintenance/modules/EamInspectionOrderBatchPrintModal.vue | 242 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 242 insertions(+), 0 deletions(-) diff --git a/src/views/eam/maintenance/modules/EamInspectionOrderBatchPrintModal.vue b/src/views/eam/maintenance/modules/EamInspectionOrderBatchPrintModal.vue new file mode 100644 index 0000000..dbc9c10 --- /dev/null +++ b/src/views/eam/maintenance/modules/EamInspectionOrderBatchPrintModal.vue @@ -0,0 +1,242 @@ +<template> + <j-modal title="棰勮" :width="1248" :visible="visible" switchFullscreen centered + :mask-closable="false" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="spinning" style="height: 100%;"> + <div id="dataTable"> + <div class="table-container" v-for="dataItem in dataSource"> + <div style="page-break-before:always"></div> + + <table class="import-table" :id="dataItem.inspectionYear+dataItem.inspectionMonth+'-'+dataItem.equipmentCode"> + <thead> + <tr> + <td colspan="42" style="border: none"> + <div style="text-align: right">{{dataItem.hfCode}}</div> + </td> + </tr> + </thead> + + <tbody> + <tr style="height: 48px;position: relative"> + <th colspan="42">鐢熶骇璁惧鑷富缁存姢鐐规琛�</th> + </tr> + + <tr style="height: 48px"> + <th colspan="9">璁惧鍚嶇О锛歿{dataItem.equipmentName}}</th> + <th colspan="9">璁惧鍨嬪彿锛歿{dataItem.equipmentModel}}</th> + <th colspan="9">缁熶竴缂栧彿锛歿{dataItem.equipmentCode}}</th> + <th colspan="6"> + {{dataItem.inspectionYear}} 骞� {{dataItem.inspectionMonth}} 鏈� + </th> + <th colspan="9">鍗曚綅锛歿{dataItem.factoryName_dictText}}</th> + </tr> + + <tr> + <td rowspan="2">搴忓彿</td> + <td rowspan="2" colspan="5">鐐规椤圭洰</td> + <td rowspan="2" colspan="5">瀹屾垚鏁版嵁/瑕佹眰</td> + <td colspan="31">鏃ユ湡</td> + </tr> + + <tr> + <td v-for="item in 31">{{item}}</td> + </tr> + + <tr v-for="item in dataItem.eamDailyInspectionList"> + <td>{{item.itemCode}}</td> + <td colspan="5">{{item.itemName}}</td> + <td colspan="5">{{item.itemDemand}}</td> + <td v-for="childItem in item.dateFlag">{{childItem!==null?childItem:''}}</td> + </tr> + + <tr> + <td colspan="11">缁存姢璐d换浜虹瀛�</td> + <td v-for="item in dataItem.dailyResponsibleInfo.operators"> + {{item!==null?item:''}} + </td> + </tr> + + <tr> + <td colspan="11">妫�鏌ヨ矗浠讳汉绛惧瓧</td> + <td v-for="item in dataItem.dailyResponsibleInfo.confirmUsers"> + {{item!==null?item:''}} + </td> + </tr> + + <tr style="height: 48px"> + <td>搴忓彿</td> + <td colspan="5">鍛ㄤ繚鍏婚」鐩�</td> + <td colspan="5">妫�鏌ユ爣鍑�</td> + <td colspan="31">鍛ㄤ繚鎵ц璁板綍</td> + </tr> + + <tr v-for="item in dataItem.eamWeeklyInspectionList"> + <td>{{item.itemCode}}</td> + <td colspan="5">{{item.itemName}}</td> + <td colspan="5">{{item.itemDemand}}</td> + + <td v-for="(childItem,childIndex) in item.weekFlag" + :colspan="childIndex!==item.weekFlag.length-1?6:7"> + {{childItem!==null?childItem:''}} + </td> + </tr> + + <tr> + <td colspan="11">鍛ㄤ繚鍏绘搷浣滆�呮墽琛岋紙鎿嶄綔鑰呯瀛楋級</td> + <td v-for="(item,index) in dataItem.weeklyResponsibleInfo.operators" + :colspan="index!==dataItem.weeklyResponsibleInfo.operators.length-1?6:7"> + {{item!==null?item:''}} + </td> + </tr> + + <tr> + <td colspan="11">鍛ㄤ繚鍏绘鏌ヤ汉纭锛堢淮淇汉鍛樼瀛楋級</td> + <td v-for="(item,index) in dataItem.weeklyResponsibleInfo.confirmUsers" + :colspan="index!==dataItem.weeklyResponsibleInfo.confirmUsers.length-1?6:7"> + {{item!==null?item:''}} + </td> + </tr> + + <tr> + <td colspan="42"> + <div style="text-align: left"> + 濉啓瑕佹眰锛氭甯革紳鈭氾紝寮傚父锛澝楋紝鏁呴殰鍋滄満锛濃柍锛屾病寮�鏈猴紳T锛氳澶囨棩甯哥偣妫�璁板綍鐢辨搷浣滀汉鍛樻墽琛屽苟璁板綍銆傛墽琛屾儏鍐垫鏌ョ敱缁翠慨浜哄憳璐熻矗鎵ц骞惰褰曪紝瀵瑰彂鐜伴棶棰樿褰曡嚦鐐规琛ㄨ儗闈㈠娉ㄦ爮锛屽鍙戠幇闂杩涜鍏ㄧ▼闂幆璁板綍銆� + </div> + </td> + </tr> + </tbody> + </table> + </div> + </div> + </a-spin> + + <template slot="footer"> + <a-button @click="handleCancel">鍏抽棴</a-button> + <a-button type="primary" @click="handleImport">瀵煎嚭</a-button> + <a-button type="primary" v-print="'#dataTable'">鎵撳嵃</a-button> + </template> + </j-modal> +</template> + +<script> + import { getAction } from '@/api/manage' + import $ from 'jquery' + import '@/components/table2excel/table2excel' + + export default { + name: 'EamInspectionOrderBatchPrintModal', + data() { + return { + visible: false, + dataSource: [], + spinning: false, + url: { + list: '/eam/eamInspectionOrder/printInspectionOrder' + } + } + }, + methods: { + /** + * 鎵归噺棰勮 + * @param ids String 涓婚〉闈㈠垪琛ㄥ嬀閫塱ds + */ + handlePreview(ids) { + this.visible = true + this.spinning = true + this.dataSource = [] + const that = this + getAction(this.url.list, { ids }) + .then(res => { + if (res.success) that.dataSource = res.result + }) + .finally(() => { + that.spinning = false + }) + }, + + handleImport() { + document.querySelectorAll('table.import-table').forEach(element => { + console.log('element', element.id) + $(element).table2excel({ + exclude: '.noExl', + name: 'Excel Document Name', + filename: '鐢熶骇璁惧鑷富缁存姢鐐规琛�-' + element.id, + exclude_img: true, + fileext: '.xls', + exclude_links: true, + exclude_inputs: false + }) + }) + }, + + + handleCancel() { + this.close() + }, + + close() { + this.$emit('close') + this.visible = false + if (this.$refs.form) this.$refs.form.clearValidate() + } + } + } +</script> + +<style scoped lang="less"> + /deep/ .ant-modal { + height: 90%; + overflow: hidden; + + .ant-modal-content { + height: 100%; + display: flex; + flex-direction: column; + overflow: hidden; + + ::-webkit-scrollbar { + width: 8px; + height: 8px; + } + + .ant-modal-body { + flex: 1; + overflow: auto; + } + } + } + + table { + width: 100%; + text-align: center; + table-layout: fixed; + + td, th { + border: 1px solid #000; + } + + tr:first-child th { + border-bottom: 0; + } + + tr:nth-child(2) th { + border-top: 0; + } + + tr:nth-child(2) th { + border-left: 0; + border-right: 0; + } + + tr:nth-child(2) th:first-child { + border-left: 1px solid #000; + } + + tr:nth-child(2) th:last-child { + border-right: 1px solid #000; + } + } + + .table-container:not(:last-child) { + margin-bottom: 20px; + } +</style> \ No newline at end of file -- Gitblit v1.9.3