abnormalAlarmDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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. if(sz.length==0){
  196. sz=["A相,dcAA","B相,dcBa","C相,dcCa"]
  197. }
  198. this.keySz=[]
  199. for(var i in sz){
  200. var obj=sz[i].split(',')
  201. this.keySz.push({
  202. name:obj[0],
  203. value:obj[1]
  204. })
  205. }
  206. this.childDcMapsort()
  207. }).catch(error => {
  208. uni.showToast({
  209. title: error,
  210. icon: "none"
  211. })
  212. })
  213. },
  214. getAlarmRecordDetails(id) {
  215. uni.showLoading({
  216. title: "加载中",
  217. mask: true,
  218. })
  219. API.alarmRecordDetails(id).then((response) => {
  220. uni.hideLoading();
  221. this.companyInfo = response.data.companyInfo;
  222. this.remoteMonitorRecord = response.data.remoteMonitorRecord;
  223. this.remoteMonitorMeter = response.data.meter;
  224. this.alarmRecord = response.data.alarmRecord;
  225. this.alarmConfig = response.data.alarmConfig;
  226. if(this.alarmConfig.code=='TPU'){
  227. // this.childDcMap=response.data.childDcMap;
  228. this.getAlarmRecordTPUDetails(id,this.remoteMonitorMeter.id)
  229. }
  230. }).catch(error => {
  231. uni.showToast({
  232. title: error,
  233. icon: "none"
  234. })
  235. })
  236. },
  237. getLineCharts() {
  238. if (!this.myLineChart) {
  239. this.myLineChart = echarts.init(document.getElementById('lineEcharts'), null, {
  240. width: uni.upx2px(686),
  241. height: uni.upx2px(400)
  242. });
  243. }
  244. this.myLineChart.clear();
  245. var data1 = ['0-2点', '3-4点', '5-6点', '7-8点', '9-10点', '11-12点', '13-14点', '15-16点',
  246. '17-18点', '19-20点', '21-22点', '23-24点'
  247. ];
  248. var data2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  249. var option = {
  250. tooltip: {
  251. trigger: 'axis',
  252. axisPointer: {
  253. type: 'shadow'
  254. }
  255. },
  256. legend: {
  257. show: false
  258. },
  259. grid: {
  260. top: '6%',
  261. left: '3%',
  262. right: '8%',
  263. bottom: '8%',
  264. containLabel: true
  265. },
  266. xAxis: {
  267. type: 'category',
  268. data: data1,
  269. axisLabel: {
  270. rotate: 40,
  271. interval: 0,
  272. textStyle: {
  273. color: "#333"
  274. }
  275. },
  276. },
  277. yAxis: {
  278. type: 'value',
  279. axisLabel: {
  280. formatter: '{value} °C'
  281. }
  282. },
  283. series: [{
  284. name: '温度',
  285. type: 'line',
  286. data: data2,
  287. itemStyle: {
  288. color: '#F39423'
  289. }
  290. }]
  291. };
  292. this.myLineChart.setOption(option);
  293. },
  294. reasonClick(item,index) {
  295. this.current = index;
  296. },
  297. closeWorkOrder() {
  298. uni.navigateTo({
  299. url: '/pages/workOrderManagement/workOrderDetails'
  300. })
  301. this.closeShow = false;
  302. }
  303. }
  304. }
  305. </script>
  306. <style lang="scss" scoped>
  307. .main {
  308. background-color: #fff;
  309. .item {
  310. display: flex;
  311. align-items: center;
  312. justify-content: space-between;
  313. padding: 28rpx 32rpx;
  314. border-bottom: 1px solid rgba(242, 242, 242, 1);
  315. .title {
  316. color: rgba(51, 51, 51, 1);
  317. white-space: pre;
  318. padding-right: 20rpx;
  319. }
  320. .value {
  321. color: rgb(16, 16, 16);
  322. font-size: 32rpx;
  323. .reason {
  324. display: inline-block;
  325. padding:0 20rpx;
  326. line-height: 48rpx;
  327. border-radius: 4px;
  328. color: rgba(255, 61, 0, 1);
  329. border: 1px solid rgba(255, 61, 0, 1);
  330. font-size: 24rpx;
  331. text-align: center;
  332. }
  333. }
  334. .equipment {
  335. font-weight: bold;
  336. }
  337. .warning {
  338. color: rgba(255, 61, 0, 1);
  339. }
  340. }
  341. // 异常记录
  342. .record-chat {
  343. padding: 40rpx 32rpx;
  344. .title {
  345. color: rgba(51, 51, 51, 1);
  346. font-size: 32rpx;
  347. }
  348. .chat-box {
  349. padding: 24rpx 0;
  350. margin-top: 24rpx;
  351. border-radius: 8px;
  352. background: linear-gradient(180deg, rgba(255, 243, 208, 1) 0%, rgba(208, 236, 236, 0) 100%);
  353. .date {
  354. padding: 0 40rpx;
  355. margin-bottom: 24rpx;
  356. color: rgba(16, 16, 16, 1);
  357. font-weight: bold;
  358. }
  359. .img {
  360. width: 100%;
  361. height: 400rpx;
  362. }
  363. }
  364. }
  365. }
  366. // 底部
  367. .bottom {
  368. background-color: #fff;
  369. position: fixed;
  370. bottom: 0;
  371. left: 0;
  372. right: 0;
  373. display: flex;
  374. padding: 20rpx 32rpx;
  375. justify-content: space-between;
  376. .close {
  377. width: 328rpx;
  378. line-height: 80rpx;
  379. border-radius: 4px;
  380. background-color: rgba(222, 225, 228, 1);
  381. color: rgba(51, 51, 51, 1);
  382. font-size: 32rpx;
  383. }
  384. .create {
  385. width: 328rpx;
  386. line-height: 80rpx;
  387. border-radius: 4px;
  388. background-color: rgba(22, 119, 255, 1);
  389. color: rgba(255, 255, 255, 1);
  390. font-size: 32rpx;
  391. }
  392. }
  393. //关闭原因
  394. .close-reason{
  395. padding: 32rpx;
  396. .title{
  397. color: rgba(16,16,16,1);
  398. font-size: 36rpx;
  399. font-weight: bold;
  400. }
  401. .reason-content{
  402. margin-top: 60rpx;
  403. .reason-item{
  404. display: flex;
  405. align-items: center;
  406. justify-content: space-between;
  407. margin-bottom: 56rpx;
  408. .item-title{
  409. color: rgba(16,16,16,1);
  410. font-size: 32rpx;
  411. }
  412. }
  413. }
  414. .button-box{
  415. display: flex;
  416. .think{
  417. width: 328rpx;
  418. line-height: 80rpx;
  419. font-size: 32rpx;
  420. border-radius: 4px;
  421. background-color: rgba(222,225,228,1);
  422. color: rgba(51,51,51,1);
  423. }
  424. .confirm{
  425. width: 328rpx;
  426. line-height: 80rpx;
  427. font-size: 32rpx;
  428. border-radius: 4px;
  429. background-color: rgba(255,68,68,1);
  430. color: rgba(255,255,255,1);
  431. }
  432. }
  433. }
  434. .table1,.border-table{
  435. margin: 8rpx 0;
  436. width: 100%;
  437. border-collapse: collapse;
  438. td{
  439. border: 1px solid #e7e7e7;
  440. text-align: end;
  441. padding: 16rpx 16rpx;
  442. }
  443. tr{
  444. background-color:#f5f5f6
  445. }
  446. tr{
  447. td:first-child{
  448. text-align: start;
  449. min-width: 20%;
  450. max-width: 30%;
  451. }
  452. td:last-child{
  453. white-space: pre;
  454. }
  455. }
  456. .tr1{
  457. text-align: end;
  458. font-weight: bold;
  459. }
  460. tr:nth-child(even) {
  461. background-color: #fff;
  462. }
  463. }
  464. .keySz0,.keySz1{
  465. font-weight: bold;
  466. background-color: #f8f0a6;
  467. }
  468. .childDcMap td{
  469. background-color: #1677FF !important ;
  470. color:#fff !important ;
  471. }
  472. .queryNum{
  473. border: 1px solid #9E9E9E;
  474. padding: 4rpx 16rpx;
  475. margin: 8rpx ;
  476. }
  477. .queryNumIndex{
  478. color: #fff;
  479. background: #1677FF;
  480. }
  481. </style>