fix: mioitem_form车间批次号获取

This commit is contained in:
caoqianming 2024-01-24 09:31:57 +08:00
parent 9ea6c53725
commit 98581e7d51
1 changed files with 253 additions and 317 deletions

View File

@ -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>
@ -177,7 +111,7 @@ export default {
};
},
mounted() {
this.getBatchs();
// this.getBatchs();
},
methods: {
init() {
@ -190,12 +124,12 @@ 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 => {
res.forEach(item => {
@ -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