优化耗材
This commit is contained in:
parent
c9bbb2d8ad
commit
1bb073dc44
|
|
@ -421,8 +421,9 @@ export function isPcBowser() {
|
||||||
* 保留小数n位,不进行四舍五入
|
* 保留小数n位,不进行四舍五入
|
||||||
* num你传递过来的数字,
|
* num你传递过来的数字,
|
||||||
* decimal你保留的几位,默认保留小数后两位
|
* decimal你保留的几位,默认保留小数后两位
|
||||||
|
* isInt 是否保留0
|
||||||
*/
|
*/
|
||||||
export function formatDecimal(num, decimal = 2) {
|
export function formatDecimal(num, decimal = 2, isInt = false) {
|
||||||
num = num.toFixed(3).toString();
|
num = num.toFixed(3).toString();
|
||||||
const index = num.indexOf(".");
|
const index = num.indexOf(".");
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
|
@ -431,5 +432,9 @@ export function formatDecimal(num, decimal = 2) {
|
||||||
num = num.substring(0);
|
num = num.substring(0);
|
||||||
}
|
}
|
||||||
//截取后保留两位小数
|
//截取后保留两位小数
|
||||||
return parseFloat(num).toFixed(decimal);
|
if (isInt) {
|
||||||
|
return parseFloat(num);
|
||||||
|
} else {
|
||||||
|
return parseFloat(num).toFixed(decimal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
<el-table-column label="最近入库量" prop="lasterInStock"></el-table-column>
|
<el-table-column label="最近入库量" prop="lasterInStock"></el-table-column>
|
||||||
<el-table-column label="库存数量" prop="stockNumber">
|
<el-table-column label="库存数量" prop="stockNumber">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.stockNumber - scope.row.stockConsume }}
|
{{ formatDecimal(scope.row.stockNumber - scope.row.stockConsume, 2, true) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right">
|
<el-table-column label="操作" fixed="right">
|
||||||
|
|
@ -43,10 +43,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { formatDecimal } from '@/utils'
|
||||||
import { tbConsInfoGet } from "@/api/invoicing";
|
import { tbConsInfoGet } from "@/api/invoicing";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
formatDecimal,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
searchForm: {
|
searchForm: {
|
||||||
conTypeId: '',
|
conTypeId: '',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue