<template>
|
<el-dialog
|
width="60%"
|
title="IFS库位"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<div style="display:flex;margin-bottom:10px;">
|
<div style="display:flex;align-items:center;">
|
<div>
|
<span>库位号:</span>
|
</div>
|
<div>
|
<el-input
|
class="detail-ifs-location-input"
|
v-model="dataForm.locationNo"
|
></el-input>
|
</div>
|
</div>
|
<div style="display:flex;align-items:center;margin-left:10px;">
|
<div>
|
<span>库位描述:</span>
|
</div>
|
<div>
|
<el-input
|
class="detail-ifs-location-input"
|
v-model="dataForm.locationDesc"
|
></el-input>
|
</div>
|
</div>
|
<div style="margin-left:10px;">
|
<el-button type="primary" @click="queryLocation">查询</el-button>
|
</div>
|
</div>
|
<el-table
|
class="ifs-location-table"
|
:data="ifsLocationData"
|
style="width: 100%;"
|
height="450px"
|
border
|
@current-change="handleCurrentChange"
|
stripe
|
ref="detailIfsLocationTable"
|
>
|
<el-table-column align="center" width="55" label="单选">
|
<template slot-scope="scope">
|
<el-checkbox
|
class="detail-ifs-location-table-single-checkbox"
|
v-model="scope.row.commonChecked"
|
disabled
|
></el-checkbox>
|
</template>
|
</el-table-column>
|
<el-table-column type="index" width="50" label="序号"> </el-table-column>
|
<el-table-column prop="locationNo" label="库位号" align="center">
|
</el-table-column>
|
<el-table-column
|
prop="locationDesc"
|
label="库位描述"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="locationGroupDesc"
|
label="库位组描述"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="locationTypeDesc"
|
label="库位类型描述"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
</el-table>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`saveSelectRow`"
|
>确 定</el-button
|
>
|
</div>
|
</el-dialog>
|
</template>
|
<script>
|
import { getIfsLocationByGroup } from '@/api/warehouse/location'
|
import { IFSUpdate } from '@/api/warehouse/returnstock'
|
export default {
|
components: {},
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
transportsList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
isSubmit: false,
|
dataForm: {
|
locationNo: null,
|
locationDesc: null
|
},
|
ifsLocationData: [],
|
currLocationRow: null
|
}
|
},
|
methods: {
|
// 查询ifs库位列表
|
queryLocation() {
|
this.ifsLocationData = []
|
getIfsLocationByGroup({
|
locationNo: this.dataForm.locationNo,
|
locationDesc: this.dataForm.locationDesc
|
}).then((response) => {
|
if (response.data.code === 0) {
|
const _data = response.data.data
|
this.ifsLocationData = _data.map((item, index) => {
|
return {
|
id: index + 1,
|
locationNo: item.LOCATION_NO,
|
locationDesc: item.LOCATION_DESC,
|
locationGroupDesc: item.LOCATION_GROUP_DESC,
|
locationTypeDesc: item.LOCATION_TYPE_DESC,
|
commonChecked: false
|
}
|
})
|
}
|
})
|
},
|
// 单行选中
|
handleCurrentChange(row) {
|
if (row != null) {
|
this.ifsLocationData.forEach((item) => {
|
// 排他,每次选择时把其他选项都清除
|
if (item.id !== row.id) {
|
item.commonChecked = false
|
} else {
|
item.commonChecked = true
|
}
|
})
|
} else {
|
this.ifsLocationData.forEach((item) => {
|
// 选项都清除
|
item.commonChecked = false
|
})
|
}
|
this.currLocationRow = row
|
},
|
saveSelectRow() {
|
this.isSubmit = true
|
const transportsMaterials = []
|
this.transportsList.forEach((item) => {
|
transportsMaterials.push({
|
id: item.id,
|
stockId: item.stockId,
|
ifsBatchNo: item.ifsBatchNo,
|
ifsFromLocationName: item.ifsFromLocationName,
|
ifsFromLocationNo: item.ifsFromLocationNo,
|
partNo: item.partNo,
|
partDesc: item.partName,
|
reverseQuantity: item.reverseQuantity,
|
sn: item.sn,
|
reverseApplyId: item.reverseApplyId,
|
unit: item.unit,
|
state: item.state,
|
ifsToLocationName: this.currLocationRow.locationDesc,
|
ifsToLocationNo: this.currLocationRow.locationNo
|
})
|
})
|
console.log(transportsMaterials)
|
IFSUpdate(transportsMaterials)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.innerVisible = false
|
this.$message.success('设定至库位成功')
|
this.$emit('refreshDataList')
|
} else {
|
this.$message.error('设定至库位失败')
|
}
|
this.isSubmit = false
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
},
|
initData() {
|
this.currLocationRow = null
|
this.dataForm.locationNo = null
|
this.dataForm.locationDesc = null
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.initData()
|
this.ifsLocationData = []
|
this.$nextTick(() => {})
|
}
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.part-dialog .el-dialog__header {
|
padding: 10px 20px 10px;
|
}
|
.part-dialog .el-dialog__header .el-dialog__headerbtn {
|
top: 10px;
|
}
|
.part-dialog .el-dialog__body {
|
padding: 5px 20px;
|
}
|
|
.part-dialog .el-dialog__footer {
|
padding: 5px 20px 10px;
|
}
|
|
.part-dialog .el-dialog__body .avue-crud__pagination {
|
margin-top: 0px;
|
margin-bottom: 5px;
|
}
|
.detail-ifs-location-input >>> .el-input__inner {
|
border-top: none;
|
border-left: none;
|
border-right: none;
|
padding: 0;
|
border-radius: 0;
|
}
|
.detail-ifs-location-table-single-checkbox
|
>>> .el-checkbox__input.is-disabled.is-checked
|
.el-checkbox__inner {
|
background-color: #006eff;
|
border-color: #006eff;
|
}
|
.detail-ifs-location-table-single-checkbox
|
>>> .el-checkbox__input.is-disabled
|
.el-checkbox__inner {
|
background-color: #ffffff;
|
cursor: pointer;
|
}
|
.detail-ifs-location-table-single-checkbox >>> .el-checkbox__inner::after {
|
border: 1px solid #fff !important;
|
border-left: 0 !important;
|
border-top: 0 !important;
|
cursor: pointer !important;
|
}
|
</style>
|