|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<!-- 生产bom树 -->
|
|
|
|
|
<el-col :lg="6" :xs="24" style="" v-loading="treeLoading">
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
<el-card shadow="hover" style="height: 100%;overflow:auto;">
|
|
|
|
|
<el-input v-model="materialName" placeholder="请输入物料名称" prefix-icon="Search" clearable />
|
|
|
|
|
<el-tree
|
|
|
|
|
ref="materialBomTreeRef"
|
|
|
|
@ -244,17 +244,17 @@ import {
|
|
|
|
|
listMaterialBomJoinStructure,
|
|
|
|
|
addBatchMaterialBom,
|
|
|
|
|
getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom, deleteMaterialBoms
|
|
|
|
|
} from "@/api/mes/materialBom";
|
|
|
|
|
} from '@/api/mes/materialBom';
|
|
|
|
|
|
|
|
|
|
import { MaterialBomVO, MaterialBomForm, MaterialBomQuery } from '@/api/mes/materialBom/types';
|
|
|
|
|
import { BaseMaterialTypeVO } from '@/api/mes/baseMaterialType/types';
|
|
|
|
|
import MaterialSelect from '@/views/mes/baseMaterialInfo/addMaterial.vue';
|
|
|
|
|
|
|
|
|
|
import { to } from 'await-to-js';
|
|
|
|
|
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";
|
|
|
|
|
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);//此值是传给选择物料信息弹框使用
|
|
|
|
|
|
|
|
|
@ -293,7 +293,7 @@ const SELECT_MATERIAL_MODEL = ref({
|
|
|
|
|
PARENT_SELECT: '1',//父级物料选择
|
|
|
|
|
CHILD_SELECT: '2',//子级物料选择
|
|
|
|
|
DIALOG_CHILD_SELECT: '3'//弹窗子级选择
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 列显隐信息
|
|
|
|
|
const columns = ref<FieldOption[]>([
|
|
|
|
@ -340,7 +340,7 @@ const initParentFormData: MaterialBomForm = {
|
|
|
|
|
attachId: undefined,
|
|
|
|
|
activeFlag: '1',
|
|
|
|
|
remark: undefined,
|
|
|
|
|
materialTypeName: undefined,
|
|
|
|
|
materialTypeName: undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const initFormData: MaterialBomForm = {
|
|
|
|
@ -364,7 +364,7 @@ const initFormData: MaterialBomForm = {
|
|
|
|
|
attachId: undefined,
|
|
|
|
|
activeFlag: '1',
|
|
|
|
|
remark: undefined,
|
|
|
|
|
materialTypeName: undefined,
|
|
|
|
|
materialTypeName: undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
@ -382,31 +382,31 @@ const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
materialTypeId: [
|
|
|
|
|
{required: true, message: "物料类型不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: '物料类型不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
materialBomVersion: [
|
|
|
|
|
{required: true, message: "BOM版本不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: 'BOM版本不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
materialName: [
|
|
|
|
|
{required: true, message: "物料名称不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: '物料名称不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
standardAmount: [
|
|
|
|
|
{required: true, message: "子物料数量不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: '子物料数量不能为空', trigger: 'blur' }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
parentRules: {
|
|
|
|
|
parentMaterialName: [
|
|
|
|
|
{required: true, message: "父物料名称不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: '父物料名称不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
materialBomVersion: [
|
|
|
|
|
{required: true, message: "BOM版本不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: 'BOM版本不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
parentStandardAmount: [
|
|
|
|
|
{required: true, message: "父物料数量不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: '父物料数量不能为空', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
parentUnitId: [
|
|
|
|
|
{required: true, message: "父物料单位不能为空", trigger: "blur"}
|
|
|
|
|
{ required: true, message: '父物料单位不能为空', trigger: 'blur' }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -421,7 +421,7 @@ const parentQueryParams = ref({
|
|
|
|
|
materialName: undefined,
|
|
|
|
|
materialBomVersion: undefined,
|
|
|
|
|
params: {}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { queryParams, form, rules, parentForm, parentRules } = toRefs(data);
|
|
|
|
|
|
|
|
|
@ -452,7 +452,7 @@ const getTreeSelect = async () => {
|
|
|
|
|
id: virtualTopNodeId,//materialBomId
|
|
|
|
|
parentId: -1,
|
|
|
|
|
materialId: 0,
|
|
|
|
|
label: "生产BOM",
|
|
|
|
|
label: '生产BOM',
|
|
|
|
|
children: res.data
|
|
|
|
|
};
|
|
|
|
|
materialBomOptions.value.push(initialTree);
|
|
|
|
@ -462,7 +462,7 @@ const getTreeSelect = async () => {
|
|
|
|
|
if (!focusKeyNode.value) {//如果之前没有focus
|
|
|
|
|
focusKeyNode.value = { treeKey: virtualTopNodeId };
|
|
|
|
|
} else {
|
|
|
|
|
const clickNode = findObjectByTreeKey(materialBomOptions.value, focusKeyNode.value.treeKey)
|
|
|
|
|
const clickNode = findObjectByTreeKey(materialBomOptions.value, focusKeyNode.value.treeKey);
|
|
|
|
|
if (!clickNode) {
|
|
|
|
|
focusKeyNode.value = undefined;
|
|
|
|
|
focusKeyNode.value = { treeKey: virtualTopNodeId };
|
|
|
|
@ -484,7 +484,7 @@ const getTreeSelect = async () => {
|
|
|
|
|
|
|
|
|
|
nextTick(function() {
|
|
|
|
|
materialBomTreeRef.value?.setCurrentKey(focusKeyNode.value.treeKey, true);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
treeLoading.value = false;
|
|
|
|
@ -507,12 +507,12 @@ const getList = async () => {
|
|
|
|
|
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) => {
|
|
|
|
@ -528,7 +528,7 @@ const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
|
getParentMaterialBomInfo();
|
|
|
|
|
queryParams.value.parentId = data.materialId;
|
|
|
|
|
queryParams.value.parentMaterialTypeId = data.materialTypeId;
|
|
|
|
|
queryParams.value.materialBomVersion = data.materialBomVersion
|
|
|
|
|
queryParams.value.materialBomVersion = data.materialBomVersion;
|
|
|
|
|
handleQuery();
|
|
|
|
|
} else {
|
|
|
|
|
if (materialBomVersionOptions.value.length > 0) {
|
|
|
|
@ -543,10 +543,10 @@ const handleNodeClick = (data: MaterialBomVO) => {
|
|
|
|
|
const clickDisplay = () => {
|
|
|
|
|
if (queryParams.value.parentId === 0) {
|
|
|
|
|
parentFormDisplay.value = false;
|
|
|
|
|
childTableTitle.value = "顶级物料";
|
|
|
|
|
childTableTitle.value = '顶级物料';
|
|
|
|
|
} else {
|
|
|
|
|
parentFormDisplay.value = true;
|
|
|
|
|
childTableTitle.value = "子级物料";
|
|
|
|
|
childTableTitle.value = '子级物料';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -588,7 +588,7 @@ const handleDelete = async (row?: MaterialBomVO) => {
|
|
|
|
|
});
|
|
|
|
|
// alert(JSON.stringify(toDeleteMaterialBoms.value))
|
|
|
|
|
if (toDeleteMaterialBoms.value.length > 0) {
|
|
|
|
|
await deleteMaterialBoms(toDeleteMaterialBoms.value)
|
|
|
|
|
await deleteMaterialBoms(toDeleteMaterialBoms.value);
|
|
|
|
|
await getTreeSelect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -734,7 +734,7 @@ const handleMaterialSelect = (row, selectMode) => {
|
|
|
|
|
} else if (selectMode === SELECT_MATERIAL_MODEL.value.CHILD_SELECT) {//子级选择物料需要传值materialTypeId
|
|
|
|
|
materialTypeId.value = row.materialTypeId;
|
|
|
|
|
} else {
|
|
|
|
|
materialTypeId.value = undefined
|
|
|
|
|
materialTypeId.value = undefined;
|
|
|
|
|
}
|
|
|
|
|
materialOpen.value = true;
|
|
|
|
|
};
|
|
|
|
@ -801,7 +801,7 @@ const submitBatchSaveMaterialBoms = async () => {
|
|
|
|
|
await addBatchMaterialBom(saveMaterialBomList.value);
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
|
|
|
|
|
focusKeyNode.value.treeKey = parentForm.value.parentId + "-" + parentForm.value.materialBomVersion;
|
|
|
|
|
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;
|
|
|
|
@ -817,7 +817,7 @@ const submitBatchSaveMaterialBoms = async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 初始化单位数据 */
|
|
|
|
@ -862,7 +862,7 @@ const findObjectByTreeKey = (list, targetTreeKey) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const getClickNode = (obj) => {
|
|
|
|
|