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.

81 lines
2.6 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';
import { RequestWmseditComponent } from './requestWmsedit/requestWmsedit.component';
@Component({
selector: 'app-wcs-reuquestWms',
templateUrl: './reuquestWms.component.html',
styleUrls: ['./reuquestWms.component.scss'],
queries: {
_template: new ViewChild('$crud'),
_settingsColumn: new ViewChild('$settings'),
}
})
export class ReuquestWmsComponent implements AfterViewInit {
private _template: CrudComponent;
private _defination: any;
private _settingsColumn: TemplateRef<any>;
//private _taskkind: any[];
constructor(
private _dialogService: DialogService,
private _httpService: HttpService,
private _i18nService: I18nService,
private _toastService: ToastService
) { }
async ngAfterViewInit(): Promise<void> {
this._defination = [
{
id: 'deviceName',
header: 'routes.wcs.reuquestWms.deviceName',
filter: { field: 'text' },
editor: { field: 'text', required: true }
}, {
id: 'id',
header: 'routes.wcs.reuquestWms.requestStation',//描述
filter: { field: 'text' },//右侧查询时候 决定是否出现在查询项中
// editor: { field: 'text', required: true }//编辑选项可用时 弹出编辑窗口 这个属性决定是否出现在编辑项中
}, {
id: 'bindDevice',
header: 'routes.wcs.reuquestWms.bindingDevice',
filter: { field: 'text' },
editor: { field: 'text', 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;
}
}
public async btnrequest(id: number): Promise<void> {
if (await this._dialogService.open(RequestWmseditComponent,{ data: id })) {
this._template.refresh();
}
}
}