调整库存按钮

This commit is contained in:
2025-11-27 17:44:16 +08:00
parent 6507b3ee14
commit 9af7e0d005
3 changed files with 195 additions and 1 deletions

View File

@@ -8,6 +8,11 @@
{{ formatRFC3339(scope.row.last_updated) }}
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template #default="scope">
<el-button size="small" type="primary" @click="handleAdjust(scope.row)">调整库存</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@@ -39,7 +44,8 @@ export default {
default: '',
},
},
setup(props, { expose }) {
emits: ['adjust-stock'], // 声明组件将发出的事件
setup(props, { expose, emit }) { // 接收 emit 函数
const stockList = ref([]);
const loading = ref(false);
const pagination = ref({
@@ -81,6 +87,11 @@ export default {
fetchStockList();
};
// 处理库存调整操作
const handleAdjust = (row) => {
emit('adjust-stock', row); // 只传递行数据
};
onMounted(() => {
fetchStockList();
});
@@ -107,6 +118,7 @@ export default {
handleSizeChange,
handleCurrentChange,
formatRFC3339,
handleAdjust, // 暴露给模板
};
},
};