projects/mes-lb #97

Merged
g7hoo merged 14 commits from projects/mes-lb into projects/mes-test 2023-11-21 16:09:15 +08:00
5 changed files with 124 additions and 33 deletions
Showing only changes of commit 76f5385140 - Show all commits

View File

@ -18,7 +18,9 @@
</div> </div>
<div <div
class="ct__bom-list" class="ct__bom-list"
:class="{ hidden: active && bomListLength > 0 ? false : true }"> :class="{
hidden: active && bomListLength > 0 ? false : true,
}">
<ul class="param-bom"> <ul class="param-bom">
<li v-for="bom in equipment.paramBomList" :key="bom.name"> <li v-for="bom in equipment.paramBomList" :key="bom.name">
{{ bom.name }} {{ bom.name }}
@ -94,16 +96,16 @@ li {
} }
ul { ul {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
margin-top: 4px; margin-top: 4px;
} }
.material-bom > li, .material-bom > li,
.param-bom > li { .param-bom > li {
padding: 4px 24px; padding: 4px 24px;
background: #0001; background: #0001;
border-radius: 4px; border-radius: 4px;
} }
</style> </style>

View File

@ -51,8 +51,66 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
}, },
candidateList: [], candidate: {
selectedList: [], total: 0,
tree: [
{
id: 1,
name: '设备1',
paramBomList: [
{ name: '参数BOM1', type: 'param', id: 1 },
{ name: '参数BOM2', type: 'param', id: 2 },
{ name: '参数BOM3', type: 'param', id: 3 },
{ name: '参数BOM4', type: 'param', id: 4 },
{ name: '参数BOM5', type: 'param', id: 5 },
],
materialBomList: [
{ name: '物料BOM1', type: 'material', id: 1 },
{ name: '物料BOM2', type: 'material', id: 2 },
{ name: '物料BOM3', type: 'material', id: 3 },
{ name: '物料BOM4', type: 'material', id: 4 },
{ name: '物料BOM5', type: 'material', id: 5 },
],
},
{
id: 2,
name: '设备2',
paramBomList: [
{ name: '参数BOM1', type: 'param', id: 1 },
{ name: '参数BOM2', type: 'param', id: 2 },
{ name: '参数BOM3', type: 'param', id: 3 },
{ name: '参数BOM4', type: 'param', id: 4 },
{ name: '参数BOM5', type: 'param', id: 5 },
],
materialBomList: [
{ name: '物料BOM1', type: 'material', id: 1 },
{ name: '物料BOM2', type: 'material', id: 2 },
{ name: '物料BOM3', type: 'material', id: 3 },
{ name: '物料BOM4', type: 'material', id: 4 },
{ name: '物料BOM5', type: 'material', id: 5 },
],
},
{
id: 3,
name: '设备3',
paramBomList: [
{ name: '参数BOM1', type: 'param', id: 1 },
{ name: '参数BOM2', type: 'param', id: 2 },
{ name: '参数BOM3', type: 'param', id: 3 },
{ name: '参数BOM4', type: 'param', id: 4 },
{ name: '参数BOM5', type: 'param', id: 5 },
],
materialBomList: [
{ name: '物料BOM1', type: 'material', id: 1 },
{ name: '物料BOM2', type: 'material', id: 2 },
{ name: '物料BOM3', type: 'material', id: 3 },
{ name: '物料BOM4', type: 'material', id: 4 },
{ name: '物料BOM5', type: 'material', id: 5 },
],
},
],
},
selectedList: [],
}; };
}, },
computed: {}, computed: {},
@ -101,8 +159,8 @@ export default {
} }
this.bomLoading = false; this.bomLoading = false;
}, },
// //
handleChange() {} handleChange() {},
}, },
}; };
</script> </script>

View File

@ -26,7 +26,7 @@
<i slot="prefix" class="el-input__icon el-icon-search"></i> <i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input> </el-input>
<custom-tree /> <custom-tree :raw-data="candidateList" />
</div> </div>
<div class="ctb-footer"> <div class="ctb-footer">
<pagination <pagination

View File

@ -7,28 +7,11 @@
<template> <template>
<div class="custom-tree"> <div class="custom-tree">
<div v-for="n in 5" :key="n"> <div v-for="equipment in rawData" :key="eq.id">
<CustomBomList <CustomBomList
@open="closeOthers" @open="closeOthers"
:active="activeId == n" :active="activeId == eq.id"
:equipment="{ :equipment="equipment" />
id: n,
name: '设备' + n,
paramBomList: [
{ name: '参数BOM1', type: 'param', id: 1 },
{ name: '参数BOM2', type: 'param', id: 2 },
{ name: '参数BOM3', type: 'param', id: 3 },
{ name: '参数BOM4', type: 'param', id: 4 },
{ name: '参数BOM5', type: 'param', id: 5 },
],
materialBomList: [
{ name: '物料BOM1', type: 'material', id: 1 },
{ name: '物料BOM2', type: 'material', id: 2 },
{ name: '物料BOM3', type: 'material', id: 3 },
{ name: '物料BOM4', type: 'material', id: 4 },
{ name: '物料BOM5', type: 'material', id: 5 },
],
}" />
</div> </div>
</div> </div>
</template> </template>
@ -39,7 +22,12 @@ import CustomBomList from './CustomBomList.vue';
export default { export default {
name: 'CustomTree', name: 'CustomTree',
components: { CustomBomList }, components: { CustomBomList },
props: {}, props: {
rawData: {
type: Array,
default: () => [],
},
},
data() { data() {
return { return {
showList: false, showList: false,

View File

@ -0,0 +1,43 @@
export class Candidate {
constructor(id, name, paramBomList, materialBomList) {
this.equipmentId = id;
this.equipmentName = name;
this.children = [];
this.totalBom = paramBomList.length + materialBomList.length;
this.selected = false;
paramBomList.forEach((pb) => {
this.children.push({
id: pb.id,
name: pb.name,
type: 'param',
selected: false,
});
});
materialBomList.forEach((mb) => {
this.children.push({
id: mb.id,
name: mb.name,
type: 'material',
selected: false,
});
});
}
get selected() {
return this.children.filter((child) => child.selected).length;
}
}
export class CandidateList {
constructor() {
this.value = [];
}
addCandidate(candidate) {
this.value.push(candidate);
}
get selected() {
return this.list.filter((candidate) => candidate.selected).length;
}
}