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.
101 lines
4.1 KiB
101 lines
4.1 KiB
6 months ago
|
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-routestatus',
|
||
|
templateUrl: './routestatus.component.html',
|
||
|
styleUrls: ['./routestatus.component.scss'],
|
||
|
queries: {
|
||
|
_template: new ViewChild('$crud'),
|
||
|
_idEditor: new ViewChild('$id'),
|
||
|
_routeNameEditor: new ViewChild('$routeName'),
|
||
|
|
||
|
}
|
||
|
})
|
||
|
export class RoutestatusComponent implements AfterViewInit {
|
||
|
|
||
|
private _template: CrudComponent;
|
||
|
private _idEditor: TemplateRef<any>;
|
||
|
private _routeNameEditor: TemplateRef<any>;
|
||
|
private _defination: any;
|
||
|
|
||
|
constructor(
|
||
|
//private _dialogService: DialogService,
|
||
|
private _httpService: HttpService,
|
||
|
private _i18nService: I18nService,
|
||
|
private _toastService: ToastService
|
||
|
) { }
|
||
|
|
||
|
ngAfterViewInit(): void {
|
||
|
|
||
|
setTimeout(() => {
|
||
|
this._defination = [
|
||
|
{
|
||
|
id: 'id',
|
||
|
header: 'routes.wcs.routestatus.id',
|
||
|
filter: { order: 2, field: 'text' },
|
||
|
editor: { field: 'text', required: true, template: this._idEditor }
|
||
|
}, {
|
||
|
id: 'routeKind',
|
||
|
header: 'routes.wcs.routestatus.routeKind',
|
||
|
sortable: false
|
||
|
//filter: { order: 2, field: 'select' ,range:[{id:1,name:"入库"},{id:2,name:"出库"},{id:3,name:"移库"},{id:4,name:"站台间移库"}]}
|
||
|
}, {
|
||
|
id: 'routeName',
|
||
|
header: 'routes.wcs.routestatus.routeName',
|
||
|
editor: { field: 'text', required: true, template: this._routeNameEditor },
|
||
|
sortable: false
|
||
|
}, {
|
||
|
id: 'startDevice',
|
||
|
header: 'routes.wcs.routestatus.startDevice',
|
||
|
filter: { order: 4, field: 'text' },
|
||
|
sortable: false
|
||
|
}, {
|
||
|
id: 'endDevice',
|
||
|
header: 'routes.wcs.routestatus.endDevice',
|
||
|
filter: { order: 5, field: 'text' },
|
||
|
sortable: false
|
||
|
}, {
|
||
|
id: 'outsideAltDevice',
|
||
|
header: 'routes.wcs.routestatus.outsideAltDevice',
|
||
|
sortable: false
|
||
|
}, {
|
||
|
id: 'insideAltDevice',
|
||
|
header: 'routes.wcs.routestatus.insideAltDevice',
|
||
|
sortable: false
|
||
|
}, {
|
||
|
id: 'status',
|
||
|
header: 'routes.wcs.routestatus.status',
|
||
|
filter: { order: 1, field: 'select', range: [{ id: 0, name: "0-" + this._i18nService.translate('routes.wcs.routestatus.unusable') }, { id: 1, name: "1-" + this._i18nService.translate('routes.wcs.routestatus.usable') }] },
|
||
|
editor: { field: 'select', range: [{ id: 0, name: "0-" + this._i18nService.translate('routes.wcs.routestatus.unusable') }, { id: 1, name: "1-" + this._i18nService.translate('routes.wcs.routestatus.usable') }], required: true }
|
||
|
}
|
||
|
];
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|