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.
 
 
 

124 lines
4.3 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 { HandcommandeditComponent } from './handcommandedit/handcommandedit.component';
@Component({
selector: 'app-wcs-handcommand',
templateUrl: './handcommand.component.html',
styleUrls: ['./handcommand.component.scss'],
queries: {
_template: new ViewChild('$crud'),
_stateColumn: new ViewChild('$state')
}
})
export class HandcommandComponent implements AfterViewInit {
private _template: CrudComponent;
private _stateColumn: TemplateRef<any>;
private _defination: 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.monitortask.Barcode'
}, {
id: 'fid',
header: 'routes.wcs.monitortask.TaskCode'
}, {
id: 'taskKind',
header: 'routes.wcs.monitortask.TaskType'
}, {
id: 'id',
header: 'routes.wcs.monitortask.MonitorID'
}, {
id: 'deviceIndex',
header: 'routes.wcs.monitortask.DeviceCode',
filter: { field: 'text' }
}, {
id: 'deviceName',
header: 'routes.wcs.monitortask.DeviceName'
}, {
id: 'ordername',
header: 'routes.wcs.monitortask.OrderName'
}, {
id: 'deviceStatus',
header: 'routes.wcs.monitortask.StatusName'
}, {
id: 'aheadDetect',
header: 'routes.wcs.monitortask.NoRunCase'
}, {
id: 'startZ',
header: 'routes.wcs.monitortask.StartRollerZ'
}, {
id: 'startX',
header: 'routes.wcs.monitortask.StartRollerX'
}, {
id: 'startY',
header: 'routes.wcs.monitortask.StartRollerY'
}, {
id: 'endZ',
header: 'routes.wcs.monitortask.EndRollerZ'
}, {
id: 'endX',
header: 'routes.wcs.monitortask.EndRollerX'
}, {
id: 'endY',
header: 'routes.wcs.monitortask.EndRollerY'
}, {
id: 'startTime',
header: 'routes.wcs.monitortask.StartTime'
}
//,{
// id: 'status',//数据源还在 只是不显示了
// header: 'routes.wcs.monitortask.Status'
// }
];
});
};
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 422:
this._toastService.show(this._i18nService.translate('shared.notification.fail'));
return true;
default:
return true;
}
}
//按钮点击事件处理函数中打开一个对话框,并根据对话框的关闭结果来执行某些操作
public async btnHandTask(): Promise<void> {
if (await this._dialogService.open(HandcommandeditComponent)) {
this._template.refresh();
}
}
}