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.
128 lines
3.7 KiB
128 lines
3.7 KiB
5 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';
|
||
|
import { AutocommandeditComponent } from './autocommandedit/autocommandedit.component';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-wcs-autocommand',
|
||
|
templateUrl: './autocommand.component.html',
|
||
|
styleUrls: ['./autocommand.component.scss'],
|
||
|
queries: {
|
||
|
_template: new ViewChild('$crud'),
|
||
|
_stateColumn: new ViewChild('$state')
|
||
|
|
||
|
}
|
||
|
})
|
||
|
export class AutocommandComponent implements AfterViewInit {
|
||
|
|
||
|
private _template: CrudComponent;
|
||
|
private _defination: any;
|
||
|
private _stateColumn: TemplateRef<any>;
|
||
|
|
||
|
constructor(
|
||
|
private _dialogService: DialogService,
|
||
|
private _httpService: HttpService,
|
||
|
private _i18nService: I18nService,
|
||
|
private _toastService: ToastService
|
||
|
) { }
|
||
|
|
||
|
ngAfterViewInit(): void {
|
||
|
setTimeout(() => {
|
||
|
this._defination = [{
|
||
|
id: 'state',
|
||
|
template: this._stateColumn,
|
||
|
style: { width: '24px', paddingRight: '24px', lineHeight: 1, cursor: 'default' }
|
||
|
}, {
|
||
|
id: 'barcode',
|
||
|
header: 'routes.wcs.managetask.Barcode',
|
||
|
filter: { field: 'text' },//右侧查询时候 决定是否出现在查询项中
|
||
|
}, {
|
||
|
id: 'id',
|
||
|
header: 'routes.wcs.managetask.TaskCode',
|
||
|
}, {
|
||
|
id: 'taskKind',
|
||
|
header: 'routes.wcs.managetask.Taskkind',
|
||
|
}, {
|
||
|
id: 'controlTaskKind',
|
||
|
header: 'routes.wcs.managetask.ControlTaskKind',
|
||
|
},
|
||
|
{
|
||
|
id: 'startDevice',
|
||
|
header: 'routes.wcs.managetask.StartDevice',
|
||
|
filter: { field: 'text' },
|
||
|
}, {
|
||
|
id: 'startCell',
|
||
|
header: 'routes.wcs.managetask.StartCell',
|
||
|
}, {
|
||
|
id: 'endDevice',
|
||
|
header: 'routes.wcs.managetask.EndDevice',
|
||
|
}, {
|
||
|
id: 'endCell',
|
||
|
header: 'routes.wcs.managetask.EndCell',
|
||
|
}, {
|
||
|
id: 'taskStatus',
|
||
|
header: 'routes.wcs.managetask.TaskStatus',
|
||
|
}, {
|
||
|
id: 'fIntoStepOK',
|
||
|
header: 'routes.wcs.managetask.FIntoStepOK',
|
||
|
}, {
|
||
|
id: 'currentDevice',
|
||
|
header: 'routes.wcs.managetask.CurrentDevice',
|
||
|
}, {
|
||
|
id: 'errorInfo',
|
||
|
header: 'routes.wcs.managetask.ErrorInfo',
|
||
|
}, {
|
||
|
id: 'ftaskLevel',
|
||
|
header: 'routes.wcs.managetask.FtaskLevel',
|
||
|
}
|
||
|
// ,{
|
||
|
// id: 'statusCode',
|
||
|
// header: 'routes.wcs.managetask.TaskStatusCode',
|
||
|
// //filter: { field: 'text' },
|
||
|
// }
|
||
|
];
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
public get defination() {
|
||
|
return this._defination;
|
||
|
}
|
||
|
|
||
|
public convertor = (e: any) => {
|
||
|
e.items.forEach((item: any) => item.mode = item?.enabled != null ? 'force' : 'auto');
|
||
|
return e;
|
||
|
}
|
||
|
|
||
|
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 btnAutoTask(): Promise<void> {
|
||
|
|
||
|
// 下达自动任务,点击【下自动任务按钮】,弹出对话框
|
||
|
if (await this._dialogService.open(AutocommandeditComponent)) {
|
||
|
|
||
|
|
||
|
this._template.refresh();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|