模具 打印调整
This commit is contained in:
parent
458ed1932e
commit
013531dfc8
|
|
@ -862,51 +862,36 @@ export default {
|
|||
tdata.qrcode = tdata.qr_code;
|
||||
|
||||
|
||||
let template = JSON.parse(JSON.stringify(settings.printTemplate));
|
||||
let addedHeight = 0;
|
||||
let template = JSON.parse(JSON.stringify(settings.printTemplate));
|
||||
|
||||
|
||||
let departments = [];
|
||||
let process_id_list = [];
|
||||
this.detailsData2.forEach(item => {
|
||||
if (item.department_detail && item.department_detail.name && !departments.filter(a => a.id == item.department_detail.id + "").length) {
|
||||
departments.push({
|
||||
id: item.department_detail.id + "",
|
||||
name: item.department_detail.name
|
||||
})
|
||||
if (item.process_id && !process_id_list.filter(a => a == item.process_id + "").length) {
|
||||
process_id_list.push(item.process_id)
|
||||
}
|
||||
})
|
||||
tdata.details2 = [];
|
||||
|
||||
departments.push({
|
||||
id: '委外布产',
|
||||
name: '【委外布产】'
|
||||
})
|
||||
process_id_list.forEach(process_id => {
|
||||
|
||||
departments.forEach((department, index) => {
|
||||
|
||||
let isCurrentWeiWai = department.id == '委外布产';
|
||||
let details2 = JSON.parse(JSON.stringify(this.detailsData2));
|
||||
let ds2 = [];
|
||||
|
||||
let component_line_list = [];
|
||||
|
||||
details2.forEach(item => {
|
||||
if (!component_line_list.filter(a => a == item.component_line).length) {
|
||||
component_line_list.push(item.component_line);
|
||||
if (item.process_id != process_id) {
|
||||
return;
|
||||
}
|
||||
if (item.department_detail && item.department_detail.name) {
|
||||
if ((item.department_detail.id + '') != (department.id + '')) {
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
if (item.component_detail && item.component_detail.name) {
|
||||
item.component_detail_name = item.component_detail.name;
|
||||
}
|
||||
if (item.department_detail && item.department_detail.name) {
|
||||
item.department_detail_name = item.department_detail.name;
|
||||
}
|
||||
|
||||
if (item.process_detail && item.process_detail.name) {
|
||||
item.process_detail_name = item.process_detail.name;
|
||||
|
|
@ -919,134 +904,16 @@ export default {
|
|||
item.send_time = this.getDateValueString(item.send_time);
|
||||
item.complete_time = this.getDateValueString(item.complete_time);
|
||||
item.progress = (item.progress || 0) + "%";
|
||||
ds2.push(item);
|
||||
|
||||
tdata.details2.push(item);
|
||||
});
|
||||
|
||||
let groups = []; //按部件进行分组
|
||||
component_line_list.forEach(component_line => {
|
||||
if (isCurrentWeiWai) {
|
||||
return;
|
||||
}
|
||||
let group = {};
|
||||
let d1 = [];
|
||||
let d2 = [];
|
||||
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.component_line == component_line) {
|
||||
d1.push(item);
|
||||
}
|
||||
})
|
||||
ds2.forEach(item => {
|
||||
if (item.component_line == component_line) {
|
||||
d2.push(item);
|
||||
}
|
||||
})
|
||||
group.d1 = d1;
|
||||
group.d2 = d2;
|
||||
if(d2.length){
|
||||
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 ele3 = JSON.parse(JSON.stringify(settings.printTemplateProgress));
|
||||
ele2.options.field = 'department_' + index;
|
||||
ele3.options.field = 'progress_' + index;
|
||||
let progress = 0;
|
||||
var dps = this.detailsData3.filter(a => a.id.toString() == department.id.toString());
|
||||
if (dps.length) {
|
||||
progress = dps[0].progress;
|
||||
}
|
||||
tdata['department_' + index] = department.name;
|
||||
tdata['progress_' + index] = progress + "%";
|
||||
|
||||
ele2.options.top += addedHeight;
|
||||
ele3.options.top += addedHeight;
|
||||
|
||||
template.panels[0].printElements.push(ele2)
|
||||
|
||||
if (!isCurrentWeiWai) {
|
||||
template.panels[0].printElements.push(ele3)
|
||||
}else{
|
||||
|
||||
console.log(groups)
|
||||
}
|
||||
|
||||
|
||||
groups.forEach((group, groupIndex) => {
|
||||
|
||||
let key1 = 'details1_' + index + "_" + groupIndex;
|
||||
let key2 = 'details2_' + index + "_" + groupIndex;
|
||||
tdata[key1] = group.d1;
|
||||
tdata[key2] = group.d2;
|
||||
|
||||
let elet1 = JSON.parse(JSON.stringify(settings.printTemplateTable1))
|
||||
let elet2 = JSON.parse(JSON.stringify(settings.printTemplateTable2))
|
||||
|
||||
elet1.options.field = key1;
|
||||
elet2.options.field = key2;
|
||||
|
||||
elet1.options.top += addedHeight;
|
||||
elet2.options.top += addedHeight;
|
||||
|
||||
template.panels[0].printElements.push(elet1)
|
||||
|
||||
addedHeight += 40;
|
||||
if (!isCurrentWeiWai) {
|
||||
template.panels[0].printElements.push(elet2)
|
||||
addedHeight += 40;
|
||||
}
|
||||
})
|
||||
|
||||
addedHeight += 20;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
hiprint.init(); // 初始化打印组件
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ // 创建打印模板
|
||||
template: template
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ export default {
|
|||
{ field: 'mold_order', formatter: 'formatRef', params: { dataType: "object", textField: "code" }, sortable: false, title: '订单编号', width: 120 },
|
||||
{ field: 'mold_detail', formatter: 'formatRef', params: { dataType: "object", textField: "name" }, sortable: false, title: '模具', width: 120 },
|
||||
{ slots: { content: 'column3' }, type: "expand", width: 100, title: '进度明细', showHeaderOverflow: true },
|
||||
{ field: 'progress', minWidth: 150, cellRender: { name: 'progress' }, sortable: true, title: '总进度', showHeaderOverflow: true },
|
||||
{ field: 'progress_order', minWidth: 150, cellRender: { name: 'progress' }, sortable: true, title: '总进度', showHeaderOverflow: true },
|
||||
// { slots: { default: 'column2' },width: 200, title: '进度明细', showHeaderOverflow: true },
|
||||
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, // 创建时间
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue