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/EamInspectionOrderList.vue | 85 ++++++++++--- src/views/eam/maintenance/modules/EamInspectionOrderBatchPrintModal.vue | 242 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 307 insertions(+), 20 deletions(-) diff --git a/src/views/eam/maintenance/EamInspectionOrderList.vue b/src/views/eam/maintenance/EamInspectionOrderList.vue index 7342365..da54591 100644 --- a/src/views/eam/maintenance/EamInspectionOrderList.vue +++ b/src/views/eam/maintenance/EamInspectionOrderList.vue @@ -40,21 +40,34 @@ <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> <div class="table-operator" v-if="isDisplayOperation"> <a-button v-has="'eam:inspection:add'" @click="handleAdd" type="primary" icon="plus">鏂板</a-button> - <a-dropdown v-if="selectedRowKeys.length > 0"> - <a-menu slot="overlay"> - <a-menu-item key="1" @click="batchZf('ABOLISH')" v-has="'eam:inspection:abolish'"> - <a-icon type="snippets"/> - 浣滃簾 - </a-menu-item> - <a-menu-item key="2" @click="batchLq('UNDER_INSPECTION')" v-has="'eam:inspection:collect'"> - <a-icon type="form"/> - 棰嗗彇 - </a-menu-item> - </a-menu> - <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 - <a-icon type="down"/> - </a-button> - </a-dropdown> + <!--<a-dropdown v-if="selectedRowKeys.length > 0">--> + <!--<a-menu slot="overlay">--> + <!--<a-menu-item key="1" @click="batchZf('ABOLISH')" v-has="'eam:inspection:abolish'">--> + <!--<a-icon type="snippets"/>--> + <!--浣滃簾--> + <!--</a-menu-item>--> + <!--<a-menu-item key="2" @click="batchLq('UNDER_INSPECTION')" v-has="'eam:inspection:collect'">--> + <!--<a-icon type="form"/>--> + <!--棰嗗彇--> + <!--</a-menu-item>--> + <!--<a-menu-item key="3" @click="handleBatchPrint">--> + <!--<a-icon type="printer"/>--> + <!--鎵撳嵃--> + <!--</a-menu-item>--> + <!--</a-menu>--> + <!--<a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔--> + <!--<a-icon type="down"/>--> + <!--</a-button>--> + <!--</a-dropdown>--> + + <a-button type="primary" icon="delete" @click="batchZf('ABOLISH')" v-has="'eam:inspection:abolish'" + :disabled="selectedRowKeys.length===0">鎵归噺浣滃簾 + </a-button> + <a-button type="primary" icon="form" @click="batchLq('UNDER_INSPECTION')" v-has="'eam:inspection:collect'" + :disabled="selectedRowKeys.length===0">鎵归噺棰嗗彇 + </a-button> + <a-button type="primary" icon="monitor" @click="handleBatchPrint" :disabled="selectedRowKeys.length===0">鎵归噺棰勮 + </a-button> </div> <!-- table鍖哄煙-begin --> @@ -97,20 +110,26 @@ </template> <template v-else> - <template v-if="record.inspectionStatus=='COMPLETE'"> - <a @click="handlePrint(record)">棰勮</a> - <a-divider type="vertical"/> - </template> - <a @click="handleDetail(record)">璇︽儏</a> + + <template v-if="record.inspectionStatus=='COMPLETE'"> + <a-divider type="vertical"/> + + <a @click="handlePrint(record)">棰勮</a> + </template> </template> </span> </a-table> </div> + <!--琛ㄥ崟寮圭獥--> <eam-inspection-order-modal ref="modalForm" @ok="modalFormOk"/> + <!--瀹℃壒寮圭獥--> <inspection-order-handle ref="modalFormXq" :selectShenpiData="selectInspectionOrderXqData"/> + + <!--鎵归噺鎵撳嵃寮圭獥--> + <eam-inspection-order-batch-print-modal ref="batchPrintModal"/> </a-card> </template> @@ -120,11 +139,13 @@ import { deleteAction, getAction } from '@api/manage' import InspectionOrderHandle from '../../flowable/workflow/InspectionOrder/InspectionOrderHandle' import LxSearchEquipmentSelect from '../equipment/modules/LxSearchEquipmentSelect' + import EamInspectionOrderBatchPrintModal from './modules/EamInspectionOrderBatchPrintModal' export default { name: 'EamInspectionOrderList', mixins: [JeecgListMixin], components: { + EamInspectionOrderBatchPrintModal, LxSearchEquipmentSelect, InspectionOrderHandle, EamInspectionOrderModal @@ -281,6 +302,10 @@ this.$refs.modalFormXq.handleDetail(record) }, + /** + * 棰嗗彇 + * @param id + */ handleInspection(id) { var that = this this.loading = true @@ -302,6 +327,10 @@ }) }, + /** + * 浣滃簾 + * @param id + */ handleAbolish(id) { var that = this this.loading = true @@ -323,6 +352,10 @@ }) }, + /** + * 鎵归噺浣滃簾 + * @param type + */ batchZf(type) { var ids = '' for (var a = 0; a < this.selectedRowKeys.length; a++) { @@ -356,6 +389,10 @@ }) }, + /** + * 鎵归噺棰嗗彇 + * @param type + */ batchLq(type) { var ids = '' for (var a = 0; a < this.selectedRowKeys.length; a++) { @@ -390,11 +427,19 @@ }) }, + /** + * 棰勮 + * @param record + */ handlePrint(record) { let href = `${window._CONFIG['domianURL']}/jmreport/view/1105664887569121280?equipmentCode=` + record.equipmentCode window.open(href, '_blank') }, + handleBatchPrint() { + this.$refs.batchPrintModal.handlePreview(this.selectedRowKeys.join()) + }, + onInspectionDateChange: function(value, dateString) { this.queryParam.inspectionDateBegin = dateString[0] this.queryParam.inspectionDateEnd = dateString[1] 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