Commit f90ac8ac authored by jingnan's avatar jingnan 👀

物料确认物料配套发放增加历史扫码录入功能

parent 7b0c1690
......@@ -83,6 +83,74 @@
</el-popover>
</template>
</el-table-column>
<el-table-column v-if="flag" :width="120" label="历史扫码录入" align="center">
<template slot-scope="scope">
<el-popover
v-if="scope.row.materialType === '标准件' "
v-model="scope.row.popoverVisibleHistory"
placement="right"
width="260"
trigger="manual"
popper-class="scan-popper"
>
<div class="content">
<el-form
:ref="'ruleForm' + scope.row.uuid"
:model="typing"
:rules="rules"
label-width="100px"
>
<el-form-item
v-show="scanIdShow"
label="扫码编码:"
prop="scanId"
>
<el-input
:ref="scope.row.uuid"
v-model="typing.scanId"
placeholder="请使用扫码枪录入"
@change="getScanNameHistory"
/>
</el-form-item>
<el-form-item v-show="!scanIdShow" label="型号/件号:">
<el-input
v-model="typing.scanName"
placeholder="型号/件号 加载中..."
/>
</el-form-item>
<el-form-item label="数量:" prop="count">
<el-input v-model="typing.count" placeholder="请填写数量" />
</el-form-item>
</el-form>
<div class="footer">
<el-button
size="mini"
type="text"
@click="resetForm('ruleForm' + scope.row.uuid, scope.row,'history')"
>取消</el-button>
<el-button
type="primary"
size="mini"
@click="submitForm('ruleForm' + scope.row.uuid, scope.row,'history')"
>确定</el-button>
</div>
</div>
<div slot="reference">
<span
class="qiang"
title="扫码枪录入"
@click="codeScanBar(scope.row,'history')"
/>
<span
class="scan"
title="扫码录入"
@click="clickScan(scope.row,'history')"
/>
</div>
</el-popover>
</template>
</el-table-column>
<!-- <el-table-column
v-if="flag"
prop="extMaterial.isRecord"
......@@ -113,6 +181,7 @@
align="center"
label="型号/件号"
sortable
:width="140"
show-overflow-tooltip
/>
<el-table-column
......@@ -337,7 +406,8 @@ export default {
},
stateList: [],
flag: false,
oriData: [] // 本地row做了处理,需记录返回原数据,扫码时传给后端
oriData: [], // 本地row做了处理,需记录返回原数据,扫码时传给后端
scanType: null
}
},
created() {},
......@@ -393,6 +463,7 @@ export default {
arr.push({
// weigthObj: null,
popoverVisible: false,
popoverVisibleHistory: false,
uuid: uuidv4(),
...p,
actualWeightSelect: false,
......@@ -531,54 +602,96 @@ export default {
return 'scan-code'
}
},
resetForm(formName, row) {
row.popoverVisible = false
resetForm(formName, row, type) {
if (type === 'history') {
row.popoverVisibleHistory = false
} else {
row.popoverVisible = false
}
this.scanIdShow = true
this.$refs[formName].resetFields()
},
clickScan(row) {
if (row.affirm === '已确认') {
this.$message({
showClose: true,
message: '已确认 不可扫码录入!',
type: 'warning'
})
return
clickScan(row, type) {
if (type === 'history') {
if (row.stateName === '已出库') {
this.$message({
showClose: true,
message: '已出库 不可扫码录入!',
type: 'warning'
})
return
}
} else {
if (row.affirm === '已确认') {
this.$message({
showClose: true,
message: '已确认 不可扫码录入!',
type: 'warning'
})
return
}
}
this.rowId = row.id
this.rowId = row.extSupportingItemId
$('#' + this.onlyUuid).click()
row.popoverVisible = true
this.scanType = type
if (type === 'history') {
row.popoverVisibleHistory = true
} else {
row.popoverVisible = true
}
},
codeScanBar(row) {
if (row.affirm === '已确认') {
this.$message({
showClose: true,
message: '已确认 不可扫码录入',
type: 'warning'
codeScanBar(row, type) {
if (type === 'history') {
if (row.stateName === '已出库') {
this.$message({
showClose: true,
message: '已出库 不可扫码录入',
type: 'warning'
})
return
}
this.tableData.forEach(item => {
if (item.id === row.id) {
row.popoverVisibleHistory = true
} else {
row.popoverVisibleHistory = false
}
})
return
}
this.tableData.forEach(item => {
if (item.id === row.id) {
row.popoverVisible = true
} else {
item.popoverVisible = false
} else {
if (row.affirm === '已确认') {
this.$message({
showClose: true,
message: '已确认 不可扫码录入',
type: 'warning'
})
return
}
})
this.rowId = row.id
this.tableData.forEach(item => {
if (item.id === row.id) {
row.popoverVisible = true
} else {
item.popoverVisible = false
}
})
}
this.rowId = row.extSupportingItemId
this.$nextTick(() => {
this.$refs[row.uuid].focus()
})
},
getScanBar(info) {
this.typing.scanId = info
this.getScanName(info)
if (this.scanType === 'history') {
this.getScanNameHistory(info)
} else {
this.getScanName(info)
}
},
submitForm(formName, row) {
submitForm(formName, row, type) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.scanIdShow = true
this.getQRcode(row)
this.getQRcode(row, type)
this.$refs[formName].resetFields()
} else {
return false
......@@ -588,33 +701,31 @@ export default {
/**
* **扫描胶漆合格证二维码记实**
*/
getQRcode(row) {
getQRcode(row, type) {
// 发送请求
// const id = this.rowId
const id = row.extSupportingItemId
const scanId = this.typing.scanId
// const count = this.typing.count
const count = this.typing.count
const currentRow = this.oriData.find(item => item.jobOutId === row.jobOutId) || {}
delete currentRow.stateName
row.popoverVisible = false
row.stateName = '已出库'
post(
`/ExtScanCodeRecord/scanErpSorting?erpJobId=${scanId}`,
currentRow,
)
let requestUrl = ''
let param = {}
if (type === 'history') {
requestUrl = `/ExtScanCodeRecord/saveMaterialConfirmationHead?suppId=${id}&jbOutId=${scanId}&amount=${count}`
param = {}
} else {
requestUrl = `/ExtScanCodeRecord/scanErpSorting?erpJobId=${scanId}`
param = currentRow
}
post(requestUrl, param)
.then((res) => {
if (res.message.includes('成功')) {
this.$message({
showClose: true,
message: '添加成功!',
type: 'success'
})
} else {
this.$message({
showClose: true,
message: '添加失败',
type: 'error'
})
}
this.$message({
showClose: true,
message: '添加成功!',
type: 'success'
})
})
.catch((err) => console.log(err))
.finally(() => {
......@@ -673,7 +784,23 @@ export default {
})
.catch((err) => console.log(err))
.finally(() => {})
},
async getScanNameHistory(value) {
this.scanIdShow = false
post(
`/JobResponseOutStorage/getModelNo?id=${value}`,
{}
)
.then((res) => {
this.$set(this.typing, 'scanName', res.items)
})
.catch((err) => {
this.scanIdShow = true
console.log(err)
})
.finally(() => {})
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment