You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

298 lines
8.2 KiB

<template>
<!-- 盘点计划 -->
<div class="app-container">
<div class="search-box">
<el-form
:inline="true"
:model="enterForm"
>
<el-form-item
label="业主名称"
prop="consignorId"
>
<el-select
v-model="enterForm.consignorId"
placeholder="请选择"
clearable
>
<el-option
v-for="item in options"
:key="item.consignorCode"
:label="item.consignorName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="库房">
<el-select
v-model="enterForm.storageId"
placeholder="请选择库房"
clearable
style="width: 240px"
@change="selectStoId"
>
<el-option
v-for="item in branchList"
:key="item.id"
:label="item.storageName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item> -->
<el-form-item label="库区编号">
<el-select
v-model="enterForm.areaId"
placeholder="请选择库区编号"
clearable
style="width: 240px"
>
<el-option
v-for="item in areaIdhList"
:key="item.areaCode"
:label="item.areaName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="盘点方式"
prop="invWay"
>
<el-radio-group v-model="enterForm.invWay">
<el-radio label="open">明盘</el-radio>
<el-radio label="close">盲盘</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="盘点类型">
<el-radio-group v-model="enterForm.invType">
<el-radio label="货位"></el-radio>
<el-radio label="全盘"></el-radio>
<el-radio label="空货位"></el-radio>
<el-radio label="动销"></el-radio>
</el-radio-group>
</el-form-item> -->
<el-form-item label="盘点类型">
<el-select
v-model="enterForm.invType"
placeholder="请选择库区编号"
clearable
style="width: 240px"
>
<el-option
v-for="item in dict.type.inv_type_dict"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="货位/商品编号"
style="width: 250px"
>
<el-input
v-model="locationCode"
style="width: 250px"
placeholder="根据商品或者货位查询"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="queryTable"
>搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="opt-box">
<div class="opt-box-right">
<el-row :gutter="10">
<el-col :span="1.5">
<el-button
type="primary"
@click="generateThePlan"
:disabled="!handleSelect.length != 0"
>生成计划
</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-button type="primary" @click="exportBtn">导出</el-button> -->
</el-col>
</el-row>
</div>
</div>
<div
class="layout-full"
style="margin-bottom: 45px"
>
<heavy-table
:data="tableData"
:paging="paging"
:config="tableConfig.config"
@current-change="queryTable"
@handleselection="handleselection"
:tableProps="tableProps"
>
</heavy-table>
</div>
</div>
</template>
<script>
import { tableConfig } from './config.js'
import { consignorList } from '@/api/warehousing/acceptance'
import { storageList } from '@/api/warehousing/acceptance'
import { queryGoods, storageList1, add, listAreaByStorage, exportBtn, getAreaList } from '@/api/libraryManage/inventory'
import { Debounce, getDictLabel } from '@/utils/index'
export default {
name: 'Inventory',
dicts: ['goods_unit', 'inv_type_dict'],
data() {
return {
tableProps: {},
ids: [],
locationCode: '',
enterForm: {
consignorId: '',
storageId: '',
areaId: '',
locationCode: '',
invWay: 'open',
invType: ''
},
options: [],
branchList: [],
tableData: [],
areaIdhList: [],
handleSelect: [],
tableConfig: {},
storageId: '',
paging: {
page: 1, // 当前页
size: 10, // 页面大小
total: 0
}
}
},
mounted() {
this.getBasicList()
this.getBasicListsto()
storageList1().then((res) => {
this.enterForm.storageId = res.data[0].id
this.listAreaByStorage(this.enterForm.storageId)
})
setTimeout(() => {
this.enterForm.invType = JSON.parse(JSON.stringify(this.dict.type.inv_type_dict))[0].value
}, 500)
// this.enterForm.invType = 'QP'
},
async created() {
this.tableConfig = await this.getTableHeaderCom('busin_inventory', tableConfig.call(this))
console.log(this.tableConfig)
},
watch: {
//侦听 locationCode的变化
locationCode(newVal, oldVal) {
this.enterForm.goodCode = this.locationCode
this.enterForm.locationCode = undefined
if (newVal.indexOf('-') !== -1) {
this.enterForm.locationCode = this.locationCode
this.enterForm.goodCode = undefined
}
}
},
methods: {
// 货主请求
getBasicList() {
consignorList().then((res) => {
this.options = res.rows
// console.log(this.options)
this.enterForm.consignorId = this.options[0].id
})
},
// 库别
getBasicListsto() {
storageList().then((res) => {
this.branchList = res.data
})
},
// 根绝库别编号获得库区
selectStoId(val) {
this.enterForm.areaId = ''
if (this.enterForm.storageId) {
this.listAreaByStorage(this.enterForm.storageId)
}
},
// 库区
listAreaByStorage(val) {
listAreaByStorage(this.enterForm.storageId).then((res) => {
this.areaIdhList = res.data
// this.enterForm.areaId = 1
})
},
// 表格复选框选中
handleselection(val) {
this.handleSelect = val.map((ele) => ele.id)
// this.ids = val.map((ele) => ele.stockId)
this.ids = val.map((ele) => ele.stockId)
},
// 重置
resetQuery() {
this.enterForm = {}
},
// 表格的数据
queryTable() {
// if (!this.enterForm.consignorId) return this.$message('业主名称必填!')
if (!this.enterForm.invWay) return this.$message('盘点方式必选!')
// if (!this.enterForm.invType) return this.$message('盘点类型必选!')
this.loading = true
queryGoods({
pageSize: this.paging.size,
pageNum: this.paging.page,
...this.enterForm
})
.then((response) => {
if (response.code === 200) {
this.loading = false
this.paging.total = response.total
this.tableData = response.rows
}
})
.catch(() => {
this.loading = false
})
},
// 生成计划
generateThePlan() {
add({
invType: this.enterForm.invType,
invWay: this.enterForm.invWay,
stockIds: this.ids
})
.then((response) => {
if (response.code === 200) {
this.$message({
message: '操作成功!',
type: 'success'
})
this.queryTable()
}
})
.catch(() => {
this.loading = false
})
},
// 导出
exportBtn() {
dealEmptyQueryCondition(request)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped></style>