equipmentConditionMonitoring.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. <template>
  2. <view>
  3. <u-navbar title="设备状态监测" title-color="#101010"></u-navbar>
  4. <u-select title="" v-model="tabsFrom.show1" :defaultValue="current2"
  5. :list="companyList" value-name="id" label-name="name"
  6. child-name="childList"
  7. mode="mutil-column-auto"
  8. @confirm="selector1confirm" >
  9. </u-select>
  10. <view class="dropdownMain" >
  11. <view class="dropdown" >
  12. <view class="dropdown-item" @click="tabsFrom.show1=true">
  13. <view class="text">
  14. {{device}}
  15. </view>
  16. <view class="item-icon">
  17. <u-icon name="arrow-down" color="#999999" v-if="show1==false"></u-icon>
  18. <u-icon name="arrow-up" color="#999999" v-else></u-icon>
  19. </view>
  20. </view>
  21. <view class="dropdown-item" @click="show3=true">
  22. <view class="text">
  23. {{typeName}}
  24. </view>
  25. <view class="icon">
  26. <u-icon name="arrow-down" color="#999999" v-if="show3==false"></u-icon>
  27. <u-icon name="arrow-up" color="#999999" v-else></u-icon>
  28. </view>
  29. </view>
  30. <view class="dropdown-item" @click="show2=true">
  31. <view class="text">
  32. {{statusName}}
  33. </view>
  34. <view class="icon">
  35. <u-icon name="arrow-down" color="#999999" v-if="show2==false"></u-icon>
  36. <u-icon name="arrow-up" color="#999999" v-else></u-icon>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <u-select v-model="show3" mode="single-column" :list="deviceStatusList" @confirm="deviceStatusChange"></u-select>
  42. <u-select v-model="show2" mode="single-column" :list="statusList" @confirm="statusChange"></u-select>
  43. <view class="main">
  44. <view class="item" v-for="(item,index) in deviceList" :key="index" @click="toElectronicMonitoring(item)">
  45. <view class="item-icon" v-if="item.classify == '1'">
  46. <image class="img" src="@/assets/img/energy1.svg" mode=""></image>
  47. </view>
  48. <view class="item-icon" v-if="item.classify == '2'">
  49. <image class="img" src="@/assets/img/transformer2.svg" mode=""></image>
  50. </view>
  51. <view class="item-icon" v-if="!item.classify ">
  52. <image class="img" src="@/assets/img/transformer2.svg" mode=""></image>
  53. </view>
  54. <view class="item-content">
  55. <view class="content1">
  56. <view class="name1">
  57. {{replaceLastTwoWords(item.name)}}
  58. </view>
  59. </view>
  60. <view class="content3">
  61. {{item.installationAddressSimple}}
  62. </view>
  63. <view class="content2">
  64. <view class="text" v-if="!deviceType">
  65. {{item.deviceTypeN}}
  66. </view>
  67. <view class="text" v-else >
  68. {{item.parkName}}
  69. </view>
  70. <view class="item-state">
  71. <view class="dot" :class="item.online ? 'on-line' : 'off-line'">
  72. </view>
  73. <view class="text" v-if="deviceType==1">
  74. {{item.online ? '在线' : ''}}
  75. </view>
  76. <view class="text" v-else >
  77. {{item.online ? '在线' : '离线'}}
  78. </view>
  79. <view class="more">
  80. <u-icon name="arrow-right" size="24" color="#acacac"></u-icon>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="content3" v-if="item.classify == '2'">
  85. <view class="state-item">
  86. <view class="state-title">
  87. 运行状态:
  88. </view>
  89. <view class="state-value" v-if="item.deviceStatus == '1'">
  90. 正常
  91. </view>
  92. <view class="state-value2" v-else>
  93. 异常
  94. </view>
  95. </view>
  96. <view class="state-item">
  97. <view class="state-title">
  98. 温度状态:
  99. </view>
  100. <view class="state-value" v-if="item.temperatureStatus == '1'">
  101. 正常
  102. </view>
  103. <view class="state-value2" v-else>
  104. 异常
  105. </view>
  106. </view>
  107. <view class="state-item">
  108. <view class="state-title">
  109. 烟感状态:
  110. </view>
  111. <view class="state-value" v-if="item.smokeStatus == '1'">
  112. 正常
  113. </view>
  114. <view class="state-value2" v-else>
  115. 异常
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <u-divider :isnone="deviceList.length==0" nonetext="暂无数据" border-color="#CFD2D5">已经到底了</u-divider>
  123. </view>
  124. </template>
  125. <script>
  126. import * as API from '@/apis/pagejs/index.js'
  127. import * as API_electricityMeter from '@/apis/pagejs/electricityMeter.js'
  128. import * as API_water from '@/apis/pagejs/water.js'
  129. export default {
  130. data() {
  131. return {
  132. companyList: [], // 商户
  133. merchantList1: [],
  134. merchantList2: [],
  135. deviceList: [],
  136. show1: false,
  137. show2: false,
  138. show3: false,
  139. typeName:"电表",
  140. deviceType:"",
  141. device: '全部设备',
  142. statusName: '全部状态',
  143. deviceTypeList: [],
  144. deviceStatusList: [{
  145. value: '',
  146. label: '电表'
  147. },
  148. {
  149. value: '1',
  150. label: '水表'
  151. },
  152. ],
  153. statusList: [{
  154. value: '',
  155. label: '全部状态'
  156. },
  157. {
  158. value: '1',
  159. label: '离线'
  160. },
  161. {
  162. value: '2',
  163. label: '温度异常'
  164. },
  165. {
  166. value: '3',
  167. label: '烟感异常'
  168. },
  169. {
  170. value: '4',
  171. label: '设备异常'
  172. }
  173. ],
  174. tabsFrom: {
  175. show1: false,
  176. show1Index: 0,
  177. show2Index: '',
  178. show2: false,
  179. show1Text: "全部类型",
  180. show2Text: "全部时间",
  181. },
  182. status: '',
  183. deviceType: '',
  184. companyId:"",
  185. pageIndex: 1,
  186. recordsTotal:0,
  187. utabsone:true,
  188. companyType:0,
  189. incomeExpenditureObj:{},
  190. opCompanyId: '',
  191. childList:[],
  192. companyListMain:[],
  193. current2:[0,0],
  194. childInfo:{},
  195. companyInfo:{},
  196. popShow: false,
  197. current: 0,
  198. }
  199. },
  200. computed:{
  201. childListName(){
  202. return this.childInfo.name;
  203. },
  204. },
  205. onLoad(op) {
  206. if(op.companyId){
  207. this.companyId=op.companyId
  208. this.opCompanyId=op.companyId
  209. }
  210. this.getCompanyInfoList();
  211. this.getDeviceStatusMonitoring();
  212. },
  213. onReady() {
  214. //this.getDeviceTypeList();
  215. },
  216. onReachBottom() {
  217. if (this.deviceList.length < this.recordsTotal) {
  218. this.myLoadmore();
  219. }
  220. },
  221. methods: {
  222. merchantChangeApi() {
  223. this.popShow=false
  224. //this.getList(true)
  225. this.getDeviceStatusMonitoring(1);
  226. },
  227. titleCk() {
  228. if(this.childList.length>1){
  229. this.tabsFrom.show1 = true
  230. }
  231. },
  232. selector1confirm(e) {
  233. //this.getHomePageKwh()
  234. var index = [e[0].i,e[1].i]
  235. console.log(e)
  236. this.companyId=e[1].value
  237. this.device=e[1].label
  238. this.current2=index
  239. //this.childInfo=this.childList[this.current2];
  240. uni.showLoading()
  241. this.merchantChangeApi()
  242. },
  243. change(index) {
  244. this.current = index;
  245. this.current2=0;
  246. this.childList=[]
  247. var company= this.merchantList1[index]
  248. if(company.id!=''){
  249. this.childList=company.childList;
  250. if(this.childList&&this.childList.length){
  251. this.companyId = this.childList[0].id;
  252. this.childInfo=this.childList[0]
  253. }else{
  254. this.childList=[]
  255. this.companyId =company.id
  256. this.childInfo=company
  257. }
  258. }else{
  259. this.companyId =''
  260. }
  261. this.companyInfo=company;
  262. this.merchantChangeApi()
  263. },
  264. merchantChange(item, index) {
  265. if(this.current==0){
  266. this.current=1;
  267. }
  268. var m = company;
  269. var n = this.merchantList1[this.current];
  270. this.merchantList1[this.current] = m;
  271. this.merchantList2[index] = n;
  272. //this.$forceUpdate()
  273. this.utabsone=false
  274. this.companyId = company.id;
  275. this.companyInfo=company
  276. if(company.id!=''){
  277. this.childList=company.childList;
  278. if(this.childList&&this.childList.length){
  279. this.companyId = this.childList[0].id;
  280. this.childInfo=this.childList[0]
  281. }else{
  282. this.childList=[]
  283. this.companyId =company.id
  284. this.childInfo=company
  285. }
  286. }else{
  287. this.companyId =''
  288. }
  289. this.merchantChangeApi()
  290. this.popShow = false;
  291. },
  292. getCompanyInfoList() {
  293. this.companyKwhList = [];
  294. API.deviceCompanyList().then((response) => {
  295. var list = response.data.companyInfoList;
  296. this.companyListMain=response.data.companyInfoList;
  297. // if(list.length==1&&list[0].childList&&list[0].childList.length){
  298. // list=list[0].childList
  299. // }
  300. for(var i in list){
  301. var obj=list[i]
  302. if(!list.childList){
  303. list.childList=[]
  304. }
  305. list[i].childList.unshift({
  306. id:obj.id,
  307. name:obj.name,
  308. sp:1
  309. })
  310. }
  311. list.unshift({
  312. id:'',
  313. name:"全部",
  314. childList:[
  315. {
  316. id:'',
  317. name:"全部设备"
  318. }
  319. ]
  320. })
  321. for(var i in list){
  322. var obj=list[i]
  323. if(this.opCompanyId){
  324. for(var j in list[i].childList){
  325. var item=list[i].childList[j]
  326. if(item.id==this.opCompanyId){
  327. //this.current2=[i,j]
  328. this.device=item.name
  329. }
  330. }
  331. }
  332. }
  333. this.companyList = list;
  334. }).catch(error => {
  335. uni.showToast({
  336. title: error,
  337. icon: "none"
  338. })
  339. })
  340. },
  341. myLoadmore() {
  342. this.pageIndex += 1;
  343. this.getDeviceStatusMonitoring();
  344. },
  345. //设备查询
  346. deviceChange(e) {
  347. // console.log(e);
  348. this.deviceType = e[0].value;
  349. this.device = e[0].label;
  350. this.getDeviceStatusMonitoring(1);
  351. },
  352. deviceStatusChange(e){
  353. this.typeName =e[0].label;
  354. this.deviceType= e[0].value;
  355. this.getDeviceStatusMonitoring(1);
  356. },
  357. //状态查询
  358. statusChange(e) {
  359. // console.log(e);
  360. this.status = e[0].value;
  361. this.statusName = e[0].label;
  362. this.getDeviceStatusMonitoring(1);
  363. },
  364. getDeviceStatusMonitoringApi(bl) {
  365. uni.showLoading({
  366. title: "加载中",
  367. mask: true,
  368. })
  369. if (bl) {
  370. this.deviceList = [];
  371. this.pageIndex = 1;
  372. }
  373. API.deviceStatusMonitoring({
  374. pageIndex: this.pageIndex,
  375. pageSize: 20,
  376. deviceType: this.deviceType,
  377. status: this.status,
  378. companyId:this.companyId,
  379. classify:"1"
  380. }).then((response) => {
  381. uni.hideLoading();
  382. this.deviceList = [
  383. ...this.deviceList,
  384. ...response.data.data
  385. ];
  386. this.recordsTotal = response.data.recordsTotal;
  387. }).catch(error => {
  388. uni.showToast({
  389. title: error,
  390. icon: "none"
  391. })
  392. })
  393. },
  394. getDeviceStatusMonitoringWaterApi(bl) {
  395. uni.showLoading({
  396. title: "加载中",
  397. mask: true,
  398. })
  399. if (bl) {
  400. this.deviceList = [];
  401. this.pageIndex = 1;
  402. }
  403. API_water.deviceStatusMonitoring({
  404. pageIndex: this.pageIndex,
  405. pageSize: 20,
  406. deviceType: this.deviceType,
  407. status: this.status,
  408. companyId:this.companyId,
  409. classify:"1"
  410. }).then((response) => {
  411. uni.hideLoading();
  412. this.deviceList = [
  413. ...this.deviceList,
  414. ...response.data.data
  415. ];
  416. this.recordsTotal = response.data.recordsTotal;
  417. }).catch(error => {
  418. uni.showToast({
  419. title: error,
  420. icon: "none"
  421. })
  422. })
  423. },
  424. getDeviceStatusMonitoring(bl) {
  425. if(this.deviceType=="1"){
  426. this.getDeviceStatusMonitoringWaterApi(bl)
  427. }else{
  428. this.getDeviceStatusMonitoringApi(bl)
  429. }
  430. },
  431. //查询设备类型list
  432. getDeviceTypeList() {
  433. uni.showLoading({
  434. title: "加载中",
  435. mask: true,
  436. })
  437. API_electricityMeter.findByName({
  438. name: '设备类型'
  439. }).then((res) => {
  440. uni.hideLoading();
  441. var list = [];
  442. list = res.data.map(item => {
  443. return {
  444. label: item.name,
  445. value: item.value
  446. }
  447. })
  448. list.unshift({
  449. label: '全部设备',
  450. value: ''
  451. })
  452. this.deviceTypeList = list;
  453. }).catch(error => {
  454. uni.showToast({
  455. title: error,
  456. icon: "none"
  457. })
  458. })
  459. },
  460. toElectronicMonitoring(item) {
  461. var key=""
  462. if(this.deviceType=="1"){
  463. key="Water"
  464. }
  465. uni.navigateTo({
  466. url: '/pages/equipmentDataMonitoring/electronicMonitoring'+key+'?id=' + item.id + '&name=' + item.name +
  467. '&companyId=' + item.companyId
  468. })
  469. }
  470. }
  471. }
  472. </script>
  473. <style lang="scss" scoped>
  474. page{
  475. //padding-bottom: 100px;
  476. }
  477. .dropdownMain {
  478. position: sticky;
  479. top: 88rpx;
  480. background-color: #fff;
  481. z-index: 999;
  482. }
  483. .dropdown {
  484. padding: 18rpx 46rpx;
  485. display: flex;
  486. border-bottom: 1px solid rgba(245, 245, 245, 1);
  487. .dropdown-item {
  488. width: 50%;
  489. text-align: center;
  490. height: 60rpx;
  491. line-height: 60rpx;
  492. display: flex;
  493. align-items: center;
  494. justify-content: center;
  495. .text {
  496. max-width: 80%;
  497. white-space: nowrap;
  498. overflow: hidden;
  499. text-overflow: ellipsis;
  500. }
  501. }
  502. }
  503. .main {
  504. background-color: #fff;
  505. padding: 0 32rpx;
  506. .item:last-of-type {
  507. border: none;
  508. }
  509. .item {
  510. padding: 32rpx 0;
  511. display: flex;
  512. border-bottom: 1px solid rgba(245, 245, 245, 1);
  513. .item-icon {
  514. width: 72rpx;
  515. height: 72rpx;
  516. border-radius: 4px;
  517. background-color: rgba(219, 234, 255, 1);
  518. display: flex;
  519. align-items: center;
  520. justify-content: center;
  521. .img {
  522. width: 48rpx;
  523. height: 48rpx;
  524. }
  525. }
  526. .item-content {
  527. flex: 1;
  528. margin-left: 16rpx;
  529. .content3 {
  530. color: rgba(119, 119, 119, 1);
  531. font-size: 24rpx;
  532. }
  533. .content1 {
  534. display: flex;
  535. align-items: center;
  536. .name1 {
  537. color: rgba(51, 51, 51, 1);
  538. font-weight: bold;
  539. white-space: nowrap;
  540. overflow: hidden;
  541. text-overflow: ellipsis;
  542. }
  543. .name2 {
  544. color: rgba(119, 119, 119, 1);
  545. font-size: 24rpx;
  546. margin-left: 16rpx;
  547. }
  548. }
  549. .content2 {
  550. margin-top: 4rpx;
  551. display: flex;
  552. align-items: center;
  553. justify-content: space-between;
  554. .text {
  555. color: rgba(119, 119, 119, 1);
  556. font-size: 24rpx;
  557. }
  558. }
  559. .content3 {
  560. margin-top: 8rpx;
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. padding-right: 16rpx;
  565. .state-item {
  566. display: flex;
  567. color: rgba(51, 51, 51, 1);
  568. font-size: 24rpx;
  569. .state-value {
  570. color: #00B962;
  571. }
  572. .state-value2 {
  573. color: #FF6923;
  574. }
  575. }
  576. }
  577. }
  578. }
  579. .item-state {
  580. margin-left: auto;
  581. display: flex;
  582. align-items: center;
  583. .dot {
  584. width: 16rpx;
  585. height: 16rpx;
  586. border-radius: 999px;
  587. }
  588. .text {
  589. margin: 0 8rpx;
  590. color: rgba(51, 51, 51, 1);
  591. font-size: 24rpx;
  592. }
  593. .off-line {
  594. background-color: rgba(255, 123, 0, 1);
  595. }
  596. .on-line {
  597. background-color: rgba(0, 185, 98, 1);
  598. }
  599. }
  600. }
  601. .tabs-box {
  602. background-color: #fff;
  603. display: flex;
  604. align-items: center;
  605. padding-right: 32rpx;
  606. justify-content: space-between;
  607. border-bottom: 1px solid rgba(232, 232, 232, 1);
  608. .tabs {
  609. width: 97%;
  610. }
  611. .more{
  612. padding-right: 12rpx;
  613. }
  614. .icon {
  615. margin-left: auto;
  616. margin-right: 24rpx;
  617. }
  618. }
  619. .tabs-len-1{
  620. }
  621. .tabs-len-2{
  622. /deep/.u-tab-item {
  623. // max-width: 39% !important;
  624. // flex: none !important;
  625. }
  626. }
  627. .tabs-len-3{
  628. /deep/.u-tab-item {
  629. max-width: 39% !important;
  630. flex: none !important;
  631. }
  632. }
  633. .tabs-len-4{
  634. /deep/.u-tab-item {
  635. max-width: 26% !important;
  636. flex: none !important;
  637. }
  638. }
  639. /deep/.u-tab-item:first-child {
  640. width: 20% !important;
  641. flex: none !important;
  642. }
  643. .popup-tabs {
  644. background-color: #fff;
  645. display: flex;
  646. align-items: center;
  647. justify-content: space-between;
  648. padding-right: 32rpx;
  649. color: rgba(51, 51, 51, 1);
  650. font-size: 32rpx;
  651. padding-top: 32rpx;
  652. .tabs {
  653. width: 88%;
  654. }
  655. }
  656. .tabs-options {
  657. display: flex;
  658. padding: 64rpx 32rpx 0;
  659. flex-wrap: wrap;
  660. .item {
  661. width: 25%;
  662. margin-bottom: 40rpx;
  663. }
  664. }
  665. .electronicMonitoring-title{
  666. display: flex;
  667. align-items: center;
  668. padding: 0px 32rpx;
  669. justify-content: space-between;
  670. height: 120rpx;
  671. font-size: 36rpx;
  672. background-color: rgba(22,119,255,1);
  673. color:#fff;
  674. }
  675. </style>