equipmentConditionMonitoring.vue 16 KB

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