Zmodyfikuj pliki aplikacji Vue.js printer-posnet.ts oraz printer-posnet-card.vue, aby…
- User
Zmodyfikuj pliki aplikacji Vue.js printer-posnet.ts oraz printer-posnet-card.vue, aby były przystosowane do przesyłania danych do ASP.NET zgodnie z PrinterPosnetDto.cs.
/// PrinterPosnetDto.cs
public class PrinterPosnetDto : EntityDto { public string Name { get; set; }
codepublic string Model { get; set; } public string IpAddress { get; set; } public string Port { get; set; } public bool IsActive { get; set; } public int Target { get; set; } public int TenantId { get; set; } public long OrganizationUnitId { get; set; } public string OrganizationUnitName { get; set; }}
/// printer-posnet.ts
import { GenericEntity } from "@/views/commerce/common/named-item"; import PrinterPosnetStatus from "@/views/commerce/printers-posnet/printer-posnet-status"; import PrinterPosnetTarget from "@/views/commerce/printers-posnet/printer-posnet-target"; import type { SelectPanelOption } from "@/components/action-buttons/select-panel-option";
export default class PrinterPosnet extends GenericEntity implements SelectPanelOption { id: string; orgUnitId: number; name: string | null; target: PrinterPosnetTarget = PrinterPosnetTarget.instance.reception; status: PrinterPosnetStatus = PrinterPosnetStatus.empty(); ipAddress: string | null = null;
public static fromDto(dto: any): PrinterPosnet { const entity = new PrinterPosnet(); entity.readDto(dto); return entity; }
public static empty(): PrinterPosnet { const entity = new PrinterPosnet(); entity.id = ""; entity.orgUnitId = 0; entity.name = null; entity.ipAddress = null; return entity; }
protected readDto(dto: any) { super.readDto(dto); this.id = dto.id; this.orgUnitId = dto.orgUnitId; this.name = dto.name; this.target = PrinterPosnetTarget.getById(dto.target); this.status = dto.status ? PrinterPosnetStatus.fromDto(dto.status) : PrinterPosnetStatus.empty(); this.ipAddress = dto.ipAddress; this.model = dto.model; }
get displayName() { if (this.name) return
${this.name} (${this.id}); return this.id; }get dto(): any { return { id: this.id, orgUnitId: this.orgUnitId, name: this.name, target: this.target.id, status: this.status, ipAddress: this.ipAddress, model: this.model }; } }
/// printer-posnet-card.vue
code - Assistant