You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

99 lines
3.5 KiB

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-stationstatus',
templateUrl: './stationstatus.component.html',
styleUrls: ['./stationstatus.component.scss'],
queries: {
_template: new ViewChild('$crud'),
_statusColumn: new ViewChild('$status'),
_stationType: new ViewChild('$stationType'),
_idEditor: new ViewChild('$id'),
_stationTypeEditor: new ViewChild('$stationType'),//用于和html关联
}
})
export class StationstatusComponent implements AfterViewInit {
private _template: CrudComponent;
private _defination: any;
private _statusColumn: TemplateRef<any>;
private _stationType: TemplateRef<any>;
private _idEditor: TemplateRef<any>;
private _stationTypeEditor: TemplateRef<any>;
constructor(
private _dialogService: DialogService,
private _httpService: HttpService,
private _i18nService: I18nService,
private _toastService: ToastService
) { }
async ngAfterViewInit(): Promise<void> {
const res: any = await this._httpService.join(
this._httpService.get('stationStatus/statuskind')
);
const statuskind: any = res[0];
this._defination = [
{
id: 'id',
header: 'routes.wcs.stationstatus.stationCode',
filter: { field: 'text'},
editor: { order: 1,field: 'text', required: true,template: this._idEditor }
}
//,{
// id: 'checkStation',
// header: 'routes.wcs.stationstatus.checkStation',
// filter: { field: 'text' },
// // editor: { field: 'text', required: false }
// }
, {
id: 'stationModel',
header: 'routes.wcs.stationstatus.stationModel',
filter: { field: 'text' },
// editor: { field: 'text', required: false }
}, {
id: 'wareHouse',
header: 'routes.wcs.stationstatus.wareHouse',
filter: { field: 'text'},
// editor: { field: 'text', required: false }
}
, {
id: 'stationType',
header: 'routes.wcs.stationstatus.stationType',
filter: { order: 2, field: 'select',range:statuskind.items },
editor: { template: this._stationTypeEditor },
sortable: false
}
// , {
// id: 'stationType',
// header: 'routes.wcs.stationstatus.stationType',
// editor: { order: 4,field: 'select',range: [{ id: 1, name: this._i18nService.translate('routes.wcs.stationstatus.in')}, { id: 2, name: this._i18nService.translate('routes.wcs.stationstatus.out')}], required: true },
// sortable: false
// }
];
}
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;
}
}
}