diff --git a/.env.dev b/.env.dev index 5e7d20c9..72b44389 100644 --- a/.env.dev +++ b/.env.dev @@ -12,8 +12,8 @@ ENV = 'development' VUE_APP_TITLE = MES系统 # 芋道管理系统/开发环境 -VUE_APP_BASE_API = 'http://100.64.0.26:48082' -# VUE_APP_BASE_API = 'http://192.168.0.33:48082' +# VUE_APP_BASE_API = 'http://100.64.0.26:48082' +VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.4.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.1.49:48080' diff --git a/src/views/extend/processFlowView/components/BomSelector.vue b/src/views/extend/processFlowView/components/BomSelector.vue index 903a9154..4718abbc 100644 --- a/src/views/extend/processFlowView/components/BomSelector.vue +++ b/src/views/extend/processFlowView/components/BomSelector.vue @@ -18,32 +18,43 @@ - +
可分配设备 - 1/24 + {{ selectedEquipments.length }}/{{ bomList.length }}
- +
物料BOM
- +
@@ -53,10 +64,17 @@
参数BOM
- + @@ -69,16 +87,22 @@ export default { name: 'BomSelector', components: {}, - props: {}, + props: { + bomList: { + type: Array, + default: () => [], + }, + }, data() { return { searchText: '', selectedEquipments: [], - selectedMBom: [], - selectedPBom: [], + selectedMBom: { default: [] }, + selectedPBom: { default: [] }, selected: [], - materialBomList: [], - paramBomList: [], + materialsBomList: [], + valuesBomList: [], + currentEquipment: 'default', }; }, watch: { @@ -90,24 +114,72 @@ export default { }, }, computed: {}, + created() {}, + mounted() { + // 准备v-model + this.bomList.forEach((item) => { + this.$set(this.selectedMBom, item.id, []); + this.$set(this.selectedPBom, item.id, []); + }); + }, methods: { - handleChange(id) { - this.materialBomList = []; - this.paramBomList = []; - this.selected.push({ - id: id, + handleEquipmentChange(eq, selected) { + this.currentEquipment = eq.id; + this.materialsBomList = + // [ + // { + // id: 1, + // name: 'mb-1', + // }, + // { + // id: 2, + // name: 'mb-2', + // }, + // { + // id: 3, + // name: 'mb-3', + // }, + // ] || + eq.materialsBom || []; + this.valuesBomList = eq.valuesBom || []; + // 重新确保equipmentId已经被加载上去了 + this.materialsBomList.equipmentId = eq.id; + this.valuesBomList.equipmentId = eq.id; + + console.log('eq', selected, eq, this.selectedEquipments); + if (selected) { + this.selected.push({ + equipmentId: eq.id, + equValueBomId: null, + equMaterialBomId: null, + }); + } else { + // 清空选择状态 + this.selected = this.selected.filter( + (item) => item.equipmentId !== eq.id + ); + this.selectedMBom[eq.id] = []; + this.selectedPBom[eq.id] = []; + } + }, + handleValueBomChange(vb, equipmentId, selected) { + const selectedItem = this.selected.find( + (item) => item.equipmentId == equipmentId + ); + selectedItem.equValueBomId = selected ? vb.id : null; + this.valuesBomList.forEach((item) => { + item.disabled = selected ? item.id !== vb.id : false; }); }, - 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, - }); - } + handleMaterialBomChange(mb, equipmentId, selected) { + debugger; + const selectedItem = this.selected.find( + (item) => item.equipmentId == equipmentId + ); + selectedItem.equMaterialBomId = selected ? mb.id : null; + this.materialsBomList.forEach((item) => { + item.disabled = selected ? item.id !== mb.id : false; + }); }, }, }; diff --git a/src/views/extend/processFlowView/components/ProcessBomList.vue b/src/views/extend/processFlowView/components/ProcessBomList.vue index 1667dc7d..9ecdc8dd 100644 --- a/src/views/extend/processFlowView/components/ProcessBomList.vue +++ b/src/views/extend/processFlowView/components/ProcessBomList.vue @@ -68,7 +68,7 @@ @cancel="cancel" @confirm="submitForm"> - + @@ -90,6 +90,7 @@ export default { return { open: false, eqList: [], + bomList: [], finalList: [], choosedEquipments: [], searchBarFormConfig: [{ label: '工序下设备' }], @@ -111,6 +112,7 @@ export default { watch: { currentDet: { handler(val) { + console.log('currentDet', val); if (val != null) { this.getList(val); } else { @@ -188,7 +190,14 @@ export default { }); }, submitForm() {}, - async getList({ detId, detName, detDesc, flowId, sectionName } = {}) { + async getList({ + detId, + detName, + detDesc, + flowId, + sectionName, + sectionId, + } = {}) { console.log('get list', detId, detName, flowId); const { data, code } = await this.http( '/extend/process-flow-det-equipment/page', @@ -202,6 +211,22 @@ export default { this.list.splice(0); this.total = 0; } + + // 获取设备及bom列表 + this.http( + '/extend/process-flow-det/getEquipmentDetBySectionId?id=' + sectionId, + 'post' + ).then(({ code, data }) => { + if (code == 0) { + this.bomList = data.map(eq => { + if (eq.materialsBom) eq.materialsBom.equipmentId = eq.id + if (eq.valuesBom) eq.valuesBom.equipmentId = eq.id + return eq; + }); + } else { + this.bomList.splice(0); + } + }); }, async handleAddEquipment() { this.open = true;