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
<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}}&nbsp;年&nbsp;{{dataItem.inspectionMonth}}&nbsp;月
              </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">维护责任人签字</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 主页面列表勾选ids
       */
      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>