zhaowei
22 小时以前 5d9726ee8fbf5c6648aa6e822b5509b51cfd758c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
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 主页面列表勾选ids
       */
      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>