alarmDetail.vue
3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
<view class="alarm-detail-page">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="alarm-detail-column">
<view class="u-flex detail-column">
<view class="u-flex column">
<text class="text">{{ list.deviceName == null ? '暂无数据' : list.deviceName }}</text>
<image class="image" src="../../static/alert-detail.png"></image>
</view>
<view class="column">
<text class="text-alarm-level">告警级别:</text>
<text class="text-alarm-level" style="color:#DE4437">
{{
list.severity == 'CRITICAL'
? '危险'
: list.severity == 'MAJOR'
? '重要'
: list.severity == 'MINOR'
? '次要'
: list.severity == 'WARNING'
? '警告'
: '不确定'
}}
</text>
</view>
<view class="column">
<text class="text-alarm-level-lg">所属组织:</text>
<text class="text-alarm-lg">{{ list.originatorType }}</text>
</view>
<view class="column">
<text class="text-alarm-level-lg">告警值:</text>
<text class="text-alarm-lg">{{ list.details == null ? '暂无数据' : list.details.data }}</text>
</view>
<view class="column">
<text class="text-alarm-level-lg">告警时间:</text>
<text class="text-alarm-lg">{{ list.createdTime }}</text>
</view>
<view class="column">
<text class="text-alarm-level-lg">告警状态:</text>
<text class="text-alarm-status">
{{
list.status == 'CLEARED_UNACK'
? '清除未确认'
: list.status == 'ACTIVE_UNACK'
? '激活未确认'
: list.status == 'CLEARED_ACK'
? '清除已确认'
: '激活已确认'
}}
</text>
</view>
</view>
</view>
<!-- #ifdef MP -->
<view class="handle-result" style="">处理结果</view>
<view class="hanle-main">
<u--form :label-style="{ 'font-size': '0rpx' }" style="padding-left: 26rpx;" labelPosition="left" :model="formModel" ref="form1">
<u-form-item label="." prop="result" ref="item3">
<view style="margin-left: -60rpx;"><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view>
</u-form-item>
</u--form>
</view>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<view class="handle-result">处理结果</view>
<view class="hanle-main">
<view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view>
</view>
<!-- #endif -->
<view v-if="list.status !== 'CLEARED_ACK'" style="margin-top: 44rpx;">
<view class="u-flex" style="justify-content: center;align-items: center;"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
formModel: {
result: ''
},
list: {}
};
},
onLoad(e) {
if (e.data !== null) {
let params = JSON.parse(e.data);
this.list = params;
}
// 隐藏原生的tabbar
uni.hideTabBar();
},
methods: {
handleSubmit() {
uni.$u.http
.post(`/alarm/${this.list.id}/ack`)
.then(res => {
if (res == '') {
uni.showToast({
title: '处理成功~',
icon: 'none'
});
let pages = getCurrentPages(); //获取所有页面栈实例列表
let nowPage = pages[pages.length - 1]; //当前页页面实例
let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.detailStatus = true;
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 500);
}
})
.catch(e => {
uni.$u.toast(e.data?.message);
});
}
}
};
</script>
<style lang="scss" scoped>
@import './static/alarmDetail.scss';
</style>