update bomselector

This commit is contained in:
lb 2023-11-17 17:07:52 +08:00
parent 7249abf5b1
commit 8ddef0de9d

View File

@ -18,7 +18,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row style="border: 1px solid #ccc"> <el-row style="border: 1px solid #ccc; display: flex;">
<el-col :span="8"> <el-col :span="8">
<div class="select-list"> <div class="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px"> <div class="sl__header" style="background: #f3f4fb; padding: 12px">
@ -30,19 +30,19 @@
v-for="n in 10" v-for="n in 10"
:key="n" :key="n"
:label="'设备' + n" :label="'设备' + n"
:true-label="n" @change="() => handleChange(n)"
class="sl__body-item"></el-checkbox> class="sl__body-item"></el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</el-col> </el-col>
<el-col :span="8" style="border-left: 1px solid #ccc"> <el-col :span="8" style="border-left: 1px solid #ccc;">
<div class="select-list"> <div class="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px"> <div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">物料BOM</span> <span style="">物料BOM</span>
</div> </div>
<el-checkbox-group v-model="selectedMBom" class="sl__body"> <el-checkbox-group v-model="selectedMBom" class="sl__body">
<el-checkbox <el-checkbox
v-for="n in 10" v-for="n in materialBomList"
:key="n" :key="n"
class="sl__body-item"></el-checkbox> class="sl__body-item"></el-checkbox>
</el-checkbox-group> </el-checkbox-group>
@ -55,7 +55,7 @@
</div> </div>
<el-checkbox-group v-model="selectedPBom" class="sl__body"> <el-checkbox-group v-model="selectedPBom" class="sl__body">
<el-checkbox <el-checkbox
v-for="n in 10" v-for="n in paramBomList"
:key="n" :key="n"
class="sl__body-item"></el-checkbox> class="sl__body-item"></el-checkbox>
</el-checkbox-group> </el-checkbox-group>
@ -64,7 +64,7 @@
</el-row> </el-row>
</div> </div>
</template> </template>
;
<script> <script>
export default { export default {
name: 'BomSelector', name: 'BomSelector',
@ -76,18 +76,40 @@ export default {
selectedEquipments: [], selectedEquipments: [],
selectedMBom: [], selectedMBom: [],
selectedPBom: [], selectedPBom: [],
selected: [],
materialBomList: [],
paramBomList: [],
}; };
}, },
watch: { watch: {
selectedEquipments: { selected: {
handler(val) { handler(val) {
console.log(val); console.log(val);
}, },
deep: true, deep: true,
}, },
}, },
computed: {}, computed: {},
methods: {}, methods: {
handleChange(id) {
this.materialBomList = [];
this.paramBomList = [];
this.selected.push({
id: id,
});
},
handleBomChange(eqId, id, type) {
const record = this.selected.find((item) => item.id === eqId);
if (record) {
record[type == 'param' ? 'paramBomId' : 'materialBomId'] = id;
} else {
this.selected.push({
id: eqId,
[type == 'param' ? 'paramBomId' : 'materialBomId']: id,
});
}
},
},
}; };
</script> </script>
@ -106,10 +128,10 @@ export default {
padding: 6px; padding: 6px;
> .el-checkbox { > .el-checkbox {
margin: 0; margin: 0;
padding: 3px 6px; padding: 3px 6px;
border-radius: 4px; border-radius: 4px;
transition: background 0.3s ease-in-out; transition: background 0.3s ease-in-out;
&:hover { &:hover {
background: #0001; background: #0001;
@ -118,6 +140,6 @@ export default {
} }
.sl__header { .sl__header {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
} }
</style> </style>