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.
 
 
 

110 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-systemsetting',
templateUrl: './systemsetting.component.html',
styleUrls: ['./systemsetting.component.scss'],
queries: {
_template: new ViewChild('$crud'),
_settingsColumn: new ViewChild('$settings'),
}
})
export class SystemsettingComponent 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: 'id',
header: 'routes.wcs.systemsetting.ParamID',//描述
filter: { field: 'text' },//右侧查询时候 决定是否出现在查询项中
// editor: { field: 'text', required: true }//编辑选项可用时 弹出编辑窗口 这个属性决定是否出现在编辑项中
}, {
id: 'paramName',
header: 'routes.wcs.systemsetting.ParamName',
filter: { field: 'text' },
editor: { field: 'text', required: true }
},{
id: 'paramCode',
header: 'routes.wcs.systemsetting.ParamCode',
filter: { field: 'text' },
editor: { field: 'text', required: true }
}, {
id: 'paramType',
header: 'routes.wcs.systemsetting.ParamType',
filter: { field: 'text' },
editor: { field: 'text', required: true }
}, {
id: 'paramValue',
header: 'routes.wcs.systemsetting.ParamValue',
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 delete(e?: any): Promise<void> {
if (await this._dialogService.confirm(this._i18nService.translate('shared.notification.confirm'))) {
const data: any = {
id: e.id,
// action: 900,
// kind: e.taskKind
};
const res = await this._httpService.post(`systemsetting/delete`, data).catch(async err => {
switch (err.status) {
case 422:
this._toastService.show(this._i18nService.translate('routes.wcs.managetask.SystemError'));
break;
default:
break;
}
}) !== undefined;
if (res) {
this._toastService.show(this._i18nService.translate('shared.notification.success'));
this._template.refresh();
}
}
}
public async update(e?: any): Promise<void> {
}
}