import { AfterViewInit, Component, TemplateRef, ViewChild } from '@angular/core'; import { DialogService } from '@app/core/services/dialog.service'; import { HttpService } from '@app/core/services/http.service'; import { I18nService } from '@app/core/services/i18n.service'; import { ToastService } from '@app/core/services/toast.service'; //import { CrudComponent } from '@app/routes/.templates/crud/crud.component'; @Component({ selector: 'app-wcs-historytaskquery', templateUrl: './historytaskquery.component.html', styleUrls: ['./historytaskquery.component.scss'], queries: { _template: new ViewChild('$crud'), _timeColumn: new ViewChild('$time'), } }) export class HistorytaskqueryComponent implements AfterViewInit { //private _template: CrudComponent; private _defination: any; private _timeColumn: TemplateRef; //private _taskkind: any[]; constructor( //private _dialogService: DialogService, private _httpService: HttpService, private _i18nService: I18nService, private _toastService: ToastService ) { } async ngAfterViewInit(): Promise { //查询多个 const res: any = await this._httpService.join( this._httpService.get('historytaskquery/taskkind'), this._httpService.get('historytaskquery/controlTaskKind') ); const taskkind: any = res[0]; const controlTaskKind: any = res[1]; // console.log(res[1].total) //const taskkind:any=await this._httpService.get('historytaskquery/taskkind'); this._defination = [ { id: 'barcode', header: 'routes.wcs.historytaskquery.barcode', filter: { field: 'text' },//右侧查询时候 决定是否出现在查询项中 //editor: { field: 'text', required: true }//编辑选项可用时 弹出编辑窗口 这个属性决定是否出现在编辑项中 }, { id: 'id', header: 'routes.wcs.historytaskquery.taskNo', filter: { field: 'text' }, }, { id: 'relativeControlid', header: 'routes.wcs.historytaskquery.relativeControlid', }, { id: 'taskKind', header: 'routes.wcs.historytaskquery.taskKind', filter: { order: 3, field: 'select', range: taskkind.items } }, { id: 'controlTaskKind', header: 'routes.wcs.historytaskquery.controlTaskKind', filter: { order: 4, field: 'select', range: controlTaskKind.items } }, { id: 'level', header: 'routes.wcs.historytaskquery.level' }, { id: 'startDevice', header: 'routes.wcs.historytaskquery.startDevice' }, { id: 'startCell', header: 'routes.wcs.historytaskquery.startCell' }, { id: 'endDevice', header: 'routes.wcs.historytaskquery.endDevice' }, { id: 'endCell', header: 'routes.wcs.historytaskquery.endCell' }, { id: 'taskStatus', header: 'routes.wcs.historytaskquery.taskStatus' }, { id: 'currentLocation', header: 'routes.wcs.historytaskquery.currentLocation' }, { id: 'startTime', header: 'routes.wcs.historytaskquery.startTime', template: this._timeColumn, filter: { order: 1, field: 'date-range' } }, { id: 'endTime', header: 'routes.wcs.historytaskquery.endTime', template: this._timeColumn, filter: { order: 2, field: 'date-range' } }, { id: 'errorMessage', header: 'routes.wcs.historytaskquery.errorMessage' }, { id: 'errorNo', header: 'routes.wcs.historytaskquery.errorNo' }, { id: 'workArea', header: 'routes.wcs.historytaskquery.workArea' }, { id: 'logicArea', header: 'routes.wcs.historytaskquery.logicArea' } ]; } public get defination() { return this._defination; } public error = (e: any) => { switch (e.status) { /* case 409: this._toastService.show(this._i18nService.translate(`routes.basic.user.error.conflict.${e.error}`)); return false; case 410: this._toastService.show(this._i18nService.translate(`routes.basic.user.error.gone.${e.error}`)); return true; */ case 422: this._toastService.show(this._i18nService.translate('shared.notification.fail')); return true; default: return true; } } }