632 lines
19 KiB
Plaintext
632 lines
19 KiB
Plaintext
<template>
|
||
<div class="app-container">
|
||
<div style="font-size: 30px;margin-bottom: 10px">
|
||
添加其他入库单
|
||
</div>
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="add"
|
||
:disabled="canBeInput"
|
||
>新增</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="save"
|
||
:disabled="canBeInput"
|
||
>保存</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="danger"
|
||
icon="el-icon-delete"
|
||
size="mini"
|
||
:disabled="buttonEnable"
|
||
@click="handleDelete"
|
||
>删除</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="success"
|
||
icon="el-icon-delete"
|
||
size="mini"
|
||
:disabled="buttonEnable"
|
||
@click="printFlowList"
|
||
>打印物料条码</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
<el-table
|
||
v-loading="loading"
|
||
highlight-current-row
|
||
:row-class-name="tableRowClassName"
|
||
@current-change="handleCurrentChange"
|
||
@selection-change="handleSelectionChange"
|
||
:data="tableData"
|
||
border
|
||
style="width: 1400px"
|
||
:height="400"
|
||
class="tableStyle">
|
||
<el-table-column
|
||
type="selection"
|
||
width="55">
|
||
</el-table-column>
|
||
<el-table-column
|
||
type="index"
|
||
align="center"
|
||
label="序号"
|
||
width="50">
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="materialCode"
|
||
label="物料编码"
|
||
width="230">
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="materialName"
|
||
label="物料名称"
|
||
width="200">
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="是否筛选"
|
||
prop="isFil"
|
||
width="100">
|
||
<template slot-scope="scope">
|
||
<el-select size="small" style="width: 80px" v-model="scope.row.isFil" placeholder="筛选">
|
||
<el-option
|
||
v-for="item in filOption"
|
||
:key="item.key"
|
||
:label="item.text"
|
||
:value="item.key">
|
||
</el-option>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="有效期"
|
||
prop="bzyxq"
|
||
width="180">
|
||
<template slot-scope="scope">
|
||
<el-input style="width: 150px" v-model="scope.row.bzyxq"></el-input>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="质量检测号"
|
||
prop="inspectionNo"
|
||
width="180">
|
||
<template slot-scope="scope">
|
||
<el-input style="width: 150px" v-model="scope.row.inspectionNo"></el-input>
|
||
</template>
|
||
</el-table-column>
|
||
<!-- <el-table-column-->
|
||
<!-- prop="dictStatus"-->
|
||
<!-- label="状态"-->
|
||
<!-- show-overflow-tooltip="true"-->
|
||
<!-- width="200">-->
|
||
<!-- <template slot-scope="scope">-->
|
||
<!-- <el-input readonly v-model="scope.row.dictStatusShow">-->
|
||
<!-- </el-input>-->
|
||
<!-- </template>-->
|
||
<!-- </el-table-column>-->
|
||
<!-- <el-table-column-->
|
||
<!-- prop="materialSpec"-->
|
||
<!-- label="规格型号"-->
|
||
<!-- show-overflow-tooltip="true"-->
|
||
<!-- width="200">-->
|
||
<!-- </el-table-column>-->
|
||
<el-table-column
|
||
label="批次号"
|
||
width="180">
|
||
<template slot-scope="scope">
|
||
<el-input v-if="scope.row.dictStatus===1" :controls="false" style="width: 160px" v-model="scope.row.batchNo"></el-input>
|
||
<el-input v-if="scope.row.dictStatus!==1" disabled :controls="false" style="width: 100px" v-model="scope.row.batchNo"></el-input>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="待收数量"
|
||
width="100">
|
||
<template slot-scope="scope">
|
||
<el-input-number v-if="scope.row.dictStatus===1" :controls="false" style="width: 80px" v-model="scope.row.planQty" :step="0.1" :max="999999"></el-input-number>
|
||
<el-input-number v-if="scope.row.dictStatus!==1" disabled :controls="false" style="width: 80px" v-model="scope.row.planQty" :step="0.1" :max="999999"></el-input-number>
|
||
</template>
|
||
</el-table-column>
|
||
<!-- <el-table-column-->
|
||
<!-- prop="realQty"-->
|
||
<!-- label="实收数量"-->
|
||
<!-- width="130">-->
|
||
<!-- </el-table-column>-->
|
||
<!-- <el-table-column-->
|
||
<!-- label="包装规格"-->
|
||
<!-- width="130">-->
|
||
<!-- <template slot-scope="scope">-->
|
||
<!-- <el-input-number v-if="scope.row.dictStatus===1" :controls="false" style="width: 100px" v-model="scope.row.packageSize" :step="0.1" :max="999999"></el-input-number>-->
|
||
<!-- <el-input-number v-if="scope.row.dictStatus!==1" disabled :controls="false" style="width: 100px" v-model="scope.row.packageSize" :step="0.1" :max="999999"></el-input-number>-->
|
||
<!-- </template>-->
|
||
<!-- </el-table-column>-->
|
||
<el-table-column
|
||
prop="unitOfMeasure"
|
||
label="计量单位"
|
||
width="80">
|
||
</el-table-column>
|
||
<el-table-column
|
||
label="供应商代码"
|
||
width="150">
|
||
<template slot-scope="scope">
|
||
<el-input v-if="scope.row.dictStatus===1" readonly v-model="scope.row.supplierCode">
|
||
<i slot="suffix" class="el-icon-search " @click.prevent="selectSupplier"></i>
|
||
</el-input>
|
||
<el-input v-if="scope.row.dictStatus!==1" readonly v-model="scope.row.supplierCode">
|
||
</el-input>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="supplierName"
|
||
label="供应商名称"
|
||
width="150">
|
||
</el-table-column>
|
||
<!-- <el-table-column-->
|
||
<!-- label="入库时间"-->
|
||
<!-- prop="completeTime"-->
|
||
<!-- width="180">-->
|
||
<!-- </el-table-column>-->
|
||
</el-table>
|
||
|
||
<div id="printFlow" v-if="printInfo">
|
||
</div>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import QRCode from 'qrcodejs2'
|
||
import selectMaterial from '@/views/mes/plan/order/prod/order-prod-select-material.vue'
|
||
import selectSupplier from '@/views/mes/BasicData/supplier/select-supplier.vue'
|
||
import selectWarehouse from '@/views/mes/BasicData/warehouse/select-warehouse.vue'
|
||
export default {
|
||
name: 'edit',
|
||
props:{
|
||
layerid: {
|
||
type: String,
|
||
default: ""
|
||
},
|
||
lydata: {
|
||
type: Object,
|
||
default: () => {
|
||
return {};
|
||
}
|
||
}
|
||
},
|
||
mounted() {
|
||
|
||
if(this.$parent.currentRow.dictStatus===3&&!this.$parent.isAdd){
|
||
this.canBeInput=true
|
||
}
|
||
|
||
this.isAdd = !this.$parent.isAdd
|
||
if(!this.$parent.isAdd){
|
||
this.$otherInputBill.OtherInputGet({billId:this.lydata.id}).then(data=>{
|
||
if(data.data.code===200){
|
||
this.tableData = data.data.data
|
||
this.tableData.forEach(data=>{
|
||
data.dictStatusShow = this.$dictType.getInputBillStatus(data.dictStatus)
|
||
})
|
||
}
|
||
})
|
||
}
|
||
},
|
||
data() {
|
||
return{
|
||
filOption:[{key:'Y',text:'是'},{key:'N',text:'否'}],
|
||
canBeInput:false,
|
||
printInfo:false,
|
||
tableData:[],
|
||
loading:false,
|
||
formData:{},
|
||
isAdd:true,
|
||
buttonEnable:true,
|
||
multipleSelection:[],
|
||
currentRowIndex:null,
|
||
}
|
||
},
|
||
methods:{
|
||
|
||
printFlowList() {
|
||
let flag = true
|
||
const params = []
|
||
console.log(this.multipleSelection)
|
||
this.multipleSelection.forEach(data=>{
|
||
let paramsS={
|
||
billDetailId:null,
|
||
materialId:null,
|
||
planQty:null,
|
||
dictType:2,
|
||
inputBillId:null,
|
||
inputBillNumber: null,
|
||
batchNo:null,
|
||
packageSize:null,
|
||
}
|
||
if(data.id===null||data.id===undefined){
|
||
this.$message.error('请先保存');
|
||
flag = false
|
||
}
|
||
data.billDetailId = data.id
|
||
|
||
paramsS.billDetailId = data.id
|
||
paramsS.materialId = data.materialId
|
||
paramsS.planQty = data.planQty
|
||
paramsS.inputBillId = data.inputBillId
|
||
paramsS.inputBillNumber = data.inputBillNumber
|
||
paramsS.batchNo = data.batchNo
|
||
paramsS.packageSize = data.packageSize
|
||
|
||
params.push(paramsS)
|
||
|
||
})
|
||
if(flag){
|
||
this.$inputBill.printBars(params).then(data=>{
|
||
if(data.data.code===200){
|
||
this.printFlow(data.data.data);
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
|
||
},
|
||
|
||
printFlow(respData) {
|
||
this.printData = [];
|
||
this.printInfo = true;
|
||
let router = "";
|
||
|
||
// alert(respData)
|
||
|
||
|
||
respData.forEach(data=>{
|
||
if(data.supplierName===null){
|
||
data.supplierName=''
|
||
}
|
||
})
|
||
|
||
this.printData = respData
|
||
this.$nextTick(() => {
|
||
|
||
this.printData.forEach((value,index) => {
|
||
router = router + '<div style="height: 72mm;width: 100mm;padding: 0;page-break-after:always;margin-top: 300px" >' +
|
||
'<table border="1" cellspacing="0" cellpadding="0" width="100%" height="100%">'+
|
||
'<tr>'+
|
||
'<td align="center" style="height: 12mm;">其他入库单据</td>'+
|
||
'<td align="center" colspan="2">'+value.inputBillNumber+'</td>'+
|
||
'<td align="center" rowspan="2">'+
|
||
|
||
'<div id="qrcode'+index+'"></div>'+
|
||
|
||
'</td>'+
|
||
'</tr>'+
|
||
'<tr>'+
|
||
'<td align="center" style="height: 12mm;">条码</td>'+
|
||
'<td align="center" colspan="2">'+value.materialBar+'</td>'+
|
||
'</tr>'+
|
||
'<tr>'+
|
||
'<td align="center" style="height: 12mm;">物料编码</td>'+
|
||
'<td align="center" colspan="3">'+value.materialCode+'</td>'+
|
||
|
||
'</tr>'+
|
||
'<tr>'+
|
||
'<td align="center" style="height: 12mm;">物料名称</td>'+
|
||
'<td align="center" colspan="3"> '+value.materialName+'</td>'+
|
||
|
||
'</tr>'+
|
||
'<tr>'+
|
||
'<td align="center" style="width: 25%; height: 12mm;">批次</td>'+
|
||
'<td align="center" style="width: 25%;">'+value.batchNo+'</td>'+
|
||
'<td align="center" style="width: 30%;">数量</td>'+
|
||
'<td align="center">'+value.materialQty+'</td>'+
|
||
'</tr>'+
|
||
'<tr>'+
|
||
'<td align="center" style="height: 12mm;">供应商</td>'+
|
||
'<td align="center" colspan="3"> '+value.supplierName+'</td>'+
|
||
|
||
'</tr>'+
|
||
'</table>'+
|
||
' </div>'
|
||
})
|
||
|
||
let printerTable = document.getElementById("printFlow");
|
||
printerTable.innerHTML = router;
|
||
|
||
|
||
this.$nextTick(() => {
|
||
this.printData.forEach((value, idx) => {
|
||
let qrcode = new QRCode('qrcode' + idx, {
|
||
width: 90, //图像宽度
|
||
height: 90, //图像高度
|
||
colorDark: "#000000", //前景色
|
||
colorLight: "#ffffff", //背景色
|
||
typeNumber: 4,
|
||
correctLevel: QRCode.CorrectLevel.H //容错级别 容错级别有:(1)QRCode.CorrectLevel.L (2)QRCode.CorrectLevel.M (3)QRCode.CorrectLevel.Q (4)QRCode.CorrectLevel.H
|
||
});
|
||
console.log(value.materialBar)
|
||
qrcode.makeCode(value.materialBar);
|
||
})
|
||
|
||
this.$nextTick(() => {
|
||
|
||
window.setTimeout(()=>{
|
||
this.loading = false;
|
||
this.printInfo = false;
|
||
let tableToPrint = document.getElementById('printFlow');//将要被打印的表格
|
||
let newWin = window.open("");//新打开一个空窗口
|
||
newWin.document.write('<html><head><title>物料条码打印</title></head><style>@page{margin:0px 10px;size: auto} td{text-align: center; border: solid 1px #000000; height: 20px;}.a4{page-break-before: auto;' +
|
||
' page-break-after: always;}</style><body style="padding: 0px;margin: 0px">');
|
||
newWin.document.write(tableToPrint.outerHTML);//将表格添加进新的窗口
|
||
newWin.document.write('</body></html>');
|
||
newWin.focus();//在IE浏览器中使用必须添加这一句
|
||
newWin.print();//打印
|
||
newWin.close();//关闭窗口
|
||
},1000)
|
||
|
||
|
||
})
|
||
|
||
|
||
|
||
})
|
||
|
||
|
||
})
|
||
|
||
|
||
|
||
},
|
||
|
||
|
||
|
||
|
||
handleSelectionChange(val) {
|
||
console.log(val.length)
|
||
if(this.$parent.isAdd||val.length>0&&this.$parent.currentRow.dictStatus!==3){
|
||
this.buttonEnable = false
|
||
}else {
|
||
this.buttonEnable = true
|
||
}
|
||
this.multipleSelection = val;
|
||
},
|
||
|
||
handleDelete() {
|
||
let delList = []
|
||
let flag = false
|
||
this.multipleSelection.forEach((data,index)=>{
|
||
if(data.realQty!==0){
|
||
flag = true
|
||
}
|
||
if(data.id===undefined||data.id===null){
|
||
}else {
|
||
delList.push(data.id)
|
||
}
|
||
})
|
||
|
||
if(flag){
|
||
this.$message.error('请勿勾选已经入库物料');
|
||
return
|
||
}
|
||
console.log(delList)
|
||
|
||
this.$otherInputBill.deleteOtherInputBillDetail(delList).then(data=>{
|
||
if(data.data.code===200){
|
||
|
||
this.multipleSelection.forEach((data)=>{
|
||
this.tableData.forEach((data2,index)=>{
|
||
if (data.materialId===data2.materialId) {
|
||
this.tableData.splice(index,1)
|
||
}
|
||
|
||
})
|
||
})
|
||
}
|
||
})
|
||
},
|
||
|
||
|
||
|
||
|
||
getWarehouse(row) {
|
||
this.tableData[this.currentRowIndex].warehouseId = row.id
|
||
this.tableData[this.currentRowIndex].warehouseCode = row.warehouseCode
|
||
|
||
},
|
||
|
||
selectWarehouse() {
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: selectWarehouse, //传递的组件对象
|
||
parent: this,//当前的vue对象
|
||
shadeClose: false
|
||
},
|
||
title: '选择库区(双击选中单条数据)'
|
||
})
|
||
},
|
||
|
||
|
||
getSupplier(row) {
|
||
|
||
this.tableData[this.currentRowIndex].supplierId = row.id
|
||
this.tableData[this.currentRowIndex].supplierCode = row.supplierCode
|
||
this.tableData[this.currentRowIndex].supplierName = row.supplierName
|
||
|
||
},
|
||
|
||
selectSupplier() {
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: selectSupplier, //传递的组件对象
|
||
parent: this,//当前的vue对象
|
||
shadeClose: false
|
||
},
|
||
title: '选择供应商(双击选中单条数据)'
|
||
})
|
||
},
|
||
|
||
|
||
|
||
handleCurrentChange(val) {
|
||
this.currentRowIndex = val.row_index;
|
||
this.currentRow = val;
|
||
|
||
},
|
||
tableRowClassName({row, rowIndex}) {
|
||
row.row_index = rowIndex;
|
||
},
|
||
|
||
save() {
|
||
let flag = false
|
||
let flagMessage = ''
|
||
if(this.$parent.isAdd){
|
||
|
||
this.tableData.forEach(data=>{
|
||
if(data.planQty===0||data.planQty===''||data.planQty===undefined){
|
||
flagMessage = '请输入计划入库数量'
|
||
flag = true
|
||
}
|
||
|
||
if(/[\u3002\uff1b\uff0c\uff1a\u201c\u201d\uff08\uff09\u3001\uff1f\u300a\u300b]/.test(data.batchNo)){
|
||
flagMessage = '请不要输入中文字符'
|
||
flag = true
|
||
}
|
||
if(/[,]/.test(data.batchNo)){
|
||
flagMessage = '请不要输入逗号'
|
||
flag = true
|
||
}
|
||
|
||
})
|
||
if(flag){
|
||
this.$message.error(flagMessage);
|
||
return
|
||
}
|
||
const params={
|
||
otherInputBill:{},
|
||
detailList:this.tableData
|
||
}
|
||
this.$otherInputBill.OtherInputAdd(params).then(data=>{
|
||
if(data.data.code===200){
|
||
this.$message({
|
||
message: '添加成功',
|
||
type: 'success'
|
||
});
|
||
this.$parent.getOtherInputList()
|
||
this.$layer.close(this.layerid);
|
||
}
|
||
})
|
||
}else {
|
||
const params={
|
||
otherInputBill:this.$parent.currentRow,
|
||
detailList:this.tableData
|
||
}
|
||
params.detailList.forEach(data=>{
|
||
data.inputBillId = this.$parent.currentRow.id
|
||
data.inputBillNumber = this.$parent.currentRow.inputBillNumber
|
||
|
||
if(data.planQty===0||data.planQty===''||data.planQty===undefined){
|
||
this.$message.error('请输入计划入库数量');
|
||
flag = true
|
||
}
|
||
|
||
})
|
||
|
||
if(flag){
|
||
return
|
||
}
|
||
|
||
this.$otherInputBill.OtherInputPut(params).then(data=>{
|
||
if(data.data.code===200){
|
||
this.$message({
|
||
message: '修改成功',
|
||
type: 'success'
|
||
});
|
||
this.$parent.getOtherInputList()
|
||
this.$layer.close(this.layerid);
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
},
|
||
initAll() {
|
||
|
||
},
|
||
goBack() {
|
||
// this.propThis.editNow = false
|
||
this.$layer.close(this.layerid);
|
||
},
|
||
|
||
|
||
|
||
getSelectMaterial(row) {
|
||
let pushData={
|
||
materialId:row.id,
|
||
materialCode:row.materialCode,
|
||
materialName:row.materialName,
|
||
unitOfMeasure:row.unitOfMeasure,
|
||
materialSpec:row.materialSpec,
|
||
packageSize:row.packageSize,
|
||
|
||
dictStatus:1,
|
||
dictStatusShow: '待入库',
|
||
planQty:0,
|
||
realQty:0,
|
||
isFil:'Y',
|
||
supplierId:null,
|
||
supplierName:null,
|
||
supplierCode:null,
|
||
}
|
||
this.tableData.push(pushData)
|
||
// if(this.tableData.length===0){
|
||
// this.tableData.push(pushData)
|
||
// }else {
|
||
//
|
||
// for(let i = 0;i<this.tableData.length;i++){
|
||
// if(this.tableData[i].materialId===pushData.materialId){
|
||
// this.$message.error('物料不能重复');
|
||
// return
|
||
// }else {
|
||
// if((i+1)===this.tableData.length){
|
||
// this.tableData.push(pushData)
|
||
// return
|
||
// }
|
||
//
|
||
// }
|
||
// }
|
||
// }
|
||
},
|
||
add() {
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: selectMaterial, //传递的组件对象
|
||
parent: this,//当前的vue对象
|
||
shadeClose: false,
|
||
data:this.tableData
|
||
},
|
||
title: '新增'
|
||
})
|
||
|
||
|
||
},
|
||
|
||
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
|
||
</style>
|