BusinessWaterDetail.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <script>
  2. import {requireImg} from "@/utils/requireImg";
  3. import BusinessWaterDistributeChart from "@/components/business/analysis/water/BusinessWaterDistributeChart.vue";
  4. import apiOperationAnalysis from "@/api/operation/apiOperationAnalysis";
  5. export default {
  6. props: {
  7. queryData: Object
  8. },
  9. components: {
  10. BusinessWaterDistributeChart
  11. },
  12. data() {
  13. return {
  14. currCheck: '',
  15. tagCheck: {
  16. all: false,
  17. F15: false,
  18. F20: false,
  19. },
  20. tableData: [
  21. {
  22. icon: 'business/energy/water.png',
  23. title: '总用水量',
  24. num: 0,
  25. unit: 'm³'
  26. },{
  27. icon: 'business/energy/water.png',
  28. title: '人均成本',
  29. num: 0,
  30. unit: '元/人/年'
  31. }
  32. ]
  33. }
  34. },
  35. mounted() {
  36. this.init();
  37. },
  38. methods: {
  39. requireImg,
  40. init() {
  41. this.handleTagSelect('all');
  42. this.getData();
  43. },
  44. refresh() {
  45. this.$util.asyncPromise(
  46. this.getData(),
  47. this.$refs.BusinessWaterDistributeChart.getData()
  48. )
  49. },
  50. handleTagSelect(item) {
  51. for (const key in this.tagCheck) {
  52. this.tagCheck[key] = false;
  53. }
  54. this.currCheck = item;
  55. this.tagCheck[item] = true;
  56. },
  57. getData() {
  58. return apiOperationAnalysis.getEnergyAnalysisWaterInfo(this.queryData).then(res=>{
  59. let data = this.$util.dataUtil.circleChartArrToObj(res);
  60. this.tableData[0].num = data['waterConsumptionTotal']
  61. this.tableData[1].num = data['perCapitaCost']
  62. })
  63. }
  64. },
  65. }
  66. </script>
  67. <template>
  68. <div class="businessEnergyDetail">
  69. <div>
  70. <div class="dashboardPortrait-select">
  71. <a-checkable-tag v-model="tagCheck.all" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('all')">
  72. <span class="dashboardPortrait-select-text">总体用水</span>
  73. </a-checkable-tag>
  74. <a-checkable-tag v-model="tagCheck.F15" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('F15')">
  75. <span class="dashboardPortrait-select-text">15F</span>
  76. </a-checkable-tag>
  77. <a-checkable-tag v-model="tagCheck.F20" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('F20')">
  78. <span class="dashboardPortrait-select-text">20F</span>
  79. </a-checkable-tag>
  80. </div>
  81. <div>
  82. <BusinessEnergySummaryTbl :data="tableData" :title-width="100" :unit-width="80"/>
  83. </div>
  84. <div class="businessEnergyDetail-chart">
  85. <BusinessWaterDistributeChart ref="BusinessWaterDistributeChart" :query-data="queryData" :height="300"></BusinessWaterDistributeChart>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <style lang="less" scoped>
  91. .businessEnergyDetail {
  92. width: 100%;
  93. height: 100%;
  94. .businessEnergyDetail-icon {
  95. display: inline-block;
  96. margin-right: 6px;
  97. vertical-align: middle;
  98. }
  99. .businessEnergyDetail-num {
  100. display: inline-block;
  101. padding: 0 20px;
  102. color: #4D4D4D;
  103. background-color: #f7fbff;
  104. }
  105. .businessEnergyDetail-chart {
  106. margin-top: 50px;
  107. }
  108. }
  109. </style>