detail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view>
  3. <cu-custom id="custom"
  4. bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
  5. :isBack="true">
  6. <block slot="backText">返回</block>
  7. <block slot="content">
  8. 告警详情
  9. </block>
  10. </cu-custom>
  11. <My_listbox ref="List" :pullDown="false" @getlist="getlist" :empty="empty">
  12. <view class="detail" v-if="detail.lasteventtime">
  13. <view class="title">
  14. {{ detail.eventname || ' --' }}
  15. </view>
  16. <view class="row">设备:{{ detail.devicename }}({{ detail.serialnumber }})</view>
  17. <view class="time-row">最近告警时间: <view class="tag" :style="{
  18. color: tagStyleList[detail.lasteventlevel - 1].color,
  19. backgroundColor: tagStyleList[detail.lasteventlevel - 1].backgroundColor,
  20. }">{{ tagStyleList[detail.lasteventlevel - 1].name }}</view> <text class="time">{{
  21. detail.lasteventtime }}</text>
  22. </view>
  23. </view>
  24. <view class="head" :style="{ top: tovw(CustomBar) }">
  25. <view class="left">
  26. 告警日志
  27. </view>
  28. <time-horizon @onConfirm="dateRange" />
  29. </view>
  30. <view class="item" v-for="item in list" :key="item.eventtime">
  31. <view class="time">{{ item.eventtime }}</view>
  32. <view class="row">
  33. 告警级别:<!-- :style="{ color: tagStyleList[item.level - 1].color }" -->
  34. <text class="text">
  35. {{ tagStyleList[item.level - 1].name }}
  36. </text>
  37. </view>
  38. <view class="row">
  39. <text v-for="it in item.paramvalues" :key="it.w_dataparamid">
  40. 当前设备
  41. <text style="color: rgb(234, 22, 45);"><!-- -->
  42. {{ it.paramname }}
  43. </text>
  44. 值为
  45. <text style="color: rgb(234, 22, 45);">
  46. {{ it.paramvalue }}
  47. </text>
  48. ,
  49. <text style="color: rgb(234, 22, 45);">
  50. {{ it.symbol + it.eventvalue }}
  51. </text>
  52. 时触发警告;
  53. </text>
  54. </view>
  55. </view>
  56. <view style="height: 30px;" />
  57. </My_listbox>
  58. </view>
  59. </template>
  60. <script>
  61. import { styleList } from "./modules/styleList";
  62. let fun = null;
  63. export default {
  64. data() {
  65. return {
  66. empty: true,
  67. w_event_logid: 0,
  68. detail: {},
  69. CustomBar: 0,
  70. tagStyleList: styleList,
  71. "content": {
  72. "pageNumber": 1,
  73. "pageSize": 20,
  74. "where": {
  75. "begindate": "",
  76. "enddate": ""
  77. }
  78. },
  79. list: []
  80. }
  81. },
  82. onLoad(e) {
  83. if (e.id == 0) {
  84. uni.showToast({
  85. title: '查询错误',
  86. icon: "none",
  87. mask: true,
  88. })
  89. setTimeout(() => {
  90. uni.navigateBack();
  91. }, 1000)
  92. } else {
  93. this.content.w_event_logid = e.id;
  94. this.getDetail()
  95. this.getlist();
  96. }
  97. },
  98. mounted() {
  99. this.$refs.List.setHeight();
  100. },
  101. methods: {
  102. getDetail() {
  103. this.$Http.basic({
  104. "id": 20230821152602,
  105. content: {
  106. "w_event_logid": this.content.w_event_logid
  107. }
  108. }).then(res => {
  109. console.log("告警详情", res)
  110. if (this.cutoff(res.msg)) return;
  111. this.detail = res.data;
  112. })
  113. },
  114. getlist(init = false) {
  115. let content = this.content;
  116. if (init) {
  117. content.pageNumber = 1;
  118. content.pageTotal = 1;
  119. }
  120. if (content.pageNumber > content.pageTotal) return;
  121. this.$Http.basic({
  122. "id": 20230816095902,
  123. content
  124. }).then(res => {
  125. console.log("告警日志", res)
  126. if (this.cutoff(res.msg)) return;
  127. fun && fun();
  128. content.pageNumber += 1;
  129. content.pageTotal = res.pageTotal;
  130. this.content = content;
  131. let list = res.data.map(v => {
  132. v.showValue = ""
  133. v.paramvalues.forEach(item => {
  134. v.showValue += `当前设备${item.paramname}值为${item.paramvalue},${item.symbol + item.eventvalue}时触发`
  135. })
  136. return v
  137. })
  138. this.list = res.pageNumber == 1 ? list : this.list.concat(list)
  139. this.empty = res.data.length == 0;
  140. })
  141. },
  142. dateRange(e, callback) {
  143. this.content.where.begindate = e[0];
  144. this.content.where.enddate = e[1];
  145. fun = callback;
  146. this.getlist(true);
  147. }
  148. },
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .detail {
  153. background: #fff;
  154. width: 355px;
  155. margin: 10px auto 0;
  156. border-radius: 4px;
  157. padding: 10px;
  158. box-sizing: border-box;
  159. .title {
  160. font-size: 16px;
  161. }
  162. .row,
  163. .time-row {
  164. font-size: 14px;
  165. line-height: 22px;
  166. margin-top: 4px;
  167. }
  168. .time-row {
  169. display: flex;
  170. .tag {
  171. padding: 0 6px;
  172. border-radius: 4px;
  173. margin-right: 6px;
  174. }
  175. .time {
  176. color: #052E5D;
  177. flex-wrap: bold;
  178. }
  179. }
  180. }
  181. .head {
  182. height: 40px;
  183. display: flex;
  184. justify-content: space-between;
  185. align-items: center;
  186. width: 355px;
  187. margin: 0 auto;
  188. box-sizing: border-box;
  189. padding: 0 10px;
  190. background: #052E5D;
  191. position: sticky;
  192. z-index: 9;
  193. .left {
  194. color: #fff;
  195. font-weight: bold;
  196. }
  197. }
  198. .item {
  199. width: 355px;
  200. padding: 10px;
  201. box-sizing: border-box;
  202. border-radius: 4px;
  203. margin: 0 auto 10px;
  204. background: #fff;
  205. .time {
  206. color: #333;
  207. flex-wrap: bold;
  208. }
  209. .row {
  210. color: #999;
  211. font-size: 12px;
  212. margin-top: 6px;
  213. }
  214. }
  215. </style>