abnormalAlarmDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <view>
  3. <u-select v-model="orderByShow" @confirm="orderconfirm" :default-value="[orderByIndex.value]" :list="orderByList" ></u-select>
  4. <u-navbar title="异常告警详情" title-color="#101010"></u-navbar>
  5. <view class="main">
  6. <view class="item">
  7. <view class="title">
  8. <!-- 告警单号:A100001 -->
  9. 告警类型
  10. </view>
  11. <view class="value">
  12. <text class="reason">{{alarmConfig.name}}</text>
  13. </view>
  14. </view>
  15. <view class="item">
  16. <view class="title">
  17. 告警设备
  18. </view>
  19. <view class="value equipment">
  20. {{companyInfo.name}}-{{remoteMonitorMeter.name}}
  21. </view>
  22. </view>
  23. <view class="item">
  24. <view class="title">
  25. 告警内容
  26. </view>
  27. <view class="value warning">
  28. {{alarmRecord.content}}
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="title">
  33. 地址
  34. </view>
  35. <view class="value ">
  36. {{remoteMonitorMeter.installationAddress}}
  37. </view>
  38. </view>
  39. <view class="item">
  40. <view class="title">
  41. 告警时间
  42. </view>
  43. <view class="value">
  44. {{alarmRecord.createTime}}
  45. </view>
  46. </view>
  47. <view v-if="alarmConfig.code=='TPU'&&childDcMap&&childDcMap.length">
  48. <view class="item">
  49. <view class="title">
  50. 查询数量
  51. </view>
  52. <view >
  53. <span v-for="(item,i) in queryNumSz"
  54. @click="queryNum=item,getAlarmRecordTPUDetails(id,remoteMonitorMeter.id)"
  55. :class="{
  56. queryNum:1,
  57. queryNumIndex:item==queryNum
  58. }">
  59. {{item}}
  60. </span>
  61. </view>
  62. </view>
  63. <view class="item">
  64. <table class="border-table ">
  65. <tr>
  66. <td>设备名称</td>
  67. <td v-for="(item,i) in keySz" :key="i" :class="'keySz'+i">
  68. {{item.name}}
  69. </td>
  70. </tr>
  71. <tr v-for="(item1,j) in childDcMap" :key="i" :class="{
  72. childDcMap:j==0
  73. }">
  74. <td >{{item1.meterName}}</td>
  75. <td v-for="(item,i) in keySz" :key="i" :class="'keySz'+i">
  76. {{item1[item.value]}}
  77. </td>
  78. </tr>
  79. </table>
  80. </view>
  81. </view>
  82. <!-- 异常记录 -->
  83. <view class="record-chat" v-if="false">
  84. <view class="title">
  85. 异常记录
  86. </view>
  87. <view class="chat-box">
  88. <view class="date">
  89. 2月4日温度监控
  90. </view>
  91. <view class="chat">
  92. <view id="lineEcharts" style="min-height:400rpx;">
  93. </view>
  94. <!-- <image class="img" src="@/assets/img/recordChat.png" mode=""></image> -->
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 底部 -->
  100. <view class="bottom" v-if="false">
  101. <button class="close" @click="closeShow=true">关闭警报</button>
  102. <button class="create" @click="gotoUrl('/pages/workOrderManagement/faultReport')">创建工单</button>
  103. </view>
  104. <!-- 关闭原因 -->
  105. <u-popup v-model="closeShow" mode="bottom" closeable close-icon-size="24" close-icon-color="#101010"
  106. border-radius="24">
  107. <view class="close-reason">
  108. <view class="title">
  109. 请选择关闭原因:
  110. </view>
  111. <view class="reason-content">
  112. <view class="reason-item" v-for="(item,index) in reasonList" :key="index">
  113. <view class="item-title">
  114. {{item}}
  115. </view>
  116. <view class="item-value" @click="reasonClick(item,index)">
  117. <label class="radio">
  118. <radio name="reason" :checked="index === current" /><text></text>
  119. </label>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="button-box">
  124. <button class="think" @click="closeShow=false">我在想想</button>
  125. <button class="confirm" @click="closeWorkOrder">确认关闭</button>
  126. </view>
  127. </view>
  128. </u-popup>
  129. </view>
  130. </template>
  131. <script>
  132. import * as echarts from 'echarts';
  133. import * as API from '@/apis/pagejs/index.js'
  134. export default {
  135. data() {
  136. return {
  137. companyInfo: {}, //企业
  138. remoteMonitorRecord: {}, //设备详细
  139. remoteMonitorMeter: {}, //设备
  140. alarmRecord: {}, //异常详细
  141. alarmConfig: {}, //异常详细
  142. id: '', //异常id
  143. closeShow: false,
  144. childDcMap:[],
  145. reasonList: ['错误告警','设备已自动恢复','不需要上门解决','平台移桩,可忽视','其他'],
  146. current: 0,
  147. myLineChart: null,
  148. orderByShow:false,
  149. orderByIndex:{},
  150. orderByList:[
  151. {
  152. value:"0",label:"按A与B的差值排序"
  153. },{
  154. value:"1",label:"按B与C的差值排序"
  155. },{
  156. value:"2",label:"按C与A的差值排序"
  157. },
  158. ],
  159. queryNum:5,
  160. queryNumSz:[5,8,10,15],
  161. keySz:[],
  162. }
  163. },
  164. onLoad(op) {
  165. if(op.id) {
  166. this.id = op.id;
  167. this.getAlarmRecordDetails(this.id);
  168. }
  169. this.orderByIndex=this.orderByList[0]
  170. },
  171. onReady() {
  172. // this.getLineCharts();
  173. },
  174. methods: {
  175. childDcMapsort(){
  176. },
  177. orderconfirm(e){
  178. console.log(e)
  179. this.orderByIndex=e[0]
  180. this.childDcMapsort()
  181. },
  182. getAlarmRecordTPUDetails(id,meterId) {
  183. uni.showLoading({
  184. title: "加载中",
  185. mask: true,
  186. })
  187. API.alarmRecordTPUDetails({
  188. meterId:meterId,
  189. id:id,
  190. queryNum:this.queryNum,
  191. }).then((response) => {
  192. uni.hideLoading();
  193. this.childDcMap=response.data.childDcMap;
  194. var sz=response.data.sort;
  195. this.keySz=[]
  196. for(var i in sz){
  197. var obj=sz[i].split(',')
  198. this.keySz.push({
  199. name:obj[0],
  200. value:obj[1]
  201. })
  202. }
  203. this.childDcMapsort()
  204. }).catch(error => {
  205. uni.showToast({
  206. title: error,
  207. icon: "none"
  208. })
  209. })
  210. },
  211. getAlarmRecordDetails(id) {
  212. uni.showLoading({
  213. title: "加载中",
  214. mask: true,
  215. })
  216. API.alarmRecordDetails(id).then((response) => {
  217. uni.hideLoading();
  218. this.companyInfo = response.data.companyInfo;
  219. this.remoteMonitorRecord = response.data.remoteMonitorRecord;
  220. this.remoteMonitorMeter = response.data.meter;
  221. this.alarmRecord = response.data.alarmRecord;
  222. this.alarmConfig = response.data.alarmConfig;
  223. if(this.alarmConfig.code=='TPU'){
  224. // this.childDcMap=response.data.childDcMap;
  225. this.getAlarmRecordTPUDetails(id,this.remoteMonitorMeter.id)
  226. }
  227. }).catch(error => {
  228. uni.showToast({
  229. title: error,
  230. icon: "none"
  231. })
  232. })
  233. },
  234. getLineCharts() {
  235. if (!this.myLineChart) {
  236. this.myLineChart = echarts.init(document.getElementById('lineEcharts'), null, {
  237. width: uni.upx2px(686),
  238. height: uni.upx2px(400)
  239. });
  240. }
  241. this.myLineChart.clear();
  242. var data1 = ['0-2点', '3-4点', '5-6点', '7-8点', '9-10点', '11-12点', '13-14点', '15-16点',
  243. '17-18点', '19-20点', '21-22点', '23-24点'
  244. ];
  245. var data2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  246. var option = {
  247. tooltip: {
  248. trigger: 'axis',
  249. axisPointer: {
  250. type: 'shadow'
  251. }
  252. },
  253. legend: {
  254. show: false
  255. },
  256. grid: {
  257. top: '6%',
  258. left: '3%',
  259. right: '8%',
  260. bottom: '8%',
  261. containLabel: true
  262. },
  263. xAxis: {
  264. type: 'category',
  265. data: data1,
  266. axisLabel: {
  267. rotate: 40,
  268. interval: 0,
  269. textStyle: {
  270. color: "#333"
  271. }
  272. },
  273. },
  274. yAxis: {
  275. type: 'value',
  276. axisLabel: {
  277. formatter: '{value} °C'
  278. }
  279. },
  280. series: [{
  281. name: '温度',
  282. type: 'line',
  283. data: data2,
  284. itemStyle: {
  285. color: '#F39423'
  286. }
  287. }]
  288. };
  289. this.myLineChart.setOption(option);
  290. },
  291. reasonClick(item,index) {
  292. this.current = index;
  293. },
  294. closeWorkOrder() {
  295. uni.navigateTo({
  296. url: '/pages/workOrderManagement/workOrderDetails'
  297. })
  298. this.closeShow = false;
  299. }
  300. }
  301. }
  302. </script>
  303. <style lang="scss" scoped>
  304. .main {
  305. background-color: #fff;
  306. .item {
  307. display: flex;
  308. align-items: center;
  309. justify-content: space-between;
  310. padding: 28rpx 32rpx;
  311. border-bottom: 1px solid rgba(242, 242, 242, 1);
  312. .title {
  313. color: rgba(51, 51, 51, 1);
  314. white-space: pre;
  315. padding-right: 20rpx;
  316. }
  317. .value {
  318. color: rgb(16, 16, 16);
  319. font-size: 32rpx;
  320. .reason {
  321. display: inline-block;
  322. padding:0 20rpx;
  323. line-height: 48rpx;
  324. border-radius: 4px;
  325. color: rgba(255, 61, 0, 1);
  326. border: 1px solid rgba(255, 61, 0, 1);
  327. font-size: 24rpx;
  328. text-align: center;
  329. }
  330. }
  331. .equipment {
  332. font-weight: bold;
  333. }
  334. .warning {
  335. color: rgba(255, 61, 0, 1);
  336. }
  337. }
  338. // 异常记录
  339. .record-chat {
  340. padding: 40rpx 32rpx;
  341. .title {
  342. color: rgba(51, 51, 51, 1);
  343. font-size: 32rpx;
  344. }
  345. .chat-box {
  346. padding: 24rpx 0;
  347. margin-top: 24rpx;
  348. border-radius: 8px;
  349. background: linear-gradient(180deg, rgba(255, 243, 208, 1) 0%, rgba(208, 236, 236, 0) 100%);
  350. .date {
  351. padding: 0 40rpx;
  352. margin-bottom: 24rpx;
  353. color: rgba(16, 16, 16, 1);
  354. font-weight: bold;
  355. }
  356. .img {
  357. width: 100%;
  358. height: 400rpx;
  359. }
  360. }
  361. }
  362. }
  363. // 底部
  364. .bottom {
  365. background-color: #fff;
  366. position: fixed;
  367. bottom: 0;
  368. left: 0;
  369. right: 0;
  370. display: flex;
  371. padding: 20rpx 32rpx;
  372. justify-content: space-between;
  373. .close {
  374. width: 328rpx;
  375. line-height: 80rpx;
  376. border-radius: 4px;
  377. background-color: rgba(222, 225, 228, 1);
  378. color: rgba(51, 51, 51, 1);
  379. font-size: 32rpx;
  380. }
  381. .create {
  382. width: 328rpx;
  383. line-height: 80rpx;
  384. border-radius: 4px;
  385. background-color: rgba(22, 119, 255, 1);
  386. color: rgba(255, 255, 255, 1);
  387. font-size: 32rpx;
  388. }
  389. }
  390. //关闭原因
  391. .close-reason{
  392. padding: 32rpx;
  393. .title{
  394. color: rgba(16,16,16,1);
  395. font-size: 36rpx;
  396. font-weight: bold;
  397. }
  398. .reason-content{
  399. margin-top: 60rpx;
  400. .reason-item{
  401. display: flex;
  402. align-items: center;
  403. justify-content: space-between;
  404. margin-bottom: 56rpx;
  405. .item-title{
  406. color: rgba(16,16,16,1);
  407. font-size: 32rpx;
  408. }
  409. }
  410. }
  411. .button-box{
  412. display: flex;
  413. .think{
  414. width: 328rpx;
  415. line-height: 80rpx;
  416. font-size: 32rpx;
  417. border-radius: 4px;
  418. background-color: rgba(222,225,228,1);
  419. color: rgba(51,51,51,1);
  420. }
  421. .confirm{
  422. width: 328rpx;
  423. line-height: 80rpx;
  424. font-size: 32rpx;
  425. border-radius: 4px;
  426. background-color: rgba(255,68,68,1);
  427. color: rgba(255,255,255,1);
  428. }
  429. }
  430. }
  431. .table1,.border-table{
  432. margin: 8rpx 0;
  433. width: 100%;
  434. border-collapse: collapse;
  435. td{
  436. border: 1px solid #e7e7e7;
  437. text-align: end;
  438. padding: 16rpx 16rpx;
  439. }
  440. tr{
  441. background-color:#f5f5f6
  442. }
  443. tr{
  444. td:first-child{
  445. text-align: start;
  446. min-width: 20%;
  447. max-width: 30%;
  448. }
  449. td:last-child{
  450. white-space: pre;
  451. }
  452. }
  453. .tr1{
  454. text-align: end;
  455. font-weight: bold;
  456. }
  457. tr:nth-child(even) {
  458. background-color: #fff;
  459. }
  460. }
  461. .keySz0,.keySz1{
  462. font-weight: bold;
  463. background-color: #f8f0a6;
  464. }
  465. .childDcMap td{
  466. background-color: #1677FF !important ;
  467. color:#fff !important ;
  468. }
  469. .queryNum{
  470. border: 1px solid #9E9E9E;
  471. padding: 4rpx 16rpx;
  472. margin: 8rpx ;
  473. }
  474. .queryNumIndex{
  475. color: #fff;
  476. background: #1677FF;
  477. }
  478. </style>