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/EamThirdMaintenanceOrderBatchPrintModal.vue | 353 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 353 insertions(+), 0 deletions(-) diff --git a/src/views/eam/maintenance/modules/EamThirdMaintenanceOrderBatchPrintModal.vue b/src/views/eam/maintenance/modules/EamThirdMaintenanceOrderBatchPrintModal.vue new file mode 100644 index 0000000..0b3c0c8 --- /dev/null +++ b/src/views/eam/maintenance/modules/EamThirdMaintenanceOrderBatchPrintModal.vue @@ -0,0 +1,353 @@ +<template> + <j-modal title="棰勮锛堜粎鍙瑙堝凡瀹屾垚宸ュ崟锛�" :width="948" :visible="visible" switchFullscreen centered + :mask-closable="false" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="spinning" style="height: 100%"> + <div id="dataTable"> + <div v-for="dataItem in dataSource" class="table-container"> + + <template v-if="tableType!==2"> + <div style="page-break-before:always"></div> + + <table class="import-table" :id="'鍔犲伐璁惧涓夌骇淇濆吇楠屾敹鍗�-'+dataItem.equipmentCode"> + <thead> + <tr> + <td colspan="18" style="border: none;text-align: right">{{dataItem.hfCodeB}}</td> + </tr> + </thead> + + <tbody> + <tr style="height: 48px;"> + <th colspan="18" style="border: none;font-size: 20px">鍔犲伐璁惧涓夌骇淇濆吇楠屾敹鍗�</th> + </tr> + + <tr> + <td colspan="3">璁惧绫诲埆</td> + <td colspan="6">{{dataItem.equipmentCategory_dictText}}</td> + + <td colspan="3">璁惧缂栧彿</td> + <td colspan="6">{{dataItem.equipmentCode}}</td> + </tr> + + <tr> + <td colspan="3">璁惧鍚嶇О</td> + <td colspan="6">{{dataItem.equipmentName}}</td> + + <td colspan="3">璁惧鍨嬪彿</td> + <td colspan="6">{{dataItem.equipmentModel}}</td> + </tr> + + <tr> + <td colspan="3" rowspan="2">淇濆吇閮ㄤ綅</td> + <td colspan="6" rowspan="2">淇濆吇鍐呭</td> + <td colspan="3" rowspan="2">楠屾敹鏍囧噯</td> + <td colspan="6">楠屾敹娆℃暟</td> + </tr> + + <tr> + <td colspan="3">绗竴娆℃</td> + <td colspan="3">绗簩娆℃</td> + </tr> + + <tr v-for="item in dataItem.eamThirdMaintenanceOrderDetailList"> + <td colspan="3" :rowSpan="item.rowSpan" v-show="!item.rowSpanDis">{{item.itemPart}}</td> + <td colspan="6">{{item.itemName}}</td> + <td colspan="3">{{item.itemDemand}}</td> + <td colspan="3">{{+item.firstInspectResult?'鈭�':'脳'}}</td> + <td colspan="3">{{item.secondInspectResult}}</td> + </tr> + </tbody> + </table> + + <div style="display:flex;justify-content: space-between; margin-top: 5px;padding: 0 20px"> + <div>妫�鏌ヤ汉鍛橈細{{dataItem.inspectorSignature_dictText}}</div> + <div>妫�鏌ユ棩鏈燂細{{dataItem.inspectTime}}</div> + </div> + </template> + + <template v-if="tableType!==1"> + <div style="page-break-before:always"></div> + + <table class="import-table" :id="'鍔犲伐璁惧涓夌骇淇濆吇瀹屽伐绉讳氦鍗�-'+dataItem.equipmentCode"> + <thead> + <tr> + <td colspan="18" style="border: none;text-align: right">{{dataItem.hfCodeA}}</td> + </tr> + </thead> + + <tbody> + <tr style="height: 48px;"> + <th colspan="18" style="border: none;font-size: 20px">鍔犲伐璁惧涓夌骇淇濆吇瀹屽伐绉讳氦鍗�</th> + </tr> + + <tr> + <td colspan="3">璁惧鍚嶇О</td> + <td colspan="3">{{dataItem.equipmentName}}</td> + <td colspan="3">璁惧鍨嬪彿</td> + <td colspan="3">{{dataItem.equipmentModel}}</td> + <td colspan="3">缁熶竴缂栧彿</td> + <td colspan="3">{{dataItem.equipmentCode}}</td> + </tr> + + <tr> + <td colspan="3">浣跨敤鍗曚綅</td> + <td colspan="3">{{dataItem.factoryName}}</td> + <td colspan="3">淇濆吇鏃ユ湡</td> + <td colspan="9">{{dataItem.maintenanceDateFormatted}}</td> + </tr> + + <tr> + <td colspan="18" style="text-align: left;padding: 5px"> + 淇濆吇鍓嶆妧鏈姸鎬�<br/> + 1銆佽澶囧姛鑳芥槸鍚﹂綈鍏細{{+dataItem.fullyFunctional===1?'鏄紙鈭氾級鍚︼紙锛�':'鏄紙锛夊惁锛堚垰锛�'}}<br/> + 2銆佽澶囪兘鍚︽甯歌繍杞紝婊¤冻鍔犲伐瑕佹眰锛歿{+dataItem.runningNormally===1?'鏄紙鈭氾級鍚︼紙锛�':'鏄紙锛夊惁锛堚垰锛�'}}<br/> + 3銆侀棶棰樻弿杩帮細{{dataItem.problemDescription}} + </td> + </tr> + + <tr> + <td colspan="18" style="text-align: left;padding: 5px"> + 淇濆吇鍐呭<br/> + 1銆佹寜鐓т笁绾т繚鍏昏鑼冭繘琛屼繚鍏汇��<br/> + 2銆佸鏁存敼鎯呭喌杩涜鎻忚堪銆� + </td> + </tr> + + <tr> + <td colspan="18" style="text-align: left;padding: 5px"> + 淇悊鏇存崲澶囦欢鏄庣粏锛� + </td> + </tr> + + <tr> + <td colspan="3">搴忓彿</td> + <td colspan="3">鍚嶇О</td> + <td colspan="3">鍨嬪彿</td> + <td colspan="3">鏁伴噺</td> + <td colspan="6">澶囨敞</td> + </tr> + + <tr v-for="item in dataItem.eamThirdMaintenanceSpareList"> + <td colspan="3">{{item.spareCode}}</td> + <td colspan="3">{{item.spareName}}</td> + <td colspan="3">{{item.spareModel}}</td> + <td colspan="3">{{item.spareQuantity}}</td> + <td colspan="6">{{item.remark}}</td> + </tr> + + <tr> + <td colspan="18" style="text-align: left;padding: 5px"> + 璇ヨ澶囩粡涓夌骇淇濆吇妫�鏌ュ悗锛岃揪鍒颁繚鍏昏鑼冭姹傘�� + <br/><br/><br/> + <div style="display: flex;justify-content: space-between"> + <div>鎿嶄綔浜哄憳锛歿{dataItem.operatorSignature_dictText}}</div> + <div>缁翠慨瀹や富浠伙細{{dataItem.repairManagerSignature_dictText}}</div> + <br/><br/><br/> + </div> + + + <div style="display: flex;justify-content: space-between"> + <div>缁翠慨浜哄憳锛歿{dataItem.repairmanSignature_dictText}}</div> + <div>璁惧妫�楠屽憳锛歿{dataItem.inspectorSignature_dictText}}</div> + <br/> + </div> + </td> + </tr> + </tbody> + </table> + </template> + </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: 'EamThirdMaintenanceOrderBatchPrintModal', + data() { + return { + visible: false, + spinning: false, + tableType: null, + dataSource: [ + { + hfCode: 'HF-16548ASDSADA', + equipmentName: '鎵嬫墦鍗佺偣澶�', + equipmentModel: '6500P', + equipmentCode: '2125400', + factoryName: '鐕冩満鍘�', + maintenanceDateFormatted: '2025骞�5鏈�20鏃�' + + } + ], + url: { + list1: '/eam/thirdMaintenanceOrder/batchExportCheck', + list2: '/eam/thirdMaintenanceOrder/batchExport' + } + } + }, + methods: { + /** + * 鎵归噺棰勮 + * @param type String 灞曠ず绫诲瀷 + * @param ids String 涓婚〉闈㈠垪琛ㄥ嬀閫塱ds + */ + handlePreview(type, ids) { + this.visible = true + this.spinning = true + this.dataSource = [] + this.tableType = type + if (type === 3) { + this.displayAllTableType(ids) + return + } + const that = this + getAction(this.url['list' + type], { ids }) + .then(res => { + if (res.success) { + that.dataSource = res.result + that.combineCell() + } + }) + .finally(() => { + that.spinning = false + }) + }, + + displayAllTableType(ids) { + const that = this + getAction(this.url.list1, { ids }) + .then(res1 => { + if (res1.success) { + getAction(this.url.list2, { ids }) + .then(res2 => { + if (res2.success) { + res1.result.forEach(item1 => { + for (let i = 0; i < res2.result.length; i++) { + if (item1.id === res2.result[i].id) { + console.log('res2', res2.result) + const dataItem = { ...item1, ...res2.result[i] } + that.dataSource.push(dataItem) + console.log('item1', item1) + break + } + } + }) + that.combineCell() + } + }) + .finally(() => { + that.spinning = false + }) + } + }) + + }, + + // 鍚堝苟 + combineCell() { + this.dataSource.forEach(item => { + let list = item.eamThirdMaintenanceOrderDetailList + let k = 0 + while (k < list.length) { + list[k]['rowSpan'] = 1 + list[k]['rowSpanDis'] = false + for (var i = k + 1; i <= list.length - 1; i++) { + if (list[k]['itemPart'] === list[i]['itemPart'] && list[k]['itemPart'] !== '') { + list[k]['rowSpan']++ + list[k]['rowSpanDis'] = false + list[i]['rowSpan'] = 1 + list[i]['rowSpanDis'] = true + } else { + break + } + } + k = i + } + }) + console.log('dataSource', this.dataSource) + }, + + handleImport() { + document.querySelectorAll('table.import-table').forEach(item => { + console.log('item', item) + $(item).table2excel({ + exclude: '.noExl', + name: 'Excel Document Name', + filename: item.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-container:not(:last-child) { + margin-bottom: 20px; + } + + table { + width: 100%; + text-align: center; + table-layout: fixed; + + td, th { + border: 1px solid #000; + } + + td.vertical-display { + transform: rotate(360deg); + writing-mode: vertical-lr; + letter-spacing: 5px; + padding: 10px 0; + } + } +</style> \ No newline at end of file -- Gitblit v1.9.3