Commit 420ec6fa authored by van.chen's avatar van.chen

提交一下

parent 3b77f4e0
<div class="searchItem" [ngClass]="{'inModal': inModal}">
<div class="item-label">{{label}}</div>
<div class="item-label"><span *ngIf="isMust" class="deleteFontColor">* </span>{{label}}</div>
<div class="item-input">
<nz-date-picker *ngIf="!readonly" [(ngModel)]="date" nzPlaceHolder="" [nzShowTime]="showTime" [nzStyle]="{'width': '100%'}" style="width: 100%" (ngModelChange)="onChange()"></nz-date-picker>
<span *ngIf="readonly">{{date | date: 'yyyy-MM-dd HH:mm:ss'}}</span>
......
......@@ -7,17 +7,18 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
export class SearchDateComponent implements OnInit {
@Input() label: any;
_value: any;
v: any;
date: any;
@Input()
get value(): any {
return this._value;
return this.v;
}
set value(_value: any) {
this.initDate(_value);
set value(v: any) {
this.initDate(v);
}
@Input() showTime: any = false;
@Input() inModal: any = false;
@Input() isMust: any = false;
@Input() readonly: any = false;
@Output() valueChange = new EventEmitter();
constructor() { }
......
<div class="searchItem" [ngClass]="{'inModal': inModal}">
<div class="item-label">{{label}}</div>
<div class="item-label"><span *ngIf="isMust" class="deleteFontColor">* </span>{{label}}</div>
<div class="item-input">
<input *ngIf="!readonly" nz-input [type]="type" [(ngModel)]="value" [maxlength]="maxlength" (ngModelChange)="onChange()">
<span *ngIf="readonly">{{value}}</span>
......
......@@ -12,6 +12,7 @@ export class SearchItemComponent implements OnInit {
@Input() inModal: any = false;
@Input() readonly: any = false;
@Input() maxlength: any = 200;
@Input() isMust: any = false;
@Output() valueChange = new EventEmitter();
constructor() {}
......
<div class="searchItem" [ngClass]="{'inModal': inModal}">
<div class="item-label">{{label}}</div>
<div class="item-label"><span *ngIf="isMust" class="deleteFontColor">* </span>{{label}}</div>
<div class="item-input">
<nz-select *ngIf="!readonly" [(ngModel)]="value" [nzNoAnimation]="true" style="width: 100%;" [nzMode]="nzMode" (ngModelChange)="onChange()">
<nz-option *ngFor="let one of data" [nzLabel]="one[optL]" [nzValue]="one[optV]"></nz-option>
......
......@@ -12,6 +12,7 @@ export class SearchSelectComponent implements OnInit {
@Input() optV: any = 'value';
@Input() nzMode: any = 'default';
@Input() inModal: any = false;
@Input() isMust: any = false;
@Input() readonly: any = false;
@Input() data: any = [];
@Output() valueChange = new EventEmitter();
......
......@@ -8,19 +8,12 @@
[nzData]="data"
[nzSize]="'middle'"
nzShowSizeChanger
[nzShowPagination]="true"
[nzLoading]="isLoading"
[nzFrontPagination]="false"
[nzTotal]="total"
[(nzPageIndex)]="page"
[(nzPageSize)]="rows"
(nzPageIndexChange)="searchData()"
(nzPageSizeChange)="searchData()">
[nzLoading]="isLoading">
<thead nz-thead>
<tr>
<th nz-th><span>{{'moduleNum' | translate}}</span></th>
<th nz-th><span>{{'wayName' | translate}}</span></th>
<th nz-th><span>{{'moduleName' | translate}}</span></th>
<th nz-th><span>{{'moduleAlias' | translate}}</span></th>
<th nz-th><span>{{'wayAlias' | translate}}</span></th>
<th nz-th><span>{{'per' | translate}}</span></th>
<th nz-th><span>{{'wayType' | translate}}</span></th>
<th nz-th><span>{{'max' | translate}}</span></th>
......@@ -35,18 +28,18 @@
</thead>
<tbody nz-tbody>
<tr *ngFor="let one of nzTable.data, let i = index">
<td nz-td>{{i + 1}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.loginTime}}</td>
<td nz-td>{{one.userName}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.loginTime}}</td>
<td nz-td>{{one.userName}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.loginTime}}</td>
<td nz-td>{{one.userName}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.loginTime}}</td>
<td nz-td>{{one.name}}</td>
<td nz-td>{{one.probesModelName}}</td>
<td nz-td>{{one.alias}}</td>
<td nz-td>{{one.unit}}</td>
<td nz-td>{{one.type}}</td>
<td nz-td>{{one.rangeMax}}</td>
<td nz-td>{{one.rangeMin}}</td>
<td nz-td>{{one.alarmUp}}</td>
<td nz-td>{{one.upperAlarmLimit}}</td>
<td nz-td>{{one.alarmDown}}</td>
<td nz-td>{{one.lowerAlarmLimit}}</td>
<td nz-td>{{one.isAlarm === 1 ? '是': '否'}}</td>
<td nz-td>
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider>
......@@ -56,3 +49,43 @@
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isV" [nzContent]="con1" nzWidth="750"
[nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false">
<ng-template #con1>
<div class="half">
<app-search-item isMust="true" inModal="true" [label]="'wayName' | translate" [(value)]="req.name"></app-search-item>
<app-search-item inModal="true" [label]="'per' | translate" [(value)]="req.unit"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'wayDescription' | translate" [(value)]="req.description"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'alarmMax' | translate" [(value)]="req.alarmUp"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'alarmMaxMax' | translate" [(value)]="req.upperAlarmLimit"></app-search-item>
<div class="searchItem inModal">
<div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div>
<div class="item-input">
<nz-radio-group [(ngModel)]="req.isAlarm">
<label nz-radio [nzValue]="1"></label>
<label nz-radio [nzValue]="0"></label>
</nz-radio-group>
</div>
</div>
</div>
<div class="half">
<app-search-item inModal="true" [label]="'wayAlias' | translate" [(value)]="req.alias"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'alarmMin' | translate" [(value)]="req.alarmDown"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'alarmMinMin' | translate" [(value)]="req.lowerAlarmLimit"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'alarmInterval' | translate" [(value)]="req.alarmInterval"></app-search-item>
</div>
<div class="searchItem inModal">
<div class="item-label" style="width: 149px;"><span class="deleteFontColor">* </span>{{'wayInfo' | translate}}</div>
<div class="item-input" style="width: calc(100% - 158px);">
<textarea nz-input [(ngModel)]="req.boxedart"></textarea>
</div>
</div>
</ng-template>
<ng-template #foot1>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
import { Component, OnInit } from '@angular/core';
import {ApiService} from '../../service/api';
import {NzMessageService} from 'ng-zorro-antd';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {TranslateService} from '@ngx-translate/core';
import {fadeIn} from '../../animation/fade-in';
import {Router} from '@angular/router';
import {ActivatedRoute, Router} from '@angular/router';
@Component({
selector: 'app-module-detail',
......@@ -16,64 +16,97 @@ export class ModuleDetailComponent implements OnInit {
req: any = {};
data = [];
isLoading = false;
page: any = 1;
rows: any = 10;
total: any;
probesModelNo = '';
isV = false;
isUpdate = false;
constructor(private api: ApiService, private message: NzMessageService,
private translate: TranslateService, private router: Router) {
constructor(private api: ApiService, private message: NzMessageService, private ac: ActivatedRoute,
private translate: TranslateService, private router: Router, private modalService: NzModalService) {
}
ngOnInit() {
this.getData();
this.init();
}
init() {
this.ac.queryParams.subscribe((params) => {
if (params.probesModelNo) {
this.probesModelNo = params.probesModelNo;
this.getData();
}
});
}
getData() {
this.isLoading = true;
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
this.api.probesModelInfo.getAll([{probesModelNo: this.probesModelNo}, this.next]);
}
onSearch() {
this.page = 1;
this.query();
}
query() {
this.isLoading = true;
const req = {
startTime: this.req.startTime ? new Date(this.req.startTime).getTime() : '',
endTime: this.req.endTime ? new Date(this.req.endTime).getTime() : ''
};
this.api.loginlog.getByTime(this.page, this.rows, [req, this.next]);
}
onGetAll() {
this.page = 1;
this.req = {};
this.getData();
}
next = (data) => {
if ( data && data.rows && data.rows.constructor === Array) {
this.data = data.rows;
this.total = data.total;
if (data && data.constructor === Array) {
this.data = data;
} else if (data && data.code === 1) {
this.message.success(data.message ? data.message : '操作成功');
this.isV = false;
this.getData();
} else if (data && data.code === 0) {
this.message.error(data.message ? data.message : '操作失败');
} else {
this.message.error(data.message || this.translate.instant('wrongToGetData'));
this.message.error(data && data.message ? data.message : '获取数据失败');
}
this.isLoading = false;
}
searchData() {
if (this.req.startTime || this.req.endTime) {
this.query();
add() {
this.req = {};
this.isUpdate = false;
this.isV = true;
}
update(one) {
this.isUpdate = true;
this.req = {...one};
this.req.oldName = one.name;
this.isV = true;
}
cancel() {
this.isV = false;
}
save() {
this.isLoading = true;
this.req.probesModelNo = this.probesModelNo;
if (this.isUpdate) {
this.api.probesModelInfo.updateProbesModelInfo([this.req, this.next]);
} else {
this.getData();
this.api.probesModelInfo.addProbesModelInfo([this.req, this.next]);
}
}
update(one) {}
deleteConfirm(one) {}
deleteConfirm(one) {
this.modalService.confirm({
nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
}
add() {}
delete(one) {
this.isLoading = true;
this.api.probesModelInfo.delProbesModelInfo([{probesModelNo: one.probesModelNo, name: one.name}, this.next]);
}
}
<div class="searchBar" @fade>
<app-search-item [label]="'moduleName' | translate" [(value)]="req.startTime"></app-search-item>
<app-search-item [label]="'moduleName' | translate" [(value)]="moduleName"></app-search-item>
<div class="btnLine">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="onSearch()"><span>{{'search' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span></button>
......@@ -11,14 +11,7 @@
[nzData]="data"
[nzSize]="'middle'"
nzShowSizeChanger
[nzShowPagination]="true"
[nzLoading]="isLoading"
[nzFrontPagination]="false"
[nzTotal]="total"
[(nzPageIndex)]="page"
[(nzPageSize)]="rows"
(nzPageIndexChange)="searchData()"
(nzPageSizeChange)="searchData()">
[nzLoading]="isLoading">
<thead nz-thead>
<tr>
<th nz-th><span>{{'num' | translate}}</span></th>
......@@ -31,9 +24,9 @@
<tbody nz-tbody>
<tr *ngFor="let one of nzTable.data, let i = index">
<td nz-td>{{i + 1}}</td>
<td nz-td class="canClick" (click)="toDetail()">{{one.userName}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.ipAddress}}</td>
<td nz-td class="canClick" (click)="toDetail(one.probesModelNo)">{{one.probesModelName}}</td>
<td nz-td>{{one.probesModelName}}</td>
<td nz-td>{{one.remark}}</td>
<td nz-td>
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider>
......@@ -46,13 +39,15 @@
</nz-table>
</div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500"
[nzFooter]="foot1" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
[nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
<ng-template #con1>
新增/编辑通道模板
<app-search-item inModal="true" isMust="true" [label]="'moduleName' | translate" [(value)]="req.probesModelName"></app-search-item>
<app-search-item *ngIf="!isUpdate" isMust="true" inModal="true" [label]="'wayNum' | translate" [(value)]="req.num"></app-search-item>
<app-search-item inModal="true" [label]="'remark' | translate" [(value)]="req.remark"></app-search-item>
</ng-template>
<ng-template #foot1>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isAddConV')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isAddConV')"><span>{{'confirm' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
......@@ -63,6 +58,6 @@
</ng-template>
<ng-template #foot2>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isSaveOther')"><span>{{'confirm' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
......@@ -16,66 +16,55 @@ export class ModuleMgrComponent implements OnInit {
req: any = {};
data = [];
isLoading = false;
page: any = 1;
rows: any = 10;
total: any;
isAddConV = false;
isSaveOther = false;
isUpdate = false;
moduleName = '';
constructor(private api: ApiService, private message: NzMessageService, private modalService: NzModalService,
private translate: TranslateService, private router: Router) {
}
ngOnInit() {
this.init();
}
init() {
this.getData();
}
getData() {
this.isLoading = true;
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
this.api.probesModel.getAll(['', this.next]);
}
onSearch() {
this.page = 1;
this.query();
}
query() {
this.isLoading = true;
const req = {
startTime: this.req.startTime ? new Date(this.req.startTime).getTime() : '',
endTime: this.req.endTime ? new Date(this.req.endTime).getTime() : ''
};
this.api.loginlog.getByTime(this.page, this.rows, [req, this.next]);
this.getData();
}
onGetAll() {
this.page = 1;
this.req = {};
this.moduleName = '';
this.getData();
}
next = (data) => {
if (data && data.rows && data.rows.constructor === Array) {
this.data = data.rows;
this.total = data.total;
if (data && data.constructor === Array) {
this.data = data.filter(one => one.probesModelName.indexOf(this.moduleName) > -1);
} else if (data && data.code === 1) {
this.message.success(data.message ? data.message : '操作成功');
this.isAddConV = false;
this.isSaveOther = false;
this.init();
} else if (data && data.code === 0) {
this.message.error(data.message ? data.message : '操作失败');
} else {
this.message.error(data.message || this.translate.instant('wrongToGetData'));
this.message.error(data && data.message ? data.message : '获取数据失败');
}
this.isLoading = false;
}
searchData() {
if (this.req.startTime || this.req.endTime) {
this.query();
} else {
this.getData();
}
}
toDetail() {
this.router.navigate(['/app/deviceCenter/moduleMgr/moduleDetail']);
toDetail(a) {
this.router.navigate(['/app/deviceCenter/moduleMgr/moduleDetail'], {queryParams: {probesModelNo: a}});
}
saveOther(one) {
......@@ -89,6 +78,7 @@ export class ModuleMgrComponent implements OnInit {
update(one) {
this.isUpdate = true;
this.req = {...one};
this.isAddConV = true;
}
......@@ -96,8 +86,13 @@ export class ModuleMgrComponent implements OnInit {
this[v] = false;
}
save(v) {
this[v] = false;
save() {
this.isLoading = true;
if (this.isUpdate) {
this.api.probesModel.updateProbesModel([this.req, this.next]);
} else {
this.api.probesModel.addProbesModel([this.req, this.next]);
}
}
deleteConfirm(one) {
......@@ -108,5 +103,8 @@ export class ModuleMgrComponent implements OnInit {
});
}
delete(one) {}
delete(one) {
this.isLoading = true;
this.api.probesModel.delProbesModel([{probesModelNo: one.probesModelNo}, this.next]);
}
}
<div class="tableBar" @fade>
<div class="btnLine" style="margin-bottom: 10px">
<label class="subTitle"> 123456 主题配置模板{{'detail' | translate}}</label>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="onSearch()"><span>{{'search' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span></button>
<button nz-button class="btnAdd" [nzLoading]="isLoading" (click)="add()"><span>{{'addTopic' | translate}}</span></button>
<app-back [isLoading]="isLoading"></app-back>
</div>
<nz-table #nzTable
[nzData]="data"
[nzSize]="'middle'"
nzShowSizeChanger
[nzShowPagination]="true"
[nzLoading]="isLoading"
[nzFrontPagination]="false"
[nzTotal]="total"
[(nzPageIndex)]="page"
[(nzPageSize)]="rows"
(nzPageIndexChange)="searchData()"
(nzPageSizeChange)="searchData()">
[nzLoading]="isLoading">
<thead nz-thead>
<tr>
<th nz-th><span>{{'num' | translate}}</span></th>
......@@ -29,10 +22,10 @@
<tbody nz-tbody>
<tr *ngFor="let one of nzTable.data, let i = index">
<td nz-td>{{i + 1}}</td>
<td nz-td>{{one.userName}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.loginTime}}</td>
<td nz-td>{{'webPlatform' | translate}}</td>
<td nz-td>{{one.topicName}}</td>
<td nz-td>{{one.topicType}}</td>
<td nz-td>{{one.dataType}}</td>
<td nz-td>{{one.dataInterval}}</td>
<td nz-td>
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider>
......@@ -42,3 +35,21 @@
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isV" [nzContent]="con1" nzWidth="500"
[nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false">
<ng-template #con1>
<app-search-item isMust="true" inModal="true" [label]="'topicName' | translate" [(value)]="req.topicName"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'topicType' | translate" [(value)]="req.topicType"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'dataType' | translate" [(value)]="req.dataType"></app-search-item>
<app-search-select isMust="true" inModal="true" [label]="'probesModel' | translate" [(value)]="req.probesModelNo"
[data]="probesModels" optL="probesModelName" optV="probesModelNo"></app-search-select>
<app-search-item isMust="true" inModal="true" [label]="'dataInterval' | translate" [(value)]="req.dataInterval"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'frequency' | translate" [(value)]="req.frequency"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'interval' | translate" [(value)]="req.interval"></app-search-item>
</ng-template>
<ng-template #foot1>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
import {Component, OnInit} from '@angular/core';
import {ApiService} from '../../service/api';
import {NzMessageService} from 'ng-zorro-antd';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {TranslateService} from '@ngx-translate/core';
import {fadeIn} from '../../animation/fade-in';
import {Router} from '@angular/router';
import {ActivatedRoute, Router} from '@angular/router';
@Component({
selector: 'app-topic-module-detail',
......@@ -16,62 +16,98 @@ export class TopicModuleDetailComponent implements OnInit {
req: any = {};
data = [];
isLoading = false;
page: any = 1;
rows: any = 10;
total: any;
topicModelNo = '';
isV = false;
isUpdate = false;
probesModels = [];
constructor(private api: ApiService, private message: NzMessageService,
private translate: TranslateService, private router: Router) {
constructor(private api: ApiService, private message: NzMessageService, private ac: ActivatedRoute,
private translate: TranslateService, private router: Router, private modalService: NzModalService) {
}
ngOnInit() {
this.getData();
this.init();
}
init() {
this.ac.queryParams.subscribe((params) => {
if (params.topicModelNo) {
this.topicModelNo = params.topicModelNo;
this.getData();
}
});
}
getData() {
this.isLoading = true;
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
this.api.topicModelInfo.getAll([{topicModelNo: this.topicModelNo}, this.next]);
}
onSearch() {
this.page = 1;
this.query();
}
query() {
this.isLoading = true;
const req = {
startTime: this.req.startTime ? new Date(this.req.startTime).getTime() : '',
endTime: this.req.endTime ? new Date(this.req.endTime).getTime() : ''
};
this.api.loginlog.getByTime(this.page, this.rows, [req, this.next]);
}
onGetAll() {
this.page = 1;
this.req = {};
this.getData();
}
next = (data) => {
if (data && data.rows && data.rows.constructor === Array) {
this.data = data.rows;
this.total = data.total;
if (data && data.constructor === Array) {
this.data = data;
} else if (data && data.code === 1) {
this.message.success(data.message ? data.message : '操作成功');
this.isV = false;
this.getData();
} else if (data && data.code === 0) {
this.message.error(data.message ? data.message : '操作失败');
} else {
this.message.error(data.message || this.translate.instant('wrongToGetData'));
this.message.error(data && data.message ? data.message : '获取数据失败');
}
this.isLoading = false;
};
}
searchData() {
if (this.req.startTime || this.req.endTime) {
this.query();
add() {
this.req = {};
this.isUpdate = false;
this.isV = true;
}
update(one) {
this.isUpdate = true;
this.req = {...one};
this.req.oldName = one.name;
this.isV = true;
}
cancel() {
this.isV = false;
}
save() {
this.isLoading = true;
this.req.topicModelNo = this.topicModelNo;
if (this.isUpdate) {
this.api.topicModelInfo.updateTopicModelInfo([this.req, this.next]);
} else {
this.getData();
this.api.topicModelInfo.addTopicModelInfo([this.req, this.next]);
}
}
update(one) {}
deleteConfirm(one) {
this.modalService.confirm({
nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
}
deleteConfirm(one) {}
delete(one) {
this.isLoading = true;
this.api.topicModelInfo.delTopicModelInfo([{topicModelNo: one.topicModelNo, name: one.name}, this.next]);
}
}
<div class="searchBar" @fade>
<app-search-item [label]="'topicModuleName' | translate" [(value)]="req.startTime"></app-search-item>
<app-search-item [label]="'topicModuleName' | translate" [(value)]="topicModuleName"></app-search-item>
<div class="btnLine">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="onSearch()"><span>{{'search' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span></button>
......@@ -11,14 +11,7 @@
[nzData]="data"
[nzSize]="'middle'"
nzShowSizeChanger
[nzShowPagination]="true"
[nzLoading]="isLoading"
[nzFrontPagination]="false"
[nzTotal]="total"
[(nzPageIndex)]="page"
[(nzPageSize)]="rows"
(nzPageIndexChange)="searchData()"
(nzPageSizeChange)="searchData()">
[nzLoading]="isLoading">
<thead nz-thead>
<tr>
<th nz-th><span>{{'num' | translate}}</span></th>
......@@ -33,11 +26,11 @@
<tbody nz-tbody>
<tr *ngFor="let one of nzTable.data, let i = index">
<td nz-td>{{i + 1}}</td>
<td nz-td class="canClick" (click)="toDetail()">{{one.userName}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.loginTime}}</td>
<td nz-td>{{'webPlatform' | translate}}</td>
<td nz-td>{{one.ipAddress}}</td>
<td nz-td class="canClick" (click)="toDetail(one.topicModelNo)">{{one.topicModelName}}</td>
<td nz-td>{{one.prefixName}}</td>
<td nz-td>{{one.companyName}}</td>
<td nz-td>{{one.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
<td nz-td>{{one.remark}}</td>
<td nz-td>
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider>
......@@ -49,10 +42,12 @@
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500"
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)"
[nzFooter]="foot1" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
<ng-template #con1>
新增/编辑主题模板
<app-search-item inModal="true" isMust="true" [label]="'topicModuleName' | translate" [(value)]="req.topicModelName"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'front' | translate" [(value)]="req.prefixName"></app-search-item>
<app-search-item inModal="true" [label]="'remark' | translate" [(value)]="req.remark"></app-search-item>
</ng-template>
<ng-template #foot1>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isAddConV')"><span>{{'cancel' | translate}}</span></button>
......
......@@ -16,66 +16,55 @@ export class TopicModuleMgrComponent implements OnInit {
req: any = {};
data = [];
isLoading = false;
page: any = 1;
rows: any = 10;
total: any;
isAddConV = false;
isUpdate = false;
isSaveOther = false;
isUpdate = false;
topicModuleName = '';
constructor(private api: ApiService, private message: NzMessageService, private modalService: NzModalService,
private translate: TranslateService, private router: Router) {
}
ngOnInit() {
this.init();
}
init() {
this.getData();
}
getData() {
this.isLoading = true;
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
this.api.topicModel.getAll(['', this.next]);
}
onSearch() {
this.page = 1;
this.query();
}
query() {
this.isLoading = true;
const req = {
startTime: this.req.startTime ? new Date(this.req.startTime).getTime() : '',
endTime: this.req.endTime ? new Date(this.req.endTime).getTime() : ''
};
this.api.loginlog.getByTime(this.page, this.rows, [req, this.next]);
this.getData();
}
onGetAll() {
this.page = 1;
this.req = {};
this.topicModuleName = '';
this.getData();
}
next = (data) => {
if (data && data.rows && data.rows.constructor === Array) {
this.data = data.rows;
this.total = data.total;
if (data && data.constructor === Array) {
this.data = data.filter(one => one.topicModelName.indexOf(this.topicModuleName) > -1);
} else if (data && data.code === 1) {
this.message.success(data.message ? data.message : '操作成功');
this.isAddConV = false;
this.isSaveOther = false;
this.init();
} else if (data && data.code === 0) {
this.message.error(data.message ? data.message : '操作失败');
} else {
this.message.error(data.message || this.translate.instant('wrongToGetData'));
this.message.error(data && data.message ? data.message : '获取数据失败');
}
this.isLoading = false;
}
searchData() {
if (this.req.startTime || this.req.endTime) {
this.query();
} else {
this.getData();
}
}
toDetail() {
this.router.navigate(['/app/deviceCenter/topicModuleMgr/topicModuleDetail']);
toDetail(a) {
this.router.navigate(['/app/deviceCenter/topicModuleMgr/topicModuleDetail'], {queryParams: {topicModelNo: a}});
}
saveOther(one) {
......@@ -84,11 +73,13 @@ export class TopicModuleMgrComponent implements OnInit {
add() {
this.isUpdate = false;
this.req = {};
this.isAddConV = true;
}
update(one) {
this.isUpdate = true;
this.req = {...one};
this.isAddConV = true;
}
......@@ -96,8 +87,14 @@ export class TopicModuleMgrComponent implements OnInit {
this[v] = false;
}
save(v) {
this[v] = false;
save() {
this.isLoading = true;
if (this.isUpdate) {
this.api.topicModel.updateTopic([this.req, this.next]);
} else {
this.req.addTopicModelForInfoVos = [];
this.api.topicModel.addTopicModel([this.req, this.next]);
}
}
deleteConfirm(one) {
......@@ -108,5 +105,8 @@ export class TopicModuleMgrComponent implements OnInit {
});
}
delete(one) {}
delete(one) {
this.isLoading = true;
this.api.topicModel.delTopicModel([{topicModelNo: one.topicModelNo}, this.next]);
}
}
......@@ -69,6 +69,35 @@ export class ApiService {
getAll: (data) => this.trans('get', '/system/province/getAll', data),
};
public probesModel = {
addProbesModel: (data) => this.trans('post', '/probesModel/addProbesModel', data),
delProbesModel: (data) => this.trans('post', '/probesModel/delProbesModel', data),
getAll: (data) => this.trans('get', '/probesModel/getAll', data),
updateProbesModel: (data) => this.trans('post', '/probesModel/updateProbesModel', data),
};
public probesModelInfo = {
addProbesModelInfo: (data) => this.trans('post', '/probesModelInfo/addProbesModelInfo', data),
delProbesModelInfo: (data) => this.trans('post', '/probesModelInfo/delProbesModelInfo', data),
getAll: (data) => this.trans('post', '/probesModelInfo/getAll', data),
updateProbesModelInfo: (data) => this.trans('post', '/probesModelInfo/updateProbesModelInfo', data),
};
public topicModelInfo = {
addTopicModelInfo: (data) => this.trans('post', '/topicModelInfo/addTopicModelInfo', data),
delTopicModelInfo: (data) => this.trans('post', '/topicModelInfo/delTopicModelInfo', data),
deployTopicModelInfo: (data) => this.trans('post', '/topicModelInfo/deployTopicModelInfo', data),
getAll: (data) => this.trans('post', '/topicModelInfo/getAll', data),
updateTopicModelInfo: (data) => this.trans('post', '/topicModelInfo/updateTopicModelInfo', data),
};
public topicModel = {
addTopicModel: (data) => this.trans('post', '/topicModel/addTopicModel', data),
delTopicModel: (data) => this.trans('post', '/topicModel/delTopicModel', data),
getAll: (data) => this.trans('get', '/topicModel/getAll', data),
updateTopic: (data) => this.trans('post', '/topicModel/updateTopic', data),
};
private trans(type, addr, data) {
this.sendHttpReq(type, addr, data[0], data[1], data[2], data[3]);
}
......
......@@ -120,5 +120,9 @@
"moduleAlias": "通道别名",
"isAlarm": "是否报警",
"saveOther": "另存为",
"addWay": "添加通道"
"addWay": "添加通道",
"alarmInterval": "报警时间间隔/ms",
"wayInfo": "通道报警信息模板",
"wayDescription": "通道描述",
"addTopic": "新增主题"
}
......@@ -4,8 +4,8 @@
export const environment = {
production: false,
baseUrl: 'http://172.16.1.52:8094', // 对外访问测试网地址
imgUrl: 'http://172.16.1.23' // 图片地址
baseUrl: 'http://172.16.1.53:8092', // 对外访问测试网地址
imgUrl: 'http://172.16.1.53:8092' // 图片地址
};
/*
......
......@@ -384,3 +384,9 @@ label.subTitle {
position: absolute;
left: 15px;
}
.half {
width: 50%;
display: inline-block;
vertical-align: top;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment