yudao-dev/src/views/extend/processFlowView/components/BomSelector.vue

146 lines
3.1 KiB
Vue
Raw Normal View History

2023-11-17 16:48:00 +08:00
<!--
filename: BomSelector.vue
author: liubin
date: 2023-11-17 16:23:28
description:
-->
<template>
<div class="bom-selector">
<el-row>
<el-col :span="8">
<el-input
v-model="searchText"
placeholder="搜索"
style="margin-bottom: 12px; user-select: none">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
</el-col>
</el-row>
2023-11-17 17:07:52 +08:00
<el-row style="border: 1px solid #ccc; display: flex;">
2023-11-17 16:48:00 +08:00
<el-col :span="8">
<div class="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">可分配设备</span>
<span>1/24</span>
</div>
<el-checkbox-group v-model="selectedEquipments" class="sl__body">
<el-checkbox
v-for="n in 10"
:key="n"
:label="'设备' + n"
2023-11-17 17:07:52 +08:00
@change="() => handleChange(n)"
2023-11-17 16:48:00 +08:00
class="sl__body-item"></el-checkbox>
</el-checkbox-group>
</div>
</el-col>
2023-11-17 17:07:52 +08:00
<el-col :span="8" style="border-left: 1px solid #ccc;">
2023-11-17 16:48:00 +08:00
<div class="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">物料BOM</span>
</div>
<el-checkbox-group v-model="selectedMBom" class="sl__body">
<el-checkbox
2023-11-17 17:07:52 +08:00
v-for="n in materialBomList"
2023-11-17 16:48:00 +08:00
:key="n"
class="sl__body-item"></el-checkbox>
</el-checkbox-group>
</div>
</el-col>
<el-col :span="8" style="border-left: 1px solid #ccc">
<div class="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">参数BOM</span>
</div>
<el-checkbox-group v-model="selectedPBom" class="sl__body">
<el-checkbox
2023-11-17 17:07:52 +08:00
v-for="n in paramBomList"
2023-11-17 16:48:00 +08:00
:key="n"
class="sl__body-item"></el-checkbox>
</el-checkbox-group>
</div>
</el-col>
</el-row>
</div>
</template>
2023-11-17 17:07:52 +08:00
;
2023-11-17 16:48:00 +08:00
<script>
export default {
name: 'BomSelector',
components: {},
props: {},
data() {
return {
searchText: '',
selectedEquipments: [],
selectedMBom: [],
selectedPBom: [],
2023-11-17 17:07:52 +08:00
selected: [],
materialBomList: [],
paramBomList: [],
2023-11-17 16:48:00 +08:00
};
},
2023-11-17 17:07:52 +08:00
watch: {
selected: {
handler(val) {
console.log(val);
},
deep: true,
},
},
2023-11-17 16:48:00 +08:00
computed: {},
2023-11-17 17:07:52 +08:00
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,
});
}
},
},
2023-11-17 16:48:00 +08:00
};
</script>
<style scoped lang="scss">
.bom-selector {
min-height: 200px;
}
.select-list {
}
.sl__body {
display: flex;
flex-direction: column;
gap: 6px;
padding: 6px;
2023-11-17 17:07:52 +08:00
2023-11-17 16:48:00 +08:00
> .el-checkbox {
2023-11-17 17:07:52 +08:00
margin: 0;
padding: 3px 6px;
2023-11-17 16:48:00 +08:00
border-radius: 4px;
2023-11-17 17:07:52 +08:00
transition: background 0.3s ease-in-out;
2023-11-17 16:48:00 +08:00
&:hover {
background: #0001;
}
}
}
.sl__header {
2023-11-17 17:07:52 +08:00
border-bottom: 1px solid #ccc;
2023-11-17 16:48:00 +08:00
}
</style>