模具 打印优化

This commit is contained in:
xielue 2023-09-19 19:15:43 +08:00
parent 62c177a286
commit e2274540b8
1 changed files with 60 additions and 20 deletions

View File

@ -859,15 +859,21 @@ export default {
} }
}) })
departments.push({
id: '委外布产',
name: '【委外布产】'
})
departments.forEach((department, index) => { departments.forEach((department, index) => {
let isCurrentWeiWai = department.id == '委外布产';
let details2 = JSON.parse(JSON.stringify(this.detailsData2)); let details2 = JSON.parse(JSON.stringify(this.detailsData2));
let ds2 = []; let ds2 = [];
let component_line_list = []; let component_line_list = [];
details2.forEach(item => { details2.forEach(item => {
if (item.component_detail && item.component_detail.name) { if (!component_line_list.filter(a => a == item.component_line).length) {
item.component_detail_name = item.component_detail.name; component_line_list.push(item.component_line);
} }
if (item.department_detail && item.department_detail.name) { if (item.department_detail && item.department_detail.name) {
if ((item.department_detail.id + '') != (department.id + '')) { if ((item.department_detail.id + '') != (department.id + '')) {
@ -875,12 +881,16 @@ export default {
} }
item.department_detail_name = item.department_detail.name; item.department_detail_name = item.department_detail.name;
} }
if (item.component_detail && item.component_detail.name) {
item.component_detail_name = item.component_detail.name;
}
if (!item.component_id) { if (!item.component_id) {
return; return;
} }
if (!component_line_list.filter(a => a == item.component_line).length) {
component_line_list.push(item.component_line);
}
if (item.process_detail && item.process_detail.name) { if (item.process_detail && item.process_detail.name) {
item.process_detail_name = item.process_detail.name; item.process_detail_name = item.process_detail.name;
} }
@ -897,13 +907,14 @@ export default {
let groups = []; // let groups = []; //
component_line_list.forEach(component_line => { component_line_list.forEach(component_line => {
if (isCurrentWeiWai) {
return;
}
let group = {}; let group = {};
let d1 = []; let d1 = [];
let d2 = []; let d2 = [];
let ds1 = JSON.parse(JSON.stringify(this.detailsData)); let ds1 = JSON.parse(JSON.stringify(this.detailsData));
ds1.forEach(item => { ds1.forEach(item => {
if (item.component_detail && item.component_detail.name) { if (item.component_detail && item.component_detail.name) {
item.component_detail_name = item.component_detail.name; item.component_detail_name = item.component_detail.name;
} }
@ -918,21 +929,44 @@ export default {
if (item.component_line == component_line) { if (item.component_line == component_line) {
d1.push(item); d1.push(item);
} }
}) })
ds2.forEach(item => { ds2.forEach(item => {
if (item.component_line == component_line) { if (item.component_line == component_line) {
d2.push(item); d2.push(item);
} }
}) })
group.d1 = d1; group.d1 = d1;
group.d2 = d2; group.d2 = d2;
groups.push(group); groups.push(group);
}) })
if (isCurrentWeiWai) {
let group = {};
let d1 = [];
let ds1 = JSON.parse(JSON.stringify(this.detailsData));
ds1.forEach(item => {
if (item.component_detail && item.component_detail.name) {
item.component_detail_name = item.component_detail.name;
}
if (item.process_detail && item.process_detail.name) {
item.process_detail_name = item.process_detail.name;
}
item.prepare_process_time = this.getDateValueString(item.prepare_process_time);
item.plan_complete_time = this.getDateValueString(item.plan_complete_time);
item.send_time = this.getDateValueString(item.send_time);
item.complete_time = this.getDateValueString(item.complete_time);
item.production_type = item.production_type == 1 ? '正常布产' : '委外布产';
if (item.production_type == '委外布产') {
d1.push(item);
}
})
group.d1 = d1;
group.d2 = [];
groups.push(group);
}
let ele2 = JSON.parse(JSON.stringify(settings.printTemplateDepartment)); let ele2 = JSON.parse(JSON.stringify(settings.printTemplateDepartment));
let ele3 = JSON.parse(JSON.stringify(settings.printTemplateProgress)); let ele3 = JSON.parse(JSON.stringify(settings.printTemplateProgress));
ele2.options.field = 'department_' + index; ele2.options.field = 'department_' + index;
@ -949,7 +983,13 @@ export default {
ele3.options.top += addedHeight; ele3.options.top += addedHeight;
template.panels[0].printElements.push(ele2) template.panels[0].printElements.push(ele2)
template.panels[0].printElements.push(ele3)
if (!isCurrentWeiWai) {
template.panels[0].printElements.push(ele3)
}else{
console.log(groups)
}
groups.forEach((group, groupIndex) => { groups.forEach((group, groupIndex) => {
@ -969,16 +1009,16 @@ export default {
elet2.options.top += addedHeight; elet2.options.top += addedHeight;
template.panels[0].printElements.push(elet1) template.panels[0].printElements.push(elet1)
template.panels[0].printElements.push(elet2)
addedHeight += 80; addedHeight += 40;
if (!isCurrentWeiWai) {
template.panels[0].printElements.push(elet2)
addedHeight += 40;
}
}) })
addedHeight += 20; addedHeight += 20;
}); });