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
2 changed files with 42 additions and 14 deletions
Showing only changes of commit 847e34fcc6 - Show all commits

View File

@ -27,10 +27,10 @@ export default {
// event: 'update', // event: 'update',
// }, // },
props: { props: {
// selected: { currentSelect: {
// type: String, type: String,
// default: '', default: null,
// }, },
list: { list: {
type: Array, type: Array,
default: () => [], default: () => [],
@ -44,7 +44,7 @@ export default {
return { return {
list__inner: [], list__inner: [],
selected: null, selected: null,
randomKey: Math.random() randomKey: Math.random(),
}; };
}, },
watch: { watch: {
@ -57,6 +57,12 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
}, },
currentSelect: {
handler(val) {
this.selected = val;
},
immediate: true,
},
}, },
methods: { methods: {
handleChange(bomItem, selected) { handleChange(bomItem, selected) {
@ -76,7 +82,7 @@ export default {
clearSelected() { clearSelected() {
console.log('clearSelected'); console.log('clearSelected');
this.selected = null; this.selected = null;
this.randomKey = Math.random() this.randomKey = Math.random();
// this.$emit('update', null); // this.$emit('update', null);
// this.$nextTick(() => { // this.$nextTick(() => {
// this.$forceUpdate(); // this.$forceUpdate();

View File

@ -29,13 +29,21 @@
</span> </span>
</div> </div>
<div class="sl__body"> <div class="sl__body">
<el-checkbox <div
class="sl__body-item"
v-for="eq in filteredBomList" v-for="eq in filteredBomList"
:key="eq.id + refreshKey" :key="eq.id + refreshKey">
:label="eq.name" <el-checkbox
:key="refreshKey"
:checked="selectedEquipments.includes(eq.id)" :checked="selectedEquipments.includes(eq.id)"
@change="(e) => handleEquipmentChange(eq, e)" @change="(e) => handleEquipmentChange(eq, e)"
class="sl__body-item"></el-checkbox> class=""></el-checkbox>
<span
:key="'label' + refreshKey"
@click.stop="() => handleLoadDom(eq)">
{{ eq.name }}
</span>
</div>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -47,9 +55,10 @@
<BomSelection <BomSelection
ref="materialsBomList" ref="materialsBomList"
key="materialsBomList" :key="materialsBomList.equipmentId + 'materialsBomList'"
:list="materialsBomList" :list="materialsBomList"
:equipment-id="materialsBomList.equipmentId" :equipment-id="materialsBomList.equipmentId"
:current-select="currentSelectedMaterialBomId"
@change="handleMaterialBomChange" /> @change="handleMaterialBomChange" />
</div> </div>
</el-col> </el-col>
@ -61,9 +70,10 @@
<BomSelection <BomSelection
ref="valuesBomList" ref="valuesBomList"
key="valuesBomList" :key="valuesBomList.equipmentId + 'valuesBomList'"
:list="valuesBomList" :list="valuesBomList"
:equipment-id="valuesBomList.equipmentId" :equipment-id="valuesBomList.equipmentId"
:current-select="currentSelectedValueBomId"
@change="handleValueBomChange" /> @change="handleValueBomChange" />
</div> </div>
</el-col> </el-col>
@ -98,6 +108,8 @@ export default {
materialsBomList: [], materialsBomList: [],
valuesBomList: [], valuesBomList: [],
refreshKey: Math.random(), refreshKey: Math.random(),
currentSelectedMaterialBomId: null,
currentSelectedValueBomId: null,
}; };
}, },
watch: { watch: {
@ -124,6 +136,14 @@ export default {
commit() { commit() {
this.$emit('update', this.selected); this.$emit('update', this.selected);
}, },
handleLoadDom(eq) {
// dom
this.currentEquipment = eq.id;
this.materialsBomList = eq.materialsBom;
this.valuesBomList = eq.valuesBom;
},
handleEquipmentChange(eq, selected) { handleEquipmentChange(eq, selected) {
this.currentEquipment = eq.id; this.currentEquipment = eq.id;
this.materialsBomList = eq.materialsBom; this.materialsBomList = eq.materialsBom;
@ -169,6 +189,7 @@ export default {
return; return;
} }
selectedItem && (selectedItem.equMaterialBomId = selected ? bomId : null); selectedItem && (selectedItem.equMaterialBomId = selected ? bomId : null);
this.currentSelectedMaterialBomId = selected ? bomId : null;
// this.$emit('update', this.selected); // this.$emit('update', this.selected);
}, },
@ -189,6 +210,7 @@ export default {
return; return;
} }
selectedItem && (selectedItem.equValueBomId = selected ? bomId : null); selectedItem && (selectedItem.equValueBomId = selected ? bomId : null);
this.currentSelectedValueBomId = selected ? bomId : null;
// this.$emit('update', this.selected); // this.$emit('update', this.selected);
}, },
}, },