报废及制造采购导出

This commit is contained in:
liushuai
2020-02-10 16:17:14 +08:00
parent 6d4033c92a
commit 436bb728eb
7 changed files with 198 additions and 374 deletions

View File

@@ -1,8 +1,8 @@
<template>
<div class="app-container">
<el-card>
<el-card style="width: 47%">
<span>项目名称:</span>
<el-select v-model="projectValue" placeholder="项目名称" size="small" filterable clearable>
<el-select v-model="projectValue" placeholder="项目名称" size="small" style="width: 180px" filterable clearable>
<el-option
v-for="item in project"
:key="item.value"
@@ -10,45 +10,48 @@
:value="item.value"/>
</el-select>
<el-button
type="success"
type="primary"
size="small"
plain
icon="el-icon-search"
style="margin-left:10px"
@click="total1=0;pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
@click="searchTable1()">查询</el-button>
<el-button
type="primary"
size="small"
plain
icon="el-icon-download"
style="margin-left:10px"
@click="searchTable1()">导出项目采购明细</el-button>
</el-card>
<el-card>
<el-card style="width: 47%">
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries1" show-summary border style="width: 100%;max-height: 700px;" height="700px">
<el-table-column label="项目名称" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" min-width="100">
<el-table-column label="零件名称" align="center" width="150">
<template slot-scope="scope">
{{ scope.row.物料名称 ? scope.row.物料名称 : scope.row.组件名称 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" align="center" min-width="100">
<el-table-column label="图号或型号" align="center" width="150">
<template slot-scope="scope">
{{ scope.row.物料型号 ? scope.row.物料型号 : scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="材料或规格" align="center" min-width="100">
<el-table-column label="材料或规格" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.材料 ? scope.row.材料 : scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" min-width="100">
<el-table-column label="数量" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="100">
<el-table-column label="单价(元)" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="小计(元)" align="center" min-width="100" prop="金额">
<el-table-column label="小计(元)" align="center" width="100" prop="金额">
<template slot-scope="scope">
{{ scope.row.金额 }}
</template>
@@ -111,39 +114,11 @@ export default {
this.$message.error('请选择项目')
}
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 4) {
sums[index] = '合计'
return
} else if (index === 5) {
const values = data.map(item => Number(item['金额']))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number(prev) + Number(curr)
} else {
return Number(prev)
}
}, 0)
sums[index] += ' 元(未税)'
} else {
sums[index] = 'N/A'
}
} else if (index === 6) {
sums[index] = parseInt(parseInt(sums[5]) * 1.16 * 100) / 100 + ' 元(含税)'
}
})
return sums
},
getSummaries1(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 4) {
if (index === 0) {
sums[index] = '合计'
return
} else if (index === 5) {
@@ -157,12 +132,10 @@ export default {
return Number(prev)
}
}, 0)
sums[index] += ' 元(税)'
sums[index] += ' 元(税)'
} else {
sums[index] = 'N/A'
}
} else if (index === 6) {
sums[index] = parseInt(parseInt(sums[5]) * 1.16 * 100) / 100 + ' 元(含税)'
}
})
return sums