update process equipment relation

This commit is contained in:
lb 2023-11-21 09:13:28 +08:00
vanhempi 20975948ef
commit 32a43fbc3b
2 muutettua tiedostoa jossa 40 lisäystä ja 27 poistoa

Näytä tiedosto

@ -121,6 +121,9 @@ export default {
},
},
methods: {
commit() {
this.$emit('update', this.selected);
},
handleEquipmentChange(eq, selected) {
this.currentEquipment = eq.id;
this.materialsBomList = eq.materialsBom;
@ -133,7 +136,7 @@ export default {
equValueBomId: null,
equMaterialBomId: null,
});
this.$emit('update', this.selected);
// this.$emit('update', this.selected);
} else {
//
this.selectedEquipments = this.selectedEquipments.filter(
@ -144,7 +147,7 @@ export default {
this.selected = this.selected.filter(
(item) => item.equipmentId !== eq.id
);
this.$emit('update', this.selected);
// this.$emit('update', this.selected);
}
},
@ -162,11 +165,11 @@ export default {
});
// ''
this.refreshKey = Math.random();
this.$emit('update', this.selected);
// this.$emit('update', this.selected);
return;
}
selectedItem && (selectedItem.equMaterialBomId = selected ? bomId : null);
this.$emit('update', this.selected);
// this.$emit('update', this.selected);
},
handleValueBomChange(equipmentId, bomId, selected) {
@ -182,11 +185,11 @@ export default {
equMaterialBomId: null,
});
this.refreshKey = Math.random();
this.$emit('update', this.selected);
// this.$emit('update', this.selected);
return;
}
selectedItem && (selectedItem.equValueBomId = selected ? bomId : null);
this.$emit('update', this.selected);
// this.$emit('update', this.selected);
},
},
};

Näytä tiedosto

@ -68,7 +68,12 @@
@cancel="cancel"
@confirm="submitForm">
<!-- <CustomTransfer /> -->
<BomSelector :bom-list="bomList" v-model="selectedBoms" />
<BomSelector
ref="bomSelector"
v-if="open"
:bom-list="bomList"
:value="selectedBoms"
@update="selectedBoms = $event" />
</base-dialog>
</section>
</template>
@ -146,27 +151,32 @@ export default {
data: method !== 'get' ? payload : null,
});
},
async submitForm() {
console.log('selectedBoms', this.selectedBoms);
if (this.selectedBoms.length) {
const { code, data } = await this.http(
'/extend/process-flow-det-equipment/createList',
'post',
this.selectedBoms.map((item) => ({
...item,
flowDetId: this.currentDet.detId,
}))
);
if (code == 0) {
this.$message.success('操作成功');
this.getList(this.currentDet);
this.cancel();
submitForm() {
//
this.$refs.bomSelector.commit();
//
this.$nextTick(async () => {
console.log('selectedBoms', this.selectedBoms);
if (this.selectedBoms.length) {
const { code, data } = await this.http(
'/extend/process-flow-det-equipment/createList',
'post',
this.selectedBoms.map((item) => ({
...item,
flowDetId: this.currentDet.detId,
}))
);
if (code == 0) {
this.$message.success('操作成功');
this.getList(this.currentDet);
this.cancel();
} else {
this.$message.error('操作失败');
}
} else {
this.$message.error('操作失败');
this.$message.info('请选择设备');
}
} else {
this.$message.info('请选择设备');
}
});
},
async getList({
detId,
@ -202,7 +212,7 @@ export default {
//
eq.materialsBom.chosen = eq.materialsBomChoseId ?? null;
eq.valuesBom.chosen = eq.valuesBomChoseId ?? null;
if (eq.materialsBom.chosen || eq.valuesBom.chosen) {
if (eq.equChose || eq.materialsBom.chosen || eq.valuesBom.chosen) {
this.selectedBoms.push({
equipmentId: eq.id,
equMaterialBomId: eq.materialsBom.chosen,