abnormalAlarmDetails.vue 11 KB

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