Commit 4aa16b6f authored by yating.lin's avatar yating.lin

接口调试

parent 7055323f
...@@ -69,12 +69,12 @@ ...@@ -69,12 +69,12 @@
<h3 style="margin-bottom: 5px;">{{item.description}}</h3> <h3 style="margin-bottom: 5px;">{{item.description}}</h3>
<div> <div>
<div style="width:65%; float: left"> <div style="width:65%; float: left">
<div *ngIf="item.data.temp" class="warnContent">温度: {{item.data.temp}} ℃</div> <div *ngIf="item.data !== null && item.data.temp" class="warnContent">温度: {{item.data.temp}} ℃</div>
<div *ngIf="item.data.humi" class="warnContent">湿度: {{item.data.humi}} %</div> <div *ngIf="item.data !== null && item.data.humi" class="warnContent">湿度: {{item.data.humi}} %</div>
<div *ngIf="item.data.heatStressLevel" class="warnContent">热应激等级: {{item.data.heatStressLevel}}</div> <div *ngIf="item.data !== null && item.data.heatStressLevel" class="warnContent">热应激等级: {{item.data.heatStressLevel}}</div>
<div *ngIf="item.data.liquidPump" class="warnContent">供液泵压力: {{item.data.liquidPump}} MPa</div> <div *ngIf="item.data !== null && item.data.liquidPump" class="warnContent">供液泵压力: {{item.data.liquidPump}} MPa</div>
<div *ngIf="item.data.press" class="warnContent">电磁阀压力: {{item.data.press}} MPa</div> <div *ngIf="item.data !== null && item.data.press" class="warnContent">电磁阀压力: {{item.data.press}} MPa</div>
<div *ngIf="item.data.NH3" class="warnContent">氨气: {{item.data.NH3}} ppm</div> <div *ngIf="item.data !== null && item.data.NH3" class="warnContent">氨气: {{item.data.NH3}} ppm</div>
</div> </div>
<div style="width:35%; float: left"> <div style="width:35%; float: left">
<div *ngIf="displayArea === 'trouble' && item.disposeState === 0" > <div *ngIf="displayArea === 'trouble' && item.disposeState === 0" >
......
...@@ -197,6 +197,12 @@ export class EnvAlarmDetailPage implements OnInit { ...@@ -197,6 +197,12 @@ export class EnvAlarmDetailPage implements OnInit {
}; };
this.api.troubleLog.processingFailure([req, (data) => { this.api.troubleLog.processingFailure([req, (data) => {
if (data && data.code === 1) {
this.api.presentMsgToast(data.message);
} else {
this.api.presentMsgToast('获取数据失败');
}
this.reflush();
}]); }]);
} }
......
...@@ -7,6 +7,7 @@ import { IonicModule } from '@ionic/angular'; ...@@ -7,6 +7,7 @@ import { IonicModule } from '@ionic/angular';
import { EnvCfgPage } from './env-cfg.page'; import { EnvCfgPage } from './env-cfg.page';
import {NgxDatatableModule} from '@swimlane/ngx-datatable'; import {NgxDatatableModule} from '@swimlane/ngx-datatable';
import {WtModule} from '../../components/wt/wt.module';
const routes: Routes = [ const routes: Routes = [
{ {
...@@ -21,7 +22,8 @@ const routes: Routes = [ ...@@ -21,7 +22,8 @@ const routes: Routes = [
FormsModule, FormsModule,
IonicModule, IonicModule,
RouterModule.forChild(routes), RouterModule.forChild(routes),
NgxDatatableModule NgxDatatableModule,
WtModule
], ],
declarations: [EnvCfgPage] declarations: [EnvCfgPage]
}) })
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<ion-select-option *ngFor="let cowshed of cowshedList" [value]="cowshed.fieldRegionNo">{{cowshed.fieldRegionName}}</ion-select-option> <ion-select-option *ngFor="let cowshed of cowshedList" [value]="cowshed.fieldRegionNo">{{cowshed.fieldRegionName}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<div *ngIf="curCowshed.fieldRegionName"> <div *ngIf="curCowshed.fieldRegionName">
<ion-item lines="full" class="subTitle"> <ion-item lines="full" class="subTitle">
<ion-label>智慧模式选择</ion-label> <ion-label>智慧模式选择</ion-label>
...@@ -315,8 +316,12 @@ ...@@ -315,8 +316,12 @@
</tr> </tr>
<tr style="height: 30px"> <tr style="height: 30px">
<th>氨气</th> <th>氨气</th>
<td><ion-input [(ngModel)]="curCowshed.environmentConfigJson.NH3U" (ionFocus)="humHaveTouch($event)" class="tdBorder" style="border-bottom: 1px solid lightgray;"></ion-input></td> <!--<td><ion-input [(ngModel)]="curCowshed.environmentConfigJson.NH3U" (ionFocus)="humHaveTouch($event)" class="tdBorder" style="border-bottom: 1px solid lightgray;"></ion-input></td>-->
<td><ion-input [(ngModel)]="curCowshed.environmentConfigJson.NH3L" (ionFocus)="humHaveTouch($event)" class="tdBorder" style="border-right: 1px solid lightgray; border-bottom: 1px solid lightgray;"></ion-input></td> <!--<td><ion-input [(ngModel)]="curCowshed.environmentConfigJson.NH3L" (ionFocus)="humHaveTouch($event)" class="tdBorder" style="border-right: 1px solid lightgray; border-bottom: 1px solid lightgray;"></ion-input></td>-->
<td><ion-input [(ngModel)]="curCowshed.environmentConfigJson.NH3U" class="tdBorder" style="border-bottom: 1px solid lightgray;"></ion-input></td>
<td><ion-input [(ngModel)]="curCowshed.environmentConfigJson.NH3L" class="tdBorder" style="border-right: 1px solid lightgray; border-bottom: 1px solid lightgray;"></ion-input></td>
<td>ppm</td> <td>ppm</td>
</tr> </tr>
...@@ -358,4 +363,6 @@ ...@@ -358,4 +363,6 @@
<ion-button color="secondary" class="addBtn" round (click)="updateCowshed()">保存配置</ion-button> <ion-button color="secondary" class="addBtn" round (click)="updateCowshed()">保存配置</ion-button>
</ion-item> </ion-item>
</div> </div>
<!--<v-loading-bump style="z-index: 9999; color: red" [remain]="comm.remain" *ngIf="comm.isLoading"></v-loading-bump>-->
</ion-content> </ion-content>
...@@ -74,78 +74,37 @@ export class EnvCfgPage implements OnInit { ...@@ -74,78 +74,37 @@ export class EnvCfgPage implements OnInit {
isShowerDisplay = false; isShowerDisplay = false;
isFanDisplay = false; isFanDisplay = false;
private $ionicPopup: any; // 发送指令延时判断
comm = {
remain : 20,
isLoading : true
};
async openPicker(numColumns = 1, numOptions = 5, columnOptions = this.defaultColumnOptions, event) { commTmr: any;
const picker = await this.pickerController.create({
columns: this.getColumns(numColumns, numOptions, columnOptions),
buttons: [
{
text: '取消',
role: 'cancel',
handler: () => {
this.fanMode.selecting = false;
}
},
{
text: '确认',
handler: (value) => {
event.target.value = value.col0.text;
console.log(value.value);
this.fanMode.selecting = false;
}
}
]
});
await picker.present();
}
getColumns(numColumns, numOptions, columnOptions) { private $ionicPopup: any;
const columns = [];
for (let i = 0; i < numColumns; i++) {
columns.push({
name: `col${i}`,
options: this.getColumnOptions(i, numOptions, columnOptions)
});
}
return columns;
}
getColumnOptions(columnIndex, numOptions, columnOptions) {
const options = [];
for (let i = 0; i < numOptions; i++) {
options.push({
text: columnOptions[columnIndex][i % numOptions],
value: i
});
}
return options;
}
tempHaveTouch(event) { ngOnInit() {
for (let i = 10; i <= 50; i++) { // this.pickerController = document.querySelector('ion-picker-controller');
this.defaultColumnOptions[0][i - 10] = i.toString(); this.comm.remain = 0;
} this.comm.isLoading = false;
if (this.fanMode.selecting === false) { this.commTmr = window.setInterval(() => {
this.fanMode.selecting = true;
this.openPicker(1, 41, this.defaultColumnOptions, event); if (this.comm.remain > 0) {
} this.comm.remain = this.comm.remain - 1;
} }
humHaveTouch(event) { if ( this.comm.remain < 1 ) {
for (let i = 0; i <= 100; i++) { this.comm.isLoading = false;
this.defaultColumnOptions[0][i] = i.toString(); } else {
} this.comm.isLoading = true;
if (this.fanMode.selecting === false) {
this.fanMode.selecting = true;
this.openPicker(1, 101, this.defaultColumnOptions, event);
} }
}, 1000) ;
this.init();
} }
ngOnInit() { ionViewWillLeave() {
// this.pickerController = document.querySelector('ion-picker-controller'); clearInterval(this.commTmr);
this.init();
} }
init() { init() {
...@@ -276,6 +235,73 @@ export class EnvCfgPage implements OnInit { ...@@ -276,6 +235,73 @@ export class EnvCfgPage implements OnInit {
} }
} }
async openPicker(numColumns = 1, numOptions = 5, columnOptions = this.defaultColumnOptions, event) {
const picker = await this.pickerController.create({
columns: this.getColumns(numColumns, numOptions, columnOptions),
buttons: [
{
text: '取消',
role: 'cancel',
handler: () => {
this.fanMode.selecting = false;
}
},
{
text: '确认',
handler: (value) => {
event.target.value = value.col0.text;
console.log(value.value);
this.fanMode.selecting = false;
}
}
]
});
await picker.present();
}
getColumns(numColumns, numOptions, columnOptions) {
const columns = [];
for (let i = 0; i < numColumns; i++) {
columns.push({
name: `col${i}`,
options: this.getColumnOptions(i, numOptions, columnOptions)
});
}
return columns;
}
getColumnOptions(columnIndex, numOptions, columnOptions) {
const options = [];
for (let i = 0; i < numOptions; i++) {
options.push({
text: columnOptions[columnIndex][i % numOptions],
value: i
});
}
return options;
}
tempHaveTouch(event) {
for (let i = 10; i <= 50; i++) {
this.defaultColumnOptions[0][i - 10] = i.toString();
}
if (this.fanMode.selecting === false) {
this.fanMode.selecting = true;
this.openPicker(1, 41, this.defaultColumnOptions, event);
}
}
humHaveTouch(event) {
for (let i = 0; i <= 100; i++) {
this.defaultColumnOptions[0][i] = i.toString();
}
if (this.fanMode.selecting === false) {
this.fanMode.selecting = true;
this.openPicker(1, 101, this.defaultColumnOptions, event);
}
}
workModeChange(device) { workModeChange(device) {
switch (device) { switch (device) {
case 'fan': case 'fan':
...@@ -341,7 +367,8 @@ export class EnvCfgPage implements OnInit { ...@@ -341,7 +367,8 @@ export class EnvCfgPage implements OnInit {
this.updateDateFormat(); this.updateDateFormat();
if (this.validate()) { if (this.validate()) {
this.updateModels(); this.updateModels();
this.load.toLoad('加载中...', false); // this.load.toLoad('加载中...', false);
this.comm.remain = 120;
this.curCowshed.isWisdomModel = this.curCowshed.isWisdomModelChecked ? 1 : 0; this.curCowshed.isWisdomModel = this.curCowshed.isWisdomModelChecked ? 1 : 0;
this.api.config.updateConfig([this.curCowshed, (data) => { this.api.config.updateConfig([this.curCowshed, (data) => {
if (data && data.code !== 0) { if (data && data.code !== 0) {
...@@ -350,6 +377,7 @@ export class EnvCfgPage implements OnInit { ...@@ -350,6 +377,7 @@ export class EnvCfgPage implements OnInit {
this.api.presentMsgToast('获取数据失败'); this.api.presentMsgToast('获取数据失败');
this.isError = true; this.isError = true;
} }
this.comm.remain = 0;
this.load.offLoad(); this.load.offLoad();
}]); }]);
} }
...@@ -400,7 +428,7 @@ export class EnvCfgPage implements OnInit { ...@@ -400,7 +428,7 @@ export class EnvCfgPage implements OnInit {
return false; return false;
} }
if (this.fan.controlModel === Constants.CONTROLL_SELF) { if (this.fan.controlModel === Constants.CONTROLL_SELF) {
if (this.isEmpty(this.fan.controlConfig.TU) || this.isEmpty(this.fan.controlConfig.TL)) { if (this.isEmpty(this.fan.controlConfig.config.TU) || this.isEmpty(this.fan.controlConfig.config.TL)) {
this.api.presentMsgToast('请完成风机配置'); this.api.presentMsgToast('请完成风机配置');
return false; return false;
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
.online { .online {
border-radius: 2px; border-radius: 2px;
background-color: #199ED8; background-color: #61C7CC;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
box-shadow: #ccc 0.5px 0.5px 3px; box-shadow: #ccc 0.5px 0.5px 3px;
......
...@@ -16,7 +16,13 @@ export class EnvDetailPage implements OnInit { ...@@ -16,7 +16,13 @@ export class EnvDetailPage implements OnInit {
private api: Api, private api: Api,
private ac: ActivatedRoute, private ac: ActivatedRoute,
private load: Load, private load: Load,
private tf: Transfer) {} private tf: Transfer) {
this.ac.queryParams.subscribe((data) => {
if (data.no) {
this.fieldRegionNo = data.no;
}
});
}
item = { item = {
factoryNo: '', factoryNo: '',
...@@ -72,8 +78,10 @@ export class EnvDetailPage implements OnInit { ...@@ -72,8 +78,10 @@ export class EnvDetailPage implements OnInit {
this.comm.isLoading = false; this.comm.isLoading = false;
this.comm.remain = 0; this.comm.remain = 0;
this.ac.queryParams.subscribe((data) => { this.ac.queryParams.subscribe((data) => {
if (data.no) {
this.fieldRegionNo = data.no; this.fieldRegionNo = data.no;
this.getData(0); this.getData(0);
}
}); });
} }
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {Api} from '../../service/api'; import {Api} from '../../service/api';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {Load} from '../../service/load'; import {Load} from '../../service/load';
import { AlertController } from '@ionic/angular'; import { AlertController } from '@ionic/angular';
import {Constants} from '../../service/constants'; import {Constants} from '../../service/constants';
@Component({ @Component({
selector: 'v-env-fan', selector: 'v-env-fan',
......
...@@ -5,11 +5,19 @@ ...@@ -5,11 +5,19 @@
</ion-buttons> </ion-buttons>
<ion-searchbar (ionInput)="getItems($event)" debounce="1000" style="height: 40px;"></ion-searchbar> <ion-searchbar (ionInput)="getItems($event)" debounce="1000" style="height: 40px;"></ion-searchbar>
</ion-toolbar> </ion-toolbar>
<!--<ion-slides style="width: 100%; height: 125px;" mode="ios"-->
<!--[options]="lunbo" #slide (ionSlideTouchEnd)="slideDidChange()">-->
<!--<ion-slide class="slideCon" *ngFor="let one of imgs">-->
<!--<div class="inBox">-->
<!--<img [src]="'../../../../assets/lunbo/' + one">-->
<!--</div>-->
<!--</ion-slide>-->
<!--</ion-slides>-->
<ion-slides style="width: 100%; height: 125px;" mode="ios" <ion-slides style="width: 100%; height: 125px;" mode="ios"
[options]="lunbo" #slide (ionSlideTouchEnd)="slideDidChange()"> [options]="lunbo" #slide>
<ion-slide class="slideCon" *ngFor="let one of imgs"> <ion-slide class="slideCon" >
<div class="inBox"> <div class="inBox">
<img [src]="'../../../../assets/lunbo/' + one"> <img [src]="'../../../../assets/lunbo/4.png'">
</div> </div>
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
.online { .online {
border-radius: 2px; border-radius: 2px;
background-color: #199ED8; background-color: #61C7CC;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
box-shadow: #ccc 0.5px 0.5px 3px; box-shadow: #ccc 0.5px 0.5px 3px;
......
...@@ -29,15 +29,15 @@ export class EnvHomePage implements OnInit { ...@@ -29,15 +29,15 @@ export class EnvHomePage implements OnInit {
isLoading: true isLoading: true
}; };
imgs = ['1.jpg', '2.jpg', '3.jpg']; imgs = ['4.png'];
lunbo = { lunbo = {
speed: 1000, speed: 1000,
allowTouchMove: true, allowTouchMove: false,
effect: 'flip', effect: 'flip',
autoplay: { autoplay: {
delay: 2000, delay: 2000,
}, },
loop: true, loop: false,
spaceBetween: 0, spaceBetween: 0,
zoom: false, zoom: false,
height: 150, height: 150,
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
line-height: 25px; line-height: 25px;
margin-bottom: 5px;">时间参数</h1> margin-bottom: 5px;">时间参数</h1>
<ion-item lines="full" insert="false"> <ion-item lines="full" insert="false">
<span class="content">{{param[0].fieldDeviceName}}喷淋时间 &nbsp;&nbsp;&nbsp;&nbsp;{{controlConfig.A}} &nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="content">{{fieldDeviceNameA}}喷淋时间 &nbsp;&nbsp;&nbsp;&nbsp;{{controlConfig.A}} &nbsp;&nbsp;&nbsp;&nbsp;</span>
</ion-item> </ion-item>
<ion-item lines="full" insert="false"> <ion-item lines="full" insert="false">
<span class="content">{{param[1].fieldDeviceName}}喷淋时间 &nbsp;&nbsp;&nbsp;&nbsp;{{controlConfig.B}} &nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="content">{{fieldDeviceNameB}}喷淋时间 &nbsp;&nbsp;&nbsp;&nbsp;{{controlConfig.B}} &nbsp;&nbsp;&nbsp;&nbsp;</span>
</ion-item> </ion-item>
<ion-item lines="full" insert="false"> <ion-item lines="full" insert="false">
<span class="content">间隔时间 &nbsp;&nbsp;&nbsp;&nbsp; {{controlConfig.interval}} &nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="content">间隔时间 &nbsp;&nbsp;&nbsp;&nbsp; {{controlConfig.interval}} &nbsp;&nbsp;&nbsp;&nbsp;</span>
......
...@@ -41,7 +41,26 @@ export class EnvShowerPage implements OnInit { ...@@ -41,7 +41,26 @@ export class EnvShowerPage implements OnInit {
offset: 0 offset: 0
}; };
// 各设备信息 // 各设备信息
param = []; param: any = [{
fieldDeviceNo: '',
fieldDeviceName: '',
alarm: 0,
cycle: 0,
state: 0,
press: 0.25,
ts: 0
},
{
fieldDeviceNo: '',
fieldDeviceName: '',
alarm: 0,
cycle: 0,
state: 0,
press: 0.25,
ts: 0
}];
fieldDeviceNameA = 'A区';
fieldDeviceNameB = 'B区';
controlModelOptions = [ controlModelOptions = [
{modelId: 0, modelValue: '-'}, {modelId: 0, modelValue: '-'},
...@@ -49,7 +68,14 @@ export class EnvShowerPage implements OnInit { ...@@ -49,7 +68,14 @@ export class EnvShowerPage implements OnInit {
{modelId: 2, modelValue: '自控模式'}, {modelId: 2, modelValue: '自控模式'},
{modelId: 3, modelValue: '智控模式'}]; {modelId: 3, modelValue: '智控模式'}];
constructor(private api: Api, private ac: ActivatedRoute, private load: Load, private route: ActivatedRoute) { } constructor(private api: Api, private ac: ActivatedRoute, private load: Load, private route: ActivatedRoute) {
this.param[0].fieldDeviceName = 'A区';
this.param[1].fieldDeviceName = 'B区';
this.route.paramMap.subscribe(params => {
this.fieldRegionNo = params.get('fieldRegionNo');
this.getData(0);
});
}
ngOnInit() { ngOnInit() {
this.comm.remain = 0; this.comm.remain = 0;
...@@ -69,10 +95,10 @@ export class EnvShowerPage implements OnInit { ...@@ -69,10 +95,10 @@ export class EnvShowerPage implements OnInit {
this.init(); this.init();
} }
// ionViewWillEnter() { ionViewWillEnter() {
// console.log('ionViewWillEnter_shower'); console.log('ionViewWillEnter_shower');
// this.init(); this.init();
// } }
ionViewWillLeave() { ionViewWillLeave() {
clearInterval(this.commTmr); clearInterval(this.commTmr);
} }
...@@ -99,6 +125,13 @@ export class EnvShowerPage implements OnInit { ...@@ -99,6 +125,13 @@ export class EnvShowerPage implements OnInit {
this.param.forEach(device => { this.param.forEach(device => {
device.op = device.cycle === 1 ? true : false; device.op = device.cycle === 1 ? true : false;
}); });
if (this.param[0]) {
this.fieldDeviceNameA = this.param[0].fieldDeviceName;
}
if (this.param[1]) {
this.fieldDeviceNameB = this.param[1].fieldDeviceName;
}
this.initButtons(); this.initButtons();
} }
this.load.offLoad(); this.load.offLoad();
......
...@@ -70,7 +70,6 @@ const routes: Routes = [ ...@@ -70,7 +70,6 @@ const routes: Routes = [
// EnvShowerPage, // EnvShowerPage,
// EnvLightPage, // EnvLightPage,
// EnvWaterchannelPage, // EnvWaterchannelPage,
EnvCfgPage,
] ]
}) })
export class TabsPageModule {} export class TabsPageModule {}
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