Commit 95ab2f6f authored by van.chen's avatar van.chen

111

parent 0f9101e3
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
(nzPageSizeChange)="pageChange()"> (nzPageSizeChange)="pageChange()">
<thead nz-thead> <thead nz-thead>
<tr> <tr>
<!--<th--> <th
<!--nzShowCheckbox--> nzShowCheckbox
<!--[(nzChecked)]="isAllCheck"--> [(nzChecked)]="isAllCheck"
<!--[nzDisabled]="data.length===0"--> [nzDisabled]="data.length===0"
<!--[nzIndeterminate]="isIndeterminate"--> [nzIndeterminate]="isIndeterminate"
<!--(nzCheckedChange)="checkAll($event)"--> (nzCheckedChange)="checkAll($event)"
<!--&gt;</th>--> ></th>
<th nz-th><span>{{'gatewayName' | translate}}</span></th> <th nz-th><span>{{'gatewayName' | translate}}</span></th>
<th nz-th><span>{{'gatewaySN' | translate}}</span></th> <th nz-th><span>{{'gatewaySN' | translate}}</span></th>
<th nz-th><span>{{'type' | translate}}</span></th> <th nz-th><span>{{'type' | translate}}</span></th>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</thead> </thead>
<tbody nz-tbody> <tbody nz-tbody>
<tr *ngFor="let one of nzTable.data,let i = index"> <tr *ngFor="let one of nzTable.data,let i = index">
<!--<td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>--> <td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>
<td nz-td class="canClick" (click)="toSee(one)">{{one.name}}</td> <td nz-td class="canClick" (click)="toSee(one)">{{one.name}}</td>
<td nz-td>{{one.sn}}</td> <td nz-td>{{one.sn}}</td>
<td nz-td>{{one.type}}</td> <td nz-td>{{one.type}}</td>
...@@ -75,23 +75,25 @@ ...@@ -75,23 +75,25 @@
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
<!--<div class="btnLine whenOneLine" style="text-align: left; margin-top: -48px;">--> <div class="btnLine whenOneLine" style="text-align: left; margin-top: -48px;">
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDelete()">--> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDelete()">
<!--<span>{{'delete' | translate}}</span></button>--> <span>{{'delete' | translate}}</span></button>
<!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()"><span>{{'bind' | translate}}</span>--> <button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()">
<!--</button>--> <span>{{'bind' | translate}}</span>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">--> </button>
<!--<span>{{'unbind' | translate}}</span></button>--> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">
<!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDivide()"><span>{{'divide' | translate}}</span>--> <span>{{'unbind' | translate}}</span></button>
<!--</button>--> <button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDivide()">
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">--> <span>{{'divide' | translate}}</span>
<!--<span>{{'update' | translate}}</span></button>--> </button>
<!--</div>--> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">
<!--<div class="pagePart whenOneLine">--> <span>{{'update' | translate}}</span></button>
<!--<nz-pagination [nzPageIndex]="page" [nzTotal]="total" [nzPageSize]="rows"--> </div>
<!--[nzShowTotal]="totalTemplate"></nz-pagination>--> <div class="pagePart whenOneLine">
<!--<ng-template #totalTemplate> 共 {{ total }} 项</ng-template>--> <nz-pagination [nzPageIndex]="page" [nzTotal]="total" [nzPageSize]="rows"
<!--</div>--> [nzShowTotal]="totalTemplate"></nz-pagination>
<ng-template #totalTemplate> 共 {{ total }} 项</ng-template>
</div>
</div> </div>
<nz-modal [(nzVisible)]="isAddConV" [nzTitle]="isUpdate ? ('updateGateway' | translate) : ('addGateway' | translate)" <nz-modal [(nzVisible)]="isAddConV" [nzTitle]="isUpdate ? ('updateGateway' | translate) : ('addGateway' | translate)"
[nzContent]="con1" nzWidth="500" [nzContent]="con1" nzWidth="500"
......
...@@ -205,7 +205,10 @@ export class GatewayComponent implements OnInit { ...@@ -205,7 +205,10 @@ export class GatewayComponent implements OnInit {
this.isMulti = false; this.isMulti = false;
this.isUpdate = false; this.isUpdate = false;
this.isAddConV = true; this.isAddConV = true;
this.try = {field: ['name', 'sn', 'companyNo']}; this.try = {
trans: {name: 'gatewayName', sn: 'gatewaySN', companyNo: 'selectCompany'},
field: ['name', 'sn', 'companyNo']
};
} }
bind(one) { bind(one) {
...@@ -217,7 +220,10 @@ export class GatewayComponent implements OnInit { ...@@ -217,7 +220,10 @@ export class GatewayComponent implements OnInit {
influxdbDatabaseNo: '', influxdbDatabaseNo: '',
pDeviceNo: '' pDeviceNo: ''
}; };
this.try = {field: ['address', 'deviceNo']}; this.try = {
trans: {address: 'bindTongxinAddr'},
field: ['address', 'deviceNo']
};
this.isBindConV = true; this.isBindConV = true;
} }
...@@ -238,7 +244,10 @@ export class GatewayComponent implements OnInit { ...@@ -238,7 +244,10 @@ export class GatewayComponent implements OnInit {
this.isMulti = false; this.isMulti = false;
this.req = {...one}; this.req = {...one};
this.companySelected(one.companyNo); this.companySelected(one.companyNo);
this.try = {field: ['name', 'sn', 'companyNo', 'deviceNo']}; this.try = {
trans: {name: 'gatewayName', sn: 'gatewaySN', companyNo: 'selectCompany'},
field: ['name', 'sn', 'companyNo', 'deviceNo']
};
this.isUpdate = true; this.isUpdate = true;
this.isAddConV = true; this.isAddConV = true;
} }
...@@ -246,7 +255,7 @@ export class GatewayComponent implements OnInit { ...@@ -246,7 +255,7 @@ export class GatewayComponent implements OnInit {
divide(one) { divide(one) {
this.isMulti = false; this.isMulti = false;
this.req4 = {...one}; this.req4 = {...one};
this.try = {field: ['companyNo', 'deviceNo']}; this.try = {trans: {companyNo: 'selectCompany'}, field: ['companyNo', 'deviceNo']};
this.isDivideConV = true; this.isDivideConV = true;
} }
......
<div class="tableBar" @fade> <div class="tableBar" @fade>
<div class="btnLine" style="margin-bottom: 10px"> <div class="btnLine" style="margin-bottom: 10px">
<label class="subTitle"> {{probesModelName}} 通道模板{{'detail' | translate}}</label> <label class="subTitle"> {{probesModelName}} 通道模板{{'detail' | translate}}</label>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="add()"><span>{{'addWay' | translate}}</span></button> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="add()"><span>{{'addWay' | translate}}</span>
</button>
<app-back [isLoading]="isLoading"></app-back> <app-back [isLoading]="isLoading"></app-back>
</div> </div>
<nz-table #nzTable <nz-table #nzTable
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
<td nz-td>{{one.upperAlarmLimit}}</td> <td nz-td>{{one.upperAlarmLimit}}</td>
<td nz-td>{{one.alarmDown}}</td> <td nz-td>{{one.alarmDown}}</td>
<td nz-td>{{one.lowerAlarmLimit}}</td> <td nz-td>{{one.lowerAlarmLimit}}</td>
<td nz-td>{{one.isAlarm === 1 ? '是': '否'}}</td> <td nz-td>{{one.isAlarm === 1 ? '是' : '否'}}</td>
<td nz-td> <td nz-td>
<span class="editSpan" (click)="update(one)">{{'update' | translate}}</span> <span class="editSpan" (click)="update(one)">{{'update' | translate}}</span>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
...@@ -50,15 +51,14 @@ ...@@ -50,15 +51,14 @@
</nz-table> </nz-table>
</div> </div>
<nz-modal [(nzVisible)]="isV" [nzContent]="con1" nzWidth="750" <nz-modal [(nzVisible)]="isV" [nzContent]="con1" nzWidth="750"
[nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false"> [nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()"
nzMaskClosable="false">
<ng-template #con1> <ng-template #con1>
<div class="half"> <div class="half">
<app-search-item nz-tooltip nzTitle="此处输入为英文" isMust="true" inModal="true" [label]="'wayName' | translate" [(value)]="req.name"></app-search-item> <app-search-item nz-tooltip nzTitle="此处输入为英文或数字" isMust="true" inModal="true" [label]="'wayName' | translate"
<app-search-item isMust="true" inModal="true" [label]="'per' | translate" [(value)]="req.unit"></app-search-item> [(value)]="req.name"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'wayDescription' | translate" [(value)]="req.description"></app-search-item> <app-search-select isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"
<app-search-item inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item> [data]="[{a: 'AI'}, {a: 'AO'}, {a: 'DI'}, {a: 'DO'}]" optL="a" optV="a"></app-search-select>
<app-search-item inModal="true" [label]="'alarmMax' | translate" [(value)]="req.alarmUp"></app-search-item>
<app-search-item inModal="true" [label]="'alarmMaxMax' | translate" [(value)]="req.upperAlarmLimit"></app-search-item>
<div class="searchItem inModal"> <div class="searchItem inModal">
<div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div> <div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div>
<div class="item-input"> <div class="item-input">
...@@ -68,14 +68,28 @@ ...@@ -68,14 +68,28 @@
</nz-radio-group> </nz-radio-group>
</div> </div>
</div> </div>
<app-search-item inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item>
<app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMax' | translate"
[(value)]="req.alarmUp"></app-search-item>
<app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMaxMax' | translate"
[(value)]="req.upperAlarmLimit"></app-search-item>
<app-search-item *ngIf="req.isAlarm && req.type !== 'DI' && req.type !== 'DO'" inModal="true" [label]="'alarmInterval' | translate"
[(value)]="req.alarmInterval"></app-search-item>
</div> </div>
<div class="half"> <div class="half">
<app-search-item isMust="true" nz-tooltip nzTitle="此处输入为英文" inModal="true" [label]="'wayAlias' | translate" [(value)]="req.alias"></app-search-item> <app-search-item isMust="true" nz-tooltip nzTitle="此处输入为英文或数字" inModal="true" [label]="'wayAlias' | translate"
<app-search-item isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"></app-search-item> [(value)]="req.alias"></app-search-item>
<app-search-item *ngIf="req.type !== 'DI' && req.type !== 'DO'" isMust="true" 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 inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item> <app-search-item inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item>
<app-search-item inModal="true" [label]="'alarmMin' | translate" [(value)]="req.alarmDown"></app-search-item> <app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMin' | translate"
<app-search-item inModal="true" [label]="'alarmMinMin' | translate" [(value)]="req.lowerAlarmLimit"></app-search-item> [(value)]="req.alarmDown"></app-search-item>
<app-search-item inModal="true" [label]="'alarmInterval' | translate" [(value)]="req.alarmInterval"></app-search-item> <app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMinMin' | translate"
[(value)]="req.lowerAlarmLimit"></app-search-item>
<app-search-item *ngIf="req.isAlarm && (req.type === 'DI' || req.type === 'DO')" inModal="true" [label]="'alarmInterval' | translate"
[(value)]="req.alarmInterval"></app-search-item>
</div> </div>
<div class="searchItem inModal"> <div class="searchItem inModal">
<div class="item-label" style="width: 149px;">{{'wayInfo' | translate}}</div> <div class="item-label" style="width: 149px;">{{'wayInfo' | translate}}</div>
...@@ -85,7 +99,9 @@ ...@@ -85,7 +99,9 @@
</div> </div>
</ng-template> </ng-template>
<ng-template #foot1> <ng-template #foot1>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"><span>{{'cancel' | translate}}</span></button> <button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel()"><span>{{'cancel' | translate}}</span>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span></button> </button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save()"><span>{{'confirm' | translate}}</span>
</button>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
...@@ -80,7 +80,11 @@ export class ModuleDetailComponent implements OnInit { ...@@ -80,7 +80,11 @@ export class ModuleDetailComponent implements OnInit {
this.isUpdate = false; this.isUpdate = false;
this.isV = true; this.isV = true;
this.try = { this.try = {
field: ['probesModelNo', 'name', 'alias', 'description', 'type', 'unit', 'isAlarm'], trans: {name: 'wayName', alias: 'wayAlias', description: 'wayDescription', type: 'per', isAlarm: 'isAlarm',
alarmUp: 'alarmMax', upperAlarmLimit: 'alarmMaxMax', rangeMax: 'max', alarmDown: 'alarmMin',
lowerAlarmLimit: 'alarmMinMin', alarmInterval: 'alarmInterval', rangeMin: 'min'},
field: ['probesModelNo', 'name', 'alias', 'description', 'type', 'isAlarm'],
num: ['alarmUp', 'upperAlarmLimit', 'rangeMax', 'alarmDown', 'lowerAlarmLimit', 'alarmInterval', 'rangeMin'],
eng: ['name', 'alias'] eng: ['name', 'alias']
}; };
} }
...@@ -91,7 +95,11 @@ export class ModuleDetailComponent implements OnInit { ...@@ -91,7 +95,11 @@ export class ModuleDetailComponent implements OnInit {
this.req.oldName = one.name; this.req.oldName = one.name;
this.isV = true; this.isV = true;
this.try = { this.try = {
field: ['probesModelNo', 'name', 'alias', 'description', 'type', 'unit', 'isAlarm'], trans: {name: 'wayName', alias: 'wayAlias', description: 'wayDescription', type: 'per', isAlarm: 'isAlarm',
alarmUp: 'alarmMax', upperAlarmLimit: 'alarmMaxMax', rangeMax: 'max', alarmDown: 'alarmMin',
lowerAlarmLimit: 'alarmMinMin', alarmInterval: 'alarmInterval', rangeMin: 'min'},
field: ['probesModelNo', 'name', 'alias', 'description', 'type', 'isAlarm'],
num: ['alarmUp', 'upperAlarmLimit', 'rangeMax', 'alarmDown', 'lowerAlarmLimit', 'alarmInterval', 'rangeMin'],
eng: ['name', 'alias'] eng: ['name', 'alias']
}; };
} }
...@@ -103,6 +111,11 @@ export class ModuleDetailComponent implements OnInit { ...@@ -103,6 +111,11 @@ export class ModuleDetailComponent implements OnInit {
save() { save() {
this.isLoading = true; this.isLoading = true;
this.req.probesModelNo = this.probesModelNo; this.req.probesModelNo = this.probesModelNo;
if (this.req.type !== 'DI' && this.req.type !== 'DO' && !this.req.unit) {
this.message.warning('单位为必填项');
this.isLoading = false;
return false;
}
if (!this.ck.formCheck(this.req, this.try)) { if (!this.ck.formCheck(this.req, this.try)) {
this.isLoading = false; this.isLoading = false;
return false; return false;
......
...@@ -92,21 +92,21 @@ export class ModuleMgrComponent implements OnInit { ...@@ -92,21 +92,21 @@ export class ModuleMgrComponent implements OnInit {
newProbesModelName: '', newProbesModelName: '',
probesModelNo: one.probesModelNo probesModelNo: one.probesModelNo
}; };
this.try = {field: ['newProbesModelName', 'probesModelNo']}; this.try = {trans: {newProbesModelName: 'moduleName'}, field: ['newProbesModelName', 'probesModelNo']};
} }
add() { add() {
this.req = {}; this.req = {};
this.isUpdate = false; this.isUpdate = false;
this.isAddConV = true; this.isAddConV = true;
this.try = {field: ['probesModelName', 'num']}; this.try = {trans: {probesModelName: 'moduleName', num: 'wayNum'}, field: ['probesModelName', 'num']};
} }
update(one) { update(one) {
this.isUpdate = true; this.isUpdate = true;
this.req = {...one}; this.req = {...one};
this.isAddConV = true; this.isAddConV = true;
this.try = {field: ['probesModelNo', 'probesModelName']}; this.try = {trans: {probesModelName: 'moduleName'}, field: ['probesModelNo', 'probesModelName']};
} }
cancel(v) { cancel(v) {
......
...@@ -153,7 +153,7 @@ export class SensorDetailComponent implements OnInit { ...@@ -153,7 +153,7 @@ export class SensorDetailComponent implements OnInit {
this.req5 = { this.req5 = {
deviceNo: this.deviceNo deviceNo: this.deviceNo
}; };
this.try = {field: []}; this.try = {trans: {topicModelNo: 'topicModel'}, field: ['topicModelNo']};
} }
add() { add() {
...@@ -163,6 +163,8 @@ export class SensorDetailComponent implements OnInit { ...@@ -163,6 +163,8 @@ export class SensorDetailComponent implements OnInit {
this.req.frequency = 0; this.req.frequency = 0;
this.isUC = true; this.isUC = true;
this.try = { this.try = {
trans: {dataType: 'dataType', frequency: 'frequency', interval: 'interval',
topicName: 'topicName', topicType: 'topicType', dataInterval: 'dataSaveInTime'},
field: ['dataType', 'deviceNo', 'frequency', 'interval', 'topicName', 'topicType'], field: ['dataType', 'deviceNo', 'frequency', 'interval', 'topicName', 'topicType'],
num: ['interval', 'dataInterval'] num: ['interval', 'dataInterval']
}; };
...@@ -175,6 +177,8 @@ export class SensorDetailComponent implements OnInit { ...@@ -175,6 +177,8 @@ export class SensorDetailComponent implements OnInit {
this.req.oldTopicName = one.topicName; this.req.oldTopicName = one.topicName;
this.isUC = true; this.isUC = true;
this.try = { this.try = {
trans: {dataType: 'dataType', frequency: 'frequency', interval: 'interval',
topicName: 'topicName', topicType: 'topicType', dataInterval: 'dataSaveInTime'},
field: ['dataType', 'deviceNo', 'frequency', 'interval', 'topicName', 'topicType', 'oldTopicName'], field: ['dataType', 'deviceNo', 'frequency', 'interval', 'topicName', 'topicType', 'oldTopicName'],
num: ['interval', 'dataInterval'] num: ['interval', 'dataInterval']
}; };
...@@ -264,6 +268,8 @@ export class SensorDetailComponent implements OnInit { ...@@ -264,6 +268,8 @@ export class SensorDetailComponent implements OnInit {
deviceNo: this.deviceNo, deviceNo: this.deviceNo,
newTopicModelName: '' newTopicModelName: ''
}; };
this.try = {field: ['companyNo', 'deviceNo', 'newTopicModelName']}; this.try = {
trans: {companyNo: 'selectCompany', newTopicModelName: 'moduleName'},
field: ['companyNo', 'deviceNo', 'newTopicModelName']};
} }
} }
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<span>{{'search' | translate}}</span></button> <span>{{'search' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span> <button nz-button class="btnAll" [nzLoading]="isLoading" (click)="onGetAll()"><span>{{'allData' | translate}}</span>
</button> </button>
<!--<button nz-button class="btnAdd" [nzLoading]="isLoading" (click)="multiAdd()">--> <button nz-button class="btnAdd" [nzLoading]="isLoading" (click)="multiAdd()">
<!--<span>{{'multiAdd' | translate}}</span></button>--> <span>{{'multiAdd' | translate}}</span></button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="add()"> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="add()">
<span>{{'addSensor' | translate}}</span></button> <span>{{'addSensor' | translate}}</span></button>
</div> </div>
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
(nzPageSizeChange)="pageChange()"> (nzPageSizeChange)="pageChange()">
<thead nz-thead> <thead nz-thead>
<tr> <tr>
<!--<th--> <th
<!--nzShowCheckbox--> nzShowCheckbox
<!--[(nzChecked)]="isAllCheck"--> [(nzChecked)]="isAllCheck"
<!--[nzDisabled]="data.length===0"--> [nzDisabled]="data.length===0"
<!--[nzIndeterminate]="isIndeterminate"--> [nzIndeterminate]="isIndeterminate"
<!--(nzCheckedChange)="checkAll($event)"--> (nzCheckedChange)="checkAll($event)"
<!--&gt;</th>--> ></th>
<th nz-th><span>{{'sensorName' | translate}}</span></th> <th nz-th><span>{{'sensorName' | translate}}</span></th>
<th nz-th><span>{{'sensorSN' | translate}}</span></th> <th nz-th><span>{{'sensorSN' | translate}}</span></th>
<th nz-th><span>{{'frontName' | translate}}</span></th> <th nz-th><span>{{'frontName' | translate}}</span></th>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</thead> </thead>
<tbody nz-tbody> <tbody nz-tbody>
<tr *ngFor="let one of nzTable.data,let i = index"> <tr *ngFor="let one of nzTable.data,let i = index">
<!--<td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>--> <td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>
<td nz-td class="canClick" (click)="toSee(one)">{{one.name}}</td> <td nz-td class="canClick" (click)="toSee(one)">{{one.name}}</td>
<td nz-td>{{one.sn}}</td> <td nz-td>{{one.sn}}</td>
<td nz-td>{{one.prefixName}}</td> <td nz-td>{{one.prefixName}}</td>
...@@ -72,23 +72,23 @@ ...@@ -72,23 +72,23 @@
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
<!--<div class="btnLine whenOneLine" style="text-align: left; margin-top: -48px;">--> <div class="btnLine whenOneLine" style="text-align: left; margin-top: -48px;">
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDelete()">--> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDelete()">
<!--<span>{{'delete' | translate}}</span></button>--> <span>{{'delete' | translate}}</span></button>
<!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()"><span>{{'bind' | translate}}</span>--> <button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()"><span>{{'bind' | translate}}</span>
<!--</button>--> </button>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">--> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">
<!--<span>{{'unbind' | translate}}</span></button>--> <span>{{'unbind' | translate}}</span></button>
<!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDivide()"><span>{{'divide' | translate}}</span>--> <button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDivide()"><span>{{'divide' | translate}}</span>
<!--</button>--> </button>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">--> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">
<!--<span>{{'update' | translate}}</span></button>--> <span>{{'update' | translate}}</span></button>
<!--</div>--> </div>
<!--<div class="pagePart whenOneLine">--> <div class="pagePart whenOneLine">
<!--<nz-pagination [nzPageIndex]="page" [nzTotal]="total" [nzPageSize]="rows"--> <nz-pagination [nzPageIndex]="page" [nzTotal]="total" [nzPageSize]="rows"
<!--[nzShowTotal]="totalTemplate"></nz-pagination>--> [nzShowTotal]="totalTemplate"></nz-pagination>
<!--<ng-template #totalTemplate> 共 {{ total }} 项</ng-template>--> <ng-template #totalTemplate> 共 {{ total }} 项</ng-template>
<!--</div>--> </div>
</div> </div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500" [nzTitle]="isUpdate ? ('updateSensor' | translate) : ('addSensor' | translate)" <nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500" [nzTitle]="isUpdate ? ('updateSensor' | translate) : ('addSensor' | translate)"
......
...@@ -231,7 +231,9 @@ export class SensorMgrComponent implements OnInit { ...@@ -231,7 +231,9 @@ export class SensorMgrComponent implements OnInit {
this.isMulti = false; this.isMulti = false;
this.isAddConV = true; this.isAddConV = true;
this.isUpdate = false; this.isUpdate = false;
this.try = {field: ['name', 'sn', 'type', 'companyNo']}; this.try = {
trans: {name: 'sensorName', sn: 'sensorSN', type: 'type', companyNo: 'selectCompany'},
field: ['name', 'sn', 'type', 'companyNo']};
} }
bind(one) { bind(one) {
...@@ -244,7 +246,9 @@ export class SensorMgrComponent implements OnInit { ...@@ -244,7 +246,9 @@ export class SensorMgrComponent implements OnInit {
pDeviceNo: '' pDeviceNo: ''
}; };
this.isBindConV = true; this.isBindConV = true;
this.try = {field: ['address', 'deviceNo']}; this.try = {
trans: {address: 'belongAddress'},
field: ['address', 'deviceNo']};
} }
unbind(one) { unbind(one) {
...@@ -263,7 +267,9 @@ export class SensorMgrComponent implements OnInit { ...@@ -263,7 +267,9 @@ export class SensorMgrComponent implements OnInit {
divide(one) { divide(one) {
this.isMulti = false; this.isMulti = false;
this.req5 = {...one}; this.req5 = {...one};
this.try = {field: ['companyNo', 'deviceNo']}; this.try = {
trans: {companyNo: 'selectCompany'},
field: ['companyNo', 'deviceNo']};
this.isDivideConV = true; this.isDivideConV = true;
} }
...@@ -273,7 +279,9 @@ export class SensorMgrComponent implements OnInit { ...@@ -273,7 +279,9 @@ export class SensorMgrComponent implements OnInit {
this.companySelected(one.companyNo); this.companySelected(one.companyNo);
this.isUpdate = true; this.isUpdate = true;
this.isAddConV = true; this.isAddConV = true;
this.try = {field: ['name', 'sn', 'type', 'companyNo', 'deviceNo']}; this.try = {
trans: {name: 'sensorName', sn: 'sensorSN', type: 'type', companyNo: 'selectCompany'},
field: ['name', 'sn', 'type', 'companyNo', 'deviceNo']};
} }
cancel(v) { cancel(v) {
......
...@@ -53,12 +53,10 @@ ...@@ -53,12 +53,10 @@
[nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false"> [nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false">
<ng-template #con1> <ng-template #con1>
<div class="half"> <div class="half">
<app-search-item nz-tooltip nzTitle="此处输入为英文" isMust="true" inModal="true" [label]="'wayName' | translate" [(value)]="req.name"></app-search-item> <app-search-item nz-tooltip nzTitle="此处输入为英文或数字" isMust="true" inModal="true" [label]="'wayName' | translate"
<app-search-item isMust="true" inModal="true" [label]="'per' | translate" [(value)]="req.unit"></app-search-item> [(value)]="req.name"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'wayDescription' | translate" [(value)]="req.description"></app-search-item> <app-search-select isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"
<app-search-item inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item> [data]="[{a: 'AI'}, {a: 'AO'}, {a: 'DI'}, {a: 'DO'}]" optL="a" optV="a"></app-search-select>
<app-search-item inModal="true" [label]="'alarmMax' | translate" [(value)]="req.alarmUp"></app-search-item>
<app-search-item inModal="true" [label]="'alarmMaxMax' | translate" [(value)]="req.upperAlarmLimit"></app-search-item>
<div class="searchItem inModal"> <div class="searchItem inModal">
<div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div> <div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div>
<div class="item-input"> <div class="item-input">
...@@ -68,14 +66,28 @@ ...@@ -68,14 +66,28 @@
</nz-radio-group> </nz-radio-group>
</div> </div>
</div> </div>
<app-search-item inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item>
<app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMax' | translate"
[(value)]="req.alarmUp"></app-search-item>
<app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMaxMax' | translate"
[(value)]="req.upperAlarmLimit"></app-search-item>
<app-search-item *ngIf="req.isAlarm && req.type !== 'DI' && req.type !== 'DO'" inModal="true" [label]="'alarmInterval' | translate"
[(value)]="req.alarmInterval"></app-search-item>
</div> </div>
<div class="half"> <div class="half">
<app-search-item nz-tooltip nzTitle="此处输入为英文" isMust="true" inModal="true" [label]="'wayAlias' | translate" [(value)]="req.alias"></app-search-item> <app-search-item isMust="true" nz-tooltip nzTitle="此处输入为英文或数字" inModal="true" [label]="'wayAlias' | translate"
<app-search-item isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"></app-search-item> [(value)]="req.alias"></app-search-item>
<app-search-item *ngIf="req.type !== 'DI' && req.type !== 'DO'" isMust="true" 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 inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item> <app-search-item inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item>
<app-search-item inModal="true" [label]="'alarmMin' | translate" [(value)]="req.alarmDown"></app-search-item> <app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMin' | translate"
<app-search-item inModal="true" [label]="'alarmMinMin' | translate" [(value)]="req.lowerAlarmLimit"></app-search-item> [(value)]="req.alarmDown"></app-search-item>
<app-search-item inModal="true" [label]="'alarmInterval' | translate" [(value)]="req.alarmInterval"></app-search-item> <app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMinMin' | translate"
[(value)]="req.lowerAlarmLimit"></app-search-item>
<app-search-item *ngIf="req.isAlarm && (req.type === 'DI' || req.type === 'DO')" inModal="true" [label]="'alarmInterval' | translate"
[(value)]="req.alarmInterval"></app-search-item>
</div> </div>
<div class="searchItem inModal"> <div class="searchItem inModal">
<div class="item-label" style="width: 149px;">{{'wayInfo' | translate}}</div> <div class="item-label" style="width: 149px;">{{'wayInfo' | translate}}</div>
......
...@@ -71,7 +71,11 @@ export class SensorTopicWayComponent implements OnInit { ...@@ -71,7 +71,11 @@ export class SensorTopicWayComponent implements OnInit {
this.isUpdate = false; this.isUpdate = false;
this.isV = true; this.isV = true;
this.try = { this.try = {
field: ['deviceNo', 'topicName', 'name', 'alias', 'description', 'type', 'unit', 'isAlarm'], trans: {name: 'wayName', alias: 'wayAlias', description: 'wayDescription', type: 'per', isAlarm: 'isAlarm',
alarmUp: 'alarmMax', upperAlarmLimit: 'alarmMaxMax', rangeMax: 'max', alarmDown: 'alarmMin',
lowerAlarmLimit: 'alarmMinMin', alarmInterval: 'alarmInterval', rangeMin: 'min'},
field: ['deviceNo', 'topicName', 'name', 'alias', 'description', 'type', 'isAlarm'],
num: ['alarmUp', 'upperAlarmLimit', 'rangeMax', 'alarmDown', 'lowerAlarmLimit', 'alarmInterval', 'rangeMin'],
eng: ['name', 'alias'] eng: ['name', 'alias']
}; };
} }
...@@ -82,7 +86,11 @@ export class SensorTopicWayComponent implements OnInit { ...@@ -82,7 +86,11 @@ export class SensorTopicWayComponent implements OnInit {
this.req.oldName = one.name; this.req.oldName = one.name;
this.isV = true; this.isV = true;
this.try = { this.try = {
field: ['deviceNo', 'topicName', 'name', 'alias', 'description', 'type', 'unit', 'isAlarm'], trans: {name: 'wayName', alias: 'wayAlias', description: 'wayDescription', type: 'per', isAlarm: 'isAlarm',
alarmUp: 'alarmMax', upperAlarmLimit: 'alarmMaxMax', rangeMax: 'max', alarmDown: 'alarmMin',
lowerAlarmLimit: 'alarmMinMin', alarmInterval: 'alarmInterval', rangeMin: 'min'},
field: ['deviceNo', 'topicName', 'name', 'alias', 'description', 'type', 'isAlarm'],
num: ['alarmUp', 'upperAlarmLimit', 'rangeMax', 'alarmDown', 'lowerAlarmLimit', 'alarmInterval', 'rangeMin'],
eng: ['name', 'alias'] eng: ['name', 'alias']
}; };
} }
...@@ -101,8 +109,18 @@ export class SensorTopicWayComponent implements OnInit { ...@@ -101,8 +109,18 @@ export class SensorTopicWayComponent implements OnInit {
return false; return false;
} }
if (this.isV && this.isUpdate) { if (this.isV && this.isUpdate) {
if (this.req.type !== 'DI' && this.req.type !== 'DO' && !this.req.unit) {
this.message.warning('单位为必填项');
this.isLoading = false;
return false;
}
this.api.probes.updateProbes([this.req, this.next]); this.api.probes.updateProbes([this.req, this.next]);
} else if (this.isV && !this.isUpdate) { } else if (this.isV && !this.isUpdate) {
if (this.req.type !== 'DI' && this.req.type !== 'DO' && !this.req.unit) {
this.message.warning('单位为必填项');
this.isLoading = false;
return false;
}
this.api.probes.addProbes([this.req, this.next]); this.api.probes.addProbes([this.req, this.next]);
} else if (this.isSaveOther) { } else if (this.isSaveOther) {
this.api.probes.saveAsProbesModel([this.req2, this.next]); this.api.probes.saveAsProbesModel([this.req2, this.next]);
...@@ -132,6 +150,8 @@ export class SensorTopicWayComponent implements OnInit { ...@@ -132,6 +150,8 @@ export class SensorTopicWayComponent implements OnInit {
deviceNo: this.deviceNo, deviceNo: this.deviceNo,
topicName: this.topicName topicName: this.topicName
}; };
this.try = {field: ['newProbesModelName', 'deviceNo']}; this.try = {
trans: {newProbesModelName: 'moduleName'},
field: ['newProbesModelName', 'deviceNo']};
} }
} }
...@@ -93,7 +93,10 @@ export class TopicModuleDetailComponent implements OnInit { ...@@ -93,7 +93,10 @@ export class TopicModuleDetailComponent implements OnInit {
this.req = {}; this.req = {};
this.req.frequency = 0; this.req.frequency = 0;
this.isUpdate = false; this.isUpdate = false;
this.try = {field: ['topicName', 'topicType', 'dataType', 'interval'], this.try = {
trans: {topicName: 'topicName', topicType: 'topicType',
dataType: 'dataType', interval: 'inTime', dataInterval: 'dataInterval'},
field: ['topicName', 'topicType', 'dataType', 'interval'],
num: ['dataType', 'interval', 'dataInterval']}; num: ['dataType', 'interval', 'dataInterval']};
this.isV = true; this.isV = true;
} }
...@@ -103,7 +106,10 @@ export class TopicModuleDetailComponent implements OnInit { ...@@ -103,7 +106,10 @@ export class TopicModuleDetailComponent implements OnInit {
this.req = {...one}; this.req = {...one};
this.req.frequency = 0; this.req.frequency = 0;
this.req.oldTopicName = one.topicName; this.req.oldTopicName = one.topicName;
this.try = {field: ['topicModelNo', 'topicName', 'topicType', 'dataType', 'interval'], this.try = {
trans: {topicName: 'topicName', topicType: 'topicType',
dataType: 'dataType', interval: 'inTime', dataInterval: 'dataInterval'},
field: ['topicModelNo', 'topicName', 'topicType', 'dataType', 'interval'],
num: ['dataType', 'interval', 'dataInterval']}; num: ['dataType', 'interval', 'dataInterval']};
this.isV = true; this.isV = true;
} }
......
...@@ -92,21 +92,27 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -92,21 +92,27 @@ export class TopicModuleMgrComponent implements OnInit {
newTopicModelName: '', newTopicModelName: '',
topicModelNo: one.topicModelNo topicModelNo: one.topicModelNo
}; };
this.try = {field: ['newTopicModelName', 'topicModelNo']}; this.try = {
trans: {newTopicModelName: 'moduleName'},
field: ['newTopicModelName', 'topicModelNo']};
} }
add() { add() {
this.isUpdate = false; this.isUpdate = false;
this.req = {}; this.req = {};
this.isAddConV = true; this.isAddConV = true;
this.try = {field: ['topicModelName', 'prefixName']}; this.try = {
trans: {newTopicModelName: 'moduleName'},
field: ['topicModelName', 'prefixName']};
} }
update(one) { update(one) {
this.isUpdate = true; this.isUpdate = true;
this.req = {...one}; this.req = {...one};
this.isAddConV = true; this.isAddConV = true;
this.try = {field: ['topicModelNo', 'topicModelName', 'prefixName']}; this.try = {
trans: {newTopicModelName: 'moduleName', front: 'prefixName'},
field: ['topicModelNo', 'topicModelName', 'prefixName']};
} }
cancel(v) { cancel(v) {
......
...@@ -51,12 +51,10 @@ ...@@ -51,12 +51,10 @@
[nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false"> [nzFooter]="foot1" [nzTitle]="isUpdate ? ('update' | translate) : ('add' | translate)" (nzOnCancel)="cancel()" nzMaskClosable="false">
<ng-template #con1> <ng-template #con1>
<div class="half"> <div class="half">
<app-search-item nz-tooltip nzTitle="此处输入为英文" isMust="true" inModal="true" [label]="'wayName' | translate" [(value)]="req.name"></app-search-item> <app-search-item nz-tooltip nzTitle="此处输入为英文或数字" isMust="true" inModal="true" [label]="'wayName' | translate"
<app-search-item isMust="true" inModal="true" [label]="'per' | translate" [(value)]="req.unit"></app-search-item> [(value)]="req.name"></app-search-item>
<app-search-item isMust="true" inModal="true" [label]="'wayDescription' | translate" [(value)]="req.description"></app-search-item> <app-search-select isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"
<app-search-item inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item> [data]="[{a: 'AI'}, {a: 'AO'}, {a: 'DI'}, {a: 'DO'}]" optL="a" optV="a"></app-search-select>
<app-search-item inModal="true" [label]="'alarmMax' | translate" [(value)]="req.alarmUp"></app-search-item>
<app-search-item inModal="true" [label]="'alarmMaxMax' | translate" [(value)]="req.upperAlarmLimit"></app-search-item>
<div class="searchItem inModal"> <div class="searchItem inModal">
<div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div> <div class="item-label"><span class="deleteFontColor">* </span>{{'isAlarm' | translate}}</div>
<div class="item-input"> <div class="item-input">
...@@ -66,14 +64,28 @@ ...@@ -66,14 +64,28 @@
</nz-radio-group> </nz-radio-group>
</div> </div>
</div> </div>
<app-search-item inModal="true" [label]="'max' | translate" [(value)]="req.rangeMax"></app-search-item>
<app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMax' | translate"
[(value)]="req.alarmUp"></app-search-item>
<app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMaxMax' | translate"
[(value)]="req.upperAlarmLimit"></app-search-item>
<app-search-item *ngIf="req.isAlarm && req.type !== 'DI' && req.type !== 'DO'" inModal="true" [label]="'alarmInterval' | translate"
[(value)]="req.alarmInterval"></app-search-item>
</div> </div>
<div class="half"> <div class="half">
<app-search-item nz-tooltip nzTitle="此处输入为英文" isMust="true" inModal="true" [label]="'wayAlias' | translate" [(value)]="req.alias"></app-search-item> <app-search-item isMust="true" nz-tooltip nzTitle="此处输入为英文或数字" inModal="true" [label]="'wayAlias' | translate"
<app-search-item isMust="true" inModal="true" [label]="'wayType' | translate" [(value)]="req.type"></app-search-item> [(value)]="req.alias"></app-search-item>
<app-search-item *ngIf="req.type !== 'DI' && req.type !== 'DO'" isMust="true" 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 inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item> <app-search-item inModal="true" [label]="'min' | translate" [(value)]="req.rangeMin"></app-search-item>
<app-search-item inModal="true" [label]="'alarmMin' | translate" [(value)]="req.alarmDown"></app-search-item> <app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMin' | translate"
<app-search-item inModal="true" [label]="'alarmMinMin' | translate" [(value)]="req.lowerAlarmLimit"></app-search-item> [(value)]="req.alarmDown"></app-search-item>
<app-search-item inModal="true" [label]="'alarmInterval' | translate" [(value)]="req.alarmInterval"></app-search-item> <app-search-item *ngIf="req.isAlarm" inModal="true" [label]="'alarmMinMin' | translate"
[(value)]="req.lowerAlarmLimit"></app-search-item>
<app-search-item *ngIf="req.isAlarm && (req.type === 'DI' || req.type === 'DO')" inModal="true" [label]="'alarmInterval' | translate"
[(value)]="req.alarmInterval"></app-search-item>
</div> </div>
<div class="searchItem inModal"> <div class="searchItem inModal">
<div class="item-label" style="width: 149px;">{{'wayInfo' | translate}}</div> <div class="item-label" style="width: 149px;">{{'wayInfo' | translate}}</div>
......
...@@ -80,7 +80,11 @@ export class TopicModuleWayComponent implements OnInit { ...@@ -80,7 +80,11 @@ export class TopicModuleWayComponent implements OnInit {
this.isUpdate = false; this.isUpdate = false;
this.isV = true; this.isV = true;
this.try = { this.try = {
field: ['topicModelNo', 'topicName', 'name', 'alias', 'description', 'type', 'unit', 'isAlarm'], trans: {name: 'wayName', alias: 'wayAlias', description: 'wayDescription', type: 'per', isAlarm: 'isAlarm',
alarmUp: 'alarmMax', upperAlarmLimit: 'alarmMaxMax', rangeMax: 'max', alarmDown: 'alarmMin',
lowerAlarmLimit: 'alarmMinMin', alarmInterval: 'alarmInterval', rangeMin: 'min'},
field: ['topicModelNo', 'topicName', 'name', 'alias', 'description', 'type', 'isAlarm'],
num: ['alarmUp', 'upperAlarmLimit', 'rangeMax', 'alarmDown', 'lowerAlarmLimit', 'alarmInterval', 'rangeMin'],
eng: ['name', 'alias'] eng: ['name', 'alias']
}; };
} }
...@@ -91,7 +95,11 @@ export class TopicModuleWayComponent implements OnInit { ...@@ -91,7 +95,11 @@ export class TopicModuleWayComponent implements OnInit {
this.req.oldName = one.name; this.req.oldName = one.name;
this.isV = true; this.isV = true;
this.try = { this.try = {
field: ['topicModelNo', 'topicName', 'name', 'alias', 'description', 'type', 'unit', 'isAlarm'], trans: {name: 'wayName', alias: 'wayAlias', description: 'wayDescription', type: 'per', isAlarm: 'isAlarm',
alarmUp: 'alarmMax', upperAlarmLimit: 'alarmMaxMax', rangeMax: 'max', alarmDown: 'alarmMin',
lowerAlarmLimit: 'alarmMinMin', alarmInterval: 'alarmInterval', rangeMin: 'min'},
field: ['topicModelNo', 'topicName', 'name', 'alias', 'description', 'type', 'isAlarm'],
num: ['alarmUp', 'upperAlarmLimit', 'rangeMax', 'alarmDown', 'lowerAlarmLimit', 'alarmInterval', 'rangeMin'],
eng: ['name', 'alias'] eng: ['name', 'alias']
}; };
} }
...@@ -104,6 +112,11 @@ export class TopicModuleWayComponent implements OnInit { ...@@ -104,6 +112,11 @@ export class TopicModuleWayComponent implements OnInit {
this.isLoading = true; this.isLoading = true;
this.req.topicModelNo = this.topicModelNo; this.req.topicModelNo = this.topicModelNo;
this.req.topicName = this.topicName; this.req.topicName = this.topicName;
if (this.req.type !== 'DI' && this.req.type !== 'DO' && !this.req.unit) {
this.message.warning('单位为必填项');
this.isLoading = false;
return false;
}
if (!this.ck.formCheck(this.req, this.try)) { if (!this.ck.formCheck(this.req, this.try)) {
this.isLoading = false; this.isLoading = false;
return false; return false;
......
import { Injectable } from '@angular/core'; import {Injectable} from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import { isUndefined } from 'util'; import {isUndefined} from 'util';
import { TranslateService } from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
@Injectable() @Injectable()
export class CheckService { export class CheckService {
constructor( private message: NzMessageService, private translate: TranslateService) {} private flag = 0;
private trans = {};
constructor(private message: NzMessageService, private translate: TranslateService) {
}
formCheck(data, req) { formCheck(data, req) {
const fNum = req.field.length; this.flag = 0;
this.trans = req.trans;
const fieldStr = '-' + req.field.join('-') + '-'; const fieldStr = '-' + req.field.join('-') + '-';
const field = req.field.filter((item) => data[item] !== '' && data[item] !== null && !isUndefined(data[item])).length; if (req.field) {
if (field !== fNum) { req.field.filter((item) => this.checkField(fieldStr, data, item));
this.message.warning(this.translate.instant('pleaseFillAll')); if (this.flag) {
return false; return false;
} }
const tNum = req.time ? req.time.length : 0; }
const time = req.time ? req.time.filter((item) => this.checkTime(fieldStr, data, item)).length : 0;
if (time !== tNum) { if (req.time) {
this.message.warning(this.translate.instant('wrongTime')); req.time.filter((item) => this.checkTime(fieldStr, data, item));
if (this.flag) {
return false; return false;
} }
const telNum = req.tel ? req.tel.length : 0; }
const tel = req.tel ? req.tel.filter((item) => this.checkTel(fieldStr, data, item)).length : 0;
if (tel !== telNum) { if (req.tel) {
this.message.warning(this.translate.instant('wrongTel')); req.tel.filter((item) => this.checkTel(fieldStr, data, item));
if (this.flag) {
return false; return false;
} }
const mNum = req.money ? req.money.length : 0; }
const money = req.money ? req.money.filter((item) => this.checkMoney(fieldStr, data, item)).length : 0;
if (money !== mNum) { if (req.money) {
this.message.warning(this.translate.instant('wrongAmount')); req.money.filter((item) => this.checkMoney(fieldStr, data, item));
if (this.flag) {
return false; return false;
} }
const nNum = req.num ? req.num.length : 0; }
const num = req.num ? req.num.filter((item) => this.checkNum(fieldStr, data, item)).length : 0;
if (num !== nNum) { if (req.num) {
this.message.warning(this.translate.instant('wrongNum')); req.num.filter((item) => this.checkNum(fieldStr, data, item));
if (this.flag) {
return false; return false;
} }
}
const f2Num = req.float2 ? req.float2.length : 0; if (req.float2) {
const float2 = req.float2 ? req.float2.filter((item) => this.checkFloat2(fieldStr, data, item)).length : 0; req.float2.filter((item) => this.checkFloat2(fieldStr, data, item));
if (float2 !== f2Num) { if (this.flag) {
this.message.warning(this.translate.instant('wrongNum'));
return false; return false;
} }
}
const eNum = req.eng ? req.eng.length : 0; if (req.eng) {
const eng = req.eng ? req.eng.filter((item) => this.checkEng(fieldStr, data, item)).length : 0; req.eng.filter((item) => this.checkEng(fieldStr, data, item));
if (eng !== eNum) { if (this.flag) {
this.message.warning(this.translate.instant('wrongEng'));
return false; return false;
} }
}
return true; return true;
} }
private checkField(fieldStr, data, field) {
if (this.flag === 1) { return false; }
if ((data[field] === '' || isUndefined(data[field]) || data[field] === null) && fieldStr.indexOf('-' + field + '-') >= -1) {
this.message.warning(this.translate.instant(this.trans[field]) + '为必填字段, 请检查');
this.flag = 1;
return false;
} else {
return true;
}
}
private checkTime(fieldStr, data, time) { private checkTime(fieldStr, data, time) {
if (this.flag === 1) { return false; }
if ((data[time] === '' || isUndefined(data[time]) || data[time] === null) && fieldStr.indexOf('-' + time + '-') <= -1) { if ((data[time] === '' || isUndefined(data[time]) || data[time] === null) && fieldStr.indexOf('-' + time + '-') <= -1) {
return true; return true;
} }
if (data[time] && new Date(data[time]).getTime() > 0 && new Date(data[time]).getTime().toString().length === 13) { if (data[time] && new Date(data[time]).getTime() > 0 && new Date(data[time]).getTime().toString().length === 13) {
return true; return true;
} else { } else {
this.message.warning(this.translate.instant(this.trans[time]) + '格式填写错误, 应填入正确时间');
this.flag = 1;
return false; return false;
} }
} }
private checkTel(fieldStr, data, tel) { private checkTel(fieldStr, data, tel) {
if (this.flag === 1) { return false; }
if ((data[tel] === '' || isUndefined(data[tel]) || data[tel] === null) && fieldStr.indexOf('-' + tel + '-') <= -1) { if ((data[tel] === '' || isUndefined(data[tel]) || data[tel] === null) && fieldStr.indexOf('-' + tel + '-') <= -1) {
return true; return true;
} }
const reg = new RegExp( '^1\\d{10}$'); const reg = new RegExp('^1\\d{10}$');
if (data[tel].length !== 11 || !reg.test(data[tel])) { if (data[tel].length !== 11 || !reg.test(data[tel])) {
this.message.warning(this.translate.instant(this.trans[tel]) + '格式填写错误, 应填入正确11位手机号');
this.flag = 1;
return false; return false;
} else { } else {
return true; return true;
...@@ -81,47 +108,59 @@ export class CheckService { ...@@ -81,47 +108,59 @@ export class CheckService {
} }
private checkMoney(fieldStr, data, money) { private checkMoney(fieldStr, data, money) {
if (this.flag === 1) { return false; }
if ((data[money] === '' || isUndefined(data[money]) || data[money] === null) && fieldStr.indexOf('-' + money + '-') <= -1) { if ((data[money] === '' || isUndefined(data[money]) || data[money] === null) && fieldStr.indexOf('-' + money + '-') <= -1) {
return true; return true;
} }
if (parseFloat(data[money]).toFixed(2) === data[money] && parseInt(data[money], 10).toString().length < 8) { if (parseFloat(data[money]).toFixed(2) === data[money] && parseInt(data[money], 10).toString().length < 8) {
return true; return true;
} else { } else {
this.message.warning(this.translate.instant(this.trans[money]) + '格式填写错误, 应填入数字金额');
this.flag = 1;
return false; return false;
} }
} }
private checkNum(fieldStr, data, num) { private checkNum(fieldStr, data, num) {
if (this.flag === 1) { return false; }
if ((data[num] === '' || isUndefined(data[num]) || data[num] === null) && fieldStr.indexOf('-' + num + '-') <= -1) { if ((data[num] === '' || isUndefined(data[num]) || data[num] === null) && fieldStr.indexOf('-' + num + '-') <= -1) {
return true; return true;
} }
const reg = new RegExp( '^[0-9]*$'); const reg = new RegExp('^[0-9]*$');
if (reg.test(data[num])) { if (reg.test(data[num])) {
return true; return true;
} else { } else {
this.message.warning(this.translate.instant(this.trans[num]) + '格式填写错误, 应填入数值');
this.flag = 1;
return false; return false;
} }
} }
private checkFloat2(fieldStr, data, float2) { private checkFloat2(fieldStr, data, float2) {
if (this.flag === 1) { return false; }
if ((data[float2] === '' || isUndefined(data[float2]) || data[float2] === null) && fieldStr.indexOf('-' + float2 + '-') <= -1) { if ((data[float2] === '' || isUndefined(data[float2]) || data[float2] === null) && fieldStr.indexOf('-' + float2 + '-') <= -1) {
return true; return true;
} }
if ( parseFloat(data[float2]).toFixed(2).toString() === data[float2]) { if (parseFloat(data[float2]).toFixed(2).toString() === data[float2]) {
return true; return true;
} else { } else {
this.message.warning(this.translate.instant(this.trans[float2]) + '格式填写错误, 应填入两位小数');
this.flag = 1;
return false; return false;
} }
} }
private checkEng(fieldStr, data, eng) { private checkEng(fieldStr, data, eng) {
if (this.flag === 1) { return false; }
if ((data[eng] === '' || isUndefined(data[eng]) || data[eng] === null) && fieldStr.indexOf('-' + eng + '-') <= -1) { if ((data[eng] === '' || isUndefined(data[eng]) || data[eng] === null) && fieldStr.indexOf('-' + eng + '-') <= -1) {
return true; return true;
} }
const reg = new RegExp( '^[a-zA-Z]*$'); const reg = new RegExp('^[a-zA-Z0-9]*$');
if (reg.test(data[eng])) { if (reg.test(data[eng])) {
return true; return true;
} else { } else {
this.message.warning(this.translate.instant(this.trans[eng]) + '格式填写错误, 应填入英文或数字');
this.flag = 1;
return false; return false;
} }
} }
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
export const environment = { export const environment = {
production: false, production: false,
baseUrl: 'http://cloud-test.witium.com/api', // 对外访问测试网地址 // baseUrl: 'http://cloud-test.witium.com/api', // 对外访问测试网地址
// baseUrl: 'http://172.16.1.53:8092', // cy // baseUrl: 'http://172.16.1.53:8092', // cy
baseUrl: 'http://172.16.1.52:8094', // zz
}; };
/* /*
......
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