diff --git a/src/views/PurchasingCenter/FundApproval1/index.vue b/src/views/PurchasingCenter/FundApproval1/index.vue index e36f59c0..9171bc17 100644 --- a/src/views/PurchasingCenter/FundApproval1/index.vue +++ b/src/views/PurchasingCenter/FundApproval1/index.vue @@ -59,7 +59,7 @@

合同明细

- + - + - + - + @@ -100,11 +100,16 @@ {{ scope.row.合同类型 === 1 ? scope.row.交货期.split(' ')[0] === '1900-01-01' ? '-' : scope.row.交货期.split(' ')[0] : scope.row.交货期要求 }} - + + + + @@ -162,7 +167,7 @@ export default { columns.forEach((column, index) => { if (index === 0) { sums[index] = '总价' - } else if (index === 7) { + } else if (index === 6) { const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量']))) if (!values.every(value => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { @@ -173,7 +178,7 @@ export default { return prev } }, 0) - sums[index] += ' 元' + sums[index] = sums[index].toFixed(2) + ' 元' } else { sums[index] = 'N/A' } diff --git a/src/views/PurchasingCenter/FundApproval2/index.vue b/src/views/PurchasingCenter/FundApproval2/index.vue index 7224ca88..59ad373e 100644 --- a/src/views/PurchasingCenter/FundApproval2/index.vue +++ b/src/views/PurchasingCenter/FundApproval2/index.vue @@ -26,11 +26,11 @@ @@ -196,8 +149,33 @@ export default { this.fetchData() }, methods: { + getSummaries2(param) { // 合计 + const { columns, data } = param + const sums = [] + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '总价' + return + } else if (index === 2 || index === 3) { + const values = data.map(item => Number(item[column.property])) + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0) + sums[index] = sums[index].toFixed(2) + ' 元' + } else { + sums[index] = 'N/A' + } + } + }) + return sums + }, showOffline(row) { - console.log(row, 222) const children = document.getElementsByClassName('tableData') const parent = document.getElementsByClassName('offlineContract')[0] if (children.length !== 0) { @@ -236,13 +214,13 @@ export default { document.getElementById('remark').innerHTML = row.离线合同备注 }, searchContactDetail(row) { - document.documentElement.scrollTop = this.$el.querySelector('#firstAnchor').offsetTop - searchContactDetail(row.采购合同流水号).then(response => { - this.contractDetail1 = response.data[0].合同内容 + var check + row.采购合同流水号 ? check = 1 : check = 2 + searchContactDetail(check, row.采购合同流水号, row.离线合同流水号).then(response => { + this.contractDetail2 = response.data }) }, searchOfflineContactDetail(row) { // 查询离线合同明细 - document.documentElement.scrollTop = this.$el.querySelector('#secondAnchor').offsetTop searchMateriel(row.离线合同流水号).then(response => { this.contractDetail2 = response.data this.showOffline(row) @@ -254,7 +232,7 @@ export default { columns.forEach((column, index) => { if (index === 0) { sums[index] = '总价' - } else if (index === 7) { + } else if (index === 6) { const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量']))) if (!values.every(value => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { @@ -265,7 +243,7 @@ export default { return prev } }, 0) - sums[index] += ' 元' + sums[index] = sums[index].toFixed(2) + ' 元' } else { sums[index] = 'N/A' } diff --git a/src/views/PurchasingCenter/FundApproval3/index.vue b/src/views/PurchasingCenter/FundApproval3/index.vue index 2396f385..7d8861ce 100644 --- a/src/views/PurchasingCenter/FundApproval3/index.vue +++ b/src/views/PurchasingCenter/FundApproval3/index.vue @@ -26,11 +26,11 @@ @@ -203,9 +148,37 @@ export default { this.fetchData() }, methods: { + getSummaries2(param) { // 合计 + const { columns, data } = param + const sums = [] + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '总价' + return + } else if (index === 2 || index === 3) { + const values = data.map(item => Number(item[column.property])) + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0) + sums[index] = sums[index].toFixed(2) + ' 元' + } else { + sums[index] = 'N/A' + } + } + }) + return sums + }, searchContactDetail(row) { - searchContactDetail(row.采购合同流水号).then(response => { - this.contractDetail1 = response.data[0].合同内容 + var check + row.采购合同流水号 ? check = 1 : check = 2 + searchContactDetail(check, row.采购合同流水号, row.离线合同流水号).then(response => { + this.contractDetail2 = response.data }) }, searchOfflineContactDetail(row) { // 查询离线合同明细 @@ -219,7 +192,7 @@ export default { columns.forEach((column, index) => { if (index === 0) { sums[index] = '总价' - } else if (index === 7) { + } else if (index === 6) { const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量']))) if (!values.every(value => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { @@ -230,7 +203,7 @@ export default { return prev } }, 0) - sums[index] += ' 元' + sums[index] = sums[index].toFixed(2) + ' 元' } else { sums[index] = 'N/A' }