自适应重量单位

This commit is contained in:
2025-11-27 17:52:19 +08:00
parent 9af7e0d005
commit ede3d6b330
3 changed files with 41 additions and 20 deletions

View File

@@ -2,7 +2,11 @@
<div>
<el-table :data="stockList" style="width: 100%" v-loading="loading">
<el-table-column prop="raw_material_name" label="原料名称"></el-table-column>
<el-table-column prop="stock" label="当前库存 (g)"></el-table-column>
<el-table-column prop="stock" label="当前库存">
<template #default="scope">
{{ formatWeight(scope.row.stock) }}
</template>
</el-table-column>
<el-table-column prop="last_updated" label="最后更新时间">
<template #default="scope">
{{ formatRFC3339(scope.row.last_updated) }}
@@ -30,7 +34,7 @@
import { ref, onMounted, watch } from 'vue';
import { InventoryApi } from '../../api/inventory';
import { ElMessage } from 'element-plus';
import { formatRFC3339 } from '../../utils/format';
import { formatRFC3339, formatWeight } from '../../utils/format'; // 导入 formatWeight
export default {
name: 'StockListTable',
@@ -118,6 +122,7 @@ export default {
handleSizeChange,
handleCurrentChange,
formatRFC3339,
formatWeight, // 暴露给模板
handleAdjust, // 暴露给模板
};
},