|  | @@ -159,22 +159,39 @@ export default {
 | 
											
												
													
														|  |              size: A4 landscape;
 |  |              size: A4 landscape;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |        }
 |  |        }
 | 
											
												
													
														|  | 
 |  | +      .el-table__empty-block {
 | 
											
												
													
														|  | 
 |  | +        width: calc(11.7in - 1.27cm) !important;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      th:nth-last-child(2) {
 | 
											
												
													
														|  | 
 |  | +        display: none !important;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      td:last-child {
 | 
											
												
													
														|  | 
 |  | +        display: none;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      .title {
 | 
											
												
													
														|  | 
 |  | +        line-height: 44px;
 | 
											
												
													
														|  | 
 |  | +        text-align: center;
 | 
											
												
													
														|  | 
 |  | +        font-size: 16px;
 | 
											
												
													
														|  | 
 |  | +        background-color: #ffffff;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  |        </style>`
 |  |        </style>`
 | 
											
												
													
														|  |        const iframe = document.createElement('iframe');
 |  |        const iframe = document.createElement('iframe');
 | 
											
												
													
														|  | -      iframe.setAttribute('style', `position: absolute;top: 0;left: 0;width: 11.7in;height: 300px;z-index: -1;opacity: 0;border: none;background-color: #efefef;`)
 |  | 
 | 
											
												
													
														|  | 
 |  | +      iframe.setAttribute('style', `position: absolute;top: 0;left: 0;width: calc(11.7in - 1.27cm);height: 300px;z-index: -1;opacity: 0;border: none;background-color: #efefef;`)
 | 
											
												
													
														|  |        document.body.appendChild(iframe);
 |  |        document.body.appendChild(iframe);
 | 
											
												
													
														|  |        const doc = iframe.contentDocument;
 |  |        const doc = iframe.contentDocument;
 | 
											
												
													
														|  | -      doc.write(style + content);
 |  | 
 | 
											
												
													
														|  | -      if (title) {
 |  | 
 | 
											
												
													
														|  | -        doc.title = title;
 |  | 
 | 
											
												
													
														|  | -      }
 |  | 
 | 
											
												
													
														|  | 
 |  | +      const titleDom = `<div class="title">${title}</div>`;
 | 
											
												
													
														|  | 
 |  | +      doc.write(style + titleDom + content);
 | 
											
												
													
														|  | 
 |  | +      // if (title) {
 | 
											
												
													
														|  | 
 |  | +      //   doc.title = title;
 | 
											
												
													
														|  | 
 |  | +      // }
 | 
											
												
													
														|  |        // 以下设置只对el-table有效,如果打印的不是el-table请注释
 |  |        // 以下设置只对el-table有效,如果打印的不是el-table请注释
 | 
											
												
													
														|  |        const thead = doc.querySelector('.el-table__header-wrapper thead');
 |  |        const thead = doc.querySelector('.el-table__header-wrapper thead');
 | 
											
												
													
														|  |        thead.classList.add('el-table__header-wrapper');
 |  |        thead.classList.add('el-table__header-wrapper');
 | 
											
												
													
														|  | -      thead.style.width='100%';
 |  | 
 | 
											
												
													
														|  | 
 |  | +      thead.style.width='calc(11.7in - 1.27cm)';
 | 
											
												
													
														|  |        const tbody = doc.querySelector('.el-table__body-wrapper table');
 |  |        const tbody = doc.querySelector('.el-table__body-wrapper table');
 | 
											
												
													
														|  | 
 |  | +      tbody.removeChild(tbody.firstElementChild);
 | 
											
												
													
														|  |        tbody.appendChild(thead);
 |  |        tbody.appendChild(thead);
 | 
											
												
													
														|  | -      tbody.style.width='100%';
 |  | 
 | 
											
												
													
														|  | 
 |  | +      tbody.style.width='calc(11.7in - 1.27cm)';
 | 
											
												
													
														|  |        // 打印并移除iframe
 |  |        // 打印并移除iframe
 | 
											
												
													
														|  |        iframe.contentWindow.print();
 |  |        iframe.contentWindow.print();
 | 
											
												
													
														|  |        document.body.removeChild(iframe);
 |  |        document.body.removeChild(iframe);
 |