<template>
|
<div class="add-quotation">
|
<el-dialog title="到货确认" :visible.sync="editConfig.visible" width="50%" :before-close="handleClose" append-to-body
|
custom-class="iframe-dialog">
|
<el-form ref="form" :model="editConfig.infomation" label-position="right" label-width="130px" size="mini"
|
style="height: 60vh; overflow-x: hidden">
|
<!-- 信息 -->
|
<div class="basic-info">
|
<div class="product-view">
|
<CommonFormTableView :isBoder="true" :detailEnter="true" :recalculateShow="false" :addTypeIdMultiple="true"
|
:product-table-list="productTableList" sign="purchase" @rowClick="rowClick" />
|
</div>
|
<!-- <div class="btn-box">
|
</div> -->
|
</div>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button size="small" v-if="this.editConfig.title != '查看'" @click="editConfig.visible = false">取消</el-button>
|
<el-button type="primary" size="small"
|
@click="saveClick('form')">确认收货</el-button>
|
<el-button type="primary" size="small"
|
@click="saveOkClickAll('form')">全部合格入库</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
getPurchaseProductConfirmInfo,
|
savePurchaseProductConfirm,
|
allProductInWarehouse
|
} from "@/api/purchaseManage/purchase"
|
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
|
export default {
|
name: "ArrivalConfirmation",
|
components: { CommonFormTableView },
|
props: {
|
editCommonConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
infomation: {}
|
}
|
}
|
}
|
},
|
data() {
|
return {
|
editConfig: this.editCommonConfig,
|
productTableList: {},
|
editSelectSupplierConfig: {
|
editVisible: false,
|
title: "",
|
infomation: {}
|
},
|
tableData: [],
|
productIndex: 0,
|
productId: "",
|
isNoProduct: true,
|
clientList: [],
|
plcBrandList: [],
|
editRow: {
|
isDefault: "pin"
|
},
|
total: 0,
|
totalTwo: 0,
|
productListIdx: 0,
|
lacks: [],
|
pickerOptions: {
|
disabledDate(time) {
|
return time.getTime() < Date.now() - 8.64e7
|
}
|
},
|
pickerOptionsBefore: {
|
disabledDate(time) {
|
return time.getTime() > Date.now()
|
}
|
},
|
receiveWhouseList: [] // 收货仓库列表
|
}
|
},
|
created() {
|
this.setTableForm()
|
this.getPurchaseProductConfirmInfo(this.editConfig.infomation.number)
|
},
|
computed: {
|
// calculateDifference() {
|
// return this.productTableList.tableData.map(row => ({
|
// ...row,
|
// surplusReceiveAmount: row.notReceiveAmount - row.nowReceiveAmount
|
// }));
|
// }
|
},
|
watch: {
|
"editCommonConfig.visible": {
|
immediate: true,
|
handler: function () {
|
}
|
}
|
},
|
methods: {
|
// 确认收货
|
async saveClick() {
|
let pipeline=false // 是否有大于0的收货数量
|
// let rule1=false // 本次收货是否大于未收货数量
|
let arr=[]
|
this.productTableList.tableData.map((item)=>{
|
if(item.nowReceiveAmount>0&&item.nowReceiveAmount<=item.notReceiveAmount){
|
pipeline=true
|
arr.push(item)
|
}
|
})
|
if(pipeline){
|
await savePurchaseProductConfirm(this.productTableList.tableData).then((res)=>{
|
if(res.code===200){
|
this.editConfig.visible=false
|
this.$parent.getData()
|
this.$message.success("确认收货成功!")
|
}
|
})
|
}else{
|
this.$message.warning("本次收货数量不能为0且不能超出未收货数量 ")
|
}
|
},
|
// 全部合格入库
|
async saveOkClickAll(){
|
let pipeline=false // 是否有大于0的收货数量
|
// let rule1=false // 本次收货是否大于未收货数量
|
// let arr=[]
|
this.productTableList.tableData.map((item)=>{
|
if(item.nowReceiveAmount>0&&item.nowReceiveAmount<=item.notReceiveAmount){
|
pipeline=true
|
// arr.push(item)
|
}
|
})
|
if(pipeline){
|
await allProductInWarehouse(this.productTableList.tableData).then((res)=>{
|
if(res.code===200){
|
this.editConfig.visible=false
|
this.$parent.getData()
|
this.$message.success("确认入库质检成功!")
|
}
|
})
|
}else{
|
this.$message.warning("本次收货数量不能为0且不能超出未收货数量 ")
|
}
|
|
},
|
saveParams() {
|
let data = JSON.parse(JSON.stringify(this.editConfig.infomation))
|
|
let params = {
|
productList: this.tableData,
|
purchase: {
|
}
|
}
|
if (data.id) {
|
params.purchase.id = data.id
|
}
|
return params
|
},
|
handleClose() {
|
this.editConfig.visible = false
|
},
|
setTableForm() {
|
this.productTableList = {
|
tableProductList: [],
|
tableData: this.tableData,
|
disabled: this.editConfig.isDisabled,
|
isReturn: true,
|
tableColumn: [
|
{ label: "产品名称", prop: "productName" },
|
{ label: "产品编号", prop: "productId" },
|
{ label: "采购数量", prop: "amount" },
|
{ label: "已收货数量", prop: "overReceiveAmount" },
|
{ label: "未收货数量", prop: "notReceiveAmount" },
|
{
|
label: "本次收货数量",
|
prop: "nowReceiveAmount",
|
inputFloat: true,
|
isRequird: true,
|
},
|
{ label: "剩余收货数量", prop: "surplusReceiveAmount",compute:true}
|
]
|
}
|
this.toal = this.editConfig.infomation.realTotalPrice
|
},
|
//选择行
|
rowClick(row) {
|
console.log(row, "xuanze")
|
this.productListIdx = row.productIndex
|
},
|
// 到货确认列表
|
getPurchaseProductConfirmInfo(params){
|
getPurchaseProductConfirmInfo(params).then((res)=>{
|
console.log(res,"res9")
|
this.productTableList.tableData=res.data
|
})
|
},
|
// 剩余收货计算
|
calculateDifference(row) {
|
if (row.col1 !== null && row.col2 !== null) {
|
return row.col1 - row.col2;
|
} else {
|
return 0; // 或者返回你想要的默认值
|
}
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
.table-bottom {
|
width: 500px;
|
float: right;
|
margin-right: 20px;
|
margin-top: 10px;
|
height: auto;
|
line-height: 30px;
|
font-size: 14px;
|
font-weight: 700;
|
margin-bottom: 20px;
|
color: #333;
|
|
.table-bottom-item {
|
width: 100%;
|
text-align: right;
|
|
.table-bottom-l {
|
width: 250px;
|
float: left;
|
}
|
|
.table-bottom-r {
|
width: calc(100% - 250px);
|
float: right;
|
}
|
}
|
}
|
|
::v-deep {
|
.iframe-dialog .el-dialog__body {
|
.basic-info {
|
overflow: hidden;
|
margin-top: 20px;
|
}
|
}
|
.el-dialog__header,.el-dialog__body,.el-dialog__footer{
|
padding: 0 20px;
|
}
|
.el-dialog__header{
|
height: 50px;
|
line-height: 50px;
|
}
|
.dialog-footer {
|
text-align: right !important;
|
}
|
.el-table tr {
|
background-color: #fff;
|
}
|
.el-table th.el-table__cell.is-leaf{
|
background-color: #F1F3F8 !important;
|
}
|
}
|
</style>
|