核算价格
This commit is contained in:
@@ -16,15 +16,7 @@
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
size="small"
|
||||
highlight-current-row
|
||||
min-height="540px"
|
||||
height="540px"
|
||||
stripe
|
||||
border>
|
||||
<el-table v-loading="loading" :data="tableData" :summary-method="getSummaries" size="small" highlight-current-row show-summary min-height="540px" height="540px" stripe border>
|
||||
<el-table-column align="center" label="采购合同编号" width="150px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.采购合同编号 }}
|
||||
@@ -45,7 +37,7 @@
|
||||
{{ scope.row.物料名称 ? scope.row.物料名称 : scope.row.组件名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="数量" width="70px">
|
||||
<el-table-column align="center" label="数量" width="70px" prop="数量">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.数量 }}
|
||||
</template>
|
||||
@@ -55,9 +47,9 @@
|
||||
<el-input v-model="scope.row.单价" size="mini" width="80px" align="center" @blur="filterNuber(scope.row.单价, scope.$index, '单价', scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="总额(元)" width="90px">
|
||||
<el-table-column align="center" label="总额(元)" width="90px" prop="金额">
|
||||
<template slot-scope="scope">
|
||||
{{ Number(scope.row.金额).toFixed(2) }}
|
||||
{{ scope.row.金额 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -75,7 +67,8 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>import { initPayState, searchParts, Preservation } from '@/api/WorkshopProcurement/AccountingPrice'
|
||||
<script>
|
||||
import { initPayState, searchParts, Preservation } from '@/api/WorkshopProcurement/AccountingPrice'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
data() {
|
||||
@@ -128,7 +121,6 @@ export default {
|
||||
if (value.indexOf('.') < 0 && value !== '') {
|
||||
value = parseFloat(value).toFixed(2)
|
||||
}
|
||||
console.log(value)
|
||||
this.tableData[index][date] = value
|
||||
this.tableData[index]['金额'] = value * row.数量
|
||||
this.update(row)
|
||||
@@ -140,7 +132,6 @@ export default {
|
||||
this.contractNumValue ? this.check1 = 1 : this.check1 = 0
|
||||
searchParts(this.pageCurrent, this.pageSize, this.check1, this.contractNumValue).then(response => {
|
||||
this.loading = false
|
||||
console.log(response.data.rows)
|
||||
for (let i = 0; i < response.data.rows.length; i++) {
|
||||
if (response.data.rows[i].物料型号 === null || response.data.rows[i].物料型号 === '') {
|
||||
response.data.rows[i].物料型号 = response.data.rows[i].零件图号
|
||||
@@ -156,27 +147,59 @@ export default {
|
||||
物料名称: response.data.rows[i].物料名称,
|
||||
数量: response.data.rows[i].数量,
|
||||
单价: Number(response.data.rows[i].单价).toFixed(2),
|
||||
金额: response.data.rows[i].金额
|
||||
金额: Number(response.data.rows[i].金额).toFixed(2)
|
||||
})
|
||||
}
|
||||
}
|
||||
console.log(response, 90)
|
||||
this.total = response.data.total
|
||||
})
|
||||
} else {
|
||||
this.tableData = []
|
||||
}
|
||||
},
|
||||
update(row) {
|
||||
console.log(row, 12)
|
||||
Preservation(row.采购合同明细流水号, row.单价).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('编辑成功')
|
||||
// this.searchTable()
|
||||
} else {
|
||||
this.$message.error('编辑失败')
|
||||
// 合计
|
||||
getSummaries(param) {
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '总价'
|
||||
} else if (index === 4) {
|
||||
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) + Number(curr))
|
||||
}
|
||||
}, 0)
|
||||
sums[index] += ''
|
||||
} else {
|
||||
sums[index] = 'N/A'
|
||||
}
|
||||
} else if (index === 6) {
|
||||
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 (parseInt((Number(prev) + Number(curr)) * 100) / 100).toFixed(2)
|
||||
} else {
|
||||
return (parseInt(Number(prev) * 100) / 100).toFixed(2)
|
||||
}
|
||||
}, 0)
|
||||
sums[index] += ' 元'
|
||||
} else {
|
||||
sums[index] = 'N/A'
|
||||
}
|
||||
}
|
||||
})
|
||||
return sums
|
||||
},
|
||||
update(row) {
|
||||
Preservation(row.采购合同明细流水号, row.单价)
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val
|
||||
|
||||
Reference in New Issue
Block a user