Browse Source

采购接收记录取消

master
han\hanst 3 months ago
parent
commit
38eea14f1f
  1. 128
      src/views/modules/purchase/cancelReceipt.vue
  2. 19
      src/views/modules/purchase/receiptRecords.vue

128
src/views/modules/purchase/cancelReceipt.vue

@ -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 () {

19
src/views/modules/purchase/receiptRecords.vue

@ -90,13 +90,13 @@
label="批次号"
width="120">
</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"
@ -118,9 +118,10 @@
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
@ -130,8 +131,8 @@
label="需要检验"
width="100">
<template slot-scope="scope">
<el-tag v-if="scope.row.needInspectFlag === 'Y'" type="warning"></el-tag>
<el-tag v-else type="success"></el-tag>
<span v-if="scope.row.needInspectFlag === 'Y'" type="warning"></span>
<span v-else type="success"></span>
</template>
</el-table-column>
<el-table-column
@ -238,7 +239,7 @@ export default {
favorite: false,
dataList: [],
pageIndex: 1,
pageSize: 10,
pageSize: 20,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
@ -260,7 +261,7 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.height = (window.innerHeight - 240)/2;
this.height = (window.innerHeight - 250);
})
},
activated () {

Loading…
Cancel
Save