|
|
|
@ -94,13 +94,13 @@ |
|
|
|
label="库位" |
|
|
|
width="100"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
<!-- <el-table-column |
|
|
|
prop="arriveQty" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
label="到货数量" |
|
|
|
width="100"> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column>--> |
|
|
|
<el-table-column |
|
|
|
prop="qtyReceived" |
|
|
|
header-align="center" |
|
|
|
@ -143,19 +143,20 @@ |
|
|
|
label="状态" |
|
|
|
width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-tag v-if="scope.row.status === 'RECEIVED'" type="success">已接收</el-tag> |
|
|
|
<el-tag v-else-if="scope.row.status === 'CANCELLED'" type="danger">已取消</el-tag> |
|
|
|
<el-tag v-else type="info">{{ scope.row.status }}</el-tag> |
|
|
|
<span v-if="scope.row.status === 'RECEIVED'" type="success">已接收</span> |
|
|
|
<span v-else-if="scope.row.status === 'CANCEL'" type="danger">已取消</span> |
|
|
|
<span v-else-if="scope.row.status === 'ARRIVED'" type="warning">已到货</span> |
|
|
|
<span v-else type="info">{{ scope.row.status }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
fixed="right" |
|
|
|
fixed="left" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="150" |
|
|
|
width="80" |
|
|
|
label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button @click="cancelSingleReceipt(scope.row)" type="text" size="small" :disabled="scope.row.status !== 'RECEIVED'">取消</el-button> |
|
|
|
<a @click="cancelSingleReceipt(scope.row)" type="text" size="small" :disabled="scope.row.status !== 'RECEIVED'">取消</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
@ -180,14 +181,12 @@ |
|
|
|
<el-form :model="cancelForm" :rules="cancelRules" ref="cancelForm" label-width="100px"> |
|
|
|
<el-form-item label="取消原因" prop="cancelReason"> |
|
|
|
<el-input |
|
|
|
type="textarea" |
|
|
|
:rows="4" |
|
|
|
placeholder="请输入取消原因" |
|
|
|
v-model="cancelForm.cancelReason"> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<span slot="footer" class="dialog-footer" style="margin-top: 80px"> |
|
|
|
<el-button @click="cancelDialogVisible = false">取 消</el-button> |
|
|
|
<el-button type="primary" @click="confirmCancel" :loading="cancelLoading">确 定</el-button> |
|
|
|
</span> |
|
|
|
@ -204,12 +203,12 @@ export default { |
|
|
|
favorite: false, |
|
|
|
dataList: [], |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 20, |
|
|
|
totalPage: 0, |
|
|
|
dataListLoading: false, |
|
|
|
dataListSelections: [], |
|
|
|
queryHeaderData: { |
|
|
|
site: '', |
|
|
|
site: localStorage.getItem('site'), |
|
|
|
receiptNo: '', |
|
|
|
partNo: '', |
|
|
|
batchNo: '', |
|
|
|
@ -276,9 +275,19 @@ export default { |
|
|
|
}, |
|
|
|
// 取消单个接收记录 |
|
|
|
cancelSingleReceipt (row) { |
|
|
|
this.currentCancelRecords = [row] |
|
|
|
this.cancelForm.cancelReason = '' |
|
|
|
this.cancelDialogVisible = true |
|
|
|
// 显示确认提示 |
|
|
|
this.$confirm(`确认要取消接收单号 ${row.receiptNo} 的记录吗?`, '确认取消', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
this.currentCancelRecords = [row] |
|
|
|
this.cancelForm.cancelReason = ' ' |
|
|
|
//this.cancelDialogVisible = true |
|
|
|
this.confirmCancel() |
|
|
|
}).catch(() => { |
|
|
|
// 用户取消操作 |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 批量取消接收记录 |
|
|
|
cancelSelectedReceipts () { |
|
|
|
@ -286,54 +295,61 @@ export default { |
|
|
|
this.$message.warning('请选择要取消的记录') |
|
|
|
return |
|
|
|
} |
|
|
|
this.currentCancelRecords = this.dataListSelections |
|
|
|
this.cancelForm.cancelReason = '' |
|
|
|
this.cancelDialogVisible = true |
|
|
|
|
|
|
|
// 显示确认提示 |
|
|
|
this.$confirm(`确认要取消选中的 ${this.dataListSelections.length} 条接收记录吗?`, '确认取消', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
this.currentCancelRecords = this.dataListSelections |
|
|
|
this.cancelForm.cancelReason = ' ' |
|
|
|
//this.cancelDialogVisible = true |
|
|
|
this.confirmCancel() |
|
|
|
}).catch(() => { |
|
|
|
// 用户取消操作 |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 确认取消 |
|
|
|
confirmCancel () { |
|
|
|
this.$refs.cancelForm.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.cancelLoading = true |
|
|
|
const promises = this.currentCancelRecords.map(record => { |
|
|
|
return cancelReceipt({ |
|
|
|
receiptNo: record.receiptNo, |
|
|
|
site: record.site, |
|
|
|
itemNo: record.itemNo, |
|
|
|
cancelReason: this.cancelForm.cancelReason |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.cancelLoading = true |
|
|
|
const promises = this.currentCancelRecords.map(record => { |
|
|
|
return cancelReceipt({ |
|
|
|
receiptNo: record.receiptNo, |
|
|
|
site: record.site, |
|
|
|
itemNo: record.itemNo, |
|
|
|
cancelReason: this.cancelForm.cancelReason |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
Promise.all(promises).then(results => { |
|
|
|
let successCount = 0 |
|
|
|
let errorMessages = [] |
|
|
|
Promise.all(promises).then(results => { |
|
|
|
let successCount = 0 |
|
|
|
let errorMessages = [] |
|
|
|
|
|
|
|
results.forEach((result, index) => { |
|
|
|
if (result.data && result.data.code === 0) { |
|
|
|
successCount++ |
|
|
|
} else { |
|
|
|
const record = this.currentCancelRecords[index] |
|
|
|
errorMessages.push(`${record.receiptNo}: ${result.data.msg || '取消失败'}`) |
|
|
|
} |
|
|
|
}) |
|
|
|
results.forEach((result, index) => { |
|
|
|
if (result.data && result.data.code === 0) { |
|
|
|
successCount++ |
|
|
|
} else { |
|
|
|
const record = this.currentCancelRecords[index] |
|
|
|
errorMessages.push(`${record.receiptNo}: ${result.data.msg || '取消失败'}`) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (successCount > 0) { |
|
|
|
this.$message.success(`成功取消 ${successCount} 条记录`) |
|
|
|
this.getDataList() |
|
|
|
} |
|
|
|
if (successCount > 0) { |
|
|
|
this.$message.success(`成功取消 ${successCount} 条记录`) |
|
|
|
this.getDataList() |
|
|
|
} |
|
|
|
|
|
|
|
if (errorMessages.length > 0) { |
|
|
|
this.$message.error(`部分记录取消失败:\n${errorMessages.join('\n')}`) |
|
|
|
} |
|
|
|
if (errorMessages.length > 0) { |
|
|
|
this.$message.error(`部分记录取消失败:\n${errorMessages.join('\n')}`) |
|
|
|
} |
|
|
|
|
|
|
|
this.cancelDialogVisible = false |
|
|
|
this.cancelLoading = false |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('取消操作失败') |
|
|
|
this.cancelLoading = false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.cancelDialogVisible = false |
|
|
|
this.cancelLoading = false |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('取消操作失败') |
|
|
|
this.cancelLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 重置查询 |
|
|
|
resetQuery () { |
|
|
|
|