新增采购计划

This commit is contained in:
砂糖
2025-07-22 13:22:50 +08:00
parent 67dda73d12
commit 1cd1b96db9
5 changed files with 389 additions and 254 deletions

View File

@@ -0,0 +1,50 @@
<template>
<div>
<el-button v-if="showButton" type="primary" @click="handleRecommend" :loading="loading">推荐采购计划</el-button>
</div>
</template>
<script>
import { recommendPurchasePlan } from '@/api/wms/purchasePlan'
export default {
name: 'RecommendPurchasePanel',
props: {
orderId: {
type: [String, Number],
required: true
},
showButton: {
type: Boolean,
default: true
}
},
data() {
return {
loading: false
}
},
mounted() {
if (!this.showButton) {
this.handleRecommend();
}
},
methods: {
async handleRecommend() {
if (!this.orderId) {
this.$message.error('缺少订单ID');
return;
}
this.loading = true;
try {
const res = await recommendPurchasePlan(this.orderId);
this.$emit('recommend', res.data);
} catch (e) {
this.$message.error('推荐失败');
} finally {
this.loading = false;
}
}
}
}
</script>