新增采购计划
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user