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