dataMonitoring-list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view>
  3. <view class="navbar-c">
  4. <view class="back" @click="toStatistics">
  5. <u-icon name="arrow-left" color="#101010" size="36"></u-icon>
  6. </view>
  7. <view class="title">
  8. 设备数据监测<image class="img" src="@/assets/img/refresh-line.svg"></image>
  9. </view>
  10. <view class="right" @click="toDataMonitoringMap" v-if="false">
  11. <image class="img" src="@/assets/img/riLine-road-map-line.svg" mode=""></image>地图
  12. </view>
  13. </view>
  14. <view class="dropdown">
  15. <view class="dropdown-item" @click="show1=true">
  16. {{device}} <u-icon name="arrow-down" color="#999999"></u-icon>
  17. </view>
  18. <view class="dropdown-item" @click="show2=true">
  19. {{state}} <u-icon name="arrow-down" color="#999999"></u-icon>
  20. </view>
  21. </view>
  22. <u-select v-model="show1" mode="single-column" :list="selectDeviceList" @confirm="deviceChange"></u-select>
  23. <u-select v-model="show2" mode="single-column" :list="stateList" @confirm="stateChange"></u-select>
  24. <view class="main">
  25. <view class="item" v-for="(item,index) in deviceList" :key="index" @click="toElectronicMonitoring(item)">
  26. <view class="title">
  27. <view class="icon-box">
  28. <image class="img" src="@/assets/img/transformer1.svg" mode=""></image>
  29. </view>
  30. <view class="equipment">
  31. <view class="name1">
  32. {{replaceLastTwoWords(item.name)}}
  33. </view>
  34. <view class="name2">
  35. {{item.installationAddressSimple}}
  36. </view>
  37. </view>
  38. <!-- 状态 -->
  39. <view class="state">
  40. <!-- <view class="state1" v-if="item.deviceStatus == '1'">
  41. <view class="icon"></view>
  42. <view class="text">
  43. 正常运行
  44. </view>
  45. </view>
  46. <view class="state1" v-else>
  47. <view class="icon icon2"></view>
  48. <view class="text">
  49. 设备异常
  50. </view>
  51. </view> -->
  52. <view class="state1" v-if="item.temperatureStatus == '1'">
  53. <view class="icon"></view>
  54. <view class="text">
  55. 温度正常
  56. </view>
  57. </view>
  58. <view class="state1" v-else>
  59. <view class="icon icon2"></view>
  60. <view class="text">
  61. 温度异常
  62. </view>
  63. </view>
  64. <view class="state1" v-if="item.smokeStatus == '1'">
  65. <view class="icon"></view>
  66. <view class="text">
  67. 烟感正常
  68. </view>
  69. </view>
  70. <view class="state1" v-else>
  71. <view class="icon icon2"></view>
  72. <view class="text">
  73. 烟感异常
  74. </view>
  75. </view>
  76. <view class="state1" v-if="item.online">
  77. <view class="icon icon4"></view>
  78. <view class="text">
  79. 设备在线
  80. </view>
  81. </view>
  82. <view class="state1" v-else>
  83. <view class="icon icon3"></view>
  84. <view class="text">
  85. 设备离线
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 箭头 -->
  90. <view class="more">
  91. <u-icon name="arrow-right" color="#acacac" size="24"></u-icon>
  92. </view>
  93. </view>
  94. <!-- 设备信息 -->
  95. <view class="infos" v-if="item.remoteMonitorRecord != null">
  96. <view class="infos-item">
  97. <view class="item-title">
  98. 当前电流:
  99. </view>
  100. <view class="item-value">
  101. {{item.remoteMonitorRecord.dcaTotal.toFixed(2)}}A
  102. </view>
  103. </view>
  104. <view class="infos-item">
  105. <view class="item-title">
  106. 当前电压:
  107. </view>
  108. <view class="item-value">
  109. {{item.remoteMonitorRecord.dcvTop.toFixed(2)}}V
  110. </view>
  111. </view>
  112. <view class="infos-item">
  113. <view class="item-title">
  114. 当前温度:
  115. </view>
  116. <view class="item-value">
  117. {{item.remoteMonitorRecord.temperatureTop}}°C
  118. </view>
  119. </view>
  120. <view class="infos-item">
  121. <view class="item-title">
  122. 当前功率:
  123. </view>
  124. <view class="item-value">
  125. {{item.remoteMonitorRecord.totalPower.toFixed(2)}}kW
  126. </view>
  127. </view>
  128. <view class="infos-item">
  129. <view class="item-title">
  130. 当前功率因数:
  131. </view>
  132. <view class="item-value">
  133. {{item.remoteMonitorRecord.dcfTop.toFixed(2)}}
  134. </view>
  135. </view>
  136. <view class="infos-item">
  137. <view class="item-title">
  138. 平均功率因数:
  139. </view>
  140. <view class="item-value">
  141. {{item.remoteMonitorRecord.averPowerFactor.toFixed(2)}}
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. <u-divider :isnone="deviceList.length==0" nonetext="暂无数据" border-color="#CFD2D5">已经到底了</u-divider>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. import * as API from '@/apis/pagejs/index.js'
  152. export default {
  153. data() {
  154. return {
  155. show2: false, // 状态选择
  156. state: '全部状态',
  157. stateList: [
  158. {label: '全部状态', value: ''},
  159. {label: '设备正常', value: '0'},
  160. {label: '设备离线', value: '1'},
  161. {label: '温度异常', value: '2'},
  162. {label: '烟感异常', value: '3'},
  163. {label: '设备异常', value: '4'}
  164. ],
  165. show1: false, // 设备选择
  166. device: '全部设备',
  167. selectDeviceList: [],
  168. deviceList: [],
  169. companyId: '',
  170. status: '',
  171. pageIndex: 1,
  172. recordsTotal: 0,
  173. value1: 0,
  174. value2: 0,
  175. options1: [{
  176. label: '荆鹏集团',
  177. value: 1,
  178. },
  179. {
  180. label: '青少年宫',
  181. value: 2,
  182. },
  183. {
  184. label: '荆州院子',
  185. value: 3,
  186. },
  187. ],
  188. options2: [{
  189. label: '设备离线',
  190. value: 1,
  191. },
  192. {
  193. label: '温度异常',
  194. value: 2,
  195. },
  196. {
  197. label: '电压异常',
  198. value: 3,
  199. },
  200. {
  201. label: '功率因数异常',
  202. value: 4,
  203. },
  204. ],
  205. }
  206. },
  207. onReady() {
  208. this.getList();
  209. this.getAlarmConfiguration();
  210. },
  211. onReachBottom() {
  212. if (this.deviceList.length < this.recordsTotal) {
  213. this.myLoadmore();
  214. }
  215. },
  216. methods: {
  217. // 异常查询条件
  218. getAlarmConfiguration() {
  219. uni.showLoading({
  220. title: "加载中",
  221. mask: true,
  222. })
  223. API.alarmConfiguration().then((response) => {
  224. uni.hideLoading();
  225. var list2 = [];
  226. if(response.data.companyInfoList && response.data.companyInfoList.length != 0) {
  227. list2 = response.data.companyInfoList.map(item => {
  228. return {
  229. label: item.name,
  230. value: item.id
  231. }
  232. });
  233. }
  234. list2.unshift({
  235. value: '',
  236. label: '全部设备'
  237. });
  238. this.selectDeviceList = list2;
  239. }).catch(error => {
  240. uni.showToast({
  241. title: error,
  242. icon: "none"
  243. })
  244. })
  245. },
  246. // 状态查询
  247. stateChange(e) {
  248. console.log(e);
  249. this.status = e[0].value;
  250. this.state = e[0].label;
  251. this.getList(true);
  252. },
  253. // 设备查询
  254. deviceChange(e) {
  255. console.log(e);
  256. this.companyId = e[0].value;
  257. this.device = e[0].label;
  258. this.getList(true);
  259. },
  260. myLoadmore() {
  261. this.pageIndex += 1;
  262. this.getList();
  263. },
  264. getList(bl) {
  265. uni.showLoading({
  266. title: "加载中",
  267. mask: true,
  268. })
  269. if (bl) {
  270. this.deviceList = [];
  271. this.pageIndex = 1;
  272. }
  273. var data = {
  274. pageIndex: this.pageIndex,
  275. pageSize: 5,
  276. companyId: this.companyId,
  277. status: this.status
  278. };
  279. API.homePageDeviceData(data).then((res) => {
  280. uni.hideLoading()
  281. this.deviceList = [
  282. ...this.deviceList,
  283. ...res.data.data
  284. ];
  285. this.recordsTotal = res.data.recordsTotal;
  286. }).catch(error => {
  287. uni.showToast({
  288. title: error,
  289. icon: "none"
  290. })
  291. })
  292. },
  293. toStatistics() {
  294. uni.navigateBack()
  295. },
  296. toDataMonitoringMap() {
  297. uni.navigateTo({
  298. url: '/pages/equipmentDataMonitoring/dataMonitoring-map'
  299. })
  300. },
  301. toElectronicMonitoring(item) {
  302. uni.navigateTo({
  303. url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item.name
  304. + '&companyId=' + item.companyId
  305. })
  306. }
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. .dropdown {
  312. background-color: #fff;
  313. position: sticky;
  314. top: 88rpx;
  315. z-index: 999;
  316. padding: 18rpx 46rpx;
  317. display: flex;
  318. border-bottom: 1px solid rgba(245, 245, 245, 1);
  319. .dropdown-item{
  320. width: 50%;
  321. text-align: center;
  322. height: 60rpx;
  323. line-height: 60rpx;
  324. }
  325. }
  326. .back {
  327. z-index: 999;
  328. width: 200rpx;
  329. }
  330. .slot {
  331. display: flex;
  332. align-items: center;
  333. .img {
  334. width: 32rpx;
  335. height: 32rpx;
  336. margin-right: 4rpx;
  337. }
  338. }
  339. .dropdown {
  340. background-color: #fff;
  341. position: sticky;
  342. top: 87rpx;
  343. z-index: 999;
  344. }
  345. .main {
  346. background-color: #fff;
  347. .item {
  348. border-bottom: 1px solid rgba(245, 245, 245, 1);
  349. padding: 32rpx 32rpx 16rpx 32rpx;
  350. .title {
  351. display: flex;
  352. align-items: flex-start;
  353. .icon-box {
  354. width: 72rpx;
  355. height: 72rpx;
  356. border-radius: 4px;
  357. display: flex;
  358. align-items: center;
  359. justify-content: center;
  360. background-color: rgba(219, 234, 255, 1);
  361. .img {
  362. width: 48rpx;
  363. height: 48rpx;
  364. }
  365. }
  366. .equipment {
  367. margin-left: 16rpx;
  368. width: 35%;
  369. .name1 {
  370. color: rgba(51, 51, 51, 1);
  371. white-space: nowrap;
  372. overflow: hidden;
  373. text-overflow: ellipsis;
  374. }
  375. .name2 {
  376. color: rgba(119, 119, 119, 1);
  377. font-size: 24rpx;
  378. margin-top: 4rpx;
  379. white-space: nowrap;
  380. overflow: hidden;
  381. text-overflow: ellipsis;
  382. }
  383. }
  384. // 状态
  385. .state {
  386. display: flex;
  387. align-items: center;
  388. flex-wrap: wrap;
  389. justify-content: flex-end;
  390. margin-left: auto;
  391. flex: 1;
  392. .state1 {
  393. display: flex;
  394. align-items: center;
  395. margin-left: 24rpx;
  396. .icon {
  397. width: 16rpx;
  398. height: 16rpx;
  399. border-radius: 99px;
  400. background-color: rgba(22, 119, 255, 1);
  401. margin-right: 8rpx;
  402. }
  403. .icon2 {
  404. background-color: #FF4F3F;
  405. }
  406. .icon3 {
  407. background-color: #C2C2C2;
  408. }
  409. .icon4{
  410. background-color: rgba(0,185,98,1);
  411. }
  412. }
  413. }
  414. .more{
  415. margin-left: 8rpx;
  416. }
  417. }
  418. // 设备信息
  419. .infos {
  420. margin-top: 32rpx;
  421. padding-left: 88rpx;
  422. display: flex;
  423. align-items: center;
  424. justify-content: space-between;
  425. flex-wrap: wrap;
  426. font-size: 24rpx;
  427. .infos-item {
  428. width: 48%;
  429. display: flex;
  430. margin-bottom: 16rpx;
  431. color: rgba(51,51,51,1);
  432. font-size: 24rpx;
  433. .item-value{
  434. font-weight: bold;
  435. }
  436. .warning {
  437. color: rgba(255, 61, 0, 1);
  438. }
  439. }
  440. }
  441. }
  442. }
  443. </style>