vue js事件方法呼叫api並返回值

侬侬发發表於2024-07-29
// 確認
confirm(id) {
if (this.isEdit && this.form.list !== undefined && this.form.list.length <= 0) {
this.$notify({
title: '表身為空時不能確認',
type: 'error'
})
} else {
this.confirmLoading = true
inConfirm(id).then((res) => {
this.confirmLoading = false
this.getForm(this.form.id)//重新整理
this.$notify({
title: res,
type: 'success'
})
})
.catch(() => {
this.confirmLoading = false
})
}
},
// 轉採購退貨單和採購退貨出庫單
transfer(id) {
this.transferLoading = true
toTransfer(id).then((res) => {
this.transferLoading = false
this.$notify({
title: res,
type: 'success'
})
this.refresh()
})
.catch(() => {
this.transferLoading = false
})
},

相關文章