projects/mes-test #132

Manually merged
gtz217 merged 281 commits from projects/mes-test into projects/mes 2023-11-30 09:11:34 +08:00
3 changed files with 134 additions and 37 deletions
Showing only changes of commit 44452f2e89 - Show all commits

View File

@ -12,8 +12,8 @@ ENV = 'development'
VUE_APP_TITLE = MES系统 VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://100.64.0.26: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.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.4.173:48080' # 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.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48080' # VUE_APP_BASE_API = 'http://192.168.1.49:48080'

View File

@ -18,32 +18,43 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row style="border: 1px solid #ccc; display: flex;"> <el-row style="border: 1px solid #ccc; display: flex">
<el-col :span="8"> <el-col :span="8">
<div class="select-list"> <div class="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px"> <div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">可分配设备</span> <span style="">可分配设备</span>
<span>1/24</span> <span>{{ selectedEquipments.length }}/{{ bomList.length }}</span>
</div> </div>
<el-checkbox-group v-model="selectedEquipments" class="sl__body"> <el-checkbox-group v-model="selectedEquipments" class="sl__body">
<el-checkbox <el-checkbox
v-for="n in 10" v-for="eq in bomList"
:key="n" :key="eq.id"
:label="'设备' + n" :label="`${eq.name} (${
@change="() => handleChange(n)" selectedMBom[currentEquipment].length +
selectedPBom[currentEquipment].length
} / 2)`"
@change="(e) => handleEquipmentChange(eq, e)"
class="sl__body-item"></el-checkbox> class="sl__body-item"></el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</el-col> </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="select-list">
<div class="sl__header" style="background: #f3f4fb; padding: 12px"> <div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">物料BOM</span> <span style="">物料BOM</span>
</div> </div>
<el-checkbox-group v-model="selectedMBom" class="sl__body"> <el-checkbox-group
v-model="selectedMBom[currentEquipment]"
class="sl__body">
<el-checkbox <el-checkbox
v-for="n in materialBomList" v-for="mb in materialsBomList"
:key="n" :key="mb.id"
:label="mb.name"
:disabled="mb.disabled || false"
@change="
(e) =>
handleMaterialBomChange(mb, materialsBomList.equipmentId, e)
"
class="sl__body-item"></el-checkbox> class="sl__body-item"></el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
@ -53,10 +64,17 @@
<div class="sl__header" style="background: #f3f4fb; padding: 12px"> <div class="sl__header" style="background: #f3f4fb; padding: 12px">
<span style="">参数BOM</span> <span style="">参数BOM</span>
</div> </div>
<el-checkbox-group v-model="selectedPBom" class="sl__body"> <el-checkbox-group
v-model="selectedPBom[currentEquipment]"
class="sl__body">
<el-checkbox <el-checkbox
v-for="n in paramBomList" v-for="vb in valuesBomList"
:key="n" :key="vb.id"
:label="vb.name"
:disabled="vb.disabled || false"
@change="
(e) => handleValueBomChange(vb, valuesBomList.equipmentId, e)
"
class="sl__body-item"></el-checkbox> class="sl__body-item"></el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
@ -69,16 +87,22 @@
export default { export default {
name: 'BomSelector', name: 'BomSelector',
components: {}, components: {},
props: {}, props: {
bomList: {
type: Array,
default: () => [],
},
},
data() { data() {
return { return {
searchText: '', searchText: '',
selectedEquipments: [], selectedEquipments: [],
selectedMBom: [], selectedMBom: { default: [] },
selectedPBom: [], selectedPBom: { default: [] },
selected: [], selected: [],
materialBomList: [], materialsBomList: [],
paramBomList: [], valuesBomList: [],
currentEquipment: 'default',
}; };
}, },
watch: { watch: {
@ -90,25 +114,73 @@ export default {
}, },
}, },
computed: {}, computed: {},
methods: { created() {},
handleChange(id) { mounted() {
this.materialBomList = []; // v-model
this.paramBomList = []; this.bomList.forEach((item) => {
this.selected.push({ this.$set(this.selectedMBom, item.id, []);
id: id, this.$set(this.selectedPBom, item.id, []);
}); });
}, },
handleBomChange(eqId, id, type) { methods: {
const record = this.selected.find((item) => item.id === eqId); handleEquipmentChange(eq, selected) {
if (record) { this.currentEquipment = eq.id;
record[type == 'param' ? 'paramBomId' : 'materialBomId'] = id; this.materialsBomList =
} else { // [
// {
// 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({ this.selected.push({
id: eqId, equipmentId: eq.id,
[type == 'param' ? 'paramBomId' : 'materialBomId']: 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;
});
},
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;
});
},
}, },
}; };
</script> </script>

View File

@ -68,7 +68,7 @@
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<!-- <CustomTransfer /> --> <!-- <CustomTransfer /> -->
<BomSelector /> <BomSelector :bom-list="bomList" />
</base-dialog> </base-dialog>
</section> </section>
</template> </template>
@ -90,6 +90,7 @@ export default {
return { return {
open: false, open: false,
eqList: [], eqList: [],
bomList: [],
finalList: [], finalList: [],
choosedEquipments: [], choosedEquipments: [],
searchBarFormConfig: [{ label: '工序下设备' }], searchBarFormConfig: [{ label: '工序下设备' }],
@ -111,6 +112,7 @@ export default {
watch: { watch: {
currentDet: { currentDet: {
handler(val) { handler(val) {
console.log('currentDet', val);
if (val != null) { if (val != null) {
this.getList(val); this.getList(val);
} else { } else {
@ -188,7 +190,14 @@ export default {
}); });
}, },
submitForm() {}, submitForm() {},
async getList({ detId, detName, detDesc, flowId, sectionName } = {}) { async getList({
detId,
detName,
detDesc,
flowId,
sectionName,
sectionId,
} = {}) {
console.log('get list', detId, detName, flowId); console.log('get list', detId, detName, flowId);
const { data, code } = await this.http( const { data, code } = await this.http(
'/extend/process-flow-det-equipment/page', '/extend/process-flow-det-equipment/page',
@ -202,6 +211,22 @@ export default {
this.list.splice(0); this.list.splice(0);
this.total = 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() { async handleAddEquipment() {
this.open = true; this.open = true;