修改显示

master
夜笙歌 2 months ago
parent c4396d1a02
commit fd422fae5e

@ -4,7 +4,7 @@
<!-- 生产bom树 --> <!-- 生产bom树 -->
<el-col :lg="6" :xs="24" style="" v-loading="treeLoading"> <el-col :lg="6" :xs="24" style="" v-loading="treeLoading">
<el-card shadow="hover" style="height: calc(100vh - 120px);overflow:auto;"> <el-card shadow="hover" style="height: calc(100vh - 120px);overflow:auto;">
<el-input v-model="materialName" placeholder="请输入物料名称" prefix-icon="Search" clearable/> <el-input v-model="materialName" placeholder="请输入物料名称" prefix-icon="Search" clearable />
<el-tree <el-tree
ref="materialBomTreeRef" ref="materialBomTreeRef"
class="mt-2" class="mt-2"
@ -18,17 +18,19 @@
@node-click="handleNodeClick" @node-click="handleNodeClick"
> >
<template #default="{ node, data }"> <template #default="{ node, data }">
<div> <div style="width: 100%">
<el-button type="primary" link @click="fun(data)" v-if="node.activeFlag && node.activeFlag!==MATERIAL_BOM_ACTIVE_FLAG.ACTIVE"> <el-tooltip :content="`${data.label}`" style="width: 100%">
发布 <div class="custom-tree-node"
</el-button> style="display: inline-block;vertical-align: top;max-width: 80%;overflow: hidden;">
<el-tooltip :content="`${data.label}`"> <span
<div class="custom-tree-node" style="display: inline-block;vertical-align: center"> :style="{backgroundColor:getColor(data)?.[0],color:getColor(data)?.[1],verticalAlign: 'center'}">{{ node.label
<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>
@ -36,13 +38,14 @@
</el-col> </el-col>
<el-col :lg="18" :xs="24" v-loading="loading"> <el-col :lg="18" :xs="24" v-loading="loading">
<el-divider content-position="left">父级物料</el-divider> <el-divider content-position="left">父级物料</el-divider>
<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-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="addNewMaterialBomVersion()" :loading="btnLoading" :disabled="addNewMaterialBomVersionBtnDisabled">{{addNewMaterialBomVersionBtnText}} @click="addNewMaterialBomVersion()" :loading="btnLoading"
:disabled="addNewMaterialBomVersionBtnDisabled">{{ addNewMaterialBomVersionBtnText }}
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -51,51 +54,50 @@
<el-form ref="parentMaterialBomFormRef" label-width="120px" :model="parentForm" :rules="parentRules"> <el-form ref="parentMaterialBomFormRef" label-width="120px" :model="parentForm" :rules="parentRules">
<el-row :gutter="20"> <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>
<el-form-item label='父物料类型ID' prop='parentMaterialTypeId' v-if="false"> <el-form-item label='父物料类型ID' prop='parentMaterialTypeId' v-if="false">
<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-form-item label='状态' prop='activeFlag' style="width:260px">
<el-select v-model='parentForm.activeFlag' disabled> <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-option v-for='dict in material_bom_active_flag' :key='dict.value' :label='dict.label'
</el-select> :value='dict.value' />
</el-form-item> </el-select>
</el-form-item>
<el-form-item label="BOM版本" prop='materialBomVersion'> <el-form-item label="BOM版本" prop='materialBomVersion'>
<el-input v-model='parentForm.materialBomVersion' placeholder='' style="width:260px" disabled/> <el-input v-model='parentForm.materialBomVersion' placeholder='' style="width:260px" disabled />
</el-form-item> </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)'
style="width:260px" @change="getList" suffix-icon="Search" readonly style="width:260px" @change="getList" suffix-icon="Search" readonly
:disabled="parentMaterialDisabled"/> :disabled="parentMaterialDisabled" />
</el-form-item> </el-form-item>
<el-form-item label="父物料类型名称" prop='parentMaterialTypeName'> <el-form-item label="父物料类型名称" prop='parentMaterialTypeName'>
<el-input v-model='parentForm.parentMaterialTypeName' placeholder='' style="width:260px" readonly/> <el-input v-model='parentForm.parentMaterialTypeName' placeholder='' style="width:260px" readonly />
</el-form-item> </el-form-item>
<!-- <el-form-item label="BOM版本" prop='materialBomVersion' :model="parentForm">-->
<!-- <el-select v-model="parentForm.materialBomVersion"-->
<!-- <el-form-item label="BOM版本" prop='materialBomVersion' :model="parentForm">--> <!-- placeholder="请选择" style="width:200px">-->
<!-- <el-select v-model="parentForm.materialBomVersion"--> <!-- <el-option-->
<!-- placeholder="请选择" style="width:200px">--> <!-- v-for="item in materialBomVersionOptions"-->
<!-- <el-option--> <!-- :key="item.materialBomVersion"-->
<!-- v-for="item in materialBomVersionOptions"--> <!-- :label="item.materialBomVersion"-->
<!-- :key="item.materialBomVersion"--> <!-- :value="item.materialBomVersion"-->
<!-- :label="item.materialBomVersion"--> <!-- ></el-option>-->
<!-- :value="item.materialBomVersion"--> <!-- </el-select>-->
<!-- ></el-option>--> <!-- </el-form-item>-->
<!-- </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"
placeholder='请输入父物料数量' placeholder='请输入父物料数量'
style="width:200px"/> style="width:200px" />
</el-form-item> </el-form-item>
<el-form-item label='单位' prop='parentUnitId'> <el-form-item label='单位' prop='parentUnitId'>
@ -110,12 +112,12 @@
</el-form-item> </el-form-item>
<el-form-item label="BOM说明" prop='materialBomDesc'> <el-form-item label="BOM说明" prop='materialBomDesc'>
<el-input v-model='parentForm.materialBomDesc' placeholder='' style="width:360px" type="textarea"/> <el-input v-model='parentForm.materialBomDesc' placeholder='' style="width:360px" type="textarea" />
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-divider content-position="left">子级物料</el-divider> <el-divider content-position="left">子级物料</el-divider>
@ -137,29 +139,29 @@
</template> </template>
<el-table :data="materialBomList" @selection-change="handleSelectionChange"> <el-table :data="materialBomList" @selection-change="handleSelectionChange">
<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"/> 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"/> 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" w/> prop="materialTypeName" :show-overflow-tooltip="true" w />
<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"> 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,SELECT_MATERIAL_MODEL.CHILD_SELECT)' @click='handleMaterialSelect(scope.row,SELECT_MATERIAL_MODEL.CHILD_SELECT)'
suffix-icon="Search" readonly/> suffix-icon="Search" 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="220px"> prop="standardAmount" :show-overflow-tooltip="true" width="220px">
<template #default='scope'> <template #default='scope'>
<el-input-number v-model='scope.row.standardAmount' :precision="2" :step="1" <el-input-number v-model='scope.row.standardAmount' :precision="2" :step="1"
placeholder='请输入数量' style="width:180px"/> placeholder='请输入数量' style="width:180px" />
</template> </template>
</el-table-column> </el-table-column>
@ -222,18 +224,18 @@
<!-- </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='请点击检索物料' <el-input v-model='form.materialName' placeholder='请点击检索物料'
@click='handleMaterialSelect(form,SELECT_MATERIAL_MODEL.DIALOG_CHILD_SELECT)' @click='handleMaterialSelect(form,SELECT_MATERIAL_MODEL.DIALOG_CHILD_SELECT)'
style="width:360px"/> style="width:360px" />
</el-form-item> </el-form-item>
<el-form-item label='子物料数量' prop='standardAmount'> <el-form-item label='子物料数量' prop='standardAmount'>
<el-input-number v-model='form.standardAmount' :precision="2" :step="1" placeholder='请输入子物料数量' <el-input-number v-model='form.standardAmount' :precision="2" :step="1" placeholder='请输入子物料数量'
style="width:360px"/> style="width:360px" />
</el-form-item> </el-form-item>
<el-form-item label='子物料单位' prop='unitId'> <el-form-item label='子物料单位' prop='unitId'>
@ -277,22 +279,22 @@ import {
addBatchMaterialBom, addBatchMaterialBom,
getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom, deleteMaterialBoms, getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom, deleteMaterialBoms,
selectNextMaterialBomVersion selectNextMaterialBomVersion
} 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';
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 { material_bom_active_flag } = toRefs<any>(proxy?.useDict('material_bom_active_flag'));
@ -330,13 +332,13 @@ 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({ const MATERIAL_BOM_ACTIVE_FLAG = ref({
ACTIVE: '1',// ACTIVE: '1',//
HISTORY: '2',// HISTORY: '2',//
DESIGN: '3'// DESIGN: '3'//
}) });
const addNewMaterialBomVersionBtnText = ref('新增中'); const addNewMaterialBomVersionBtnText = ref('新增中');
const addNewMaterialBomVersionBtnDisabled = ref(true); const addNewMaterialBomVersionBtnDisabled = ref(true);
@ -347,14 +349,14 @@ const initialMaterialBomVersion = ref('01');
// //
const columns = ref<FieldOption[]>([ const columns = ref<FieldOption[]>([
{key: 0, label: `生产BOM_ID`, visible: false, children: []}, { key: 0, label: `生产BOM_ID`, visible: false, children: [] },
{key: 1, label: `子物料类型编号`, visible: true, children: []}, { key: 1, label: `子物料类型编号`, visible: true, children: [] },
{key: 2, label: `子物料类型名称`, visible: true, children: []}, { key: 2, label: `子物料类型名称`, visible: true, children: [] },
{key: 3, label: `BOM版本`, visible: false, children: []}, { key: 3, label: `BOM版本`, visible: false, children: [] },
{key: 4, label: `子物料ID`, visible: false, children: []}, { key: 4, label: `子物料ID`, visible: false, children: [] },
{key: 5, label: `子物料名称`, visible: true, children: []}, { key: 5, label: `子物料名称`, visible: true, children: [] },
{key: 6, label: `子物料数量`, visible: true, children: []}, { key: 6, label: `子物料数量`, visible: true, children: [] },
{key: 7, label: `子物料单位`, visible: true, children: []} { key: 7, label: `子物料单位`, visible: true, children: [] }
]); ]);
const materialBomTreeRef = ref<ElTreeInstance>(); const materialBomTreeRef = ref<ElTreeInstance>();
@ -390,7 +392,7 @@ const initParentFormData: MaterialBomForm = {
attachId: undefined, attachId: undefined,
activeFlag: undefined, activeFlag: undefined,
remark: undefined, remark: undefined,
materialTypeName: undefined, materialTypeName: undefined
}; };
const initFormData: MaterialBomForm = { const initFormData: MaterialBomForm = {
@ -414,12 +416,12 @@ const initFormData: MaterialBomForm = {
attachId: undefined, attachId: undefined,
activeFlag: undefined, activeFlag: undefined,
remark: undefined, remark: undefined,
materialTypeName: undefined, materialTypeName: undefined
}; };
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({ const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
form: {...initFormData}, form: { ...initFormData },
parentForm: {...initParentFormData}, parentForm: { ...initParentFormData },
queryParams: { queryParams: {
materialBomId: undefined, materialBomId: undefined,
parentId: undefined, parentId: undefined,
@ -432,31 +434,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' }
] ]
} }
@ -471,9 +473,9 @@ 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);
/** 通过条件过滤节点 */ /** 通过条件过滤节点 */
const filterNode = (value: string, data: any) => { const filterNode = (value: string, data: any) => {
@ -502,7 +504,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);
@ -510,13 +512,13 @@ const getTreeSelect = async () => {
// materialBomOptions.value = res.data; // materialBomOptions.value = res.data;
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 = {
@ -532,9 +534,9 @@ const getTreeSelect = async () => {
// const focusKeyNodeIndex = materialBomOptions.value.findIndex((optionItem) => focusKeyNode.value.treeKey === optionItem.treeKey);//children // const focusKeyNodeIndex = materialBomOptions.value.findIndex((optionItem) => focusKeyNode.value.treeKey === optionItem.treeKey);//children
} }
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;
@ -567,12 +569,12 @@ 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) => {
@ -603,14 +605,14 @@ const handleNodeClick = (data: MaterialBomVO) => {
parentMaterialDisabled.value = focusKeyNode.value.treeKey != -1; parentMaterialDisabled.value = focusKeyNode.value.treeKey != -1;
}; };
const handleBtnStatus = () =>{ const handleBtnStatus = () => {
if(parentForm.value.materialBomVersion && parentForm.value.materialBomVersion!==''){ if (parentForm.value.materialBomVersion && parentForm.value.materialBomVersion !== '') {
addNewMaterialBomVersionBtnDisabled.value = false; addNewMaterialBomVersionBtnDisabled.value = false;
addNewMaterialBomVersionBtnText.value = "新增版本"; addNewMaterialBomVersionBtnText.value = '新增版本';
publishBtnDisplay.value = parentForm.value.activeFlag !== MATERIAL_BOM_ACTIVE_FLAG.value.ACTIVE; publishBtnDisplay.value = parentForm.value.activeFlag !== MATERIAL_BOM_ACTIVE_FLAG.value.ACTIVE;
}else{ } else {
addNewMaterialBomVersionBtnDisabled.value = true; addNewMaterialBomVersionBtnDisabled.value = true;
addNewMaterialBomVersionBtnText.value = "新增中"; addNewMaterialBomVersionBtnText.value = '新增中';
publishBtnDisplay.value = false; publishBtnDisplay.value = false;
} }
@ -619,10 +621,10 @@ const handleBtnStatus = () =>{
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 = '子级物料';
} }
}; };
@ -664,7 +666,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();
} }
@ -695,7 +697,7 @@ const handleSelectionChange = (selection: MaterialBomVO[]) => {
/** 重置操作表单 */ /** 重置操作表单 */
const reset = () => { const reset = () => {
form.value = {...initFormData}; form.value = { ...initFormData };
materialBomFormRef.value?.resetFields(); materialBomFormRef.value?.resetFields();
}; };
/** 取消按钮 */ /** 取消按钮 */
@ -810,7 +812,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;
}; };
@ -881,9 +883,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.materialId = parentForm.value.parentId;
focusKeyNode.value.materialTypeId = parentForm.value.parentMaterialTypeId 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;
@ -899,13 +901,13 @@ const submitBatchSaveMaterialBoms = async () => {
} }
} }
}); });
} };
/** 初始化单位数据 */ /** 初始化单位数据 */
const initUnitInfoData = async () => { const initUnitInfoData = async () => {
if (unitInfoOptions.value === undefined || unitInfoOptions.value.length <= 0) { if (unitInfoOptions.value === undefined || unitInfoOptions.value.length <= 0) {
const {data} = await getUnitInfoList(); const { data } = await getUnitInfoList();
// alert(JSON.stringify(data)) // alert(JSON.stringify(data))
unitInfoOptions.value = data; unitInfoOptions.value = data;
} }
@ -915,7 +917,7 @@ const initUnitInfoData = async () => {
const initMaterialBomVersionData = async () => { const initMaterialBomVersionData = async () => {
// alert(JSON.stringify(getMaterialBomVersionList)) // alert(JSON.stringify(getMaterialBomVersionList))
if (materialBomVersionOptions.value === undefined || materialBomVersionOptions.value.length <= 0) { if (materialBomVersionOptions.value === undefined || materialBomVersionOptions.value.length <= 0) {
const {data} = await getMaterialBomVersionList(); const { data } = await getMaterialBomVersionList();
materialBomVersionOptions.value = data; materialBomVersionOptions.value = data;
if (materialBomVersionOptions.value.length > 0) { if (materialBomVersionOptions.value.length > 0) {
@ -933,14 +935,14 @@ const getParentMaterialBomInfo = async () => {
parentForm.value = res.data; parentForm.value = res.data;
handleBtnStatus(); handleBtnStatus();
if(!parentForm.value.materialBomVersion || parentForm.value.materialBomVersion===''){ if (!parentForm.value.materialBomVersion || parentForm.value.materialBomVersion === '') {
parentForm.value.materialBomVersion = initialMaterialBomVersion.value; parentForm.value.materialBomVersion = initialMaterialBomVersion.value;
parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN; parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN;
} }
queryParams.value.parentId = parentForm.value.parentId queryParams.value.parentId = parentForm.value.parentId;
queryParams.value.parentMaterialTypeId = parentForm.value.parentMaterialTypeId queryParams.value.parentMaterialTypeId = parentForm.value.parentMaterialTypeId;
queryParams.value.materialBomVersion = parentForm.value.materialBomVersion queryParams.value.materialBomVersion = parentForm.value.materialBomVersion;
handleQuery(); handleQuery();
btnLoading.value = false; btnLoading.value = false;
}; };
@ -955,18 +957,18 @@ const findObjectByTreeKey = (list, targetTreeKey) => {
} }
} }
return null; return null;
} };
/** 基于当前父级物料和版本新增物料bom版本 */ /** 基于当前父级物料和版本新增物料bom版本 */
const addNewMaterialBomVersion = async () => { const addNewMaterialBomVersion = async () => {
loading.value = true; loading.value = true;
parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN; parentForm.value.activeFlag = MATERIAL_BOM_ACTIVE_FLAG.value.DESIGN;
await getNextMaterialBomVersion(); await getNextMaterialBomVersion();
materialBomList.value.forEach(childMaterialBom => { materialBomList.value.forEach(childMaterialBom => {
childMaterialBom.materialBomId = undefined; childMaterialBom.materialBomId = undefined;
}); });
loading.value = false; loading.value = false;
console.log( materialBomList); console.log(materialBomList);
}; };
// const getClickNode = (obj) => { // const getClickNode = (obj) => {
@ -997,4 +999,9 @@ const getColor = (e) => {
}; };
</script> </script>
<style lang="scss" scoped></style> <style lang="less" scoped>
:deep(.el-tree-node__content) {
width: 100%;
}
</style>

Loading…
Cancel
Save