import { RhEsopNewService } from './../../../esop-new.service'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { DataResultT, RhSafeAny } from 'rh-base/model'; import { EsopDcoumentBindQueryDto, ESopDocumentOutDto } from '../../../../mdp-model'; import { MsgHelper } from 'rh-base/core'; @Component({ selector: 'rh-document-bind-items', templateUrl: './document-bind-items.component.html', styleUrls: ['./document-bind-items.component.css'] }) export class DocumentBindItemsComponent implements OnInit { selectedIndex = 0; /** 传入数据 */ @Input() rhSelectedDatas: RhSafeAny = []; /** 关闭上弹事件 */ @Output() rhClose = new EventEmitter(); dataMaterialResult: RhSafeAny = {}; dataBomResult: RhSafeAny = {}; dataProcessResult: RhSafeAny = {}; dataProcessRoutingEntryResult: RhSafeAny = {}; dataProcessInfoResult: RhSafeAny = {}; isModalShow = false; modelData: ESopDocumentOutDto = ESopDocumentOutDto.create(); panel = { Material: true, Bom: true, ProcessRouting: true, ProcessRoutingEntry: true, Process: true }; btnShowPanel = true; selectedDatas: ESopDocumentOutDto[] = []; constructor(private esopService: RhEsopNewService) {} ngOnInit(): void { this.getDatas(); } //TODO 换页未完成 getDatas() { this.isModalShow = false; const params: EsopDcoumentBindQueryDto = EsopDcoumentBindQueryDto.create(); params.DocumentInfoCode = this.rhSelectedDatas[0].DocumentInfoCode; params.DocumentInfoName = this.rhSelectedDatas[0].DocumentInfoName; this.esopService.GetDocumentBindItems(params).subscribe((result) => { this.dataMaterialResult = new DataResultT( result.Message, result.Success, result.Attach?.eSopMaterialDtos, result.Attach?.eSopMaterialDtos?.length as number, result.Record, result.SkipCount, result.httpRequestUrl, result.httpRequestPara ); this.dataBomResult = new DataResultT( result.Message, result.Success, result.Attach?.eSopBomDtos, result.Attach?.eSopBomDtos?.length as number, result.Record, result.SkipCount, result.httpRequestUrl, result.httpRequestPara ); this.dataProcessResult = new DataResultT( result.Message, result.Success, result.Attach?.eSopProcessRoutingDtos, result.Attach?.eSopProcessRoutingDtos?.length as number, result.Record, result.SkipCount, result.httpRequestUrl, result.httpRequestPara ); this.dataProcessRoutingEntryResult = new DataResultT( result.Message, result.Success, result.Attach?.eSopProcessRoutingEntryDtos, result.Attach?.eSopProcessRoutingEntryDtos?.length as number, result.Record, result.SkipCount, result.httpRequestUrl, result.httpRequestPara ); this.dataProcessInfoResult = new DataResultT( result.Message, result.Success, result.Attach?.eSopProcessDtos, result.Attach?.eSopProcessDtos?.length as number, result.Record, result.SkipCount, result.httpRequestUrl, result.httpRequestPara ); // this.dataResult = result; // if (result.Success) { // this.dataResult = result; // } else { // MsgHelper.ShowWarningMessage('查询失败' + result.Message); // } }); } refreshDatas() { // this.getDatas(); } /** * 替换 * @param event */ replaceSopBtnFun() { const arr = Object.values(this.modelData); const i = arr.find((f) => Array.isArray(f) && f.length > 0); if (i) { this.isModalShow = true; } else { MsgHelper.ShowErrorMessage('请先选择需要替换的文档的数据!'); } } selectedDatasChange(event: RhSafeAny, type: keyof ESopDocumentOutDto) { this.modelData[type] = event; // this.selectedDatas = event; } /** * 展开关闭 * @param bo */ closeOrOpen(bo: boolean) { this.btnShowPanel = bo; this.panel = { Material: bo, Bom: bo, ProcessRouting: bo, ProcessRoutingEntry: bo, Process: bo }; } }