projects/mes-test #133
4
.env.dev
4
.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'
|
||||
|
@ -18,32 +18,43 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row style="border: 1px solid #ccc; display: flex;">
|
||||
<el-row style="border: 1px solid #ccc; display: flex">
|
||||
<el-col :span="8">
|
||||
<div class="select-list">
|
||||
<div class="sl__header" style="background: #f3f4fb; padding: 12px">
|
||||
<span style="">可分配设备</span>
|
||||
<span>1/24</span>
|
||||
<span>{{ selectedEquipments.length }}/{{ bomList.length }}</span>
|
||||
</div>
|
||||
<el-checkbox-group v-model="selectedEquipments" class="sl__body">
|
||||
<el-checkbox
|
||||
v-for="n in 10"
|
||||
:key="n"
|
||||
:label="'设备' + n"
|
||||
@change="() => handleChange(n)"
|
||||
v-for="eq in bomList"
|
||||
:key="eq.id"
|
||||
:label="`${eq.name} (${
|
||||
selectedMBom[currentEquipment].length +
|
||||
selectedPBom[currentEquipment].length
|
||||
} / 2)`"
|
||||
@change="(e) => handleEquipmentChange(eq, e)"
|
||||
class="sl__body-item"></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8" style="border-left: 1px solid #ccc;">
|
||||
<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="selectedMBom" class="sl__body">
|
||||
<el-checkbox-group
|
||||
v-model="selectedMBom[currentEquipment]"
|
||||
class="sl__body">
|
||||
<el-checkbox
|
||||
v-for="n in materialBomList"
|
||||
:key="n"
|
||||
v-for="mb in materialsBomList"
|
||||
:key="mb.id"
|
||||
:label="mb.name"
|
||||
:disabled="mb.disabled || false"
|
||||
@change="
|
||||
(e) =>
|
||||
handleMaterialBomChange(mb, materialsBomList.equipmentId, e)
|
||||
"
|
||||
class="sl__body-item"></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
@ -53,10 +64,17 @@
|
||||
<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-group
|
||||
v-model="selectedPBom[currentEquipment]"
|
||||
class="sl__body">
|
||||
<el-checkbox
|
||||
v-for="n in paramBomList"
|
||||
:key="n"
|
||||
v-for="vb in valuesBomList"
|
||||
:key="vb.id"
|
||||
:label="vb.name"
|
||||
:disabled="vb.disabled || false"
|
||||
@change="
|
||||
(e) => handleValueBomChange(vb, valuesBomList.equipmentId, e)
|
||||
"
|
||||
class="sl__body-item"></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
@ -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;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -68,7 +68,7 @@
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<!-- <CustomTransfer /> -->
|
||||
<BomSelector />
|
||||
<BomSelector :bom-list="bomList" />
|
||||
</base-dialog>
|
||||
</section>
|
||||
</template>
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user