update process equipment relation

Esse commit está contido em:
lb 2023-11-21 09:13:28 +08:00
commit 32a43fbc3b
2 arquivos alterados com 40 adições e 27 exclusões

Ver arquivo

@ -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);
},
},
};

Ver arquivo

@ -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,