自适应重量单位
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
width="400px"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
v-model="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
width="400px"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form :model="form" :rules="rules" ref="formRef" label-width="80px">
|
||||
<el-form-item label="原料名称">
|
||||
@@ -18,12 +18,12 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="变动数量" prop="change_amount">
|
||||
<el-input-number
|
||||
v-model="form.change_amount"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1000"
|
||||
controls-position="right"
|
||||
style="width: 100%;"
|
||||
v-model="form.change_amount"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1000"
|
||||
controls-position="right"
|
||||
style="width: 100%;"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
@@ -40,9 +40,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, reactive, computed, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { InventoryApi } from '../../api/inventory';
|
||||
import {ref, reactive, computed, watch} from 'vue';
|
||||
import {ElMessage} from 'element-plus';
|
||||
import {InventoryApi} from '../../api/inventory';
|
||||
|
||||
export default {
|
||||
name: 'StockAdjustmentDialog',
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
},
|
||||
},
|
||||
emits: ['update:visible', 'success'],
|
||||
setup(props, { emit }) {
|
||||
setup(props, {emit}) {
|
||||
const formRef = ref(null);
|
||||
const dialogVisible = computed({
|
||||
get: () => props.visible,
|
||||
@@ -94,9 +94,9 @@ export default {
|
||||
|
||||
const rules = {
|
||||
change_amount: [
|
||||
{ required: true, message: '请输入变动数量', trigger: 'blur' },
|
||||
{ type: 'number', message: '数量必须为数字', trigger: 'blur' },
|
||||
{ min: 1, message: '数量必须大于0', trigger: 'blur' },
|
||||
{required: true, message: '请输入变动数量', trigger: 'blur'},
|
||||
{type: 'number', message: '数量必须为数字', trigger: 'blur'},
|
||||
{min: 1, message: '数量必须大于0', trigger: 'blur'},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -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, // 暴露给模板
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user