数量盘点入库
This commit is contained in:
parent
867aab7c4f
commit
e8969befbc
|
|
@ -197,7 +197,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="待入库总数" label-width="130px" prop="num">
|
||||
<el-form-item label="待入库总数" label-width="130px" prop="num" v-if="!isNumCheck">
|
||||
<el-input-number
|
||||
v-model="codeForm.num"
|
||||
placeholder="请输入待入库总数"
|
||||
|
|
@ -215,7 +215,7 @@
|
|||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="前缀" label-width="130px" prop="codePrefix">
|
||||
<el-form-item label="前缀" label-width="130px" prop="codePrefix" v-if="!isNumCheck">
|
||||
<el-input
|
||||
v-model="codeForm.codePrefix"
|
||||
placeholder="请输入前缀"
|
||||
|
|
@ -227,7 +227,7 @@
|
|||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item label="后缀范围" label-width="130px" prop="codeSuffixStart">
|
||||
<el-form-item label="后缀范围" label-width="130px" prop="codeSuffixStart" v-if="!isNumCheck">
|
||||
<el-input
|
||||
v-model="codeForm.codeSuffixStart"
|
||||
clearable
|
||||
|
|
@ -237,7 +237,7 @@
|
|||
@input="changeInput(codeForm.codeSuffixStart)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd">
|
||||
<el-form-item label="~" label-width="auto" prop="codeSuffixEnd" v-if="!isNumCheck">
|
||||
<el-input
|
||||
v-model="codeForm.codeSuffixEnd"
|
||||
clearable
|
||||
|
|
@ -249,7 +249,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="单价" label-width="130px" prop="buyPrice">
|
||||
<el-form-item label="单价" label-width="130px" prop="buyPrice" v-if="!isNumCheck">
|
||||
<el-input-number
|
||||
v-model="codeForm.buyPrice"
|
||||
:precision="2"
|
||||
|
|
@ -266,7 +266,7 @@
|
|||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="选择厂家" label-width="130px" prop="codeFactory">
|
||||
<el-form-item label="选择厂家" label-width="130px" prop="codeFactory" v-if="!isNumCheck">
|
||||
<el-select
|
||||
v-model="codeForm.codeFactory"
|
||||
placeholder="请选择厂家"
|
||||
|
|
@ -283,7 +283,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="检验时间" label-width="130px" prop="thisCheckFixTime">
|
||||
<el-form-item label="检验时间" label-width="130px" prop="thisCheckFixTime" v-if="!isNumCheck">
|
||||
<el-date-picker
|
||||
v-model="codeForm.thisCheckFixTime"
|
||||
type="date"
|
||||
|
|
@ -294,7 +294,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="下次检验时间" label-width="130px" prop="nextCheckFixTime">
|
||||
<el-form-item label="下次检验时间" label-width="130px" prop="nextCheckFixTime" v-if="!isNumCheck">
|
||||
<el-date-picker
|
||||
v-model="codeForm.nextCheckFixTime"
|
||||
type="date"
|
||||
|
|
@ -308,12 +308,12 @@
|
|||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="7">
|
||||
<el-form-item label="检验人" label-width="130px" prop="checkMan">
|
||||
<el-form-item label="检验人" label-width="130px" prop="checkMan" v-if="!isNumCheck">
|
||||
<el-input v-model="codeForm.checkMan" placeholder="请输入检验人" clearable style="width: 220px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-col :span="isNumCheck ? 7 : 10">
|
||||
<el-form-item label="备注" label-width="130px" prop="remarks">
|
||||
<el-input
|
||||
v-model="codeForm.remarks"
|
||||
|
|
@ -322,7 +322,7 @@
|
|||
maxlength="200"
|
||||
rows="4"
|
||||
show-word-limit
|
||||
style="width: 400px"
|
||||
:style="{ width: isNumCheck ? '220px' : '400px' }"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
|
@ -365,21 +365,22 @@
|
|||
>导出</el-button>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
<el-table v-loading="loading" :data="codeTableList" @selection-change="handleSelectionChange" :stripe="true" :border="true">
|
||||
<el-table v-loading="loading" :data="codeTableList" v-if="!isNumCheck"
|
||||
@selection-change="handleSelectionChange" :stripe="true" :border="true">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-input v-model="row.maCode" placeholder="请输入设备编码"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出厂编码" align="center" prop="outFacCode" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-input v-model="row.outFacCode" placeholder="请输入设备编码"></el-input>
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-input v-model="row.outFacCode" placeholder="请输入出厂编码"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="生产厂家" align="center" prop="maVender" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-select v-model="row.maVender" placeholder="请选择生产厂家" clearable filterable>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
|
|
@ -391,7 +392,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检验日期" align="center" prop="thisCheckFixTime" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-date-picker
|
||||
v-model="row.thisCheckFixTime"
|
||||
type="date"
|
||||
|
|
@ -402,7 +403,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下次检验日期" align="center" prop="nextCheckFixTime" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-date-picker
|
||||
v-model="row.nextCheckFixTime"
|
||||
type="date"
|
||||
|
|
@ -413,7 +414,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" prop="buyPrice" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-input-number
|
||||
v-model="row.buyPrice"
|
||||
:precision="2"
|
||||
|
|
@ -457,6 +458,43 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 数量入库 -->
|
||||
<el-table v-loading="loading" :data="numTableList" border stripe v-if="isNumCheck">
|
||||
<el-table-column label="序号" align="center" type="index" />
|
||||
<el-table-column prop="typeCn" label="设备名称" align="center" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column prop="guigeCn" label="规格型号" align="center" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="当前库存" align="center" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column prop="num" label="入库数量" align="center" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-input-number v-model="row.putInStoreNum" placeholder="请输入入库数量" @blur="handlePutBlur(row)"
|
||||
clearable :controls="false" :min="1" style="width: 10vw;" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitCn" label="计量单位" align="center" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true">
|
||||
<template v-slot:default="{ row }">
|
||||
<el-input v-model="row.remark" placeholder="请输入备注" align="center" :show-overflow-tooltip="true" clearable></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot:default="{ $index }">
|
||||
<el-popconfirm
|
||||
title="确定删除吗?"
|
||||
icon="el-icon-info"
|
||||
placement="top"
|
||||
@confirm="handleDeleteRow($index)"
|
||||
@cancel="cancelPop"
|
||||
>
|
||||
<el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
|
|
@ -511,6 +549,9 @@ export default {
|
|||
returnList: [],
|
||||
// 编码盘点表格数据
|
||||
codeTableList: [],
|
||||
// 编码盘点表格数据
|
||||
numTableList: [],
|
||||
numTable: {},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 入库来源选项
|
||||
|
|
@ -523,6 +564,8 @@ export default {
|
|||
codeOpen: false,
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
isNumCheck: false,
|
||||
isAdd: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
|
|
@ -642,7 +685,9 @@ export default {
|
|||
this.deviceType = {}
|
||||
this.reset();
|
||||
this.codeTableList = []
|
||||
this.numTableList = []
|
||||
this.$refs['codeForm'].clearValidate()
|
||||
this.isNumCheck = false;
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
|
|
@ -681,17 +726,27 @@ export default {
|
|||
},
|
||||
/** 填充编码盘点表单 */
|
||||
fillCodeForm() {
|
||||
console.log('🚀 ~ fillCodeForm ~ this.isNumCheck:', this.isNumCheck);
|
||||
// 校验表单
|
||||
this.$refs['codeForm'].validate(valid => {
|
||||
if (!valid) return
|
||||
console.log('🚀 ~ fillCodeForm ~ this.codeForm:', this.codeForm);
|
||||
// 清空this.codeTableList
|
||||
this.codeTableList = []
|
||||
if (this.isNumCheck) {
|
||||
// 判断 this.numTableList 中是否有 this.numTable 的数据, 如果有, 则不添加
|
||||
if (this.numTableList.some(item => item.typeId == this.codeForm.typeId)) {
|
||||
this.$message.error('请勿重复添加')
|
||||
return
|
||||
}
|
||||
console.log('🚀 ~ fillCodeForm ~ this.numTable:', this.numTable);
|
||||
this.numTableList.push(this.numTable)
|
||||
} else {
|
||||
// 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
|
||||
for (let i = 0; i < this.codeForm.num; i++) {
|
||||
// 设备编码: 前缀 拼接 后缀
|
||||
let suffix = (parseInt(this.codeForm.codeSuffixStart) + i).toString().padStart(this.codeForm.codeSuffixStart?.length, '0')
|
||||
console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
||||
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
||||
suffix = isNaN(suffix) ? '' : suffix
|
||||
const maCode = `${this.codeForm.codePrefix || ''}${suffix}`
|
||||
// 出厂编码
|
||||
|
|
@ -715,6 +770,7 @@ export default {
|
|||
buyPrice
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 输入框改变 */
|
||||
|
|
@ -743,12 +799,14 @@ export default {
|
|||
},
|
||||
/** 新增数量盘点按钮操作 */
|
||||
handleNumberAdd() {
|
||||
this.isNumCheck = true;
|
||||
this.reset();
|
||||
this.numberOpen = true;
|
||||
this.codeOpen = true;
|
||||
this.title = "数量盘点入库";
|
||||
},
|
||||
/** 新增编号盘点按钮操作 */
|
||||
handleCodeAdd() {
|
||||
this.isNumCheck = false;
|
||||
this.reset();
|
||||
this.codeOpen = true;
|
||||
this.title = "编码盘点入库";
|
||||
|
|
@ -773,10 +831,32 @@ export default {
|
|||
submitForm: function() {
|
||||
this.$refs['codeForm'].validate(valid => {
|
||||
if (valid) {
|
||||
let SavePutInfoDto = {}
|
||||
console.log('🚀 ~ this.codeForm:', this.codeForm);
|
||||
console.log('🚀 ~ this.codeTableList:', this.codeTableList);
|
||||
console.log('🚀 ~ this.numTableList:', this.numTableList);
|
||||
if (this.isNumCheck) {
|
||||
// 提交数据
|
||||
const SavePutInfoDto = {
|
||||
SavePutInfoDto = {
|
||||
isCode: false,
|
||||
putInType: this.codeForm.putInType,
|
||||
remarks: this.codeForm.remarks || '',
|
||||
machIneDtoList: this.numTableList,
|
||||
}
|
||||
console.log('🚀 ~ submitForm: ~ SavePutInfoDto-isNum', SavePutInfoDto)
|
||||
// 发送请求
|
||||
inputByCode(SavePutInfoDto).then(response => {
|
||||
this.$message.success('入库成功')
|
||||
this.codeOpen = false
|
||||
this.getList()
|
||||
this.resetCodeForm()
|
||||
this.reset()
|
||||
this.numTableList = []
|
||||
this.deviceType = {}
|
||||
})
|
||||
} else {
|
||||
// 提交数据
|
||||
SavePutInfoDto = {
|
||||
isCode: true, // 是否编码盘点
|
||||
putInType: this.codeForm.putInType,
|
||||
typeId: this.codeForm.typeId,
|
||||
|
|
@ -803,6 +883,7 @@ export default {
|
|||
this.deviceType = {}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
/* this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
|
|
@ -822,6 +903,27 @@ export default {
|
|||
}
|
||||
}); */
|
||||
},
|
||||
// 入库数量输入框失去焦点
|
||||
handlePutBlur(row) {
|
||||
if (row.putInStoreNum > row.num) {
|
||||
this.$message.error('入库数量不能大于当前库存')
|
||||
row.putInStoreNum = row.num
|
||||
}
|
||||
if (!row.putInStoreNum) {
|
||||
this.$message.warning('入库数量不能为空')
|
||||
row.putInStoreNum = 1
|
||||
}
|
||||
},
|
||||
// 删除行
|
||||
handleDeleteRow(index) {
|
||||
this.numTableList.splice(index, 1)
|
||||
setTimeout(() => {
|
||||
this.$message.success('删除成功')
|
||||
}, 50)
|
||||
},
|
||||
cancelPop() {
|
||||
this.$message.info('取消删除')
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const dictIds = row.dictId || this.ids;
|
||||
|
|
@ -875,12 +977,14 @@ export default {
|
|||
)
|
||||
console.log('🚀 ~ deviceTypeChange ~ this.leaseApplyDetails:', this.leaseApplyDetails);
|
||||
// this.deviceType = {}
|
||||
|
||||
this.numTable = this.handelTableItemData(nodes[0])
|
||||
},
|
||||
//// 将数据处理成 表格中需要的数据
|
||||
handelTableItemData(node){
|
||||
const template = JSON.parse(JSON.stringify(this.leaseApplyDetailsItem))
|
||||
// template.createBy = this.user.name
|
||||
console.log('🚀 ~ handelTableItemData ~ node.data, node.data.id:', node.data, node.data.id);
|
||||
console.log('🚀 ~ handelTableItemData ~ node.data, node.data.id:', node.data, node.data.id, node);
|
||||
this.codeForm.typeId = node.data.id
|
||||
template.num = node.data.num
|
||||
template.companyId = node.data.companyId
|
||||
|
|
@ -888,6 +992,7 @@ export default {
|
|||
template.unitCn = node.data.unitName
|
||||
template.typeCn = node.pathLabels[2]
|
||||
template.guigeCn = node.pathLabels[3]
|
||||
template.putInStoreNum = 1
|
||||
|
||||
if(this.taskId){
|
||||
const index = this.leaseApplyInfoList.find(key => key.companyId == node.data.companyId)
|
||||
|
|
|
|||
Loading…
Reference in New Issue