<template>
|
<el-dialog
|
top="10vh"
|
width="60%"
|
:fullscreen="isFullScreen"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
>
|
<template slot="title">
|
<i
|
:class="isFullScreen ? 'icon-zuixiaohua' : 'icon-quanpingzuidahua'"
|
style="position: absolute; right: 52px; float: right"
|
@click="fullscreen"
|
>
|
</i>
|
<span>移库</span>
|
</template>
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" class="l-mes">
|
<div class="avue-crud">
|
<el-table
|
:data="dataForm.stock"
|
style="width: 100%"
|
class="mps-table"
|
height="500px"
|
>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="工厂"
|
width="100px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.factoryName }}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="零件号"
|
width="200px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.partNo }}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="零件名称"
|
width="120px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.partName }}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="仓库"
|
width="90px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.warehouseName }}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="批号"
|
width="120px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.partBatchNo }}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="locationNo"
|
header-align="center"
|
align="center"
|
label="库位号"
|
width="170px"
|
>
|
<template scope="scope">
|
<el-form-item
|
:prop="'stock.' + scope.$index"
|
:rules="rules.locationNo"
|
>
|
<el-input
|
v-model="scope.row.locationNo"
|
placeholder=""
|
readonly
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openLocationDialog(scope.$index)"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="可用库存数量"
|
width="120px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{
|
scope.row.availableStockQuantity
|
}}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="availableStockQuantityMove"
|
header-align="center"
|
align="center"
|
label="移库的库存数量"
|
width="170px"
|
>
|
<template scope="scope">
|
<el-form-item
|
:prop="'stock.' + scope.$index"
|
:rules="rules.availableStockQuantityMove"
|
>
|
<el-input
|
v-model="scope.row.availableStockQuantityMove"
|
placeholder=""
|
>
|
</el-input>
|
</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="单位"
|
width="160px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.unit }}</el-form-item>
|
</template>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="状态"
|
width="160px"
|
>
|
<template slot-scope="scope">
|
<el-form-item>{{ scope.row.status }}</el-form-item>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button type="info" @click="visible = false">取消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>确定</el-button
|
>
|
</div>
|
<locationDialog
|
:currshowlist.sync="showLocation"
|
@listenToLocationEvent="selectLocation"
|
/>
|
</el-dialog>
|
</template>
|
|
<script>
|
import locationDialog from '@/views/common/location.vue'
|
import { validateQtyStock } from '../../../util/validate'
|
import { moveStockNumber } from '../../../api/warehouse/stock'
|
|
export default {
|
data() {
|
return {
|
index: '',
|
showLocation: false,
|
isFullScreen: false,
|
visible: true,
|
dataForm: {
|
stock: []
|
},
|
dataRule: {},
|
isSubmit: false
|
}
|
},
|
components: {
|
locationDialog
|
},
|
methods: {
|
init(stock) {
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs.dataForm.resetFields()
|
this.dataForm.stock = []
|
this.dataForm.stock = JSON.parse(JSON.stringify(stock))
|
})
|
},
|
dataFormSubmit() {
|
this.isSubmit = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
for (let i = 0; i < this.dataForm.stock.length; i++) {
|
this.dataForm.stock[i].manualInput = true
|
}
|
// console.log(this.dataForm.stock)
|
moveStockNumber(this.dataForm.stock)
|
.then((res) => {
|
this.$message.success('移库成功')
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
} else {
|
this.isSubmit = false
|
}
|
})
|
},
|
// 库位弹窗
|
openLocationDialog(index) {
|
this.showLocation = true
|
this.index = index
|
},
|
selectLocation(location) {
|
if (location) {
|
this.dataForm.stock[this.index].locationId = location.id
|
this.dataForm.stock[this.index].locationNo = location.locNo
|
}
|
},
|
// 全屏
|
fullscreen() {
|
this.isFullScreen = !this.isFullScreen
|
}
|
},
|
computed: {
|
rules: function() {
|
return {
|
availableStockQuantityMove: [
|
{ validator: validateQtyStock, trigger: 'blur' }
|
]
|
}
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.mps-table .el-table__row > td {
|
border: none;
|
}
|
|
.mps-table::before {
|
height: 0px;
|
}
|
</style>
|