|
|
@ -8,7 +8,7 @@
|
|
|
|
<el-tree
|
|
|
|
<el-tree
|
|
|
|
ref="materialBomTreeRef"
|
|
|
|
ref="materialBomTreeRef"
|
|
|
|
class="mt-2"
|
|
|
|
class="mt-2"
|
|
|
|
node-key="id"
|
|
|
|
node-key="treeKey"
|
|
|
|
:data="materialBomOptions"
|
|
|
|
:data="materialBomOptions"
|
|
|
|
:props="{ label: 'label', children: 'children' }"
|
|
|
|
:props="{ label: 'label', children: 'children' }"
|
|
|
|
:expand-on-click-node="false"
|
|
|
|
:expand-on-click-node="false"
|
|
|
@ -22,59 +22,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :lg="18" :xs="24" v-loading="loading">
|
|
|
|
<el-col :lg="18" :xs="24" v-loading="loading">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<el-divider content-position="left">物料</el-divider>
|
|
|
|
<el-divider content-position="left">父级物料</el-divider>
|
|
|
|
<el-form ref="parentMaterialBomFormRef" label-width="120px">
|
|
|
|
<el-form ref="parentMaterialBomFormRef" label-width="120px" :model="parentForm">
|
|
|
|
<el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-form-item label="BOM版本" v-if="parentMaterialBomVersion">
|
|
|
|
<el-form-item label='父物料ID' prop='parentId'>
|
|
|
|
{{ parentMaterialBomVersion }}
|
|
|
|
<el-input v-model='parentForm.parentId' placeholder='' style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="父物料类型名称" v-if="parentMaterialTypeName">
|
|
|
|
<el-form-item label='父物料类型ID' prop='parentMaterialTypeId'>
|
|
|
|
{{ parentMaterialTypeName }}
|
|
|
|
<el-input v-model='parentForm.parentMaterialTypeId' placeholder='' style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="父物料名称">
|
|
|
|
|
|
|
|
{{ parentMaterialName }}
|
|
|
|
<el-form-item label='父物料名称' prop='parentMaterialName'>
|
|
|
|
|
|
|
|
<el-input v-model='parentForm.parentMaterialName' placeholder='请点击检索物料'
|
|
|
|
|
|
|
|
@click='handleMaterialSelect(parentForm,SELECT_MATERIAL_MODEL.PARENT_SELECT)'
|
|
|
|
|
|
|
|
style="width:360px" @change="getList" suffix-icon="Search"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="父物料类型名称" prop='parentMaterialTypeName'>
|
|
|
|
|
|
|
|
<el-input v-model='parentForm.parentMaterialTypeName' placeholder='' style="width:360px" dsiabeld/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="BOM版本" prop='materialBomVersion' :model="parentForm">
|
|
|
|
|
|
|
|
<el-select v-model="parentForm.materialBomVersion"
|
|
|
|
|
|
|
|
placeholder="请选择" style="width:360px">
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="item in materialBomVersionOptions"
|
|
|
|
|
|
|
|
:key="item.materialBomVersion"
|
|
|
|
|
|
|
|
:label="item.materialBomVersion"
|
|
|
|
|
|
|
|
:value="item.materialBomVersion"
|
|
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='父物料数量' prop='parentStandardAmount'>
|
|
|
|
|
|
|
|
<el-input-number v-model='parentForm.parentStandardAmount' :precision="2" :step="0.1"
|
|
|
|
|
|
|
|
placeholder='请输入父物料数量'
|
|
|
|
|
|
|
|
style="width:360px"/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='单位' prop='parentUnitId'>
|
|
|
|
|
|
|
|
<el-select v-model="parentForm.parentUnitId" placeholder="请选择" style="width:360px">
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="item in unitInfoOptions"
|
|
|
|
|
|
|
|
:key="item.unitId"
|
|
|
|
|
|
|
|
:label="item.unitName"
|
|
|
|
|
|
|
|
:value="item.unitId"
|
|
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-divider content-position="left">子级物料</el-divider>
|
|
|
|
<el-divider content-position="left">子级物料</el-divider>
|
|
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
|
|
|
|
|
|
|
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
|
|
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
|
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
|
|
|
|
|
<el-form-item label="子物料类型编号" prop="materialTypeCode" label-width="120px">
|
|
|
|
|
|
|
|
<el-input v-model="queryParams.materialTypeCode" placeholder="请输入物料类型编号" clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="子物料类型名称" prop="materialTypeName" label-width="120px">
|
|
|
|
|
|
|
|
<el-input v-model="queryParams.materialTypeName" placeholder="请输入物料类型名称" clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="子物料名称" prop="materialName" label-width="120px">
|
|
|
|
|
|
|
|
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable
|
|
|
|
|
|
|
|
@keyup.enter="handleQuery"/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
<el-card shadow="hover">
|
|
|
|
<template #header>
|
|
|
|
<template #header>
|
|
|
|
<el-row :gutter="10">
|
|
|
|
<el-row :gutter="10">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
|
|
<el-button v-has-permi="['mes:materialBom:add']" type="success" plain icon="CircleCheck"
|
|
|
|
|
|
|
|
@click="submitBatchSaveMaterialBoms()" :loading="btnLoading">保存
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-col :span="1.5">
|
|
|
|
<el-button v-has-permi="['mes:materialBom:add']" type="primary" plain icon="Plus"
|
|
|
|
<el-button v-has-permi="['mes:materialBom:add']" type="primary" plain icon="Plus"
|
|
|
|
@click="handleAdd()" :loading="btnLoading">新增
|
|
|
|
@click="handleAdd()" :loading="btnLoading">新增
|
|
|
@ -93,38 +99,56 @@
|
|
|
|
<el-table-column type="selection" width="50" align="center"/>
|
|
|
|
<el-table-column type="selection" width="50" align="center"/>
|
|
|
|
<el-table-column type="index" width="50" align="center" label="序号"/>
|
|
|
|
<el-table-column type="index" width="50" align="center" label="序号"/>
|
|
|
|
<el-table-column v-if="columns[0].visible" key="materialBomId" label="生产BOM_ID" align="center"
|
|
|
|
<el-table-column v-if="columns[0].visible" key="materialBomId" label="生产BOM_ID" align="center"
|
|
|
|
prop="materialBomId" width="110px"/>
|
|
|
|
prop="materialBomId"/>
|
|
|
|
<el-table-column v-if="columns[1].visible" key="materialTypeCode" label="子物料类型编号" align="center"
|
|
|
|
<el-table-column v-if="columns[1].visible" key="materialTypeCode" label="子物料类型编号" align="center"
|
|
|
|
prop="materialTypeCode" :show-overflow-tooltip="true" width="130px"/>
|
|
|
|
prop="materialTypeCode" :show-overflow-tooltip="true"/>
|
|
|
|
<el-table-column v-if="columns[2].visible" key="materialTypeName" label="子物料类型名称" align="center"
|
|
|
|
<el-table-column v-if="columns[2].visible" key="materialTypeName" label="子物料类型名称" align="center"
|
|
|
|
prop="materialTypeName" :show-overflow-tooltip="true" width="130px"/>
|
|
|
|
prop="materialTypeName" :show-overflow-tooltip="true" w/>
|
|
|
|
<el-table-column v-if="columns[3].visible" key="materialBomVersion" label="BOM版本" align="center"
|
|
|
|
|
|
|
|
prop="materialBomVersion" :show-overflow-tooltip="true" width="90px">
|
|
|
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
|
|
|
<el-input v-model='scope.row.materialBomVersion'/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column v-if="columns[4].visible" key="materialId" label="子物料ID" align="center"
|
|
|
|
<el-table-column v-if="columns[4].visible" key="materialId" label="子物料ID" align="center"
|
|
|
|
prop="materialId" :show-overflow-tooltip="true" />
|
|
|
|
prop="materialId" :show-overflow-tooltip="true"/>
|
|
|
|
<el-table-column v-if="columns[5].visible" key="materialName" label="子物料名称" align="center"
|
|
|
|
<el-table-column v-if="columns[5].visible" key="materialName" label="子物料名称" align="center"
|
|
|
|
prop="materialName" :show-overflow-tooltip="true" width="300px">
|
|
|
|
prop="materialName" :show-overflow-tooltip="true">
|
|
|
|
<template #default='scope'>
|
|
|
|
<template #default='scope'>
|
|
|
|
<el-input v-model='scope.row.materialName' placeholder='请点击检索物料'
|
|
|
|
<el-input v-model='scope.row.materialName' placeholder='请点击检索物料'
|
|
|
|
@click='handleMaterialSelect(scope.row)' readonly/>
|
|
|
|
@click='handleMaterialSelect(scope.row,SELECT_MATERIAL_MODEL.CHILD_SELECT)' readonly/>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column v-if="columns[6].visible" key="standardAmount" label="子物料数量" align="center"
|
|
|
|
<el-table-column v-if="columns[6].visible" key="standardAmount" label="子物料数量" align="center"
|
|
|
|
prop="standardAmount" :show-overflow-tooltip="true" width="100px">
|
|
|
|
prop="standardAmount" :show-overflow-tooltip="true" width="200px">
|
|
|
|
<template #default='scope'>
|
|
|
|
<template #default='scope'>
|
|
|
|
<el-input v-model='scope.row.standardAmount'/>
|
|
|
|
<el-input-number v-model='scope.row.standardAmount' :precision="2" :step="0.1"
|
|
|
|
|
|
|
|
placeholder='请输入数量'
|
|
|
|
|
|
|
|
style="width:180px"/>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column v-if="columns[7].visible" key="unitName" label="子物料单位" align="center"
|
|
|
|
<el-table-column v-if="columns[7].visible" key="unitId" label="子物料单位" align="center"
|
|
|
|
prop="unitName" :show-overflow-tooltip="true" width="100px"/>
|
|
|
|
prop="unitId" :show-overflow-tooltip="true">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
|
|
|
<el-select v-model="scope.row.unitId" placeholder="请选择">
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="item in unitInfoOptions"
|
|
|
|
|
|
|
|
:key="item.unitId"
|
|
|
|
|
|
|
|
:label="item.unitName"
|
|
|
|
|
|
|
|
:value="item.unitId"
|
|
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
|
|
|
<el-button v-has-permi="['mes:materialBom:add']" type="success" plain icon="CircleCheck"
|
|
|
|
|
|
|
|
@click="submitBatchSaveMaterialBoms()" :loading="btnLoading">保存
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <pagination-->
|
|
|
|
<!-- <pagination-->
|
|
|
|
<!-- v-show="total > 0"-->
|
|
|
|
<!-- v-show="total > 0"-->
|
|
|
|
<!-- v-model:page="queryParams.pageNum"-->
|
|
|
|
<!-- v-model:page="queryParams.pageNum"-->
|
|
|
@ -152,16 +176,17 @@
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='BOM版本' prop='materialBomVersion' v-if="parentMaterialId===0">
|
|
|
|
<!-- <el-form-item label='BOM版本' prop='materialBomVersion'>-->
|
|
|
|
<el-input v-model='form.materialBomVersion' placeholder='请输入BOM版本' style="width:360px"/>
|
|
|
|
<!-- <el-input v-model='form.materialBomVersion' placeholder='请输入BOM版本' style="width:360px"/>-->
|
|
|
|
</el-form-item>
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='子物料ID' prop='materialId' v-if="false">
|
|
|
|
<el-form-item label='子物料ID' prop='materialId' v-if="false">
|
|
|
|
<el-input v-model='form.materialId' placeholder='' style="width:360px"/>
|
|
|
|
<el-input v-model='form.materialId' placeholder='' style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='子物料名称' prop='materialName'>
|
|
|
|
<el-form-item label='子物料名称' prop='materialName'>
|
|
|
|
<el-input v-model='form.materialName' placeholder='请点击检索物料' @click='handleMaterialSelect(form)'
|
|
|
|
<el-input v-model='form.materialName' placeholder='请点击检索物料'
|
|
|
|
|
|
|
|
@click='handleMaterialSelect(form,SELECT_MATERIAL_MODEL.DIALOG_CHILD_SELECT)'
|
|
|
|
style="width:360px"/>
|
|
|
|
style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
@ -170,6 +195,17 @@
|
|
|
|
style="width:360px"/>
|
|
|
|
style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='子物料单位' prop='unitId'>
|
|
|
|
|
|
|
|
<el-select v-model="form.unitId" placeholder="请选择单位">
|
|
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
|
|
v-for="item in unitInfoOptions"
|
|
|
|
|
|
|
|
:key="item.unitId"
|
|
|
|
|
|
|
|
:label="item.unitName"
|
|
|
|
|
|
|
|
:value="item.unitId"
|
|
|
|
|
|
|
|
></el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<div class="dialog-footer">
|
|
|
|
<div class="dialog-footer">
|
|
|
@ -197,7 +233,8 @@
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
materialBomTreeSelect,
|
|
|
|
materialBomTreeSelect,
|
|
|
|
listMaterialBomJoinStructure,
|
|
|
|
listMaterialBomJoinStructure,
|
|
|
|
addBatchMaterialBom, updateMaterialBom, addMaterialBom, delMaterialBom
|
|
|
|
addBatchMaterialBom, updateMaterialBom, addMaterialBom, delMaterialBom,
|
|
|
|
|
|
|
|
getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom
|
|
|
|
} from "@/api/mes/materialBom";
|
|
|
|
} from "@/api/mes/materialBom";
|
|
|
|
|
|
|
|
|
|
|
|
import {MaterialBomVO, MaterialBomForm, MaterialBomQuery} from '@/api/mes/materialBom/types';
|
|
|
|
import {MaterialBomVO, MaterialBomForm, MaterialBomQuery} from '@/api/mes/materialBom/types';
|
|
|
@ -206,8 +243,11 @@ import MaterialSelect from '@/views/mes/baseMaterialInfo/addMaterial.vue';
|
|
|
|
|
|
|
|
|
|
|
|
import {to} from 'await-to-js';
|
|
|
|
import {to} from 'await-to-js';
|
|
|
|
import {nextTick} from "vue";
|
|
|
|
import {nextTick} from "vue";
|
|
|
|
|
|
|
|
import {MaterialBomVersionVO} from "@/api/mes/materialBomVersion/types";
|
|
|
|
|
|
|
|
import {BaseMeasurementUnitInfoVO} from "@/api/mes/baseMeasurementUnitInfo/types";
|
|
|
|
|
|
|
|
import {BaseStructureBomTreeVO} from "@/api/mes/baseStructureBom/types";
|
|
|
|
|
|
|
|
|
|
|
|
const materialTypeId = ref(0);
|
|
|
|
const materialTypeId = ref(0);//此值是传给选择物料信息弹框使用
|
|
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
const router = useRouter();
|
|
|
|
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
@ -231,11 +271,17 @@ const childTableTitle = ref('');
|
|
|
|
const materialName = ref('');
|
|
|
|
const materialName = ref('');
|
|
|
|
const materialBomOptions = ref<MaterialBomVO[]>([]);
|
|
|
|
const materialBomOptions = ref<MaterialBomVO[]>([]);
|
|
|
|
const materialTypeOptions = ref<BaseMaterialTypeVO[]>([]);
|
|
|
|
const materialTypeOptions = ref<BaseMaterialTypeVO[]>([]);
|
|
|
|
const parentMaterialId = ref(1);
|
|
|
|
const materialBomVersionOptions = ref<MaterialBomVersionVO[]>([]);
|
|
|
|
const parentParentMaterialId = ref();
|
|
|
|
const unitInfoOptions = ref<BaseMeasurementUnitInfoVO[]>([]);
|
|
|
|
const parentMaterialTypeName = ref('');
|
|
|
|
|
|
|
|
const parentMaterialName = ref('');
|
|
|
|
const focusKeyNode = ref<MaterialBomVO>;
|
|
|
|
const parentMaterialBomVersion = ref('');
|
|
|
|
|
|
|
|
|
|
|
|
const globalSelectMode = ref('');
|
|
|
|
|
|
|
|
const SELECT_MATERIAL_MODEL = ref({
|
|
|
|
|
|
|
|
PARENT_SELECT: '1',//父级物料选择
|
|
|
|
|
|
|
|
CHILD_SELECT: '2',//子级物料选择
|
|
|
|
|
|
|
|
DIALOG_CHILD_SELECT: '3'//弹窗子级选择
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 列显隐信息
|
|
|
|
// 列显隐信息
|
|
|
|
const columns = ref<FieldOption[]>([
|
|
|
|
const columns = ref<FieldOption[]>([
|
|
|
@ -250,6 +296,7 @@ const columns = ref<FieldOption[]>([
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
const materialBomTreeRef = ref<ElTreeInstance>();
|
|
|
|
const materialBomTreeRef = ref<ElTreeInstance>();
|
|
|
|
|
|
|
|
const parentMaterialBomFormRef = ref<ElFormInstance>();
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
|
const materialBomFormRef = ref<ElFormInstance>();
|
|
|
|
const materialBomFormRef = ref<ElFormInstance>();
|
|
|
|
const formDialogRef = ref<ElDialogInstance>();
|
|
|
|
const formDialogRef = ref<ElDialogInstance>();
|
|
|
@ -259,9 +306,37 @@ const dialog = reactive<DialogOption>({
|
|
|
|
title: ''
|
|
|
|
title: ''
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initParentFormData: MaterialBomForm = {
|
|
|
|
|
|
|
|
materialBomId: undefined,
|
|
|
|
|
|
|
|
parentId: undefined,
|
|
|
|
|
|
|
|
parentStandardAmount: undefined,
|
|
|
|
|
|
|
|
unitId: undefined,
|
|
|
|
|
|
|
|
parentUnitId: undefined,
|
|
|
|
|
|
|
|
materialId: undefined,
|
|
|
|
|
|
|
|
materialName: undefined,
|
|
|
|
|
|
|
|
materialTypeId: undefined,
|
|
|
|
|
|
|
|
parentMaterialTypeId: undefined,
|
|
|
|
|
|
|
|
materialBomDesc: undefined,
|
|
|
|
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
|
|
|
|
ancestors: undefined,
|
|
|
|
|
|
|
|
standardAmount: undefined,
|
|
|
|
|
|
|
|
topFlag: undefined,
|
|
|
|
|
|
|
|
checkType: '1',
|
|
|
|
|
|
|
|
projectId: undefined,
|
|
|
|
|
|
|
|
assembleTime: undefined,
|
|
|
|
|
|
|
|
materialClassfication: undefined,
|
|
|
|
|
|
|
|
attachId: undefined,
|
|
|
|
|
|
|
|
activeFlag: '1',
|
|
|
|
|
|
|
|
remark: undefined,
|
|
|
|
|
|
|
|
materialTypeName: undefined,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const initFormData: MaterialBomForm = {
|
|
|
|
const initFormData: MaterialBomForm = {
|
|
|
|
materialBomId: undefined,
|
|
|
|
materialBomId: undefined,
|
|
|
|
parentId: undefined,
|
|
|
|
parentId: undefined,
|
|
|
|
|
|
|
|
parentStandardAmount: undefined,
|
|
|
|
|
|
|
|
unitId: undefined,
|
|
|
|
|
|
|
|
parentUnitId: undefined,
|
|
|
|
materialId: undefined,
|
|
|
|
materialId: undefined,
|
|
|
|
materialName: undefined,
|
|
|
|
materialName: undefined,
|
|
|
|
materialTypeId: undefined,
|
|
|
|
materialTypeId: undefined,
|
|
|
@ -282,6 +357,7 @@ const initFormData: MaterialBomForm = {
|
|
|
|
|
|
|
|
|
|
|
|
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
form: {...initFormData},
|
|
|
|
form: {...initFormData},
|
|
|
|
|
|
|
|
parentForm: {...initParentFormData},
|
|
|
|
queryParams: {
|
|
|
|
queryParams: {
|
|
|
|
materialBomId: undefined,
|
|
|
|
materialBomId: undefined,
|
|
|
|
parentId: undefined,
|
|
|
|
parentId: undefined,
|
|
|
@ -289,7 +365,7 @@ const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
materialTypeName: undefined,
|
|
|
|
materialTypeName: undefined,
|
|
|
|
materialName: undefined,
|
|
|
|
materialName: undefined,
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
bomStructureParentId: undefined,
|
|
|
|
parentMaterialTypeId: undefined,
|
|
|
|
params: {}
|
|
|
|
params: {}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
@ -308,8 +384,18 @@ const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const {queryParams, form, rules} = toRefs(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const parentQueryParams = ref({
|
|
|
|
|
|
|
|
materialBomId: undefined,
|
|
|
|
|
|
|
|
parentId: undefined,
|
|
|
|
|
|
|
|
materialTypeCode: undefined,
|
|
|
|
|
|
|
|
materialTypeName: undefined,
|
|
|
|
|
|
|
|
materialName: undefined,
|
|
|
|
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
|
|
|
|
params: {}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {queryParams, form, rules, parentForm} = toRefs(data);
|
|
|
|
|
|
|
|
|
|
|
|
/** 通过条件过滤节点 */
|
|
|
|
/** 通过条件过滤节点 */
|
|
|
|
const filterNode = (value: string, data: any) => {
|
|
|
|
const filterNode = (value: string, data: any) => {
|
|
|
@ -329,62 +415,83 @@ watchEffect(
|
|
|
|
/** 查询物料类型bom结构树下拉树结构 */
|
|
|
|
/** 查询物料类型bom结构树下拉树结构 */
|
|
|
|
const getTreeSelect = async () => {
|
|
|
|
const getTreeSelect = async () => {
|
|
|
|
treeLoading.value = true;
|
|
|
|
treeLoading.value = true;
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
const res = await materialBomTreeSelect();
|
|
|
|
const res = await materialBomTreeSelect();
|
|
|
|
// alert(JSON.stringify(res))
|
|
|
|
materialBomOptions.value = [];
|
|
|
|
materialBomOptions.value = res.data;
|
|
|
|
const virtualTopNodeId = -1;
|
|
|
|
|
|
|
|
const initialTree: BaseStructureBomTreeVO = {
|
|
|
|
|
|
|
|
treeKey: virtualTopNodeId,
|
|
|
|
|
|
|
|
id: virtualTopNodeId,//materialBomId
|
|
|
|
|
|
|
|
parentId: -1,
|
|
|
|
|
|
|
|
materialId: 0,
|
|
|
|
|
|
|
|
label: "生产BOM",
|
|
|
|
|
|
|
|
children: res.data
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
materialBomOptions.value.push(initialTree);
|
|
|
|
|
|
|
|
console.log(materialBomOptions);
|
|
|
|
|
|
|
|
|
|
|
|
//此处的parentid是materialtypeid
|
|
|
|
// materialBomOptions.value = res.data;
|
|
|
|
columns.value[3].visible = false;
|
|
|
|
|
|
|
|
if (queryParams.value.parentId === null || queryParams.value.parentId === undefined) {
|
|
|
|
|
|
|
|
const topMaterialBom = materialBomOptions.value.find(item => item.id === 0);
|
|
|
|
|
|
|
|
queryParams.value.bomStructureParentId = 1;//赋值结构bom的parentId
|
|
|
|
|
|
|
|
queryParams.value.parentId = 0;
|
|
|
|
|
|
|
|
parentMaterialId.value = 0;
|
|
|
|
|
|
|
|
parentParentMaterialId.value = undefined;
|
|
|
|
|
|
|
|
parentMaterialName.value = topMaterialBom.materialName;
|
|
|
|
|
|
|
|
// parentParentMaterialTypeName.value = "顶级";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queryParams.value.parentId === 0) {
|
|
|
|
if (!focusKeyNode.value) {//如果之前没有focus
|
|
|
|
columns.value[3].visible = true;
|
|
|
|
focusKeyNode.value = {treeKey: virtualTopNodeId};
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
alert(23)
|
|
|
|
|
|
|
|
alert(focusKeyNode.value.treeKey)
|
|
|
|
|
|
|
|
console.log(JSON.stringify(materialBomOptions.value))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nextTick(function () {
|
|
|
|
nextTick(function () {
|
|
|
|
materialBomTreeRef.value?.setCurrentKey(queryParams.value.parentId, true);
|
|
|
|
materialBomTreeRef.value?.setCurrentKey(focusKeyNode.value.treeKey, true);
|
|
|
|
handleQuery();
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleNodeClick(focusKeyNode.value);
|
|
|
|
|
|
|
|
treeLoading.value = false;
|
|
|
|
// const dd = {"id":"1","parentId":-1,"label":"dd"};
|
|
|
|
// const dd = {"id":"1","parentId":-1,"label":"dd"};
|
|
|
|
// materialTypeOptions.value[0].children.push(dd);
|
|
|
|
// materialTypeOptions.value[0].children.push(dd);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 查询生产bom列表 */
|
|
|
|
/** 查询生产bom列表 */
|
|
|
|
const getList = async () => {
|
|
|
|
const getList = async () => {
|
|
|
|
|
|
|
|
//如果是有节点的则加载数据,如果是顶级节点生产BOM则不加载数据
|
|
|
|
loading.value = true;
|
|
|
|
loading.value = true;
|
|
|
|
const res = await listMaterialBomJoinStructure(queryParams.value);
|
|
|
|
const res = await listMaterialBomJoinStructure(queryParams.value);
|
|
|
|
materialBomList.value = res.data;
|
|
|
|
materialBomList.value = res.data;
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
treeLoading.value = false;
|
|
|
|
|
|
|
|
// total.value = res.total;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const resetParentQueryParams = () => {
|
|
|
|
|
|
|
|
parentQueryParams.value.parentId = undefined;//是当前节点的materialId
|
|
|
|
|
|
|
|
parentQueryParams.value.materialBomVersion = undefined;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const resetQueryParams = () => {
|
|
|
|
|
|
|
|
queryParams.value.parentId = undefined;//materialid
|
|
|
|
|
|
|
|
queryParams.value.parentMaterialTypeId = undefined;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 节点单击事件 */
|
|
|
|
/** 节点单击事件 */
|
|
|
|
const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
queryParams.value.bomStructureParentId = data.materialTypeId;
|
|
|
|
materialBomList.value = [];
|
|
|
|
queryParams.value.parentId = data.id;
|
|
|
|
resetParentForm();
|
|
|
|
parentMaterialId.value = data.id;
|
|
|
|
resetQueryParams();
|
|
|
|
parentParentMaterialId.value = data.parentId;
|
|
|
|
resetParentQueryParams();
|
|
|
|
parentMaterialName.value = data.materialName;
|
|
|
|
focusKeyNode.value = data;
|
|
|
|
parentMaterialTypeName.value = data.materialTypeName;
|
|
|
|
if (data.materialId && data.materialId != 0) {
|
|
|
|
parentMaterialBomVersion.value = data.materialBomVersion;
|
|
|
|
parentQueryParams.value.parentId = data.materialId;//是当前节点的materialId
|
|
|
|
columns.value[3].visible = false;
|
|
|
|
parentQueryParams.value.materialBomVersion = data.materialBomVersion;
|
|
|
|
if (data.id === 0) {
|
|
|
|
getParentMaterialBomInfo();
|
|
|
|
columns.value[3].visible = true;
|
|
|
|
queryParams.value.parentId = data.materialId;
|
|
|
|
|
|
|
|
queryParams.value.parentMaterialTypeId = data.materialTypeId;
|
|
|
|
|
|
|
|
queryParams.value.materialBomVersion = data.materialBomVersion
|
|
|
|
|
|
|
|
handleQuery();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (materialBomVersionOptions.value.length > 0) {
|
|
|
|
|
|
|
|
parentForm.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
|
|
|
|
queryParams.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
handleQuery();
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const clickDisplay = () => {
|
|
|
|
const clickDisplay = () => {
|
|
|
|
if (queryParams.value.parentId === 0) {
|
|
|
|
if (queryParams.value.parentId === 0) {
|
|
|
|
parentFormDisplay.value = false;
|
|
|
|
parentFormDisplay.value = false;
|
|
|
@ -465,13 +572,18 @@ const cancel = () => {
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
const handleAdd = async () => {
|
|
|
|
const handleAdd = async () => {
|
|
|
|
reset();
|
|
|
|
reset();
|
|
|
|
|
|
|
|
materialTypeOptions.value = [];
|
|
|
|
|
|
|
|
if (!parentForm.value.parentId) {
|
|
|
|
|
|
|
|
proxy?.$modal.msgWarning('请先选择父级物料');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
materialTypeOptions.value = Array.from(
|
|
|
|
materialTypeOptions.value = Array.from(
|
|
|
|
new Map(materialBomList.value.map(item => [item['materialTypeId'], item]))
|
|
|
|
new Map(materialBomList.value.map(item => [item['materialTypeId'], item]))
|
|
|
|
).map(([_, item]) => item);
|
|
|
|
).map(([_, item]) => item);
|
|
|
|
|
|
|
|
|
|
|
|
dialog.visible = true;
|
|
|
|
dialog.visible = true;
|
|
|
|
dialog.title = '新增';
|
|
|
|
dialog.title = '新增';
|
|
|
|
form.value.parentId = queryParams.value.parentId;
|
|
|
|
form.value.parentId = parentForm.value.parentId;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -480,15 +592,30 @@ const submitForm = () => {
|
|
|
|
materialBomFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
materialBomFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
submitLoading.value = true;
|
|
|
|
submitLoading.value = true;
|
|
|
|
try {
|
|
|
|
const selectedMaterialType = materialTypeOptions.value
|
|
|
|
form.value.materialBomId ? await updateMaterialBom(form.value) : await addMaterialBom(form.value);
|
|
|
|
.find(materialType => materialType.materialTypeId === form.value.materialTypeId);
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
const childMaterialBom = {
|
|
|
|
await getTreeSelect();
|
|
|
|
materialTypeId: form.value.materialTypeId,
|
|
|
|
dialog.visible = false;
|
|
|
|
materialTypeCode: selectedMaterialType.materialTypeCode,
|
|
|
|
submitLoading.value = false;
|
|
|
|
materialTypeName: selectedMaterialType.materialTypeName,
|
|
|
|
} catch {
|
|
|
|
materialId: form.value.materialId,
|
|
|
|
submitLoading.value = false;
|
|
|
|
materialName: form.value.materialName,
|
|
|
|
}
|
|
|
|
standardAmount: form.value.standardAmount,
|
|
|
|
|
|
|
|
unitId: form.value.unitId
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
materialBomList.value.push(childMaterialBom);
|
|
|
|
|
|
|
|
submitLoading.value = false;
|
|
|
|
|
|
|
|
dialog.visible = false;
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// form.value.materialBomId ? await updateMaterialBom(form.value) : await addMaterialBom(form.value);
|
|
|
|
|
|
|
|
// proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
|
|
|
// await getTreeSelect();
|
|
|
|
|
|
|
|
// dialog.visible = false;
|
|
|
|
|
|
|
|
// submitLoading.value = false;
|
|
|
|
|
|
|
|
// } catch {
|
|
|
|
|
|
|
|
// submitLoading.value = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// const child = {"id":"1","parentId":-1,"label":"dd"};
|
|
|
|
// const child = {"id":"1","parentId":-1,"label":"dd"};
|
|
|
|
// alert(materialTypeOptions.value[0])
|
|
|
|
// alert(materialTypeOptions.value[0])
|
|
|
@ -515,9 +642,19 @@ const resetForm = () => {
|
|
|
|
form.value.materialBomId = undefined;
|
|
|
|
form.value.materialBomId = undefined;
|
|
|
|
form.value.activeFlag = '1';
|
|
|
|
form.value.activeFlag = '1';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 重置父级表单
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
const resetParentForm = () => {
|
|
|
|
|
|
|
|
parentMaterialBomFormRef.value?.resetFields();
|
|
|
|
|
|
|
|
parentMaterialBomFormRef.value?.clearValidate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
getTreeSelect(); // 初始化物料类型结构bom数据
|
|
|
|
getTreeSelect(); // 初始化物料类型结构bom数据
|
|
|
|
// initMaterialTypeData();
|
|
|
|
initUnitInfoData();
|
|
|
|
|
|
|
|
initMaterialBomVersionData();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const handleSelection = () => {
|
|
|
|
const handleSelection = () => {
|
|
|
@ -526,18 +663,44 @@ const handleSelection = () => {
|
|
|
|
// this.multiple = !selection.length
|
|
|
|
// this.multiple = !selection.length
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleMaterialSelect = (row) => {
|
|
|
|
const handleMaterialSelect = (row, selectMode) => {
|
|
|
|
editedRow.value = row;
|
|
|
|
editedRow.value = row;
|
|
|
|
materialTypeId.value = row.materialTypeId;
|
|
|
|
globalSelectMode.value = selectMode;
|
|
|
|
|
|
|
|
if (selectMode === SELECT_MATERIAL_MODEL.value.DIALOG_CHILD_SELECT) {//弹窗新增子级时需要先选择子物料类型
|
|
|
|
|
|
|
|
if (!row.materialTypeId) {
|
|
|
|
|
|
|
|
proxy?.$modal.msgWarning('请先选择父级物料');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
materialTypeId.value = row.materialTypeId;//弹窗子级选择物料需要传值materialTypeId
|
|
|
|
|
|
|
|
} else if (selectMode === SELECT_MATERIAL_MODEL.value.CHILD_SELECT) {//子级选择物料需要传值materialTypeId
|
|
|
|
|
|
|
|
materialTypeId.value = row.materialTypeId;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
materialTypeId.value = undefined
|
|
|
|
|
|
|
|
}
|
|
|
|
materialOpen.value = true;
|
|
|
|
materialOpen.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 提交物料信息按钮 */
|
|
|
|
/** 提交物料信息按钮 */
|
|
|
|
const submitMaterialForm = () => {
|
|
|
|
const submitMaterialForm = () => {
|
|
|
|
let selectedRow = materialSelectRef.value.tableRef.store.states.currentRow.value;
|
|
|
|
let selectedRow = materialSelectRef.value.tableRef.store.states.currentRow.value;
|
|
|
|
editedRow.value.materialId = selectedRow.materialId;
|
|
|
|
|
|
|
|
editedRow.value.materialName = selectedRow.materialName;
|
|
|
|
|
|
|
|
|
|
|
|
//此处只有是父级物料时赋值
|
|
|
|
|
|
|
|
if (globalSelectMode.value === SELECT_MATERIAL_MODEL.value.PARENT_SELECT) {
|
|
|
|
|
|
|
|
editedRow.value.parentId = selectedRow.materialId;
|
|
|
|
|
|
|
|
editedRow.value.parentMaterialName = selectedRow.materialName;
|
|
|
|
|
|
|
|
editedRow.value.parentMaterialTypeId = selectedRow.materialTypeId;
|
|
|
|
|
|
|
|
editedRow.value.parentMaterialTypeName = selectedRow.matrialTypeName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryParams.value.parentId = selectedRow.materialId;
|
|
|
|
|
|
|
|
queryParams.value.parentMaterialTypeId = selectedRow.materialTypeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alert(JSON.stringify(queryParams.value))
|
|
|
|
|
|
|
|
getList();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
editedRow.value.materialId = selectedRow.materialId;
|
|
|
|
|
|
|
|
editedRow.value.materialName = selectedRow.materialName;
|
|
|
|
|
|
|
|
}
|
|
|
|
materialOpen.value = false;
|
|
|
|
materialOpen.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -549,17 +712,23 @@ const submitBatchSaveMaterialBoms = async () => {
|
|
|
|
for (let i = 0; i < materialBomList.value.length; i++) {
|
|
|
|
for (let i = 0; i < materialBomList.value.length; i++) {
|
|
|
|
let item = materialBomList.value[i];
|
|
|
|
let item = materialBomList.value[i];
|
|
|
|
if (item.materialId) {
|
|
|
|
if (item.materialId) {
|
|
|
|
if (!item.materialBomVersion && parentMaterialId.value === 0) {
|
|
|
|
|
|
|
|
proxy?.$modal.msgWarning('序号为[' + parseInt(i) + 1 + '],请填写BOM版本');
|
|
|
|
|
|
|
|
btnLoading.value = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!item.standardAmount) {
|
|
|
|
if (!item.standardAmount) {
|
|
|
|
proxy?.$modal.msgWarning('序号为[' + parseInt(i) + 1 + '],请填写子物料数量');
|
|
|
|
proxy?.$modal.msgWarning('序号为[' + i + 1 + '],请填写子物料数量');
|
|
|
|
btnLoading.value = false;
|
|
|
|
btnLoading.value = false;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item.parentId = parentMaterialId.value;
|
|
|
|
if (!item.unitId) {
|
|
|
|
|
|
|
|
proxy?.$modal.msgWarning('序号为[' + i + 1 + '],请选择单位');
|
|
|
|
|
|
|
|
btnLoading.value = false;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.parentId = parentForm.value.parentId;
|
|
|
|
|
|
|
|
item.parentUnitId = parentForm.value.parentUnitId;
|
|
|
|
|
|
|
|
item.materialBomVersion = parentForm.value.materialBomVersion;
|
|
|
|
|
|
|
|
item.parentStandardAmount = parentForm.value.parentStandardAmount;
|
|
|
|
|
|
|
|
item.parentMaterialTypeId = parentForm.value.parentMaterialTypeId;
|
|
|
|
saveMaterialBomList.value.push(item);
|
|
|
|
saveMaterialBomList.value.push(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -570,14 +739,57 @@ const submitBatchSaveMaterialBoms = async () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await addBatchMaterialBom(saveMaterialBomList.value);
|
|
|
|
await addBatchMaterialBom(saveMaterialBomList.value);
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
focusKeyNode.value.treeKey = parentForm.value.parentId + "-" + parentForm.value.materialBomVersion;
|
|
|
|
|
|
|
|
focusKeyNode.value.materialBomVersion = parentForm.value.materialBomVersion;
|
|
|
|
|
|
|
|
focusKeyNode.value.parentUnitId = parentForm.value.parentUnitId;
|
|
|
|
|
|
|
|
focusKeyNode.value.parentStandardAmount = parentForm.value.parentStandardAmount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await getTreeSelect();
|
|
|
|
await getTreeSelect();
|
|
|
|
|
|
|
|
resetParentQueryParams();
|
|
|
|
|
|
|
|
resetQueryParams();
|
|
|
|
|
|
|
|
resetParentForm();
|
|
|
|
btnLoading.value = false;
|
|
|
|
btnLoading.value = false;
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
alert(e)
|
|
|
|
proxy?.$modal.msgWarning(e);
|
|
|
|
btnLoading.value = false;
|
|
|
|
btnLoading.value = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化单位数据 */
|
|
|
|
|
|
|
|
const initUnitInfoData = async () => {
|
|
|
|
|
|
|
|
if (unitInfoOptions.value === undefined || unitInfoOptions.value.length <= 0) {
|
|
|
|
|
|
|
|
const {data} = await getUnitInfoList();
|
|
|
|
|
|
|
|
// alert(JSON.stringify(data))
|
|
|
|
|
|
|
|
unitInfoOptions.value = data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化物料bom版本数据 */
|
|
|
|
|
|
|
|
const initMaterialBomVersionData = async () => {
|
|
|
|
|
|
|
|
// alert(JSON.stringify(getMaterialBomVersionList))
|
|
|
|
|
|
|
|
if (materialBomVersionOptions.value === undefined || materialBomVersionOptions.value.length <= 0) {
|
|
|
|
|
|
|
|
const {data} = await getMaterialBomVersionList();
|
|
|
|
|
|
|
|
materialBomVersionOptions.value = data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (materialBomVersionOptions.value.length > 0) {
|
|
|
|
|
|
|
|
parentForm.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
|
|
|
|
queryParams.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 查询父级生产bom */
|
|
|
|
|
|
|
|
const getParentMaterialBomInfo = async () => {
|
|
|
|
|
|
|
|
const res = await getParentMaterialBom(parentQueryParams.value);
|
|
|
|
|
|
|
|
parentForm.value = res.data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|
|
|
|
<style lang="scss" scoped></style>
|
|
|
|