fix: mioitem_form车间批次号获取
This commit is contained in:
parent
9ea6c53725
commit
98581e7d51
|
@ -1,121 +1,55 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="titleMap[form.type]"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-dialog :title="titleMap[form.type]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
|
||||
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="物料">
|
||||
<el-select
|
||||
v-model="selectMaterial"
|
||||
value-key="id"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="selectMaterialChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in materialOptions"
|
||||
:key="item.id"
|
||||
:label="item.full_name"
|
||||
:value="item"
|
||||
>
|
||||
<el-select v-model="selectMaterial" value-key="id" clearable filterable style="width: 100%"
|
||||
@change="selectMaterialChange">
|
||||
<el-option v-for="item in materialOptions" :key="item.id" :label="item.full_name" :value="item">
|
||||
<span style="float: left">{{ item.full_name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号">
|
||||
<!-- <el-input v-model="form.batch" placeholder="手动输入批次号" :disabled="inputBatchDisable" /> -->
|
||||
<el-select
|
||||
v-model="form.batch"
|
||||
value-key="id"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="inputBatchDisable"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in wbatchOptions"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
>
|
||||
<el-select v-model="form.batch" value-key="id" filterable allow-create clearable style="width: 100%"
|
||||
:disabled="inputBatchDisable">
|
||||
<el-option v-for="item in wbatchOptions" :key="item" :label="item" :value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库已有批次">
|
||||
<el-select
|
||||
v-model="selectBatch"
|
||||
value-key="id"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="selectBatchChange"
|
||||
@clear="selectBatchClear"
|
||||
:disabled="selectBatchDisable"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in batchOptions"
|
||||
:key="item.id"
|
||||
:label="item.batch"
|
||||
:value="item"
|
||||
>
|
||||
<el-select v-model="selectBatch" value-key="id" clearable style="width: 100%" @change="selectBatchChange"
|
||||
@clear="selectBatchClear" :disabled="selectBatchDisable">
|
||||
<el-option v-for="item in batchOptions" :key="item.id" :label="item.batch" :value="item">
|
||||
<span style="float: left">{{ item.batch }}</span>
|
||||
<span
|
||||
style="
|
||||
<span style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ item.count }} -- {{ item.warehouse_name }}</span
|
||||
>
|
||||
">{{ item.count }} -- {{ item.warehouse_name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库">
|
||||
<el-select
|
||||
v-model="form.warehouse"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:disabled="warehouseDisable"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in warehouseOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
<el-select v-model="form.warehouse" clearable style="width: 100%" :disabled="warehouseDisable">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number v-model="form.count" :min="1" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<div v-if="assembShow">
|
||||
<el-row
|
||||
v-for="item in components"
|
||||
v-bind:key="item"
|
||||
style="margin-bottom: 8px"
|
||||
>
|
||||
<el-row v-for="item in components" v-bind:key="item" style="margin-bottom: 8px">
|
||||
<el-col :span="12"> {{ item.number }} - {{ item.name }} </el-col>
|
||||
<el-col :span="12">
|
||||
<el-select v-model="item.batch" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="itemx in item.batchOptions"
|
||||
:key="itemx.id"
|
||||
:label="itemx.batch"
|
||||
:value="itemx.batch"
|
||||
>
|
||||
<el-option v-for="itemx in item.batchOptions" :key="itemx.id" :label="itemx.batch" :value="itemx.batch">
|
||||
<span style="float: left">{{ itemx.batch }}</span>
|
||||
<span
|
||||
style="
|
||||
<span style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ itemx.count }}</span
|
||||
>
|
||||
">{{ itemx.count }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
@ -140,7 +74,7 @@ export default {
|
|||
props: {
|
||||
cate: { type: String, default: '' },
|
||||
mioId: { type: String, default: '' },
|
||||
belongDeptName:{type: String, default: ''},
|
||||
belongDeptName: { type: String, default: '' },
|
||||
belongDeptId: { type: String, default: null },
|
||||
mioObj: { type: Object }
|
||||
},
|
||||
|
@ -173,11 +107,11 @@ export default {
|
|||
selectMaterial: null,
|
||||
selectBatch: null,
|
||||
components: [],
|
||||
wbatchOptions:[],
|
||||
wbatchOptions: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getBatchs();
|
||||
// this.getBatchs();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
|
@ -190,14 +124,14 @@ export default {
|
|||
})
|
||||
},
|
||||
//获取车间物料批次号
|
||||
getBatchs(){
|
||||
getWBatchs() { //
|
||||
let wbatchs = []
|
||||
if(this.belongDeptName !=null && this.belongDeptName != undefined && this.belongDeptName != ''){
|
||||
if (this.belongDeptId != null && this.belongDeptId != undefined && this.belongDeptId != '') {
|
||||
this.$API.wpm.wmaterial.list.req({
|
||||
"belong_dept__name": this.belongDeptName,
|
||||
"count__gte": 1,
|
||||
"belong_dept": this.belongDeptId,
|
||||
"material": this.form.material,
|
||||
"page": 0
|
||||
}).then(res=>{
|
||||
}).then(res => {
|
||||
res.forEach(item => {
|
||||
if (!wbatchs.includes(item.batch)) {
|
||||
wbatchs.push(item.batch);
|
||||
|
@ -219,14 +153,14 @@ export default {
|
|||
// 'other_out': '其他出库',
|
||||
//(10, '成品'), (20, '半成品'), (30, '主要原料'),
|
||||
// (40, '辅助材料'), (50, '加工工具'), (60, '辅助工装'), (70, '办公用品')
|
||||
let type__in='';
|
||||
if(cate=='good'){
|
||||
let type__in = '';
|
||||
if (cate == 'good') {
|
||||
type__in = '10'
|
||||
}else if(cate=='halfgood'){
|
||||
} else if (cate == 'halfgood') {
|
||||
type__in = '20'
|
||||
}else if(cate=='mainso'){
|
||||
} else if (cate == 'mainso') {
|
||||
type__in = '30'
|
||||
}else if(cate=='helpso'){
|
||||
} else if (cate == 'helpso') {
|
||||
type__in = '40'
|
||||
}
|
||||
if (type == 'do_out') {//生产领料'10, 20, 30'
|
||||
|
@ -262,13 +196,15 @@ export default {
|
|||
var res = await this.$API.mtm.material.list.req({ page: 0, id__in: id__in })
|
||||
this.components = res
|
||||
for (var i = 0; i < this.components.length; i++) {
|
||||
var res2 = await this.$API.wpm.wmaterial.list.req({ page: 0, material: this.components[i].id, belong_dept: this.belongDeptId, count__gte: 1 })
|
||||
var res2 = await this.$API.wpm.wmaterial.list.req({ page: 0, material: this.components[i].id, belong_dept: this.belongDeptId })
|
||||
this.components[i].batchOptions = res2
|
||||
}
|
||||
}
|
||||
},
|
||||
getBatchOptions() {
|
||||
this.$API.inm.warehouse.batch.req({ page: 0, material: this.form.material, count__gte: 1 }).then(res => {
|
||||
// 车间批次
|
||||
this.getWBatchs();
|
||||
this.$API.inm.warehouse.batch.req({ page: 0, material: this.form.material }).then(res => {
|
||||
this.batchOptions = res
|
||||
if (res.length == 0) {
|
||||
this.selectBatchDisable = true
|
||||
|
|
Loading…
Reference in New Issue