equipmentConditionMonitoring.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <view>
  3. <u-navbar title="设备状态监测" title-color="#101010"></u-navbar>
  4. <view class="dropdown">
  5. <view class="dropdown-item" @click="show1=true">
  6. <view class="text">
  7. {{device}}
  8. </view>
  9. <view class="item-icon">
  10. <u-icon name="arrow-down" color="#999999" v-if="show1==false"></u-icon>
  11. <u-icon name="arrow-up" color="#999999" v-else></u-icon>
  12. </view>
  13. </view>
  14. <view class="dropdown-item" @click="show2=true">
  15. <view class="text">
  16. {{statusName}}
  17. </view>
  18. <view class="icon">
  19. <u-icon name="arrow-down" color="#999999" v-if="show2==false"></u-icon>
  20. <u-icon name="arrow-up" color="#999999" v-else></u-icon>
  21. </view>
  22. </view>
  23. </view>
  24. <u-select v-model="show1" mode="single-column" :list="deviceTypeList" @confirm="deviceChange"></u-select>
  25. <u-select v-model="show2" mode="single-column" :list="statusList" @confirm="statusChange"></u-select>
  26. <view class="main">
  27. <view class="item" v-for="(item,index) in deviceList" :key="index" @click="toElectronicMonitoring(item)">
  28. <view class="item-icon" v-if="item.classify == '1'">
  29. <image class="img" src="@/assets/img/energy1.svg" mode=""></image>
  30. </view>
  31. <view class="item-icon" v-if="item.classify == '2'">
  32. <image class="img" src="@/assets/img/transformer2.svg" mode=""></image>
  33. </view>
  34. <view class="item-content">
  35. <view class="content1">
  36. <view class="name1">
  37. {{replaceLastTwoWords(item.name)}}
  38. </view>
  39. <view class="name2">
  40. {{item.installationAddressSimple}}
  41. </view>
  42. </view>
  43. <view class="content2">
  44. <view class="text">
  45. {{item.deviceTypeN}}
  46. </view>
  47. <view class="item-state">
  48. <view class="dot" :class="item.online ? 'on-line' : 'off-line'">
  49. </view>
  50. <view class="text">
  51. {{item.online ? '在线' : '离线'}}
  52. </view>
  53. <view class="more">
  54. <u-icon name="arrow-right" size="24" color="#acacac"></u-icon>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="content3" v-if="item.classify == '2'">
  59. <view class="state-item">
  60. <view class="state-title">
  61. 运行状态:
  62. </view>
  63. <view class="state-value" v-if="item.deviceStatus == '1'">
  64. 正常
  65. </view>
  66. <view class="state-value2" v-else>
  67. 异常
  68. </view>
  69. </view>
  70. <view class="state-item">
  71. <view class="state-title">
  72. 温度状态:
  73. </view>
  74. <view class="state-value" v-if="item.temperatureStatus == '1'">
  75. 正常
  76. </view>
  77. <view class="state-value2" v-else>
  78. 异常
  79. </view>
  80. </view>
  81. <view class="state-item">
  82. <view class="state-title">
  83. 烟感状态:
  84. </view>
  85. <view class="state-value" v-if="item.smokeStatus == '1'">
  86. 正常
  87. </view>
  88. <view class="state-value2" v-else>
  89. 异常
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <u-divider :isnone="deviceList.length==0" nonetext="暂无数据" border-color="#CFD2D5">已经到底了</u-divider>
  97. </view>
  98. </template>
  99. <script>
  100. import * as API from '@/apis/pagejs/index.js'
  101. import * as API_electricityMeter from '@/apis/pagejs/electricityMeter.js'
  102. export default {
  103. data() {
  104. return {
  105. deviceList: [],
  106. show1: false,
  107. show2: false,
  108. device: '全部设备',
  109. statusName: '全部状态',
  110. deviceTypeList: [],
  111. statusList: [{
  112. value: '',
  113. label: '全部状态'
  114. },
  115. {
  116. value: '1',
  117. label: '离线'
  118. },
  119. {
  120. value: '2',
  121. label: '温度异常'
  122. },
  123. {
  124. value: '3',
  125. label: '烟感异常'
  126. },
  127. {
  128. value: '4',
  129. label: '设备异常'
  130. }
  131. ],
  132. status: '',
  133. deviceType: '',
  134. companyId:"",
  135. pageIndex: 1,
  136. recordsTotal:0,
  137. }
  138. },
  139. onLoad(op) {
  140. if(op.companyId){
  141. this.companyId=op.companyId
  142. }
  143. },
  144. onReady() {
  145. this.getDeviceStatusMonitoring();
  146. this.getDeviceTypeList();
  147. },
  148. onReachBottom() {
  149. if (this.deviceList.length < this.recordsTotal) {
  150. this.myLoadmore();
  151. }
  152. },
  153. methods: {
  154. myLoadmore() {
  155. this.pageIndex += 1;
  156. this.getDeviceStatusMonitoring();
  157. },
  158. //设备查询
  159. deviceChange(e) {
  160. // console.log(e);
  161. this.deviceType = e[0].value;
  162. this.device = e[0].label;
  163. this.getDeviceStatusMonitoring(1);
  164. },
  165. //状态查询
  166. statusChange(e) {
  167. // console.log(e);
  168. this.status = e[0].value;
  169. this.statusName = e[0].label;
  170. this.getDeviceStatusMonitoring(1);
  171. },
  172. getDeviceStatusMonitoring(bl) {
  173. uni.showLoading({
  174. title: "加载中",
  175. mask: true,
  176. })
  177. if (bl) {
  178. this.deviceList = [];
  179. this.pageIndex = 1;
  180. }
  181. API.deviceStatusMonitoring({
  182. pageIndex: this.pageIndex,
  183. pageSize: 20,
  184. deviceType: this.deviceType,
  185. status: this.status,
  186. companyId:this.companyId,
  187. classify:"1"
  188. }).then((response) => {
  189. uni.hideLoading();
  190. this.deviceList = [
  191. ...this.deviceList,
  192. ...response.data.data
  193. ];
  194. this.recordsTotal = response.data.recordsTotal;
  195. }).catch(error => {
  196. uni.showToast({
  197. title: error,
  198. icon: "none"
  199. })
  200. })
  201. },
  202. //查询设备类型list
  203. getDeviceTypeList() {
  204. uni.showLoading({
  205. title: "加载中",
  206. mask: true,
  207. })
  208. API_electricityMeter.findByName({
  209. name: '设备类型'
  210. }).then((res) => {
  211. uni.hideLoading();
  212. var list = [];
  213. list = res.data.map(item => {
  214. return {
  215. label: item.name,
  216. value: item.value
  217. }
  218. })
  219. list.unshift({
  220. label: '全部设备',
  221. value: ''
  222. })
  223. this.deviceTypeList = list;
  224. }).catch(error => {
  225. uni.showToast({
  226. title: error,
  227. icon: "none"
  228. })
  229. })
  230. },
  231. toElectronicMonitoring(item) {
  232. uni.navigateTo({
  233. url: '/pages/equipmentDataMonitoring/electronicMonitoring?id=' + item.id + '&name=' + item.name +
  234. '&companyId=' + item.companyId
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss" scoped>
  241. page{
  242. //padding-bottom: 100px;
  243. }
  244. .dropdown {
  245. background-color: #fff;
  246. position: sticky;
  247. top: 88rpx;
  248. z-index: 999;
  249. padding: 18rpx 46rpx;
  250. display: flex;
  251. border-bottom: 1px solid rgba(245, 245, 245, 1);
  252. .dropdown-item {
  253. width: 50%;
  254. text-align: center;
  255. height: 60rpx;
  256. line-height: 60rpx;
  257. display: flex;
  258. align-items: center;
  259. justify-content: center;
  260. .text {
  261. max-width: 80%;
  262. white-space: nowrap;
  263. overflow: hidden;
  264. text-overflow: ellipsis;
  265. }
  266. }
  267. }
  268. .main {
  269. background-color: #fff;
  270. padding: 0 32rpx;
  271. .item:last-of-type {
  272. border: none;
  273. }
  274. .item {
  275. padding: 32rpx 0;
  276. display: flex;
  277. border-bottom: 1px solid rgba(245, 245, 245, 1);
  278. .item-icon {
  279. width: 72rpx;
  280. height: 72rpx;
  281. border-radius: 4px;
  282. background-color: rgba(219, 234, 255, 1);
  283. display: flex;
  284. align-items: center;
  285. justify-content: center;
  286. .img {
  287. width: 48rpx;
  288. height: 48rpx;
  289. }
  290. }
  291. .item-content {
  292. flex: 1;
  293. margin-left: 16rpx;
  294. .content1 {
  295. display: flex;
  296. align-items: center;
  297. .name1 {
  298. color: rgba(51, 51, 51, 1);
  299. font-weight: bold;
  300. max-width: 50%;
  301. white-space: nowrap;
  302. overflow: hidden;
  303. text-overflow: ellipsis;
  304. }
  305. .name2 {
  306. color: rgba(119, 119, 119, 1);
  307. font-size: 24rpx;
  308. margin-left: 16rpx;
  309. }
  310. }
  311. .content2 {
  312. margin-top: 4rpx;
  313. display: flex;
  314. align-items: center;
  315. justify-content: space-between;
  316. .text {
  317. color: rgba(119, 119, 119, 1);
  318. font-size: 24rpx;
  319. }
  320. }
  321. .content3 {
  322. margin-top: 8rpx;
  323. display: flex;
  324. align-items: center;
  325. justify-content: space-between;
  326. padding-right: 16rpx;
  327. .state-item {
  328. display: flex;
  329. color: rgba(51, 51, 51, 1);
  330. font-size: 24rpx;
  331. .state-value {
  332. color: #00B962;
  333. }
  334. .state-value2 {
  335. color: #FF6923;
  336. }
  337. }
  338. }
  339. }
  340. }
  341. .item-state {
  342. margin-left: auto;
  343. display: flex;
  344. align-items: center;
  345. .dot {
  346. width: 16rpx;
  347. height: 16rpx;
  348. border-radius: 999px;
  349. }
  350. .text {
  351. margin: 0 8rpx;
  352. color: rgba(51, 51, 51, 1);
  353. font-size: 24rpx;
  354. }
  355. .off-line {
  356. background-color: rgba(255, 123, 0, 1);
  357. }
  358. .on-line {
  359. background-color: rgba(0, 185, 98, 1);
  360. }
  361. }
  362. }
  363. </style>