dev #13574
This commit is contained in:
parent
9800f035f9
commit
cf846fa8ee
@ -91,6 +91,13 @@ export interface Terminals {
|
|||||||
id: string;
|
id: string;
|
||||||
public_id: string;
|
public_id: string;
|
||||||
}
|
}
|
||||||
|
export interface TerminalDetails extends Terminals {
|
||||||
|
socket_data: {
|
||||||
|
closed: boolean,
|
||||||
|
connected: boolean,
|
||||||
|
last_ping: string,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface Notification {
|
export interface Notification {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@ -38,7 +38,10 @@
|
|||||||
<td style="width: 16%">{{terminals.public_id}}</td>
|
<td style="width: 16%">{{terminals.public_id}}</td>
|
||||||
<td style="width: 16%">{{terminals.division_id}}</td>
|
<td style="width: 16%">{{terminals.division_id}}</td>
|
||||||
<td style="width: 16%">{{terminals.area_types}}</td>
|
<td style="width: 16%">{{terminals.area_types}}</td>
|
||||||
<td style="width: 16%"></td>
|
<td
|
||||||
|
style="width: 16%"
|
||||||
|
[ngClass]="{disconnected: terminals.connection_status == 'disconnected', connected: terminals.connection_status == 'connected'}"
|
||||||
|
>{{terminals.connection_status}}</td>
|
||||||
<td><button (click)="updateTerminal1(terminals.id, terminals.public_id, terminals.division_id, terminals.area_types)">Изменить</button></td>
|
<td><button (click)="updateTerminal1(terminals.id, terminals.public_id, terminals.division_id, terminals.area_types)">Изменить</button></td>
|
||||||
<td><button (click)="confirm(terminals.id)">Удалить</button></td>
|
<td><button (click)="confirm(terminals.id)">Удалить</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -91,6 +94,30 @@
|
|||||||
</th> -->
|
</th> -->
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr *ngIf="terminal">
|
||||||
|
<th>
|
||||||
|
Статус:
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
{{terminal.socket_data.connected ? 'Соединен' : 'Отключен'}}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Обновлено:
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
{{terminal?.socket_data?.last_ping | date:'dd.MM.yy, HH:mm:ss'}}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Закрыто:
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
{{terminal?.socket_data?.closed ? 'Да' : 'Нет'}}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-table>
|
</p-table>
|
||||||
<div *ngIf="create; else change">
|
<div *ngIf="create; else change">
|
||||||
|
|||||||
@ -12,6 +12,14 @@ tr {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disconnected {
|
||||||
|
background-color: rgb(255, 120, 120);;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connectede {
|
||||||
|
background-color: rgb(120, 255, 143);;
|
||||||
|
}
|
||||||
|
|
||||||
ul.selectedAreasList {
|
ul.selectedAreasList {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
||||||
import { MessageService } from "primeng/api";
|
import { MessageService } from "primeng/api";
|
||||||
import { Terminals, Areas, Divisions } from "src/app/interface/data";
|
import { Terminals, Areas, Divisions, TerminalDetails } from "src/app/interface/data";
|
||||||
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
||||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
||||||
|
import { StringMapWithRename } from "@angular/compiler/src/compiler_facade_interface";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -13,6 +14,7 @@ import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from
|
|||||||
})
|
})
|
||||||
export class TerminalsComponent implements OnInit {
|
export class TerminalsComponent implements OnInit {
|
||||||
public terminals: Terminals[] = [];
|
public terminals: Terminals[] = [];
|
||||||
|
public terminal?: TerminalDetails;
|
||||||
public new_ter = true;
|
public new_ter = true;
|
||||||
public choose = this.jsonRpcService.ClientChoose;
|
public choose = this.jsonRpcService.ClientChoose;
|
||||||
public create = false;
|
public create = false;
|
||||||
@ -94,6 +96,29 @@ export class TerminalsComponent implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getTerminal(id: string) {
|
||||||
|
await this.jsonRpcService.rpc2({
|
||||||
|
method: 'getTerminal',
|
||||||
|
params: {
|
||||||
|
"client_id": this.choose,
|
||||||
|
"id": id
|
||||||
|
}
|
||||||
|
}, RpcService.authService, false)
|
||||||
|
.subscribe({
|
||||||
|
next: (result) => {
|
||||||
|
let data = result.result;
|
||||||
|
this.terminal = data;
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
console.log('ERROR: ', err)
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Произошла ошибка!',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getAreas() {
|
getAreas() {
|
||||||
this.jsonRpcService.rpc2({
|
this.jsonRpcService.rpc2({
|
||||||
method: 'getAreas',
|
method: 'getAreas',
|
||||||
@ -141,6 +166,7 @@ export class TerminalsComponent implements OnInit {
|
|||||||
async updateTerminal1(id: any, public_id: any, division_id: any, area_types: any[]) {
|
async updateTerminal1(id: any, public_id: any, division_id: any, area_types: any[]) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.new_ter = false;
|
this.new_ter = false;
|
||||||
|
this.getTerminal(id);
|
||||||
setTimeout(() => document.getElementsByTagName("input")[0].value = public_id, 100);
|
setTimeout(() => document.getElementsByTagName("input")[0].value = public_id, 100);
|
||||||
setTimeout(() => document.getElementsByTagName("input")[1].value = division_id, 100);
|
setTimeout(() => document.getElementsByTagName("input")[1].value = division_id, 100);
|
||||||
this.jsonRpcService.changeId = id;
|
this.jsonRpcService.changeId = id;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
appSelfDeliveryEndPoint: 'http://selfdelivery-pitsburg.mydatahosting.ru/admin_api',
|
appSelfDeliveryEndPoint: 'http://selfdelivery-pitsburg.mydatahosting.ru/admin_api',
|
||||||
systemId: 'dfe16ca16a3598b812',
|
systemId: 'dfe16ca16a3598b812',
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user