fix(设备模块): 优化备件选择和验收流程
1、修复快速重复选择同一备件 2、修复备品备件信息维护后,在使用备品数量超过库存数量时,当前数量有负数 3、修复点巡检工单验收,填写验收意见后系统空指针报错
This commit is contained in:
parent
abcbdf3cb0
commit
e97d17877b
@ -403,6 +403,20 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.formObj.stateName = 'COMPLETE'
|
this.formObj.stateName = 'COMPLETE'
|
||||||
checkObj.checkResult = 'Y'
|
checkObj.checkResult = 'Y'
|
||||||
|
|
||||||
|
showLoading()
|
||||||
|
inspectCheck(checkObj).then(res => {
|
||||||
|
hideLoading()
|
||||||
|
if (res.data.code !== 0) {
|
||||||
|
return me.$message.error('操作失败:' + res.data.msg);
|
||||||
|
}
|
||||||
|
this.$message.success("验收完成")
|
||||||
|
me.handleClose()
|
||||||
|
}).catch((e) => {
|
||||||
|
hideLoading()
|
||||||
|
this.$message.error('操作失败:' + e)
|
||||||
|
})
|
||||||
|
return true;
|
||||||
})
|
})
|
||||||
// } else {
|
// } else {
|
||||||
// getRepairOrderStatus({num:this.formObj.repairNum}).then(resp => {
|
// getRepairOrderStatus({num:this.formObj.repairNum}).then(resp => {
|
||||||
@ -427,6 +441,7 @@ export default {
|
|||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.formObj.stateName = 'COMPLETE'
|
this.formObj.stateName = 'COMPLETE'
|
||||||
checkObj.checkResult = 'Y'
|
checkObj.checkResult = 'Y'
|
||||||
@ -437,6 +452,7 @@ export default {
|
|||||||
checkObj.checkResult = 'N'
|
checkObj.checkResult = 'N'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me.formObj.result === '0') {
|
||||||
showLoading()
|
showLoading()
|
||||||
inspectCheck(checkObj).then(res => {
|
inspectCheck(checkObj).then(res => {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
@ -450,6 +466,7 @@ export default {
|
|||||||
this.$message.error('操作失败:' + e)
|
this.$message.error('操作失败:' + e)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getDateTime() {
|
getDateTime() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
<input-select-dialog
|
<input-select-dialog
|
||||||
:modal-fetch-fun='getPartList' :modal-obj="partDialogObj"
|
:modal-fetch-fun='getPartList' :modal-obj="partDialogObj"
|
||||||
:modal-show.sync="partDialogVisible"
|
:modal-show.sync="partDialogVisible"
|
||||||
@inputDialogSelected="partDialogSelected"></input-select-dialog>
|
@inputDialogSelected="partDialogSelected">
|
||||||
|
</input-select-dialog>
|
||||||
<!-- 图片预览弹出框 -->
|
<!-- 图片预览弹出框 -->
|
||||||
<FileView :open.sync="dialogImgVisible" :url="previewUrl"/>
|
<FileView :open.sync="dialogImgVisible" :url="previewUrl"/>
|
||||||
<el-form ref="formObj" :model="formObj" :rules="formRules">
|
<el-form ref="formObj" :model="formObj" :rules="formRules">
|
||||||
@ -355,6 +356,7 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
consumableRecord: [],
|
consumableRecord: [],
|
||||||
|
lastSelectedPart: { partId: null, time: 0 }, // 记录上次选择的备件和时间
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -473,11 +475,21 @@ export default {
|
|||||||
},
|
},
|
||||||
// 耗材弹出框选择
|
// 耗材弹出框选择
|
||||||
partDialogSelected(row) {
|
partDialogSelected(row) {
|
||||||
|
const now = Date.now();
|
||||||
|
// 如果同一备件在1秒内重复选择,则忽略
|
||||||
|
if (row.partId === this.lastSelectedPart.partId && now - this.lastSelectedPart.time < 1000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 更新最后选择的备件和时间
|
||||||
|
this.lastSelectedPart = { partId: row.partId, time: now };
|
||||||
if (this.consumeIndex >= 0) {
|
if (this.consumeIndex >= 0) {
|
||||||
let me = this
|
let me = this
|
||||||
|
if (row.qtyOnHand < 0 ){
|
||||||
|
return me.$message.warning(`【${row.partName}】该备件数量不足,请重新选择!`)
|
||||||
|
}
|
||||||
// 判断被选中的备件是否已在备件清单中
|
// 判断被选中的备件是否已在备件清单中
|
||||||
if (me.consumableRecord.find(obj => obj.partId === row.partId)) {
|
if (me.consumableRecord.find(obj => obj.partId === row.partId)) {
|
||||||
return me.$message.warning('该备件已存在备件清单中,请重新选择!')
|
return me.$message.warning(`【${row.partName}】该备件已存在备件清单中,请重新选择!`)
|
||||||
}
|
}
|
||||||
me.$set(me.consumableRecord[me.consumeIndex], "partId", row.partId)
|
me.$set(me.consumableRecord[me.consumeIndex], "partId", row.partId)
|
||||||
me.$set(me.consumableRecord[me.consumeIndex], "partName", row.partName)
|
me.$set(me.consumableRecord[me.consumeIndex], "partName", row.partName)
|
||||||
@ -526,7 +538,7 @@ export default {
|
|||||||
me.$message.success('操作成功')
|
me.$message.success('操作成功')
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
this.$message.error('操作失败:' + e)
|
// this.$message.error('操作失败:' + e)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (type === 'success' || type === 'fail') {
|
if (type === 'success' || type === 'fail') {
|
||||||
|
|||||||
@ -558,6 +558,7 @@ export default {
|
|||||||
{required: true, message: "请填写验收意见", trigger: "focus"},
|
{required: true, message: "请填写验收意见", trigger: "focus"},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
lastSelectedPart: { partId: null, time: 0 }, // 记录上次选择的备件和时间
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -915,11 +916,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
partDialogSelected(row) {
|
partDialogSelected(row) {
|
||||||
|
const now = Date.now();
|
||||||
|
// 如果同一备件在1秒内重复选择,则忽略
|
||||||
|
if (row.partId === this.lastSelectedPart.partId && now - this.lastSelectedPart.time < 1000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 更新最后选择的备件和时间
|
||||||
|
this.lastSelectedPart = { partId: row.partId, time: now };
|
||||||
if (this.consumeIndex >= 0) {
|
if (this.consumeIndex >= 0) {
|
||||||
let me = this
|
let me = this
|
||||||
|
if (row.qtyOnHand < 0 ){
|
||||||
|
return me.$message.warning(`【${row.partName}】该备件数量不足,请重新选择!`)
|
||||||
|
}
|
||||||
// 判断被选中的备件是否已在备件清单中
|
// 判断被选中的备件是否已在备件清单中
|
||||||
if (me.consumableRecord.find(obj => obj.partId === row.partId)) {
|
if (me.consumableRecord.find(obj => obj.partId === row.partId)) {
|
||||||
return me.$message.warning('该备件已存在备件清单中,请重新选择!')
|
return me.$message.warning(`【${row.partName}】该备件已存在备件清单中,请重新选择!`)
|
||||||
}
|
}
|
||||||
me.$set(me.consumableRecord[me.consumeIndex], "partId", row.partId)
|
me.$set(me.consumableRecord[me.consumeIndex], "partId", row.partId)
|
||||||
me.$set(me.consumableRecord[me.consumeIndex], "partName", row.partName)
|
me.$set(me.consumableRecord[me.consumeIndex], "partName", row.partName)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user