-
是
+
+ 是
否
{{ row[item.dataIndex] }}
@@ -486,9 +486,9 @@ export default {
{
field: 'unitPrice',
key: 'unitPrice',
- title: '单价',
+ title: '不含税单价',
align: 'center',
- width: '80px',
+ width: '110px',
edit: true
},
{
@@ -669,25 +669,52 @@ export default {
},
afterCellValueChange: ({ row, column, changeValue }) => {
- if (column.key === 'unitPrice') {
+ if (column.key === 'amount') {
changeValue = changeValue.toString()
- row['unitPrice'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+ row['amount'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+ row['unitPrice'] = (row['amount'] / row['quantity']).toFixed(4)
+ row['taxUnitPrice'] = (row['unitPrice'] / (1 + (row['taxRate'] / 100))).toFixed(4)
+ row['noTaxAmount'] = (row['taxUnitPrice'] * row['quantity']).toFixed(2)
}
- if (column.key === 'accTaxRate') {
+ if (column.key === 'noTaxAmount') {
changeValue = changeValue.toString()
- row['accTaxRate'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+ row['noTaxAmount'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+ row['taxUnitPrice'] = (row['noTaxAmount'] / row['quantity']).toFixed(4)
+ row['unitPrice'] = ((1 + (row['taxRate'] / 100)) * row['taxUnitPrice']).toFixed(4)
+ row['amount'] = (row['unitPrice'] * row['quantity']).toFixed(2)
}
if (column.key === 'taxRate') {
changeValue = changeValue.toString()
row['taxRate'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+ row['unitPrice'] = ((1 + (row['taxRate'] / 100)) * row['taxUnitPrice']).toFixed(4)
+
+ row['amount'] = (row['unitPrice'] * row['quantity']).toFixed(2)
+ row['noTaxAmount'] = (row['taxUnitPrice'] * row['quantity']).toFixed(2)
}
if (column.key === 'exchangeRate') {
changeValue = changeValue.toString()
row['exchangeRate'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3')
}
+ if (column.key === 'unitPrice') {
+ changeValue = changeValue.toString()
+ row['unitPrice'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3')
+ row['amount'] = (row['unitPrice'] * row['quantity']).toFixed(2)
+ row['taxUnitPrice'] = (row['unitPrice'] / (1 + (row['taxRate'] / 100))).toFixed(4)
+ row['noTaxAmount'] = (row['taxUnitPrice'] * row['quantity']).toFixed(2)
+ }
+ if (column.key === 'quantity') {
+ changeValue = changeValue.toString()
+ row['quantity'] = changeValue.replace(/[^0-9]/g, '')
+ row['noTaxAmount'] = (row['taxUnitPrice'] * row['quantity']).toFixed(2)
+ row['unitPrice'] = ((1 + (row['taxRate'] / 100)) * row['taxUnitPrice']).toFixed(4)
+ row['amount'] = (row['unitPrice'] * row['quantity']).toFixed(2)
+ }
if (column.key === 'taxUnitPrice') {
changeValue = changeValue.toString()
- row['taxUnitPrice'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+ row['taxUnitPrice'] = changeValue.replace(/[^\d.]/g, '').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3')
+ row['noTaxAmount'] = (row['taxUnitPrice'] * row['quantity']).toFixed(2)
+ row['unitPrice'] = ((1 + (row['taxRate'] / 100)) * row['taxUnitPrice']).toFixed(4)
+ row['amount'] = (row['unitPrice'] * row['quantity']).toFixed(2)
}
}
},
@@ -792,6 +819,7 @@ export default {
let startColKey = null
if (this.$refs['tableRef'].getRangeCellSelection()) {
index = this.$refs['tableRef'].getRangeCellSelection().selectionRangeKeys.startRowKey
+ console.log(this.$refs['tableRef'].getRangeCellSelection())
startColKey = this.$refs['tableRef'].getRangeCellSelection().selectionRangeKeys.startColKey
}
setTimeout(() => {