|
|
|
@ -53,6 +53,7 @@ |
|
|
|
</el-form-item> |
|
|
|
<el-form-item :label="' '"> |
|
|
|
<el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button> |
|
|
|
<el-button @click="packingModal()" type="primary" style="margin-left: 2px">包装</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
@ -1251,6 +1252,78 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 包装 |
|
|
|
packingModal () { |
|
|
|
// 校验是否选择了单据 |
|
|
|
if (this.outboundSelection.length === 0) { |
|
|
|
this.$message.warning('请勾选要包装的单据!') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 校验选中的单据是否都是"销售出库"类型且状态为"待出库" |
|
|
|
const invalidOrders = this.outboundSelection.filter(item => { |
|
|
|
return item.orderType !== '销售出库' || item.orderStatus !== '待出库' |
|
|
|
}) |
|
|
|
|
|
|
|
if (invalidOrders.length > 0) { |
|
|
|
this.$message.warning('只能对"销售出库"类型且状态为"待出库"的单据进行包装操作!') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 确认操作 |
|
|
|
this.$confirm(`确定将选中的 ${this.outboundSelection.length} 条单据状态更新为"待包装"?`, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
// 调用后端接口更新状态 |
|
|
|
const updateList = this.outboundSelection.map(item => ({ |
|
|
|
site: item.site, |
|
|
|
buNo: item.buNo, |
|
|
|
orderNo: item.orderNo, |
|
|
|
orderStatus: '待包装' |
|
|
|
})) |
|
|
|
|
|
|
|
this.batchUpdateOrderStatus(updateList) |
|
|
|
}).catch(() => { |
|
|
|
// 用户取消操作 |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 批量更新单据状态 |
|
|
|
batchUpdateOrderStatus (updateList) { |
|
|
|
// 这里需要调用后端API,暂时使用循环调用单个更新接口 |
|
|
|
let successCount = 0 |
|
|
|
let errorCount = 0 |
|
|
|
const totalCount = updateList.length |
|
|
|
|
|
|
|
const updatePromises = updateList.map(item => { |
|
|
|
return this.$http({ |
|
|
|
url: this.$http.adornUrl('/outboundNotification/updateOrderStatus'), |
|
|
|
method: 'post', |
|
|
|
data: this.$http.adornData(item) |
|
|
|
}).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
successCount++ |
|
|
|
} else { |
|
|
|
errorCount++ |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
errorCount++ |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
Promise.all(updatePromises).then(() => { |
|
|
|
if (errorCount === 0) { |
|
|
|
this.$message.success(`成功更新 ${successCount} 条单据状态为"待包装"`) |
|
|
|
} else { |
|
|
|
this.$message.warning(`成功 ${successCount} 条,失败 ${errorCount} 条`) |
|
|
|
} |
|
|
|
this.getDataList() |
|
|
|
this.outboundSelection = [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭 |
|
|
|
closeModal (row) { |
|
|
|
if (this.currentRow.orderType === '销售出库') { |
|
|
|
|