Commit efb727a596b5694c5dfbd33d3d8ba9ffbbf799af

Authored by 周铨
1 parent 769a42a0

优化接口异常的情况

1 -.tableData_main{width:180%;overflow:auto;border-bottom:1px solid #B0C8FE}.tableData_main .table_head{background:#DCE7FF;border:1px solid #B0C8FE;border-radius:6rpx 6rpx 0 0;height:72rpx;line-height:72rpx;display:flex}.tableData_main .head_col,.tableData_main .content_col{font-family:PingFangSC-Regular;font-size:28rpx;color:#323241;text-align:left;font-weight:400;padding-left:24rpx;white-space:nowrap}.tableData_main .head_one{min-width:300rpx}.tableData_main .head_two{min-width:250rpx}.tableData_main .head_three{min-width:250rpx}.tableData_main .head_four{min-width:250rpx}.tableData_main .swiper_container{height:350rpx}.tableData_main .table_item{display:flex;font-family:PingFangSC-Regular;font-size:24rpx;color:#323241;text-align:center;font-weight:400;background:#F5F6FD;border:1rpx solid #B0C8FE;height:72rpx;line-height:72rpx} 1 +.tableData_main{width:180%;overflow:auto;border-bottom:1px solid #B0C8FE}.tableData_main .table_head{background:#DCE7FF;border:1px solid #B0C8FE;border-radius:6rpx 6rpx 0 0;height:72rpx;line-height:72rpx;display:flex}.tableData_main .table_empty_data{height:350rpx;display:flex;align-items:center;justify-content:center;font-family:PingFangSC-Regular;font-size:28rpx;color:#323241;text-align:left;font-weight:400}.tableData_main .head_col,.tableData_main .content_col{font-family:PingFangSC-Regular;font-size:28rpx;color:#323241;text-align:left;font-weight:400;padding-left:24rpx;white-space:nowrap}.tableData_main .head_one{min-width:300rpx}.tableData_main .head_two{min-width:250rpx}.tableData_main .head_three{min-width:250rpx}.tableData_main .head_four{min-width:250rpx}.tableData_main .swiper_container{height:350rpx}.tableData_main .table_item{display:flex;font-family:PingFangSC-Regular;font-size:24rpx;color:#323241;text-align:center;font-weight:400;background:#F5F6FD;border:1rpx solid #B0C8FE;height:72rpx;line-height:72rpx}
@@ -12,6 +12,18 @@ @@ -12,6 +12,18 @@
12 display: flex; 12 display: flex;
13 } 13 }
14 14
  15 + .table_empty_data {
  16 + height: 350rpx;
  17 + display: flex;
  18 + align-items: center;
  19 + justify-content: center;
  20 + font-family: PingFangSC-Regular;
  21 + font-size: 14*2rpx;
  22 + color: #323241;
  23 + text-align: left;
  24 + font-weight: 400;
  25 + }
  26 +
15 .head_col, 27 .head_col,
16 .content_col { 28 .content_col {
17 font-family: PingFangSC-Regular; 29 font-family: PingFangSC-Regular;
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <text class="head_col head_four">{{tableHeader.three}}</text> 6 <text class="head_col head_four">{{tableHeader.three}}</text>
7 </view> 7 </view>
8 <swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000" display-multiple-items="{{tableList.length>5?5:tableList.length}}"> 8 <swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000" display-multiple-items="{{tableList.length>5?5:tableList.length}}">
9 - <view wx:for="{{tableList}}" class="container_swiper" wx:key="index" wx:for-item="item" wx:for-index="index"> 9 + <view wx:if="{{tableList&&tableList.length>0}}" wx:for="{{tableList}}" class="container_swiper" wx:key="index" wx:for-item="item" wx:for-index="index">
10 <swiper-item> 10 <swiper-item>
11 <view class="table_item"> 11 <view class="table_item">
12 <view class="content_col head_one"> 12 <view class="content_col head_one">
@@ -24,5 +24,10 @@ @@ -24,5 +24,10 @@
24 </view> 24 </view>
25 </swiper-item> 25 </swiper-item>
26 </view> 26 </view>
  27 +
  28 + <view class="table_empty_data" wx:if="tableList.length === 0">
  29 + 暂无数据
  30 +
  31 + </view>
27 </swiper> 32 </swiper>
28 </view> 33 </view>
@@ -13,6 +13,18 @@ @@ -13,6 +13,18 @@
13 display: flex; 13 display: flex;
14 } 14 }
15 15
  16 +.tableData_main .table_empty_data {
  17 + height: 350rpx;
  18 + display: flex;
  19 + align-items: center;
  20 + justify-content: center;
  21 + font-family: PingFangSC-Regular;
  22 + font-size: 28rpx;
  23 + color: #323241;
  24 + text-align: left;
  25 + font-weight: 400;
  26 +}
  27 +
16 .tableData_main .head_col, 28 .tableData_main .head_col,
17 .tableData_main .content_col { 29 .tableData_main .content_col {
18 font-family: PingFangSC-Regular; 30 font-family: PingFangSC-Regular;
@@ -3,6 +3,7 @@ import Toast from '@vant/weapp/toast/toast'; @@ -3,6 +3,7 @@ import Toast from '@vant/weapp/toast/toast';
3 import { API_CONST } from "./../../api/smartElectric"; 3 import { API_CONST } from "./../../api/smartElectric";
4 import { getUnitEvent, getCardEvent } from './../../utils/util' 4 import { getUnitEvent, getCardEvent } from './../../utils/util'
5 import { HTTPService as HTTP } from "./../../services/HTTPService"; 5 import { HTTPService as HTTP } from "./../../services/HTTPService";
  6 +import { messageFileProps } from 'miniprogram/miniprogram_npm/@vant/weapp/uploader/shared';
6 Page({ 7 Page({
7 8
8 /** 9 /**
@@ -348,7 +349,7 @@ Page({ @@ -348,7 +349,7 @@ Page({
348 Toast.loading({ 349 Toast.loading({
349 message: '加载中...', 350 message: '加载中...',
350 forbidClick: true, 351 forbidClick: true,
351 - mask:true, 352 + mask: true,
352 duration: 0, // 持续展示 toast 353 duration: 0, // 持续展示 toast
353 }); 354 });
354 HTTP.POST({ 355 HTTP.POST({
@@ -359,147 +360,291 @@ Page({ @@ -359,147 +360,291 @@ Page({
359 }).then((data: any) => { 360 }).then((data: any) => {
360 Toast.clear() 361 Toast.clear()
361 console.log(data, '-----------datat') 362 console.log(data, '-----------datat')
362 - let PV = data.data.PV // 光伏  
363 - let BMS = data.data.BMS//储能  
364 - let EM = data.data.EM // 电能表---电网  
365 - let CP = data.data.CP // 充电桩  
366 - let PCS = data.data.PCS // PCS--风电  
367 - const deviceDataListNew: any = [  
368 - {  
369 - type: '光伏',  
370 - imgUrl: "./../../img/device_photovoltaic.png",  
371 - dayNumName: "日发电量",  
372 - dayNum: PV.PV23,  
373 - unit: "kWh",  
374 - totalNum: PV.PV28,  
375 - totalNumName: "总发电量"  
376 - },  
377 - {  
378 - type: '储能',  
379 - imgUrl: "./../../img/device_energyStorage.png",  
380 - dayNumName: "日发电量",  
381 - dayNum: BMS.BMS34,  
382 - unit: "kWh",  
383 - totalNum: BMS.BMS35,  
384 - totalNumName: "放发电量"  
385 - },  
386 - {  
387 - type: '电能表',  
388 - imgUrl: "./../../img/device_electricEnergy.png",  
389 - dayNumName: "总有功功率",  
390 - dayNum: EM.EM19,  
391 - unit: "kWh",  
392 - totalNum: "0",  
393 - totalNumName: "总无功功率"  
394 - },  
395 - {  
396 - type: '充电桩',  
397 - imgUrl: "./../../img/device_chargeStation.png",  
398 - dayNumName: "总有功功率",  
399 - dayNum: "0",  
400 - unit: "kWh",  
401 - totalNum: "0",  
402 - totalNumName: "总无功功率"  
403 - },  
404 - {  
405 - type: '负载',  
406 - imgUrl: "./../../img/device_load.png",  
407 - dayNumName: "总有功功率",  
408 - dayNum: "0",  
409 - unit: "kWh",  
410 - totalNum: "0",  
411 - totalNumName: "总无功功率"  
412 - },  
413 - {  
414 - type: '风电',  
415 - imgUrl: "./../../img/device_windPower.png",  
416 - dayNumName: "在线状态",  
417 - dayNum: "0",  
418 - unit: "",  
419 - totalNum: "0",  
420 - totalNumName: "故障状态"  
421 - },  
422 - ]  
423 - const overallDataListNew: any = [  
424 - {  
425 - type: '光伏',  
426 - oneLabelName: "母线电压",  
427 - oneLabelNum: PV.PV29,  
428 - unitOne: "V",  
429 - unitTwo: "Hz",  
430 - unitThree: "kW",  
431 - twoLabelNum: PV.PV30,  
432 - twoLabelName: "PV电网频率",  
433 - threeLabelName: "PV负载功率",  
434 - threeLabelNum: PV.PV22  
435 - },  
436 - {  
437 - type: '风电',//暂时假数据  
438 - oneLabelName: "总有功功率",  
439 - oneLabelNum: "",  
440 - // unitOne: "kW",  
441 - // unitTwo: "kW",  
442 - // unitThree: "A",  
443 - // unitFour: "A",  
444 - // unitFive: "A",  
445 - twoLabelNum: "",  
446 - twoLabelName: "总无功功率",  
447 - threeLabelName: "A相电流",  
448 - threeLabelNum: '',  
449 - fourLabelName: "B相电流",  
450 - fourLabelNum: '',  
451 - fiveLabelName: "C相电流",  
452 - fiveLabelNum: '',  
453 - },  
454 - {  
455 - type: '电网',  
456 - oneLabelName: "A相有功功率",  
457 - oneLabelNum: EM.EM07,  
458 - unitOne: "kW",  
459 - unitTwo: "kW",  
460 - unitThree: "kW",  
461 - twoLabelNum: EM.EM08,  
462 - twoLabelName: "B相有功功率",  
463 - threeLabelName: "C相有功功率",  
464 - threeLabelNum: EM.EM09,  
465 - },  
466 - {  
467 - type: '储能',  
468 - oneLabelName: "SOC",  
469 - oneLabelNum: BMS.BMS03,  
470 - unitOne: "%",  
471 - unitTwo: "A",  
472 - unitThree: "V",  
473 - twoLabelNum: BMS.BMS02,  
474 - twoLabelName: "总电流",  
475 - threeLabelName: "总电压",  
476 - threeLabelNum: BMS.BMS01  
477 - },  
478 - {  
479 - type: '充电桩',  
480 - oneLabelName: "A枪电压",  
481 - oneLabelNum: CP.CP13,  
482 - unitOne: "V",  
483 - unitTwo: "%",  
484 - unitThree: "V",  
485 - unitFour: "%",  
486 - twoLabelNum: CP.CP10,  
487 - twoLabelName: "A枪SOC",  
488 - threeLabelName: "B枪电压",  
489 - threeLabelNum: CP.CP25,  
490 - fourLabelName: "B枪SOC",  
491 - fourLabelNum: CP.CP22,  
492 - },  
493 - ] 363 + if (data.success) {
494 364
  365 + let PV = data.data.PV // 光伏
  366 + let BMS = data.data.BMS//储能
  367 + let EM = data.data.EM // 电能表---电网
  368 + let CP = data.data.CP // 充电桩
  369 + let PCS = data.data.PCS // PCS--风电
  370 + const deviceDataListNew: any = [
  371 + {
  372 + type: '光伏',
  373 + imgUrl: "./../../img/device_photovoltaic.png",
  374 + dayNumName: "日发电量",
  375 + dayNum: PV.PV23,
  376 + unit: "kWh",
  377 + totalNum: PV.PV28,
  378 + totalNumName: "总发电量"
  379 + },
  380 + {
  381 + type: '储能',
  382 + imgUrl: "./../../img/device_energyStorage.png",
  383 + dayNumName: "日发电量",
  384 + dayNum: BMS.BMS34,
  385 + unit: "kWh",
  386 + totalNum: BMS.BMS35,
  387 + totalNumName: "放发电量"
  388 + },
  389 + {
  390 + type: '电能表',
  391 + imgUrl: "./../../img/device_electricEnergy.png",
  392 + dayNumName: "总有功功率",
  393 + dayNum: EM.EM19,
  394 + unit: "kWh",
  395 + totalNum: "0",
  396 + totalNumName: "总无功功率"
  397 + },
  398 + {
  399 + type: '充电桩',
  400 + imgUrl: "./../../img/device_chargeStation.png",
  401 + dayNumName: "总有功功率",
  402 + dayNum: "0",
  403 + unit: "kWh",
  404 + totalNum: "0",
  405 + totalNumName: "总无功功率"
  406 + },
  407 + {
  408 + type: '负载',
  409 + imgUrl: "./../../img/device_load.png",
  410 + dayNumName: "总有功功率",
  411 + dayNum: "0",
  412 + unit: "kWh",
  413 + totalNum: "0",
  414 + totalNumName: "总无功功率"
  415 + },
  416 + {
  417 + type: '风电',
  418 + imgUrl: "./../../img/device_windPower.png",
  419 + dayNumName: "在线状态",
  420 + dayNum: "0",
  421 + unit: "",
  422 + totalNum: "0",
  423 + totalNumName: "故障状态"
  424 + },
  425 + ]
  426 + const overallDataListNew: any = [
  427 + {
  428 + type: '光伏',
  429 + oneLabelName: "母线电压",
  430 + oneLabelNum: PV.PV29,
  431 + unitOne: "V",
  432 + unitTwo: "Hz",
  433 + unitThree: "kW",
  434 + twoLabelNum: PV.PV30,
  435 + twoLabelName: "PV电网频率",
  436 + threeLabelName: "PV负载功率",
  437 + threeLabelNum: PV.PV22
  438 + },
  439 + {
  440 + type: '风电',//暂时假数据
  441 + oneLabelName: "总有功功率",
  442 + oneLabelNum: "",
  443 + // unitOne: "kW",
  444 + // unitTwo: "kW",
  445 + // unitThree: "A",
  446 + // unitFour: "A",
  447 + // unitFive: "A",
  448 + twoLabelNum: "",
  449 + twoLabelName: "总无功功率",
  450 + threeLabelName: "A相电流",
  451 + threeLabelNum: '',
  452 + fourLabelName: "B相电流",
  453 + fourLabelNum: '',
  454 + fiveLabelName: "C相电流",
  455 + fiveLabelNum: '',
  456 + },
  457 + {
  458 + type: '电网',
  459 + oneLabelName: "A相有功功率",
  460 + oneLabelNum: EM.EM07,
  461 + unitOne: "kW",
  462 + unitTwo: "kW",
  463 + unitThree: "kW",
  464 + twoLabelNum: EM.EM08,
  465 + twoLabelName: "B相有功功率",
  466 + threeLabelName: "C相有功功率",
  467 + threeLabelNum: EM.EM09,
  468 + },
  469 + {
  470 + type: '储能',
  471 + oneLabelName: "SOC",
  472 + oneLabelNum: BMS.BMS03,
  473 + unitOne: "%",
  474 + unitTwo: "A",
  475 + unitThree: "V",
  476 + twoLabelNum: BMS.BMS02,
  477 + twoLabelName: "总电流",
  478 + threeLabelName: "总电压",
  479 + threeLabelNum: BMS.BMS01
  480 + },
  481 + {
  482 + type: '充电桩',
  483 + oneLabelName: "A枪电压",
  484 + oneLabelNum: CP.CP13,
  485 + unitOne: "V",
  486 + unitTwo: "%",
  487 + unitThree: "V",
  488 + unitFour: "%",
  489 + twoLabelNum: CP.CP10,
  490 + twoLabelName: "A枪SOC",
  491 + threeLabelName: "B枪电压",
  492 + threeLabelNum: CP.CP25,
  493 + fourLabelName: "B枪SOC",
  494 + fourLabelNum: CP.CP22,
  495 + },
  496 + ]
495 497
496 - this.setData({  
497 - allData: data.data,  
498 - deviceDataList: deviceDataListNew,  
499 - overallDataList: overallDataListNew  
500 - })  
501 - const app = getApp();  
502 - app.globalData.allData = data.data; 498 +
  499 + this.setData({
  500 + allData: data.data,
  501 + deviceDataList: deviceDataListNew,
  502 + overallDataList: overallDataListNew
  503 + })
  504 + const app = getApp();
  505 + app.globalData.allData = data.data;
  506 + } else {
  507 + const deviceDataListNew: any = [
  508 + {
  509 + type: '光伏',
  510 + imgUrl: "./../../img/device_photovoltaic.png",
  511 + dayNumName: "日发电量",
  512 + dayNum: "0",
  513 + unit: "kWh",
  514 + totalNum: "0",
  515 + totalNumName: "总发电量"
  516 + },
  517 + {
  518 + type: '储能',
  519 + imgUrl: "./../../img/device_energyStorage.png",
  520 + dayNumName: "日发电量",
  521 + dayNum: "0",
  522 + unit: "kWh",
  523 + totalNum: "0",
  524 + totalNumName: "放发电量"
  525 + },
  526 + {
  527 + type: '电能表',
  528 + imgUrl: "./../../img/device_electricEnergy.png",
  529 + dayNumName: "总有功功率",
  530 + dayNum: "0",
  531 + unit: "kWh",
  532 + totalNum: "0",
  533 + totalNumName: "总无功功率"
  534 + },
  535 + {
  536 + type: '充电桩',
  537 + imgUrl: "./../../img/device_chargeStation.png",
  538 + dayNumName: "总有功功率",
  539 + dayNum: "0",
  540 + unit: "kWh",
  541 + totalNum: "0",
  542 + totalNumName: "总无功功率"
  543 + },
  544 + {
  545 + type: '负载',
  546 + imgUrl: "./../../img/device_load.png",
  547 + dayNumName: "总有功功率",
  548 + dayNum: "0",
  549 + unit: "kWh",
  550 + totalNum: "0",
  551 + totalNumName: "总无功功率"
  552 + },
  553 + {
  554 + type: '风电',
  555 + imgUrl: "./../../img/device_windPower.png",
  556 + dayNumName: "在线状态",
  557 + dayNum: "0",
  558 + unit: "",
  559 + totalNum: "0",
  560 + totalNumName: "故障状态"
  561 + },
  562 + ]
  563 + const overallDataListNew: any = [
  564 + {
  565 + type: '光伏',
  566 + oneLabelName: "母线电压",
  567 + oneLabelNum: "0",
  568 + unitOne: "V",
  569 + unitTwo: "Hz",
  570 + unitThree: "kW",
  571 + twoLabelNum: "0",
  572 + twoLabelName: "PV电网频率",
  573 + threeLabelName: "PV负载功率",
  574 + threeLabelNum: "0"
  575 + },
  576 + {
  577 + type: '风电',//暂时假数据
  578 + oneLabelName: "总有功功率",
  579 + oneLabelNum: "",
  580 + // unitOne: "kW",
  581 + // unitTwo: "kW",
  582 + // unitThree: "A",
  583 + // unitFour: "A",
  584 + // unitFive: "A",
  585 + twoLabelNum: "",
  586 + twoLabelName: "总无功功率",
  587 + threeLabelName: "A相电流",
  588 + threeLabelNum: '',
  589 + fourLabelName: "B相电流",
  590 + fourLabelNum: '',
  591 + fiveLabelName: "C相电流",
  592 + fiveLabelNum: '',
  593 + },
  594 + {
  595 + type: '电网',
  596 + oneLabelName: "A相有功功率",
  597 + oneLabelNum: "0",
  598 + unitOne: "kW",
  599 + unitTwo: "kW",
  600 + unitThree: "kW",
  601 + twoLabelNum: "0",
  602 + twoLabelName: "B相有功功率",
  603 + threeLabelName: "C相有功功率",
  604 + threeLabelNum: "0",
  605 + },
  606 + {
  607 + type: '储能',
  608 + oneLabelName: "SOC",
  609 + oneLabelNum: "0",
  610 + unitOne: "%",
  611 + unitTwo: "A",
  612 + unitThree: "V",
  613 + twoLabelNum: "0",
  614 + twoLabelName: "总电流",
  615 + threeLabelName: "总电压",
  616 + threeLabelNum: "0",
  617 + },
  618 + {
  619 + type: '充电桩',
  620 + oneLabelName: "A枪电压",
  621 + oneLabelNum: "0",
  622 + unitOne: "V",
  623 + unitTwo: "%",
  624 + unitThree: "V",
  625 + unitFour: "%",
  626 + twoLabelNum: "0",
  627 + twoLabelName: "A枪SOC",
  628 + threeLabelName: "B枪电压",
  629 + threeLabelNum: "0",
  630 + fourLabelName: "B枪SOC",
  631 + fourLabelNum: "0",
  632 + },
  633 + ]
  634 +
  635 +
  636 + this.setData({
  637 + allData: {},
  638 + deviceDataList: deviceDataListNew,
  639 + overallDataList: overallDataListNew
  640 + })
  641 + wx.showToast({
  642 + title: '请求失败',
  643 + icon: 'error',
  644 + duration: 2000
  645 + });
  646 +
  647 + }
503 648
504 }) 649 })
505 }, 650 },
@@ -513,8 +658,26 @@ Page({ @@ -513,8 +658,26 @@ Page({
513 } 658 }
514 }).then((res: any) => { 659 }).then((res: any) => {
515 console.log(res, 'res-----------getDate') 660 console.log(res, 'res-----------getDate')
  661 + if (res.success) {
  662 + this.setData({
  663 + tableList: res.data
  664 + })
  665 + } else {
  666 + this.setData({
  667 + tableList: []
  668 + })
  669 + wx.showToast({
  670 + title: '请求失败',
  671 + icon: 'error',
  672 + duration: 2000
  673 + });
  674 + }
  675 +
  676 + }).catch(() => {
  677 +
  678 + }).finally(() => {
516 this.setData({ 679 this.setData({
517 - tableList: res.data 680 + tableList: []
518 }) 681 })
519 }) 682 })
520 } 683 }
@@ -129,6 +129,7 @@ @@ -129,6 +129,7 @@
129 border-radius: 20rpx 20rpx 0 0; 129 border-radius: 20rpx 20rpx 0 0;
130 /* // height: 500rpx; */ 130 /* // height: 500rpx; */
131 padding: 44rpx 20rpx; 131 padding: 44rpx 20rpx;
  132 + /* z-index: -100; */
132 } 133 }
133 134
134 .loadCurveEchart_home { 135 .loadCurveEchart_home {
1 { 1 {
2 "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", 2 "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3 - "projectname": "smartElectric", 3 + "projectname": "qx-apaas-power",
4 "setting": { 4 "setting": {
5 "compileHotReLoad": true, 5 "compileHotReLoad": true,
6 "urlCheck": false 6 "urlCheck": false