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.

332 lines
8.8 KiB

2 years ago
<template>
<div class="app-container">
<div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="入库仓库">
<el-select
style="width: 500px"
2 years ago
v-model="form.warehouseNo"
2 years ago
placeholder="请选择"
clearable
>
<el-option
v-for="item in WarehousingList"
:key="item.id"
:label="item.branchName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物料信息">
<div v-if="chooselist.length>0">
<div v-for="(item,index) in chooselist" :key="index" style="margin-top: 10px">
2 years ago
<span>{{ item.goodName+'-'+item.goodsNo+'-'+item.unitMsr }}</span>
2 years ago
<el-input v-model="item.qty" style="width: 100px;margin-left: 50px" placeholder="入库数量"></el-input>
</div>
</div>
2 years ago
<el-button style="margin-top: 20px" @click="chooseGoods()">选择物料</el-button>
2 years ago
</el-form-item>
<el-form-item label="容器编码">
<el-input style="width: 500px" v-model="form.containerNo" placeholder="请扫描或录入容器编码"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">确认入库</el-button>
<el-button @click="reset()">重置</el-button>
</el-form-item>
</el-form>
</div>
<!--物料选择-->
<el-dialog
title="选择物料"
:visible.sync="dialogVisible"
width="50%">
<div style="display: flex">
<div>
2 years ago
<el-tree :data="classifyList"
:props="defaultProps"
default-expand-all
@node-click="handleNodeClick"
highlight-current
></el-tree>
2 years ago
</div>
<div style="margin-left: 50px">
<div class="search-box customer-search">
<el-form
:inline="true"
:model="searchForm"
ref="searchForm"
>
<el-form-item
prop="orderNo"
>
<el-input
v-model="searchForm.goodNo"
placeholder="请输入商品编码"
clearable
></el-input>
</el-form-item>
<el-form-item
prop="orderNo"
>
<el-input
v-model="searchForm.goodName"
placeholder="请输入商品名称"
clearable
></el-input>
</el-form-item>
<el-form-item
prop="orderNo"
>
<el-input
v-model="searchForm.mnemonic"
placeholder="请输入助记码"
clearable
></el-input>
</el-form-item>
<el-form-item style="margin-left: 15px">
<el-button style="margin-left: 10px" size="small" type="primary" @click="searchList()">搜索</el-button>
</el-form-item>
</el-form>
</div>
<div
class="layout-full"
style="padding-top: 42px"
>
<heavy-table
:data="tableData"
:tableProps="tableProps"
:config="config"
:loading="loading"
@current-change="queryTable"
:paging="paging"
@handleselection="handleselection"
>
<template v-slot:errMsg="scope">
{{
scope.row.errMsg === "ERROR"
? scope.row.errMsg + "?"
: scope.row.errMsg
}}
</template>
</heavy-table>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<!-- <el-button>已选D23.145.36.7 钢管外丝1寸D29.182.12.8 回炉料3#</el-button>-->
<el-button @click="cancel()"> </el-button>
<el-button type="primary" @click="choose()">确认选择</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {dealEmptyQueryCondition, getDictLabel} from "@/utils";
import {getBranchList, InitInOrder} from "@/api/system/branch";
import {getGoods} from "@/api/basicData/goods";
export default {
name: "index",
2 years ago
dicts: ["goods_classify","good_class"],
2 years ago
data() {
const _that=this
return {
form:{},
dialogVisible: false,
searchForm:{
},
tableData: [
{
goodNo:1,
goodName:'shh'
},
{
goodNo:2,
goodName:'cdgf'
}],
tableProps:{},
config: [
// 表头数据
{ label: "复选框", type: "selection", prop: "selection", istrue: true },
{
label: '商品编号',
prop: 'goodNo',
width: 160,
istrue: true
},
{
label: '商品名称',
prop: 'goodName',
width: 150,
istrue: true
},
{
label: '规格',
prop: 'specifications',
istrue: true
},
2 years ago
// {
// label: '型号',
// prop: '',
// istrue: true
// },
2 years ago
{
label: '所属分类',
prop: 'specialMana',
istrue: true,
filter(row, value) {
return getDictLabel(value, _that.dict.type.goods_classify);
},
},
],
loading: false,
paging: {
page: 1, // 当前页
size: 10, // 页面大小
total: 0
},
WarehousingList:[],
handleSelect:[],
2 years ago
chooselist:[],
classifyList:[{
label: '物料分类',
2 years ago
children: []
2 years ago
}],
defaultProps: {
children: 'children',
label: 'label'
},
2 years ago
};
},
mounted() {
2 years ago
// 物料分类的树结构
this.getDicts("good_class").then((res)=>{
res.data.forEach((item) => {
let newItem = {
label: item.dictLabel,
value: item.dictValue
};
this.classifyList[0].children.push(newItem);
})
})
2 years ago
this.getBranchList()
this.queryTable()
},
methods: {
2 years ago
//商品分类点击某个(树)
handleNodeClick(data) {
2 years ago
this.searchForm.classify=data.value
2 years ago
this.paging.page=1
this.queryTable()
},
2 years ago
// 仓库列表
getBranchList(){
getBranchList().then((res)=>{
this.WarehousingList=res.rows
})
},
// 商品列表
async queryTable() {
this.loading = true
const request = {
...this.searchForm,
pageSize: this.paging.size,
pageNum: this.paging.page
}
dealEmptyQueryCondition(request)
const { rows, total } = await getGoods(request)
this.tableData = rows
this.paging.total = total
this.loading = false
},
// 确定入库
onSubmit(){
2 years ago
if(!this.form.warehouseNo){
2 years ago
this.$message.error('请选择入库仓库!')
return;
}
2 years ago
if(this.chooselist.length==0){
this.$message.error('请选择物料!')
return;
}
if(!this.form.containerNo){
this.$message.error('请输入容器编码!')
return;
}
2 years ago
const obj={
2 years ago
syncType:"A",
2 years ago
orderType:11,
2 years ago
orderDate:'2024-05-30',
2 years ago
containerNo:this.form.containerNo,
2 years ago
detail:this.chooselist,
2 years ago
}
InitInOrder(obj).then((res)=>{
2 years ago
if(res.code==200){
this.$message.success('入库成功!')
this.reset()
}
2 years ago
})
},
// 重置
reset(){
this.form={}
this.chooselist=[]
},
// 复选框
handleselection(row){
this.handleSelect = row
},
2 years ago
chooseGoods(){
if(!this.form.warehouseNo){
this.$message.error('请选择入库仓库!')
return;
}
this.dialogVisible = true
},
2 years ago
// 选择商品
choose(){
this.chooselist=[]
this.handleSelect.forEach((item)=>{
let newItem={
lineId:0,
goodsNo:item.goodNo,
goodName:item.goodName,
2 years ago
unitMsr:item.specifications,
warehouseNo:this.form.warehouseNo,
2 years ago
}
this.chooselist.push(newItem)
})
this.searchForm={}
this.dialogVisible = false
},
// 取消选择
cancel(){
this.searchForm={}
this.dialogVisible = false
},
// 商品列表条件查询
searchList(){
this.paging.page=1
this.queryTable()
}
},
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.app-container{
display: flex;
justify-content: center;
align-items: center;
}
.el-dropdown-link {
cursor: pointer;
color: #409EFF;
}
.el-icon-arrow-down {
font-size: 12px;
}
</style>