排产管理问题修改

dev-scheduling
zhangdi 3 weeks ago
parent f841430ff3
commit ec5a6a9c17
  1. 56
      src/views/productionSchedulingPlan/basic/components/addEquipment.vue
  2. 138
      src/views/productionSchedulingPlan/basic/equipmentCapacity.vue

@ -79,13 +79,13 @@
</template>
</el-table-column>
<el-table-column align="center" label="设备型号" width="150">
<!-- <el-table-column align="center" label="设备型号" width="150">
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].equipNameType`">
{{ scope.row.equipNameType }}
</el-form-item>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column align="center" label="设备分类" width="150">
<template #header>
<span><i style="color: red">*</i>设备分类</span>
@ -112,6 +112,33 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="工序" width="150">
<template #header>
<span><i style="color: red">*</i>工序</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].processId`"
:rules="formRules.processId"
>
<el-select
v-model="scope.row.processId"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, scope.$index, 'processId')"
>
<el-option
v-for="item in processData"
:key="item.id"
:value="item.id"
:label="item.name"
></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="工艺能力" width="150">
<template #header>
<span><i style="color: red">*</i>工艺能力</span>
@ -303,6 +330,7 @@ import {
getCraftAbility,
addEquipAbility,
updateEquipAbility,
getProcessSet,
} from '@/api/productionSchedulingPlan/basic.js';
export default {
@ -366,6 +394,7 @@ export default {
prepareTime: [{ required: true, message: '请输入准备工时', trigger: ['change', 'submit'] }],
interval: [{ required: true, message: '请输入轮次间隔', trigger: ['change', 'submit'] }],
partType: [{ required: true, message: '请选择加工类型', trigger: ['change', 'submit'] }],
processId: [{ required: true, message: '请选择工序', trigger: ['change', 'submit'] }],
},
equipTypeData: [
{
@ -378,6 +407,8 @@ export default {
},
],
equipData: [],
craftData: [],
processData: [], //
};
},
mounted() {
@ -385,10 +416,12 @@ export default {
this.getWorkCenterList();
this.getEquipment();
this.getCraftAbility();
this.getProcessSet()
//
if (this.title == '新增') {
this.addTable();
} else {
console.log('rowData', this.rowData);
this.form.tableData = this.rowData;
}
this.calcTableHeight();
@ -457,18 +490,22 @@ export default {
this.craftData = res.data.data;
});
},
//
getProcessSet() {
getProcessSet().then(res => {
this.processData = res.data.data;
});
},
//
getEquipment() {
getEquipment().then(res => {
this.equipData = res.data.data;
console.log(res.data.data, 'data');
});
},
//
calcTableHeight() {
this.$nextTick(() => {
const container = document.querySelector('.el-dialog__body');
console.log(container.offsetHeight);
this.tableHeight = container.offsetHeight - 36 - 90 - 30;
});
},
@ -480,7 +517,6 @@ export default {
},
//
onChangeData(value, index, type) {
console.log(value, index, type);
if (type == 'workCenterId') {
// this.form.workCenterName = val.wcCode;
const selectedItem = this.wcData.find(item => item.id === value);
@ -507,6 +543,14 @@ export default {
this.form.tableData[index].craftName = '';
}
}
if (type == 'processId') {
const selectedItem = this.processData.find(item => item.id === value);
if (selectedItem) {
this.form.tableData[index].processName = selectedItem.name;
} else {
this.form.tableData[index].processName = '';
}
}
},
onPartTypeChange(index) {
const row = this.form.tableData[index];
@ -637,7 +681,6 @@ export default {
this.$message.success('提交成功');
this.closeDialog();
this.$emit('submitSuccess', submitData);
done();
},
error => {
this.subLoading = false;
@ -651,7 +694,6 @@ export default {
this.closeDialog();
this.$emit('submitSuccess', submitData);
this.subLoading = false;
done();
},
error => {
window.console.log(error);

@ -128,8 +128,8 @@ export default {
search: true,
sortable: true,
span: 12,
hide: true,
display: false,
width: 120,
},
{
label: '设备名称',
@ -149,15 +149,15 @@ export default {
width: 120,
disabled: true,
},
{
label: '设备型号',
prop: 'equipNameType',
search: false,
sortable: true,
span: 12,
width: 120,
disabled: true,
},
// {
// label: '',
// prop: 'equipNameType',
// search: false,
// sortable: true,
// span: 12,
// width: 120,
// disabled: true,
// },
{
label: '设备分类',
@ -185,15 +185,23 @@ export default {
},
],
},
{
label: '工序',
prop: 'processName',
search: false,
sortable: true,
span: 12,
display: false,
width: 120,
},
{
label: '工艺能力',
prop: 'craftName',
search: false,
sortable: true,
span: 12,
hide: true,
display: false,
width: 120,
},
{
label: '额定加工能力(烧结-件/热表-dm²)',
@ -289,23 +297,96 @@ export default {
title: '新增',
rowData: [], //
spanArr: [
{
prop: 'workCenterName',
span: [],
},
{
prop: 'equipName',
span: [],
},
{
prop: 'equipCode',
span: [],
},
],
{ prop: 'workCenterName', span: [] },
{ prop: 'equipName', span: [] },
{ prop: 'equipCode', span: [] },
{ prop: 'equipType', span: [] },
], // {workCenterName: [], equipName: [], equipCode: []}
};
},
methods: {
//
calculateSpan(arr) {
if (!arr || arr.length === 0) {
this.spanArr = [
{ prop: 'workCenterName', span: [] },
{ prop: 'equipName', span: [] },
{ prop: 'equipCode', span: [] },
{ prop: 'equipType', span: [] },
];
return;
}
const workCenterSpan = [];
const equipNameSpan = [];
const equipCodeSpan = [];
const equipType = [];
let currentIndex = 0;
while (currentIndex < arr.length) {
const currentItem = arr[currentIndex];
// + +
const matchCondition = item =>
item.workCenterName === currentItem.workCenterName &&
item.equipName === currentItem.equipName &&
item.equipCode === currentItem.equipCode&&
item.equipType === currentItem.equipType;
//
let span = 1;
for (let i = currentIndex + 1; i < arr.length; i++) {
if (matchCondition(arr[i])) {
span++;
} else {
break;
}
}
// 0
workCenterSpan[currentIndex] = span;
equipNameSpan[currentIndex] = span;
equipCodeSpan[currentIndex] = span;
equipType[currentIndex] = span;
for (let i = currentIndex + 1; i < currentIndex + span; i++) {
workCenterSpan[i] = 0;
equipNameSpan[i] = 0;
equipCodeSpan[i] = 0;
equipType[i] = 0;
}
currentIndex += span;
}
this.spanArr = [
{ prop: 'workCenterName', span: workCenterSpan },
{ prop: 'equipName', span: equipNameSpan },
{ prop: 'equipCode', span: equipCodeSpan },
{prop: 'equipType', span: equipType}
];
},
// AVUE-CRUD
spanMethod({ row, column, rowIndex, columnIndex }) {
//
const defaultReturn = { rowspan: 1, colspan: 1 };
for (let i = 0; i < this.spanArr.length; i++) {
const ele = this.spanArr[i];
if (column.property == ele.prop) {
console.log(8989, column, ele);
const _row = ele.span[rowIndex];
// span 0
if (_row === undefined || _row === 0) {
return { rowspan: 0, colspan: 0 };
}
return {
rowspan: _row,
colspan: 1,
};
}
}
//
return defaultReturn;
},
handleAdd() {
this.addShow = true;
this.moldAddMore = true;
@ -429,7 +510,12 @@ export default {
if (item.partType != 0) {
item.abilityList = JSON.parse(item.standardProcessAbility);
}
if (item.craftId !== undefined && item.craftId !== null) {
item.craftId = item.craftId + '';
}
});
//
this.calculateSpan(this.data);
}
);
},

Loading…
Cancel
Save