打印
This commit is contained in:
@@ -322,6 +322,7 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange2"
|
||||
@current-change="handleCurrentChange2"/>
|
||||
<el-button :disabled="tableData3.length===0" type="warning" size="mini" style="margin-left:10px;float: right" @click="printInquirySheet()">打印</el-button>
|
||||
<el-button :disabled="tableData3.length===0" type="warning" size="mini" style="margin-left:10px;float: right" @click="exportInquirySheet()">导出</el-button>
|
||||
<el-button :disabled="tableData3.length===0" type="success" size="mini" style="float: right" @click="saveOrder()">保存</el-button>
|
||||
</div><hr>
|
||||
@@ -951,6 +952,61 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
printInquirySheet() { // 打印询价单
|
||||
this.$confirm('确定打印该询价单?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
if (this.tableData3.length === 0 && !this.supplierExport) {
|
||||
this.$message.error('请选择正确的询价单导出')
|
||||
} else {
|
||||
const children = document.getElementsByClassName('tableData')
|
||||
const parent = document.getElementsByClassName('inquirySheet')[0]
|
||||
if (children.length !== 0) {
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
parent.removeChild(children[i])
|
||||
}
|
||||
}
|
||||
const tr = []
|
||||
let length = 0
|
||||
this.tableData3.length < 15 ? length = 15 : length = this.tableData3.length
|
||||
for (let i = 0; i < length; i++) {
|
||||
tr[i] = document.createElement('tr')
|
||||
tr[i].setAttribute('class', 'tableData')
|
||||
tr[i].innerHTML = `<td width="8.3%" height="30px"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" colspan="3"/>`
|
||||
$('#tablehead').after(tr[i])
|
||||
}
|
||||
for (let j = 0; j < this.tableData3.length; j++) {
|
||||
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
|
||||
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.tableData3[j].物料型号 || this.tableData3[j].零件图号
|
||||
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料名称 || this.tableData3[j].零件名称
|
||||
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料规格 || this.tableData3[j].规格
|
||||
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量
|
||||
document.getElementsByClassName('tableData')[j].children[6].innerHTML = this.tableData3[j].备注
|
||||
}
|
||||
document.getElementById('inquirySheetNum').innerHTML = this.orderExport
|
||||
document.getElementById('supplier').innerHTML = this.supplierExport
|
||||
}
|
||||
}).then(() => {
|
||||
const htmlNode = $('#inquirySheet').html()
|
||||
const body = $('body').attr('style', 'padding: 20px;margin: 0 auto;display: block;width: 800px;background: #fff;')
|
||||
body.children().hide()
|
||||
const printNode = $(htmlNode)
|
||||
body.append(printNode)
|
||||
window.print()
|
||||
body.removeAttr('style')
|
||||
body.children().not('script').show()
|
||||
body.children().not('#app').hide()
|
||||
printNode.remove()
|
||||
}).catch(res => {
|
||||
console.log(res)
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作'
|
||||
})
|
||||
})
|
||||
},
|
||||
exportInquirySheet() { // 导出询价单
|
||||
this.$confirm('确认导出询价单?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
||||
Reference in New Issue
Block a user