Merge branch 'master' of http://123.56.95.229:10010/r/高精
This commit is contained in:
@@ -50,12 +50,12 @@
|
||||
{{ scope.row.数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="单价" width="100px">
|
||||
<el-table-column align="center" label="单价(元)" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.单价" size="mini" width="80px" align="center" @change="update(scope.row)"/>
|
||||
<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="70px">
|
||||
<el-table-column align="center" label="总额(元)" width="90px">
|
||||
<template slot-scope="scope">
|
||||
{{ Number(scope.row.金额).toFixed(2) }}
|
||||
</template>
|
||||
@@ -116,6 +116,23 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
filterNuber(val, index, date, row) {
|
||||
let value = '' + val
|
||||
value = value
|
||||
.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
|
||||
.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
|
||||
.replace('.', '$#$')
|
||||
.replace(/\./g, '')
|
||||
.replace('$#$', '.')
|
||||
.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
|
||||
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)
|
||||
},
|
||||
searchTable() {
|
||||
this.loading = true
|
||||
this.tableData = []
|
||||
@@ -152,7 +169,7 @@ export default {
|
||||
console.log(response, 1111)
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('编辑成功')
|
||||
this.searchTable()
|
||||
// this.searchTable()
|
||||
} else {
|
||||
this.$message.error('编辑失败')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user