<template>
|
<div class="add-quotation">
|
<el-dialog :visible.sync="editConfig.visible" width="70%" append-to-body custom-class="iframe-dialog">
|
<el-header>
|
<el-button type="primary" :disabled="isDisabled" size="small" @click="saveClick()">批量合格入库</el-button>
|
<el-button type="primary" :disabled="isDisabled" size="small" @click="saveNoClick()">批量不合格</el-button>
|
</el-header>
|
<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" name="rework" :selectBox="true" :detailEnter="true"
|
:recalculateShow="false" :addTypeIdMultiple="true" :product-table-list="productTableList" sign="purchase"
|
@rowClick="rowClick" @getSelectArray="getSelectArray" @toFiltering="toFiltering">
|
|
<template slot="tableButton">
|
<el-table-column label="操作" width="120" align="center">
|
<template slot-scope="scope" v-if="scope.row.status == 1">
|
<el-button type="text" size="small" @click="saveClick(scope.row)"
|
style="margin-right: 5px">合格</el-button>
|
<el-button type="text" size="small" @click="saveNoClick(scope.row)"
|
style="margin-right: 5px">不合格</el-button>
|
</template>
|
</el-table-column>
|
</template>
|
</CommonFormTableView>
|
</div>
|
</div>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button size="small" @click="editConfig.visible = false">关闭</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
getPurchaseQualityInspectionInfo,
|
savePurchaseQualityInspectionInfo
|
} from "@/api/purchaseManage/purchase"
|
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
|
import { getDataByType } from "@/api/data"
|
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: [], // 收货仓库列表
|
timeList: [],
|
statusList: [
|
{ id: 7, name: "部分收货" },
|
{ id: 8, name: "待质检" }
|
],
|
thatStatus: [],
|
thatTimes: [],
|
selectList: [],
|
qualityStatusList: getDataByType("qualityStatus"),
|
isDisabled: false,
|
}
|
},
|
created() {
|
this.setTableForm()
|
this.getPurchaseQualityInspectionInfo({
|
purchaseNumber: this.editConfig.infomation.number,
|
status: this.thatStatus,
|
times: this.thatTimes
|
})
|
},
|
computed: {
|
|
},
|
watch: {
|
"editCommonConfig.visible": {
|
immediate: true,
|
handler: function () {
|
}
|
}
|
},
|
methods: {
|
// 合格入库
|
saveClick(row) {
|
if (row) {
|
this.savePurchaseQualityInspectionInfo({
|
purchaseId: Number(this.editConfig.infomation.id),
|
ids: [Number(row.id)],
|
status: 2,
|
})
|
|
} else {
|
this.savePurchaseQualityInspectionInfo({
|
purchaseId: Number(this.editConfig.infomation.id),
|
ids: this.selectList,
|
status: 2,
|
})
|
}
|
},
|
// 不合格
|
saveNoClick(row) {
|
if (row) {
|
this.savePurchaseQualityInspectionInfo({
|
purchaseId: Number(this.editConfig.infomation.id),
|
ids: [Number(row.id)],
|
status: 3,
|
})
|
|
} else {
|
this.savePurchaseQualityInspectionInfo({
|
purchaseId: Number(this.editConfig.infomation.id),
|
ids: this.selectList,
|
status: 3,
|
})
|
}
|
},
|
async savePurchaseQualityInspectionInfo(params) {
|
if (params.ids.length > 0) {
|
await savePurchaseQualityInspectionInfo(params).then((res) => {
|
if (res) {
|
if (res.code === 200) {
|
this.editConfig.visible = false
|
if (params.status === 2) {
|
this.$message.success("质检合格!")
|
} else if (params.status === 3) {
|
this.$message.success("已设置为不合格!")
|
|
}
|
this.$parent.getData()
|
}
|
}
|
})
|
}else{
|
this.$message({
|
message: "至少选择一条!",
|
type: "warning",
|
});
|
}
|
},
|
handleClose() {
|
this.editConfig.visible = false
|
},
|
setTableForm() {
|
this.productTableList = {
|
tableProductList: [],
|
tableData: this.tableData,
|
disabled: this.editConfig.isDisabled,
|
key: 'id',
|
isReturn: true,
|
tableColumn: [
|
{
|
label: "收货时间", prop: "createTime",
|
isFilter: true,
|
isFilterList: this.timeList,
|
selectedListDefault: this.getSelectedOperateStatus([], this.timeList),
|
},
|
{ label: "收货人", prop: "principal" },
|
{ label: "产品名称", prop: "productName" },
|
{ label: "产品编码", prop: "productId" },
|
{ label: "规格", prop: "specs" },
|
{ label: "数量", prop: "amount" },
|
{ label: "单位", prop: "unit" },
|
{
|
label: "状态",
|
prop: "status",
|
isFilter: true,
|
isFilterList: this.statusList,
|
selectedListDefault: this.getSelectedOperateStatus([], this.statusList),
|
isCallMethod: true,
|
getCallMethod: this.getpurchaseStatus
|
},
|
]
|
}
|
this.toal = this.editConfig.infomation.realTotalPrice
|
},
|
//选择行
|
rowClick(row) {
|
console.log(row, "xuanze")
|
this.productListIdx = row.productIndex
|
},
|
// 多选框
|
getSelectArray(val) {
|
console.log(val, "val")
|
this.selectList = []
|
val.map((item) => {
|
this.selectList.push(Number(item.id))
|
})
|
},
|
// 获取质检列表信息
|
async getPurchaseQualityInspectionInfo(params) {
|
await getPurchaseQualityInspectionInfo(params).then((res) => {
|
this.timeList = []
|
this.isDisabled = true // 判断有没有待质检的
|
res.data.map((item) => {
|
this.timeList.push({ id: item.createTime, name: item.createTime })
|
if (item.status === 1) {
|
this.isDisabled = false
|
}
|
})
|
this.setTableForm()
|
this.productTableList.tableData = res.data
|
})
|
},
|
// 表头筛选项列表
|
getSelectedOperateStatus(selectArr, allArr) {
|
let arr = selectArr
|
if (selectArr.length == 0) {
|
arr = []
|
for (let i in allArr) {
|
arr.push(allArr[i].id)
|
}
|
} else {
|
arr = [selectArr.join(',')]
|
}
|
console.log(arr, "arr")
|
return arr;
|
},
|
// 表头筛选事件
|
async toFiltering(obj) {
|
console.log(obj, "obj")
|
if (obj.layout == 'createTime') {
|
this.thatTimes = obj.filterVal
|
} else if (obj.layout == 'status') {
|
this.thatStatus = obj.filterVal
|
}
|
await getPurchaseQualityInspectionInfo({
|
purchaseNumber: this.editConfig.infomation.number,
|
status: this.thatStatus,
|
times: this.thatTimes
|
}).then((res) => {
|
this.timeList = []
|
res.data.map((item) => {
|
this.timeList.push({ id: item.createTime, name: item.createTime })
|
})
|
this.productTableList.tableData = res.data
|
})
|
|
},
|
// 合格
|
trueClick(row) {
|
console.log(row, "row")
|
|
},
|
falseClick(row) {
|
console.log(row, "row")
|
|
},
|
getpurchaseStatus(val) {
|
if (val) {
|
for (let i in this.qualityStatusList) {
|
if (this.qualityStatusList[i].id == val) {
|
return this.qualityStatusList[i].name
|
}
|
}
|
} else {
|
return "--"
|
}
|
},
|
}
|
}
|
</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 {
|
padding: 0px 20px;
|
|
.basic-info {
|
overflow: hidden;
|
}
|
}
|
|
.el-header {
|
padding: 0;
|
height: 50px;
|
line-height: 50px;
|
}
|
|
.el-dialog__header {
|
display: none;
|
}
|
|
.dialog-footer {
|
text-align: right !important;
|
padding: 0px 20px;
|
}
|
|
.el-table tr {
|
background-color: #fff;
|
}
|
|
.el-table th.el-table__cell.is-leaf {
|
background-color: #F1F3F8 !important;
|
}
|
}
|
</style>
|