Commit 60b92aeb authored by frank's avatar frank 🏀

提交了故障维护的一些修正

parent 2eed3519
......@@ -56,7 +56,7 @@ const routes: Routes = [
@NgModule({
imports: [
RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules, enableTracing: true})
RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules, enableTracing: false})
],
exports: [RouterModule]
})
......
......@@ -39,6 +39,7 @@
//overflow-x: hidden;-webkit-overflow-scrolling: touch;
//padding-top: 45px;
//margin-bottom: 90px;
padding-left: 0px;
}
.topPart{
......
......@@ -14,63 +14,41 @@
<!--</div>-->
<ion-content color="light" style="background-color: #F3F4F4;">
<ion-segment scrollable style="position: sticky;">
<ion-segment-button>
<ion-segment scrollable style="position: sticky;" (ionChange)="segmentChanged($event)">
<ion-segment-button value="trouble">
<ion-label>故障</ion-label>
</ion-segment-button>
<ion-segment-button checked>
<ion-segment-button checked value="alarm">
<ion-label>预警</ion-label>
</ion-segment-button>
</ion-segment>
<h1 style="
font-size: 16px;
padding-left: 5px;
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;">全部预警</h1>
<ion-item lines="full">
<ion-label>预警数量</ion-label> <ion-label>2/3</ion-label>
<ion-select multiple="false" cancelText="取消" okText="确认" [(ngModel)]="workModeSetting.workMode" [(value)]="workModeSetting.workMode" (ionChange)="workModeEvent()">
<ion-select-option value="全部">全部</ion-select-option>
<ion-select-option value="风机">风机</ion-select-option>
<ion-select-option value="卷帘">卷帘</ion-select-option>
<ion-select-option value="照明">照明</ion-select-option>
</ion-select>
</ion-item>
<div class="jazz-timeline-wrapper">
<div class="jazz-timeline thin-timeline">
<div class="timeline-post">
<div class="timeline-post" *ngFor="let a of showAlarmList;">
<div class="timeline-icon icon-larger iconbg-turqoise icon-color-white">
<div class="icon-placeholder">Dec <span>25</span></div>
<div class="timeline-bar"></div>
</div>
<div class="timeline-content">
<h1 class="content-title"> 一号组风机故障 </h1>
<h1 class="content-title"> {{a.description}} </h1>
<div class="content-details">
<p>2019-08-16 </p> <ion-button color="primary" size="small" style="display: inline-block">确认修复</ion-button>
<p> {{a.troubleTime}} </p>
<ion-button color="primary" size="small" style="display: inline-block" *ngIf="a.disposeState === 0" (click)='onRecvClick(a)'>确认修复</ion-button>
<i class="vo v-yichuli" *ngIf="a.disposeState === 1"></i>
</div>
</div><!-- timeline content -->
</div><!-- .timeline-post -->
<div class="timeline-post">
<div class="timeline-icon icon-larger iconbg-black icon-color-white">
<div class="icon-placeholder">Nov <span>24</span></div>
<div class="timeline-bar"></div>
</div>
<div class="timeline-content">
<h2 class="content-title"> 二号组风机故障 </h2>
<div class="content-details">
<p>2019-08-16 </p> <ion-button color="primary" size="small" style="display: inline-block">确认修复</ion-button>
</div>
</div><!-- timeline content -->
</div><!-- .timeline-post -->
<div class="timeline-post">
<div class="timeline-icon icon-larger iconbg-brown icon-color-white">
<div class="icon-placeholder">Oct <span>12</span></div>
<div class="timeline-bar"></div>
</div>
<div class="timeline-content">
<h2 class="content-title"> 二号水槽故障 </h2>
<div class="content-details">
<p>2019-08-16 </p> <ion-button color="primary" size="small" style="display: inline-block">确认修复</ion-button>
</div>
</div><!-- timeline content -->
</div><!-- .timeline-post -->
</div>
</div>
</ion-content>
......
import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Api} from '../../service/api';
import {AlertController} from '@ionic/angular';
@Component({
selector: 'v-env-alarm-detail',
......@@ -11,9 +14,155 @@ export class EnvAlarmDetailPage implements OnInit {
fieldRegionName = '';
fieldRegionGroup = '';
constructor() { }
mSelAlarm;
showAlarmList = [];
alarmList = [];
troubleList = [];
// 工作模式
workModeSetting = { 'workMode' : '风机',
'DeviceNo' : '',
'workModeOld' : '1'};
reqDummy = {
"fieldRegionNo":"FRN110268534764224512",
"fieldRegionName":"1号牛舍",
"startTime":1565165000000,
"stopTime":156516501230000,
"devErr":36,
"devErrTotal":55,
"trouble":[{
"troubleLogNo":"123415646196875456",
"fieldDeviceName":"一号风机组",
"fieldDeviceType":"风机",
"description":"一号风机组故障",
"troubleTime":1565165000000,
"disposeState":0,
"isReal":0
}]
}
commTmr: any;
constructor(private ac: ActivatedRoute, private api: Api, private alterContoller: AlertController) { }
ngOnInit() {
this.ac.queryParams.subscribe((data) => {
this.fieldRegionNo = data.no;
this.fieldRegionName = data.name;
});
this.mSelAlarm = 'trouble';
this.getTroubletList();
this.getAlarmList();
this.commTmr = window.setInterval(() => {
console.log(1);
if(this.mSelAlarm === 'trouble'){
this.showAlarmList = this.troubleList;
} else {
this.showAlarmList = this.alarmList;
}
}, 1000) ;
}
getTroubletList(){
const req = {'fieldRegionNo': this.fieldRegionNo,
'startTime':new Date().getTime(),
'stopTime' : new Date().getTime() - 7 * 24 * 3600 * 1000};
this.api.troubleLog.getByTerm([req,(data)=> {
console.log(data);
data = this.reqDummy;
if(data.trouble && data.trouble.constructor === Array){
this.troubleList = [];
data.trouble.map((value, index) => {
let val = value;
val.troubleTime = this.api.formatTime('yyyy-MM-dd hh:mm:ss', new Date(value.troubleTime))
this.troubleList.push(val);
})
}
}]);
}
getAlarmList(){
const req = {'fieldRegionNo': this.fieldRegionNo,
'startTime':new Date().getTime(),
'stopTime' : new Date().getTime() - 7 * 24 * 3600 * 1000};
this.api.alarm.getCowshedAlarm([req,(data)=> {
console.log(data);
data = this.reqDummy;
if(data.trouble && data.trouble.constructor === Array){
this.alarmList = [];
data.trouble.map((value, index) => {
let val = value;
val.troubleTime = this.api.formatTime('yyyy-MM-dd hh:mm:ss', new Date(value.alarmTime))
this.alarmList.push(val);
})
}
}]);
}
ionViewWillLeave() {
clearInterval(this.commTmr);
}
segmentChanged(ev: any) {
console.log('Segment changed', ev);
if(ev === 'alarm') {
this.showAlarmList = this.alarmList;
this.mSelAlarm = 'alarm';
} else {
this.showAlarmList = this.troubleList;
this.mSelAlarm = 'trouble';
}
}
// 确认修复
async onRecvClick(alarm){
console.log(alarm);
const alert = await this.alterContoller.create({
header: '请注意',
message: '请确认该故障是否为真实故障?',
mode: 'ios',
buttons: [
{
text: '取消',
role: 'cancel',
cssClass: 'secondary',
//cssClass: 'width: 30%',
}, {
text: '是',
//cssClass: 'width: 40%',
handler: () => {
this.processingFailure(1, alarm);
}
}, {
text: '不是',
//cssClass: 'width: 30%',
handler: () => {
this.processingFailure(0,alarm);
}
}
]
});
await alert.present();
}
processingFailure(real, alarm) {
let req = {
"troubleLogNo": this.mSelAlarm === 'alarm'? alarm.alarmLogNo : alarm.troubleLogNo,
"disposeState": 1,
"isReal": real === 1 ? 1 : 0
};
this.api.troubleLog.processingFailure([req, (data) => {
;
}]);
}
}
......@@ -5,9 +5,9 @@
</ion-header>
<ion-content color="light" style="height: 100%">
<div class="alarmItem" *ngFor="let a of alarm" (click)="toControl(a)">
<div class="alarmItem" *ngFor="let a of alarmItem" (click)="toControl(a)">
<div class="listTitle">
<span>{{a.farm}}</span>
<span>{{a.fieldRegionName}}</span>
<span style="float:right;">近一年</span>
</div>
<div>
......
......@@ -9,20 +9,20 @@ import {NavController} from '@ionic/angular';
})
export class EnvAlarmPage implements OnInit {
alarm = [{
farm: '1号牛舍',
alarmItem = [{
fieldRegionName: '1号牛舍',
devErr: 36,
devErrTotal:136,
alarm:21,
alarmTotal:121
},{
farm: '2号牛舍',
fieldRegionName: '2号牛舍',
devErr: 1,
devErrTotal:11,
alarm:0,
alarmTotal:10
},{
farm: '3号牛舍',
fieldRegionName: '3号牛舍',
devErr: 2,
devErrTotal:12,
alarm:3,
......@@ -32,10 +32,22 @@ export class EnvAlarmPage implements OnInit {
constructor(private api: Api,public nav: NavController) { }
ngOnInit() {
this.api.alert.getAll(['{"fieldRegionType":"牛舍"}',(data) => {
if(data.total > 0) {
let rows = data.rows;
if(rows.constructor === Array){
this.alarmItem = rows;
rows.map((value, index)=> {
// this.totalAlert = this.totalAlert + value.devErr + value.alarm;
});
}
}
}]);
}
toControl(one){
const query = '/env-alarmDetail?name=' + one.farm;
const query = '/env-alarmDetail?name=' + one.fieldRegionName + '&no='+ one.fieldRegionNo;
// this.tf.transfer({
// url: '/' + one.url,
// query: query,
......
......@@ -21,6 +21,7 @@
<ion-tab-button tab="tab-alarm">
<ion-label>告警</ion-label>
<ion-icon name="hammer"></ion-icon>
<ion-badge color="danger" *ngIf="totalAlert > 0">{{totalAlert}}</ion-badge>
</ion-tab-button>
<ion-tab-button tab="tab-cfg">
......
import {Component, ComponentFactoryResolver, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, ActivationStart, Router, RouterOutlet} from '@angular/router';
import {Api} from '../../service/api';
@Component({
selector: 'v-tabs',
......@@ -10,16 +11,31 @@ export class TabsPage implements OnInit {
@ViewChild(RouterOutlet) outlet: RouterOutlet;
constructor(private router: Router) {
constructor(private router: Router, private api: Api ) {
}
totalAlert;
ngOnInit() {
// this.router.events.subscribe(e => {
// if (e instanceof ActivationStart && e.snapshot.outlet === 'tabs')
// console.log('DDEDEDEEEEEEEEEDDDDDDDDDDDDDDDDD');
// this.outlet.deactivate();
// });
this.totalAlert = 0;
this.api.alert.getAll(['{"fieldRegionType":"牛舍"}',(data) => {
if(data.total > 0) {
this.totalAlert = 0;
let rows = data.rows;
if(rows.constructor === Array){
rows.map((value, index)=> {
this.totalAlert = this.totalAlert + value.devErr + value.alarm;
});
}
}
}]);
}
......
......@@ -46,6 +46,21 @@ export class Api {
// 获取水槽信息
};
public alert = {
//获取告警列表的数据
getAll: (data)=> this.trans('post', '/alert/getAll', data),
//获取告警列表的数据
getByTerm: (data)=> this.trans('post', '/alert/getByTerm', data),
}
public troubleLog = {
// 根据条件获取所有的故障信息
getByTerm: (data) => this.trans('post', '/troubleLog/getByTerm', data),
// /处理故障
processingFailure: (data) => this.trans('post', '/troubleLog/processingFailure', data),
}
public user = {
addUser: (data) => this.trans('post', '/user/addUser', data),
deleteUser: (data) => this.trans('post', '/user/deleteUser', data),
......@@ -60,6 +75,8 @@ export class Api {
addAlarmLog: (data) => this.trans('post', '/alarm/addAlarmLog', data),
getAlarmByTerm: (data) => this.trans('post', '/alarm/getAlarmByTerm', data),
getAllAlarm: (data) => this.trans('get', '/alarm/getAllAlarm', data),
getByTerm: (data) => this.trans('post', '/alarm/getByTerm', data),
getCowshedAlarm: (data) => this.trans('post', '/alarm/getCowshedAlarm', data),
getLatestAlarm: (data) => this.trans('get', '/alarm/getLatestAlarm', data)
};
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,10 +4,11 @@
export const environment = {
// production: false,
url: 'http://pasture.witium.com.cn/api', // 对外访问测试网地址
// url: 'http://pasture.witium.com.cn/api', // 对外访问测试网地址
// url: 'http://cloud-test.witium.com:8096', // 测试
// url: 'http://172.16.1.53:8097', // cy
// url: 'http://172.16.1.52:8096', // zz
url: 'http://172.16.1.52:8096', // zz
// url: 'http://211.161.200.169:19200', // zz
// url: 'http://172.16.1.13:8096', // 测试
// mqttUrl: '172.16.1.24',
// mqttUrl: '120.27.235.39'
......
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