abnormalAlarmDetails.vue 10 KB

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