询价单合并数量

This commit is contained in:
chenjianan
2019-05-27 11:59:54 +08:00
parent edcc2c577c
commit 8854c04660
2 changed files with 87 additions and 72 deletions

View File

@@ -320,3 +320,15 @@ export function editBaseInfo(...params) {
} }
}) })
} }
// 查询询价单基础信息维护
export function searchMerge(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_询价单明细合并_查询数据',
param: '询价单流水号=' + num
}
})
}

View File

@@ -790,7 +790,7 @@
<script> <script>
import { searchMaterial, searchPart, searchSupplier, searchCreateInquirySheet, searchCreateInquirySheet2, searchSheetDetail, editInquirySheet, import { searchMaterial, searchPart, searchSupplier, searchCreateInquirySheet, searchCreateInquirySheet2, searchSheetDetail, editInquirySheet,
createInquirySheet, deleteInquirySheet, addInquirySheet1, addInquirySheet2, outInquirySheet, searchAllMaterial, materialChange, saveOrder, createInquirySheet, deleteInquirySheet, addInquirySheet1, addInquirySheet2, outInquirySheet, searchAllMaterial, materialChange, saveOrder,
submitUseInventory, initProject, searchMachine, searchGroup, searchBaseInfo, editBaseInfo, getExport1, getExport2 } from '@/api/PurchasingCenter/CreateInquirySheet' submitUseInventory, initProject, searchMachine, searchGroup, searchBaseInfo, editBaseInfo, getExport1, getExport2, searchMerge } from '@/api/PurchasingCenter/CreateInquirySheet'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { exportExcelMethod } from './exportExcel' import { exportExcelMethod } from './exportExcel'
import $ from 'jquery' import $ from 'jquery'
@@ -942,7 +942,6 @@ export default {
standardAndPurchaseValue: '', // 标准件和外购件流水号 standardAndPurchaseValue: '', // 标准件和外购件流水号
title2: '', title2: '',
orderExport: '', orderExport: '',
supplierExport: '',
useNumber: '', useNumber: '',
maxUseNumber: '', maxUseNumber: '',
dialogVisible4: false, dialogVisible4: false,
@@ -1142,7 +1141,7 @@ export default {
}) })
}, },
selectable(row, index) { // 控制某行是否可选 selectable(row, index) { // 控制某行是否可选
return (parseInt(row.询价状态编号) === 1 && parseInt(row.采购状态编号) === 1 && parseInt(row.是否确认) === 1) // 未询价&&未采购&&确认物料修改 return (parseInt(row.询价状态编号) === 1 && parseInt(row.采购状态编号) < 3 && parseInt(row.是否确认) === 1) // 未询价&&未采购&&确认物料修改
}, },
filterHandler0(value, row) { // 筛选备注 filterHandler0(value, row) { // 筛选备注
return row['备注'] === value return row['备注'] === value
@@ -1348,7 +1347,8 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
if (this.tableData3.length === 0 && !this.supplierExport) { searchMerge(this.inquirySheetFlowNum).then(res => {
if (res.data.length === 0) {
this.$message.error('请选择正确的询价单导出') this.$message.error('请选择正确的询价单导出')
} else { } else {
const children = document.getElementsByClassName('tableData') const children = document.getElementsByClassName('tableData')
@@ -1360,20 +1360,20 @@ export default {
} }
const tr = [] const tr = []
let length = 0 let length = 0
this.tableData3.length < 15 ? length = 15 : length = this.tableData3.length res.data.length < 15 ? length = 15 : length = res.data.length
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
tr[i] = document.createElement('tr') tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData') 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"/>` 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]) $('#tablehead').after(tr[i])
} }
for (let j = 0; j < this.tableData3.length; j++) { for (let j = 0; j < res.data.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1 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[1].innerHTML = res.data[j].物料型号 || res.data[j].零件图号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料名称 || this.tableData3[j].零件名称 document.getElementsByClassName('tableData')[j].children[2].innerHTML = res.data[j].物料名称 || res.data[j].零件名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料规格 || this.tableData3[j].规格 document.getElementsByClassName('tableData')[j].children[3].innerHTML = res.data[j].物料规格 || res.data[j].规格
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量 document.getElementsByClassName('tableData')[j].children[4].innerHTML = res.data[j].数量
document.getElementsByClassName('tableData')[j].children[6].innerHTML = this.tableData3[j].备注 document.getElementsByClassName('tableData')[j].children[6].innerHTML = res.data[j].备注
} }
document.getElementById('inquirySheetNum').innerHTML = this.orderExport document.getElementById('inquirySheetNum').innerHTML = this.orderExport
document.getElementById('supplier').innerHTML = '' document.getElementById('supplier').innerHTML = ''
@@ -1389,6 +1389,7 @@ export default {
body.children().not('script').show() body.children().not('script').show()
body.children().not('#app').hide() body.children().not('#app').hide()
printNode.remove() printNode.remove()
})
}).catch(res => { }).catch(res => {
console.log(res) console.log(res)
this.$message({ this.$message({
@@ -1403,7 +1404,9 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
if (this.tableData3.length === 0 && !this.supplierExport) { // 询价单导出结果
searchMerge(this.inquirySheetFlowNum).then(res => {
if (res.data.length === 0) {
this.$message.error('请选择正确的询价单导出') this.$message.error('请选择正确的询价单导出')
} else { } else {
const children = document.getElementsByClassName('tableData') const children = document.getElementsByClassName('tableData')
@@ -1415,25 +1418,26 @@ export default {
} }
const tr = [] const tr = []
let length = 0 let length = 0
this.tableData3.length < 15 ? length = 15 : length = this.tableData3.length res.data.length < 15 ? length = 15 : length = res.data.length
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
tr[i] = document.createElement('tr') tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData') 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"/>` 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]) $('#tablehead').after(tr[i])
} }
for (let j = 0; j < this.tableData3.length; j++) { for (let j = 0; j < res.data.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1 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[1].innerHTML = res.data[j].物料型号 || res.data[j].零件图号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料名称 || this.tableData3[j].零件名称 document.getElementsByClassName('tableData')[j].children[2].innerHTML = res.data[j].物料名称 || res.data[j].零件名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料规格 || this.tableData3[j].规格 document.getElementsByClassName('tableData')[j].children[3].innerHTML = res.data[j].物料规格 || res.data[j].规格
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量 document.getElementsByClassName('tableData')[j].children[4].innerHTML = res.data[j].数量
document.getElementsByClassName('tableData')[j].children[6].innerHTML = this.tableData3[j].备注 document.getElementsByClassName('tableData')[j].children[6].innerHTML = res.data[j].备注
} }
document.getElementById('inquirySheetNum').innerHTML = this.orderExport document.getElementById('inquirySheetNum').innerHTML = this.orderExport
document.getElementById('supplier').innerHTML = '' document.getElementById('supplier').innerHTML = ''
exportExcelMethod('inquirySheet', '采购询价单', '采购询价单sheet') exportExcelMethod('inquirySheet', '采购询价单', '采购询价单sheet')
} }
})
}).catch(res => { }).catch(res => {
console.log(res) console.log(res)
this.$message({ this.$message({
@@ -1592,7 +1596,6 @@ export default {
searchTable3(row) { // 查询该询价单中的物料和零件 searchTable3(row) { // 查询该询价单中的物料和零件
this.tableData3 = [] this.tableData3 = []
this.inquirySheetFlowNum = row.询价单流水号 this.inquirySheetFlowNum = row.询价单流水号
this.supplierExport = row.供应商名称
this.orderExport = row.询价单编号 this.orderExport = row.询价单编号
searchSheetDetail(row.询价单流水号).then(response => { searchSheetDetail(row.询价单流水号).then(response => {
console.log(response.data) console.log(response.data)