合同情况

This commit is contained in:
Vergil
2020-03-10 14:46:31 +08:00
parent a111028427
commit 584b25e4bd
5 changed files with 90 additions and 42 deletions

View File

@@ -1,8 +1,8 @@
<template>
<div class="app-container">
<el-card>
<h3 style="margin-top: 0">采购合同</h3>
<el-table v-loading="" :data="tableData1" border stripe style="width: 100%;max-height: 300px;" height="300px" size="mini" highlight-current-row @row-click="searchTable01">
<!--<h3 style="margin-top: 0">采购合同</h3>-->
<el-table v-loading="" :data="tableData1" border stripe style="width: 100%;height: 150px;" height="300px" size="mini" highlight-current-row @row-click="searchTable01">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
@@ -18,7 +18,7 @@
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="100" prop="请款金额">
<el-table-column label="请款金额(元)" align="center" min-width="100" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
@@ -42,28 +42,33 @@
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<h3 style="">合同明细</h3>
<!--<h3 style="">合同明细</h3>-->
<el-row>
<el-col :span="8">
<el-col :span="10">
<el-table :data="gridData1" :summary-method="getSummaries2" border stripe highlight-current-row size="mini" show-summary @row-click="searchContactDetail">
<el-table-column min-width="150" align="center" label="合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column width="120" align="center" label="已付金额" prop="已付金额">
<el-table-column width="120" align="center" label="到货金额(元)" prop="到货金额">
<template slot-scope="scope">
{{ parseFloat(scope.row.到货金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column width="120" align="center" label="已付金额(元)" prop="已付金额">
<template slot-scope="scope">
{{ parseFloat(scope.row.已付金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column width="120" align="center" label="请款金额" prop="请款金额">
<el-table-column width="120" align="center" label="请款金额(元)" prop="请款金额">
<template slot-scope="scope">
{{ parseFloat(scope.row.请款金额).toFixed(2) }}
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="16">
<el-col :span="14">
<el-table :data="contractDetail2" :summary-method="getSummaries" border height="500px" size="mini" stripe show-summary>
<el-table-column label="物料名称" align="center" min-width="150">
<template slot-scope="scope">
@@ -80,17 +85,17 @@
{{ scope.row.物料型号 ? scope.row.物料型号 : scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="70">
<el-table-column label="采购数量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="到货数量" align="center" width="70">
<el-table-column label="到货数量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="100" prop="合计">
<el-table-column label="小计(元)" align="center" min-width="100" prop="合计">
<template slot-scope="scope">
{{ (parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0)).toFixed(2) }}
</template>
@@ -235,8 +240,8 @@ export default {
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 6) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
} else if (index === 3) {
const values = data.map(item => Number(parseFloat(item['数量'])))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
@@ -246,9 +251,32 @@ export default {
return prev
}
}, 0)
sums[index] = sums[index].toFixed(2) + ' '
sums[index] = sums[index] + ' '
} else {
sums[index] = 'N/A'
sums[index] = '0'
}
} else if (index === 4) {
for (let i = 0; i < data.length; i++) {
if (!data[i].到货数量) {
data[i].到货数量 = 0
}
if (!data[i].已到货数量) {
data[i].已到货数量 = 0
}
}
const values = data.map(item => Number(parseInt(item['到货数量'])) + Number(parseInt(item['已到货数量'])))
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] + ' 件'
} else {
sums[index] = '0'
}
}
})