修改显示

master
夜笙歌 2 months ago
parent c4396d1a02
commit fd422fae5e

@ -18,17 +18,19 @@
@node-click="handleNodeClick"
>
<template #default="{ node, data }">
<div>
<el-button type="primary" link @click="fun(data)" v-if="node.activeFlag && node.activeFlag!==MATERIAL_BOM_ACTIVE_FLAG.ACTIVE">
发布
</el-button>
<el-tooltip :content="`${data.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
<div style="width: 100%">
<el-tooltip :content="`${data.label}`" style="width: 100%">
<div class="custom-tree-node"
style="display: inline-block;vertical-align: top;max-width: 80%;overflow: hidden;">
<span
:style="{backgroundColor:getColor(data)?.[0],color:getColor(data)?.[1],verticalAlign: 'center'}">{{ node.label
}}</span>
</div>
</el-tooltip>
<el-button type="primary" link @click="fun(data)"
style=" vertical-align: top; ">
上传
</el-button>
</div>
</template>
</el-tree>
@ -42,7 +44,8 @@
<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}}
@click="addNewMaterialBomVersion()" :loading="btnLoading"
:disabled="addNewMaterialBomVersionBtnDisabled">{{ addNewMaterialBomVersionBtnText }}
</el-button>
</el-col>
</el-row>
@ -59,7 +62,8 @@
<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-option v-for='dict in material_bom_active_flag' :key='dict.value' :label='dict.label'
:value='dict.value' />
</el-select>
</el-form-item>
@ -78,8 +82,6 @@
</el-form-item>
<!-- <el-form-item label="BOM版本" prop='materialBomVersion' :model="parentForm">-->
<!-- <el-select v-model="parentForm.materialBomVersion"-->
<!-- placeholder="请选择" style="width:200px">-->
@ -277,17 +279,17 @@ import {
addBatchMaterialBom,
getUnitInfoList, getMaterialBomVersionList, getParentMaterialBom, deleteMaterialBoms,
selectNextMaterialBomVersion
} 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);//使
@ -330,13 +332,13 @@ const SELECT_MATERIAL_MODEL = ref({
PARENT_SELECT: '1',//
CHILD_SELECT: '2',//
DIALOG_CHILD_SELECT: '3'//
})
});
const MATERIAL_BOM_ACTIVE_FLAG = ref({
ACTIVE: '1',//
HISTORY: '2',//
DESIGN: '3'//
})
});
const addNewMaterialBomVersionBtnText = ref('新增中');
const addNewMaterialBomVersionBtnDisabled = ref(true);
@ -390,7 +392,7 @@ const initParentFormData: MaterialBomForm = {
attachId: undefined,
activeFlag: undefined,
remark: undefined,
materialTypeName: undefined,
materialTypeName: undefined
};
const initFormData: MaterialBomForm = {
@ -414,7 +416,7 @@ const initFormData: MaterialBomForm = {
attachId: undefined,
activeFlag: undefined,
remark: undefined,
materialTypeName: undefined,
materialTypeName: undefined
};
const data = reactive<PageData<MaterialBomForm, MaterialBomQuery>>({
@ -432,31 +434,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' }
]
}
@ -471,7 +473,7 @@ const parentQueryParams = ref({
materialName: undefined,
materialBomVersion: undefined,
params: {}
})
});
const { queryParams, form, rules, parentForm, parentRules } = toRefs(data);
@ -502,7 +504,7 @@ const getTreeSelect = async () => {
id: virtualTopNodeId,//materialBomId
parentId: -1,
materialId: 0,
label: "生产BOM",
label: '生产BOM',
children: res.data
};
materialBomOptions.value.push(initialTree);
@ -512,7 +514,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;
@ -534,7 +536,7 @@ const getTreeSelect = async () => {
nextTick(function() {
materialBomTreeRef.value?.setCurrentKey(focusKeyNode.value.treeKey, true);
})
});
loading.value = false;
treeLoading.value = false;
@ -567,12 +569,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) => {
@ -606,11 +608,11 @@ const handleNodeClick = (data: MaterialBomVO) => {
const handleBtnStatus = () => {
if (parentForm.value.materialBomVersion && parentForm.value.materialBomVersion !== '') {
addNewMaterialBomVersionBtnDisabled.value = false;
addNewMaterialBomVersionBtnText.value = "新增版本";
addNewMaterialBomVersionBtnText.value = '新增版本';
publishBtnDisplay.value = parentForm.value.activeFlag !== MATERIAL_BOM_ACTIVE_FLAG.value.ACTIVE;
} else {
addNewMaterialBomVersionBtnDisabled.value = true;
addNewMaterialBomVersionBtnText.value = "新增中";
addNewMaterialBomVersionBtnText.value = '新增中';
publishBtnDisplay.value = false;
}
@ -619,10 +621,10 @@ const handleBtnStatus = () =>{
const clickDisplay = () => {
if (queryParams.value.parentId === 0) {
parentFormDisplay.value = false;
childTableTitle.value = "顶级物料";
childTableTitle.value = '顶级物料';
} else {
parentFormDisplay.value = true;
childTableTitle.value = "子级物料";
childTableTitle.value = '子级物料';
}
};
@ -664,7 +666,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();
}
@ -810,7 +812,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;
};
@ -881,9 +883,9 @@ 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.materialId = parentForm.value.parentId;
focusKeyNode.value.materialTypeId = parentForm.value.parentMaterialTypeId
focusKeyNode.value.materialTypeId = parentForm.value.parentMaterialTypeId;
focusKeyNode.value.materialBomVersion = parentForm.value.materialBomVersion;
focusKeyNode.value.parentUnitId = parentForm.value.parentUnitId;
focusKeyNode.value.parentStandardAmount = parentForm.value.parentStandardAmount;
@ -899,7 +901,7 @@ const submitBatchSaveMaterialBoms = async () => {
}
}
});
}
};
/** 初始化单位数据 */
@ -938,9 +940,9 @@ const getParentMaterialBomInfo = async () => {
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
queryParams.value.parentId = parentForm.value.parentId;
queryParams.value.parentMaterialTypeId = parentForm.value.parentMaterialTypeId;
queryParams.value.materialBomVersion = parentForm.value.materialBomVersion;
handleQuery();
btnLoading.value = false;
};
@ -955,7 +957,7 @@ const findObjectByTreeKey = (list, targetTreeKey) => {
}
}
return null;
}
};
/** 基于当前父级物料和版本新增物料bom版本 */
const addNewMaterialBomVersion = async () => {
@ -997,4 +999,9 @@ const getColor = (e) => {
};
</script>
<style lang="scss" scoped></style>
<style lang="less" scoped>
:deep(.el-tree-node__content) {
width: 100%;
}
</style>

Loading…
Cancel
Save