<template>
|
<el-dialog
|
width="900px"
|
title="退料"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
>
|
<div class="app-container">
|
<div class="avue-crud">
|
<el-table
|
v-loading="listLoading"
|
:key="tableKey"
|
:data="dataList"
|
border
|
style="width: 100%;"
|
@cell-dblclick="dblhandleCurrentChange"
|
>
|
<el-table-column
|
prop="partNo"
|
header-align="center"
|
align="center"
|
label="零件编号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partName"
|
header-align="center"
|
align="center"
|
label="零件"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partBatchNo"
|
header-align="center"
|
align="center"
|
label="零件批号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="specs"
|
header-align="center"
|
align="center"
|
label="规格型号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="returnQuantity"
|
header-align="center"
|
align="center"
|
label="退料数量"
|
>
|
<template scope="scope">
|
<el-input
|
size="small"
|
v-model="scope.row.returnQuantity"
|
placeholder="请输入数量"
|
@blur="inputblur"
|
v-focus
|
clearable
|
></el-input>
|
<!--<span v-if="!scope.row.returnQuantityFlag">{{scope.row.returnQuantity}}</span>-->
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="returnLocationId"
|
header-align="center"
|
align="center"
|
width="180"
|
label="退料库位"
|
>
|
<template scope="scope">
|
<el-select v-model="scope.row.returnLocationId" filterable>
|
<el-option
|
v-for="item in optionsList['库位']"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button type="primary" @click="saveReturnMaterial">退 料</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
<script>
|
import { returnMaterial, getReturnLocations } from '@/api/product/personboard'
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
dataList: {
|
type: Array
|
},
|
workstationId: {
|
type: Number
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
listLoading: false,
|
tableKey: 0,
|
optionsList: {
|
库位: []
|
}
|
}
|
},
|
directives: {
|
focus: {
|
inserted: function(el, option) {
|
var defClass = 'el-input'
|
var defTag = 'input'
|
var value = option.value || true
|
if (typeof value === 'boolean')
|
value = { cls: defClass, tag: defTag, foc: value }
|
else
|
value = {
|
cls: value.cls || defClass,
|
tag: value.tag || defTag,
|
foc: value.foc || false
|
}
|
// if (el.classList.contains(value.cls) && value.foc)
|
el.getElementsByTagName(value.tag)[0].focus()
|
}
|
}
|
},
|
methods: {
|
dblhandleCurrentChange(row, column, cell, event) {
|
switch (column.label) {
|
case '退料数量':
|
this.$set(row, 'returnQuantityFlag', true)
|
break
|
}
|
},
|
inputblur(row, event, column, cell) {
|
var _this = this
|
const tableD = _this.dataList
|
tableD.forEach(function(item) {
|
_this.$set(item, 'returnQuantityFlag', false)
|
})
|
},
|
saveReturnMaterial() {
|
// 调用退料接口,然后刷新线边仓、投料列表
|
var feeds = []
|
var feed
|
for (var i = 0; i < this.dataList.length; i++) {
|
feed = {}
|
feed.id = this.dataList[i].id
|
feed.systemNo = this.dataList[i].systemNo
|
feed.partBatchNo = this.dataList[i].partBatchNo
|
feed.partId = this.dataList[i].partId
|
feed.returnQuantity = this.dataList[i].returnQuantity
|
feed.returnLocationId = this.dataList[i].returnLocationId
|
feed.workstationId = this.workstationId
|
feeds.push(feed)
|
}
|
if (feeds.length > 0) {
|
// 退料
|
returnMaterial(feeds)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success('退料成功')
|
} else {
|
this.$message.error('退料失败')
|
}
|
// 刷新线边仓、投料列表
|
this.$emit('refreshFeedList')
|
this.innerVisible = false
|
})
|
.catch((error) => {})
|
}
|
},
|
getLoc() {
|
getReturnLocations(this.workstationId).then((response) => {
|
this.optionsList['库位'] = response.data.data.map((e) => {
|
return { value: e.id, label: e.locName }
|
})
|
this.dataList.forEach((e) => {
|
this.$set(e, 'returnLocationId', this.optionsList['库位'][0].value)
|
})
|
})
|
}
|
/*
|
getDataList() {
|
this.listLoading = true;
|
//查询选中线边仓零件的最新库存
|
this.listLoading = false;
|
} */
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
// this.getList();
|
this.getLoc()
|
}
|
}
|
},
|
mounted() {
|
// this.getDataList();
|
}
|
}
|
</script>
|