|
|
@ -18,19 +18,17 @@
|
|
|
|
@node-click="handleNodeClick"
|
|
|
|
@node-click="handleNodeClick"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #default="{ node, data }">
|
|
|
|
<template #default="{ node, data }">
|
|
|
|
<div style="width: 100%">
|
|
|
|
<div>
|
|
|
|
<el-tooltip :content="`${data.label}`" style="width: 100%">
|
|
|
|
<el-button type="primary" link @click="fun(data)" v-if="node.activeFlag && node.activeFlag!==MATERIAL_BOM_ACTIVE_FLAG.ACTIVE">
|
|
|
|
<div class="custom-tree-node"
|
|
|
|
发布
|
|
|
|
style="display: inline-block;vertical-align: top;max-width: 80%;overflow: hidden;">
|
|
|
|
</el-button>
|
|
|
|
<span
|
|
|
|
<el-tooltip :content="`${data.label}`">
|
|
|
|
:style="{backgroundColor:getColor(data)?.[0],color:getColor(data)?.[1],verticalAlign: 'center'}">{{ node.label
|
|
|
|
<div class="custom-tree-node" style="display: inline-block;vertical-align: center">
|
|
|
|
|
|
|
|
<span :style="{backgroundColor:getColor(data)?.[0],color:getColor(data)?.[1]}">{{ node.label
|
|
|
|
}}</span>
|
|
|
|
}}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-tooltip>
|
|
|
|
</el-tooltip>
|
|
|
|
<el-button type="primary" link @click="fun(data)"
|
|
|
|
|
|
|
|
style=" vertical-align: top; ">
|
|
|
|
|
|
|
|
上传
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-tree>
|
|
|
|
</el-tree>
|
|
|
@ -38,10 +36,20 @@
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :lg="18" :xs="24" v-loading="loading">
|
|
|
|
<el-col :lg="18" :xs="24" v-loading="loading">
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<el-divider content-position="left">父级物料</el-divider>
|
|
|
|
<el-divider content-position="left">父级物料</el-divider>
|
|
|
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
|
|
|
<el-button v-has-permi="['mes:materialBom:add']" type="primary" plain icon="Plus"
|
|
|
|
|
|
|
|
@click="addNewMaterialBomVersion()" :loading="btnLoading" :disabled="addNewMaterialBomVersionBtnDisabled">{{addNewMaterialBomVersionBtnText}}
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form ref="parentMaterialBomFormRef" label-width="120px" :model="parentForm" :rules="parentRules">
|
|
|
|
<el-form ref="parentMaterialBomFormRef" label-width="120px" :model="parentForm" :rules="parentRules">
|
|
|
|
<el-row>
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-form-item label='父物料ID' prop='parentId' v-if="false">
|
|
|
|
<el-form-item label='父物料ID' prop='parentId' v-if="false">
|
|
|
|
<el-input v-model='parentForm.parentId' placeholder='' style="width:360px"/>
|
|
|
|
<el-input v-model='parentForm.parentId' placeholder='' style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
@ -49,6 +57,16 @@
|
|
|
|
<el-input v-model='parentForm.parentMaterialTypeId' placeholder='' style="width:360px"/>
|
|
|
|
<el-input v-model='parentForm.parentMaterialTypeId' placeholder='' style="width:360px"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='状态' prop='activeFlag' style="width:260px">
|
|
|
|
|
|
|
|
<el-select v-model='parentForm.activeFlag' disabled>
|
|
|
|
|
|
|
|
<el-option v-for='dict in material_bom_active_flag' :key='dict.value' :label='dict.label' :value='dict.value' />
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="BOM版本" prop='materialBomVersion'>
|
|
|
|
|
|
|
|
<el-input v-model='parentForm.materialBomVersion' placeholder='' style="width:260px" disabled/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='父物料名称' prop='parentMaterialName'>
|
|
|
|
<el-form-item label='父物料名称' prop='parentMaterialName'>
|
|
|
|
<el-input v-model='parentForm.parentMaterialName' placeholder='请点击检索物料'
|
|
|
|
<el-input v-model='parentForm.parentMaterialName' placeholder='请点击检索物料'
|
|
|
|
@click='handleMaterialSelect(parentForm,SELECT_MATERIAL_MODEL.PARENT_SELECT)'
|
|
|
|
@click='handleMaterialSelect(parentForm,SELECT_MATERIAL_MODEL.PARENT_SELECT)'
|
|
|
@ -60,17 +78,19 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="BOM版本" prop='materialBomVersion' :model="parentForm">
|
|
|
|
|
|
|
|
<el-select v-model="parentForm.materialBomVersion"
|
|
|
|
|
|
|
|
placeholder="请选择" style="width:200px">
|
|
|
|
<!-- <el-form-item label="BOM版本" prop='materialBomVersion' :model="parentForm">-->
|
|
|
|
<el-option
|
|
|
|
<!-- <el-select v-model="parentForm.materialBomVersion"-->
|
|
|
|
v-for="item in materialBomVersionOptions"
|
|
|
|
<!-- placeholder="请选择" style="width:200px">-->
|
|
|
|
:key="item.materialBomVersion"
|
|
|
|
<!-- <el-option-->
|
|
|
|
:label="item.materialBomVersion"
|
|
|
|
<!-- v-for="item in materialBomVersionOptions"-->
|
|
|
|
:value="item.materialBomVersion"
|
|
|
|
<!-- :key="item.materialBomVersion"-->
|
|
|
|
></el-option>
|
|
|
|
<!-- :label="item.materialBomVersion"-->
|
|
|
|
</el-select>
|
|
|
|
<!-- :value="item.materialBomVersion"-->
|
|
|
|
</el-form-item>
|
|
|
|
<!-- ></el-option>-->
|
|
|
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label='父物料数量' prop='parentStandardAmount'>
|
|
|
|
<el-form-item label='父物料数量' prop='parentStandardAmount'>
|
|
|
|
<el-input-number v-model='parentForm.parentStandardAmount' :precision="2" :step="1"
|
|
|
|
<el-input-number v-model='parentForm.parentStandardAmount' :precision="2" :step="1"
|
|
|
@ -89,10 +109,13 @@
|
|
|
|
</el-select>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="BOM说明" prop='materialBomDesc'>
|
|
|
|
|
|
|
|
<el-input v-model='parentForm.materialBomDesc' placeholder='' style="width:360px" type="textarea"/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-divider content-position="left">子级物料</el-divider>
|
|
|
|
<el-divider content-position="left">子级物料</el-divider>
|
|
|
@ -252,23 +275,28 @@ import {
|
|
|
|
materialBomTreeSelect,
|
|
|
|
materialBomTreeSelect,
|
|
|
|
listMaterialBomJoinStructure,
|
|
|
|
listMaterialBomJoinStructure,
|
|
|
|
addBatchMaterialBom,
|
|
|
|
addBatchMaterialBom,
|
|
|
|
getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom, deleteMaterialBoms
|
|
|
|
getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom, deleteMaterialBoms,
|
|
|
|
} from '@/api/mes/materialBom';
|
|
|
|
selectNextMaterialBomVersion
|
|
|
|
|
|
|
|
} from "@/api/mes/materialBom";
|
|
|
|
|
|
|
|
|
|
|
|
import {MaterialBomVO, MaterialBomForm, MaterialBomQuery} from '@/api/mes/materialBom/types';
|
|
|
|
import {MaterialBomVO, MaterialBomForm, MaterialBomQuery} from '@/api/mes/materialBom/types';
|
|
|
|
import {BaseMaterialTypeVO} from '@/api/mes/baseMaterialType/types';
|
|
|
|
import {BaseMaterialTypeVO} from '@/api/mes/baseMaterialType/types';
|
|
|
|
import MaterialSelect from '@/views/mes/baseMaterialInfo/addMaterial.vue';
|
|
|
|
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 {MaterialBomVersionVO} from "@/api/mes/materialBomVersion/types";
|
|
|
|
import { BaseMeasurementUnitInfoVO } from '@/api/mes/baseMeasurementUnitInfo/types';
|
|
|
|
import {BaseMeasurementUnitInfoVO} from "@/api/mes/baseMeasurementUnitInfo/types";
|
|
|
|
import { BaseStructureBomTreeVO } from '@/api/mes/baseStructureBom/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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { material_bom_active_flag } = toRefs<any>(proxy?.useDict('material_bom_active_flag'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const materialBomList = ref<MaterialBomVO[]>();
|
|
|
|
const materialBomList = ref<MaterialBomVO[]>();
|
|
|
|
const saveMaterialBomList = ref<MaterialBomVO[]>([]);
|
|
|
|
const saveMaterialBomList = ref<MaterialBomVO[]>([]);
|
|
|
|
const treeLoading = ref(false);
|
|
|
|
const treeLoading = ref(false);
|
|
|
@ -302,7 +330,20 @@ const SELECT_MATERIAL_MODEL = ref({
|
|
|
|
PARENT_SELECT: '1',//父级物料选择
|
|
|
|
PARENT_SELECT: '1',//父级物料选择
|
|
|
|
CHILD_SELECT: '2',//子级物料选择
|
|
|
|
CHILD_SELECT: '2',//子级物料选择
|
|
|
|
DIALOG_CHILD_SELECT: '3'//弹窗子级选择
|
|
|
|
DIALOG_CHILD_SELECT: '3'//弹窗子级选择
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MATERIAL_BOM_ACTIVE_FLAG = ref({
|
|
|
|
|
|
|
|
ACTIVE: '1',//启用
|
|
|
|
|
|
|
|
HISTORY: '2',//历史
|
|
|
|
|
|
|
|
DESIGN: '3'//设计中
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const addNewMaterialBomVersionBtnText = ref('新增中');
|
|
|
|
|
|
|
|
const addNewMaterialBomVersionBtnDisabled = ref(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const publishBtnDisplay = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initialMaterialBomVersion = ref('01');
|
|
|
|
|
|
|
|
|
|
|
|
// 列显隐信息
|
|
|
|
// 列显隐信息
|
|
|
|
const columns = ref<FieldOption[]>([
|
|
|
|
const columns = ref<FieldOption[]>([
|
|
|
@ -347,9 +388,9 @@ const initParentFormData: MaterialBomForm = {
|
|
|
|
assembleTime: undefined,
|
|
|
|
assembleTime: undefined,
|
|
|
|
materialClassfication: undefined,
|
|
|
|
materialClassfication: undefined,
|
|
|
|
attachId: undefined,
|
|
|
|
attachId: undefined,
|
|
|
|
activeFlag: '1',
|
|
|
|
activeFlag: undefined,
|
|
|
|
remark: undefined,
|
|
|
|
remark: undefined,
|
|
|
|
materialTypeName: undefined
|
|
|
|
materialTypeName: undefined,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const initFormData: MaterialBomForm = {
|
|
|
|
const initFormData: MaterialBomForm = {
|
|
|
@ -371,9 +412,9 @@ const initFormData: MaterialBomForm = {
|
|
|
|
assembleTime: undefined,
|
|
|
|
assembleTime: undefined,
|
|
|
|
materialClassfication: undefined,
|
|
|
|
materialClassfication: undefined,
|
|
|
|
attachId: undefined,
|
|
|
|
attachId: undefined,
|
|
|
|
activeFlag: '1',
|
|
|
|
activeFlag: undefined,
|
|
|
|
remark: undefined,
|
|
|
|
remark: undefined,
|
|
|
|
materialTypeName: undefined
|
|
|
|
materialTypeName: undefined,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
@ -391,31 +432,31 @@ const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
materialTypeId: [
|
|
|
|
materialTypeId: [
|
|
|
|
{ required: true, message: '物料类型不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "物料类型不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
materialBomVersion: [
|
|
|
|
materialBomVersion: [
|
|
|
|
{ required: true, message: 'BOM版本不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "BOM版本不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
materialName: [
|
|
|
|
materialName: [
|
|
|
|
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "物料名称不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
standardAmount: [
|
|
|
|
standardAmount: [
|
|
|
|
{ required: true, message: '子物料数量不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "子物料数量不能为空", trigger: "blur"}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
parentRules: {
|
|
|
|
parentRules: {
|
|
|
|
parentMaterialName: [
|
|
|
|
parentMaterialName: [
|
|
|
|
{ required: true, message: '父物料名称不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "父物料名称不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
materialBomVersion: [
|
|
|
|
materialBomVersion: [
|
|
|
|
{ required: true, message: 'BOM版本不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "BOM版本不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
parentStandardAmount: [
|
|
|
|
parentStandardAmount: [
|
|
|
|
{ required: true, message: '父物料数量不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "父物料数量不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
parentUnitId: [
|
|
|
|
parentUnitId: [
|
|
|
|
{ required: true, message: '父物料单位不能为空', trigger: 'blur' }
|
|
|
|
{required: true, message: "父物料单位不能为空", trigger: "blur"}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -430,7 +471,7 @@ const parentQueryParams = ref({
|
|
|
|
materialName: undefined,
|
|
|
|
materialName: undefined,
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
params: {}
|
|
|
|
params: {}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const {queryParams, form, rules, parentForm, parentRules} = toRefs(data);
|
|
|
|
const {queryParams, form, rules, parentForm, parentRules} = toRefs(data);
|
|
|
|
|
|
|
|
|
|
|
@ -461,7 +502,7 @@ const getTreeSelect = async () => {
|
|
|
|
id: virtualTopNodeId,//materialBomId
|
|
|
|
id: virtualTopNodeId,//materialBomId
|
|
|
|
parentId: -1,
|
|
|
|
parentId: -1,
|
|
|
|
materialId: 0,
|
|
|
|
materialId: 0,
|
|
|
|
label: '生产BOM',
|
|
|
|
label: "生产BOM",
|
|
|
|
children: res.data
|
|
|
|
children: res.data
|
|
|
|
};
|
|
|
|
};
|
|
|
|
materialBomOptions.value.push(initialTree);
|
|
|
|
materialBomOptions.value.push(initialTree);
|
|
|
@ -471,12 +512,12 @@ const getTreeSelect = async () => {
|
|
|
|
if (!focusKeyNode.value) {//如果之前没有focus
|
|
|
|
if (!focusKeyNode.value) {//如果之前没有focus
|
|
|
|
focusKeyNode.value = {treeKey: virtualTopNodeId};
|
|
|
|
focusKeyNode.value = {treeKey: virtualTopNodeId};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const clickNode = findObjectByTreeKey(materialBomOptions.value, focusKeyNode.value.treeKey);
|
|
|
|
const clickNode = findObjectByTreeKey(materialBomOptions.value, focusKeyNode.value.treeKey)
|
|
|
|
|
|
|
|
|
|
|
|
if (!clickNode) {
|
|
|
|
if (!clickNode) {
|
|
|
|
focusKeyNode.value = undefined;
|
|
|
|
focusKeyNode.value = undefined;
|
|
|
|
focusKeyNode.value = {treeKey: virtualTopNodeId};
|
|
|
|
focusKeyNode.value = {treeKey: virtualTopNodeId};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if (!allTreeKeys || allTreeKeys.length <= 0) {
|
|
|
|
// if (!allTreeKeys || allTreeKeys.length <= 0) {
|
|
|
|
// focusKeyNode.value = {
|
|
|
|
// focusKeyNode.value = {
|
|
|
|
// treeKey: virtualTopNodeId,
|
|
|
|
// treeKey: virtualTopNodeId,
|
|
|
@ -493,7 +534,7 @@ const getTreeSelect = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
nextTick(function () {
|
|
|
|
nextTick(function () {
|
|
|
|
materialBomTreeRef.value?.setCurrentKey(focusKeyNode.value.treeKey, true);
|
|
|
|
materialBomTreeRef.value?.setCurrentKey(focusKeyNode.value.treeKey, true);
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
treeLoading.value = false;
|
|
|
|
treeLoading.value = false;
|
|
|
@ -504,6 +545,16 @@ const getTreeSelect = async () => {
|
|
|
|
// materialTypeOptions.value[0].children.push(dd);
|
|
|
|
// materialTypeOptions.value[0].children.push(dd);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 查询生产bom列表 */
|
|
|
|
|
|
|
|
const getNextMaterialBomVersion = async () => {
|
|
|
|
|
|
|
|
//顶级节点,如果是重新修改父级物料则重新获取最新版本
|
|
|
|
|
|
|
|
// loading.value = true;
|
|
|
|
|
|
|
|
const res = await selectNextMaterialBomVersion(parentForm.value.parentId);
|
|
|
|
|
|
|
|
parentForm.value.materialBomVersion = res.data;
|
|
|
|
|
|
|
|
// materialBomList.value = res.data;
|
|
|
|
|
|
|
|
// loading.value = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** 查询生产bom列表 */
|
|
|
|
/** 查询生产bom列表 */
|
|
|
|
const getList = async () => {
|
|
|
|
const getList = async () => {
|
|
|
|
//如果是有节点的则加载数据,如果是顶级节点生产BOM则不加载数据
|
|
|
|
//如果是有节点的则加载数据,如果是顶级节点生产BOM则不加载数据
|
|
|
@ -516,17 +567,21 @@ const getList = async () => {
|
|
|
|
const resetParentQueryParams = () => {
|
|
|
|
const resetParentQueryParams = () => {
|
|
|
|
parentQueryParams.value.parentId = undefined;//是当前节点的materialId
|
|
|
|
parentQueryParams.value.parentId = undefined;//是当前节点的materialId
|
|
|
|
parentQueryParams.value.materialBomVersion = undefined;
|
|
|
|
parentQueryParams.value.materialBomVersion = undefined;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const resetQueryParams = () => {
|
|
|
|
const resetQueryParams = () => {
|
|
|
|
queryParams.value.parentId = undefined;//materialid
|
|
|
|
queryParams.value.parentId = undefined;//materialid
|
|
|
|
queryParams.value.parentMaterialTypeId = undefined;
|
|
|
|
queryParams.value.parentMaterialTypeId = undefined;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 节点单击事件 */
|
|
|
|
/** 节点单击事件 */
|
|
|
|
const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
materialBomList.value = [];
|
|
|
|
materialBomList.value = [];
|
|
|
|
parentMaterialDisabled.value = true;
|
|
|
|
parentMaterialDisabled.value = true;
|
|
|
|
|
|
|
|
publishBtnDisplay.value = false;
|
|
|
|
|
|
|
|
addNewMaterialBomVersionBtnDisabled.value = true;
|
|
|
|
|
|
|
|
btnLoading.value = true;
|
|
|
|
|
|
|
|
|
|
|
|
resetParentForm();
|
|
|
|
resetParentForm();
|
|
|
|
resetQueryParams();
|
|
|
|
resetQueryParams();
|
|
|
|
resetParentQueryParams();
|
|
|
|
resetParentQueryParams();
|
|
|
@ -535,27 +590,39 @@ const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
parentQueryParams.value.parentId = data.materialId;//是当前节点的materialId
|
|
|
|
parentQueryParams.value.parentId = data.materialId;//是当前节点的materialId
|
|
|
|
parentQueryParams.value.materialBomVersion = data.materialBomVersion;
|
|
|
|
parentQueryParams.value.materialBomVersion = data.materialBomVersion;
|
|
|
|
getParentMaterialBomInfo();
|
|
|
|
getParentMaterialBomInfo();
|
|
|
|
queryParams.value.parentId = data.materialId;
|
|
|
|
|
|
|
|
queryParams.value.parentMaterialTypeId = data.materialTypeId;
|
|
|
|
|
|
|
|
queryParams.value.materialBomVersion = data.materialBomVersion;
|
|
|
|
|
|
|
|
handleQuery();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (materialBomVersionOptions.value.length > 0) {
|
|
|
|
parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN;
|
|
|
|
parentForm.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
handleBtnStatus();
|
|
|
|
queryParams.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
btnLoading.value = false;
|
|
|
|
}
|
|
|
|
// if (materialBomVersionOptions.value.length > 0) {
|
|
|
|
|
|
|
|
// parentForm.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
|
|
|
|
// queryParams.value.materialBomVersion = materialBomVersionOptions.value[0].materialBomVersion;
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parentMaterialDisabled.value = focusKeyNode.value.treeKey != -1;
|
|
|
|
parentMaterialDisabled.value = focusKeyNode.value.treeKey != -1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleBtnStatus = () =>{
|
|
|
|
|
|
|
|
if(parentForm.value.materialBomVersion && parentForm.value.materialBomVersion!==''){
|
|
|
|
|
|
|
|
addNewMaterialBomVersionBtnDisabled.value = false;
|
|
|
|
|
|
|
|
addNewMaterialBomVersionBtnText.value = "新增版本";
|
|
|
|
|
|
|
|
publishBtnDisplay.value = parentForm.value.activeFlag !== MATERIAL_BOM_ACTIVE_FLAG.value.ACTIVE;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
addNewMaterialBomVersionBtnDisabled.value = true;
|
|
|
|
|
|
|
|
addNewMaterialBomVersionBtnText.value = "新增中";
|
|
|
|
|
|
|
|
publishBtnDisplay.value = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const clickDisplay = () => {
|
|
|
|
const clickDisplay = () => {
|
|
|
|
if (queryParams.value.parentId === 0) {
|
|
|
|
if (queryParams.value.parentId === 0) {
|
|
|
|
parentFormDisplay.value = false;
|
|
|
|
parentFormDisplay.value = false;
|
|
|
|
childTableTitle.value = '顶级物料';
|
|
|
|
childTableTitle.value = "顶级物料";
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
parentFormDisplay.value = true;
|
|
|
|
parentFormDisplay.value = true;
|
|
|
|
childTableTitle.value = '子级物料';
|
|
|
|
childTableTitle.value = "子级物料";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -597,7 +664,7 @@ const handleDelete = async (row?: MaterialBomVO) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// alert(JSON.stringify(toDeleteMaterialBoms.value))
|
|
|
|
// alert(JSON.stringify(toDeleteMaterialBoms.value))
|
|
|
|
if (toDeleteMaterialBoms.value.length > 0) {
|
|
|
|
if (toDeleteMaterialBoms.value.length > 0) {
|
|
|
|
await deleteMaterialBoms(toDeleteMaterialBoms.value);
|
|
|
|
await deleteMaterialBoms(toDeleteMaterialBoms.value)
|
|
|
|
await getTreeSelect();
|
|
|
|
await getTreeSelect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -743,7 +810,7 @@ const handleMaterialSelect = (row, selectMode) => {
|
|
|
|
} else if (selectMode === SELECT_MATERIAL_MODEL.value.CHILD_SELECT) {//子级选择物料需要传值materialTypeId
|
|
|
|
} else if (selectMode === SELECT_MATERIAL_MODEL.value.CHILD_SELECT) {//子级选择物料需要传值materialTypeId
|
|
|
|
materialTypeId.value = row.materialTypeId;
|
|
|
|
materialTypeId.value = row.materialTypeId;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
materialTypeId.value = undefined;
|
|
|
|
materialTypeId.value = undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
materialOpen.value = true;
|
|
|
|
materialOpen.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -755,14 +822,15 @@ const submitMaterialForm = () => {
|
|
|
|
|
|
|
|
|
|
|
|
//此处只有是父级物料时赋值
|
|
|
|
//此处只有是父级物料时赋值
|
|
|
|
if (globalSelectMode.value === SELECT_MATERIAL_MODEL.value.PARENT_SELECT) {
|
|
|
|
if (globalSelectMode.value === SELECT_MATERIAL_MODEL.value.PARENT_SELECT) {
|
|
|
|
|
|
|
|
editedRow.value.materialBomVersion = undefined;
|
|
|
|
editedRow.value.parentId = selectedRow.materialId;
|
|
|
|
editedRow.value.parentId = selectedRow.materialId;
|
|
|
|
editedRow.value.parentMaterialName = selectedRow.materialName;
|
|
|
|
editedRow.value.parentMaterialName = selectedRow.materialName;
|
|
|
|
editedRow.value.parentMaterialTypeId = selectedRow.materialTypeId;
|
|
|
|
editedRow.value.parentMaterialTypeId = selectedRow.materialTypeId;
|
|
|
|
editedRow.value.parentMaterialTypeName = selectedRow.matrialTypeName;
|
|
|
|
editedRow.value.parentMaterialTypeName = selectedRow.matrialTypeName;
|
|
|
|
|
|
|
|
|
|
|
|
queryParams.value.parentId = selectedRow.materialId;
|
|
|
|
queryParams.value.parentId = selectedRow.materialId;
|
|
|
|
queryParams.value.parentMaterialTypeId = selectedRow.materialTypeId;
|
|
|
|
queryParams.value.parentMaterialTypeId = selectedRow.materialTypeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getNextMaterialBomVersion();
|
|
|
|
// alert(JSON.stringify(queryParams.value))
|
|
|
|
// alert(JSON.stringify(queryParams.value))
|
|
|
|
getList();
|
|
|
|
getList();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -796,9 +864,12 @@ const submitBatchSaveMaterialBoms = async () => {
|
|
|
|
|
|
|
|
|
|
|
|
item.parentId = parentForm.value.parentId;
|
|
|
|
item.parentId = parentForm.value.parentId;
|
|
|
|
item.parentUnitId = parentForm.value.parentUnitId;
|
|
|
|
item.parentUnitId = parentForm.value.parentUnitId;
|
|
|
|
item.materialBomVersion = parentForm.value.materialBomVersion;
|
|
|
|
|
|
|
|
item.parentStandardAmount = parentForm.value.parentStandardAmount;
|
|
|
|
item.parentStandardAmount = parentForm.value.parentStandardAmount;
|
|
|
|
item.parentMaterialTypeId = parentForm.value.parentMaterialTypeId;
|
|
|
|
item.parentMaterialTypeId = parentForm.value.parentMaterialTypeId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.materialBomDesc = parentForm.value.materialBomDesc;
|
|
|
|
|
|
|
|
item.materialBomVersion = parentForm.value.materialBomVersion;
|
|
|
|
|
|
|
|
item.activeFlag = parentForm.value.activeFlag;
|
|
|
|
saveMaterialBomList.value.push(item);
|
|
|
|
saveMaterialBomList.value.push(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -810,7 +881,9 @@ 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.treeKey = parentForm.value.parentId + "-" + parentForm.value.materialBomVersion;
|
|
|
|
|
|
|
|
focusKeyNode.value.materialId = parentForm.value.parentId;
|
|
|
|
|
|
|
|
focusKeyNode.value.materialTypeId = parentForm.value.parentMaterialTypeId
|
|
|
|
focusKeyNode.value.materialBomVersion = parentForm.value.materialBomVersion;
|
|
|
|
focusKeyNode.value.materialBomVersion = parentForm.value.materialBomVersion;
|
|
|
|
focusKeyNode.value.parentUnitId = parentForm.value.parentUnitId;
|
|
|
|
focusKeyNode.value.parentUnitId = parentForm.value.parentUnitId;
|
|
|
|
focusKeyNode.value.parentStandardAmount = parentForm.value.parentStandardAmount;
|
|
|
|
focusKeyNode.value.parentStandardAmount = parentForm.value.parentStandardAmount;
|
|
|
@ -826,7 +899,7 @@ const submitBatchSaveMaterialBoms = async () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化单位数据 */
|
|
|
|
/** 初始化单位数据 */
|
|
|
@ -858,7 +931,18 @@ const initMaterialBomVersionData = async () => {
|
|
|
|
const getParentMaterialBomInfo = async () => {
|
|
|
|
const getParentMaterialBomInfo = async () => {
|
|
|
|
const res = await getParentMaterialBom(parentQueryParams.value);
|
|
|
|
const res = await getParentMaterialBom(parentQueryParams.value);
|
|
|
|
parentForm.value = res.data;
|
|
|
|
parentForm.value = res.data;
|
|
|
|
|
|
|
|
handleBtnStatus();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!parentForm.value.materialBomVersion || parentForm.value.materialBomVersion===''){
|
|
|
|
|
|
|
|
parentForm.value.materialBomVersion = initialMaterialBomVersion.value;
|
|
|
|
|
|
|
|
parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryParams.value.parentId = parentForm.value.parentId
|
|
|
|
|
|
|
|
queryParams.value.parentMaterialTypeId = parentForm.value.parentMaterialTypeId
|
|
|
|
|
|
|
|
queryParams.value.materialBomVersion = parentForm.value.materialBomVersion
|
|
|
|
|
|
|
|
handleQuery();
|
|
|
|
|
|
|
|
btnLoading.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -871,8 +955,19 @@ const findObjectByTreeKey = (list, targetTreeKey) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 基于当前父级物料和版本,新增物料bom版本 */
|
|
|
|
|
|
|
|
const addNewMaterialBomVersion = async () => {
|
|
|
|
|
|
|
|
loading.value = true;
|
|
|
|
|
|
|
|
parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN;
|
|
|
|
|
|
|
|
await getNextMaterialBomVersion();
|
|
|
|
|
|
|
|
materialBomList.value.forEach(childMaterialBom => {
|
|
|
|
|
|
|
|
childMaterialBom.materialBomId = undefined;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
|
|
|
console.log( materialBomList);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// const getClickNode = (obj) => {
|
|
|
|
// const getClickNode = (obj) => {
|
|
|
|
// // 如果当前对象有 id,并且与之前focus的id相同,则收集
|
|
|
|
// // 如果当前对象有 id,并且与之前focus的id相同,则收集
|
|
|
@ -902,8 +997,4 @@ const getColor = (e) => {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
<style lang="scss" scoped></style>
|
|
|
|
:deep(.el-tree-node__content) {
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|