intakeWaterAnalysis.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <el-row class="el-row-container" v-loading="loading">
  3. <el-col
  4. :span="4"
  5. style="height:100%;padding-bottom:32px;"
  6. >
  7. <el-card style="margin:16px;height: 100%; overflow-y: auto">
  8. <data-report-left
  9. @setCurrentData="setCurrentData"
  10. :treeData="treeData"
  11. ></data-report-left>
  12. </el-card>
  13. </el-col>
  14. <el-col
  15. :span="20"
  16. style="padding: 16px 16px 16px 0; height: 100%;"
  17. >
  18. <el-card style="height: 100%; overflow-y: auto">
  19. <el-col :span="24" class="elrow-main__col-top">
  20. <div>
  21. <el-select
  22. v-model="currentYear"
  23. style="width: 250px;margin-right: 16px;"
  24. >
  25. <el-option
  26. v-for="item in options"
  27. :key="item.value"
  28. :label="item.label"
  29. :value="item.value">
  30. </el-option>
  31. </el-select>
  32. <el-button
  33. type="primary"
  34. size="small"
  35. @click="handleSearch"
  36. >查询</el-button
  37. >
  38. </div>
  39. <i
  40. class="el-icon-download"
  41. @click="downloadHandler"
  42. ></i>
  43. </el-col>
  44. <el-col :span="24" class="elrow-main__col-bottom">
  45. <b-table
  46. ref="tableRef"
  47. :args="{ 'highlight-current-row': true }"
  48. :data="loadData"
  49. :columns="columns"
  50. isShowIndex
  51. >
  52. </b-table>
  53. </el-col>
  54. </el-card>
  55. </el-col>
  56. </el-row>
  57. </template>
  58. <script>
  59. import { getAreaList } from '@/api/statistics/index.js'
  60. import { getTree } from '@/api/tree.js'
  61. import BTable from '@/components/Table/index.vue';
  62. import DataReportLeft from '@/components/DataReportLeft/index.vue'
  63. import { assign, omit } from 'lodash-es';
  64. export default {
  65. name:"waterManage",
  66. components: { BTable,DataReportLeft},
  67. data() {
  68. return {
  69. activeName:'first',
  70. currentYear: '',
  71. loading: false,
  72. associationManageShow: false,
  73. treeData: [],
  74. currentClickId: '',
  75. options: [],
  76. queryParams: {},
  77. columns: [
  78. {
  79. label: '区域名称',
  80. prop: 'cusareaName',
  81. customRender: '',
  82. align: 'center'
  83. },
  84. {
  85. label: '实际用水量(m³)',
  86. prop: 'waterNumTotal',
  87. customRender: '',
  88. align: 'center'
  89. },
  90. {
  91. label: '额定用水量(m³)',
  92. prop: 'waterrightAmount',
  93. customRender: '',
  94. align: 'center'
  95. },
  96. {
  97. label: '面积',
  98. prop: 'waterrightAreasize',
  99. customRender: '',
  100. align: 'center'
  101. },
  102. {
  103. label: '实际亩均用水量(m³)',
  104. prop: 'actualPerMuWater',
  105. customRender: '',
  106. align: 'center'
  107. },
  108. {
  109. label: '额定亩均水量(m³)',
  110. prop: 'ratedPerMuWater',
  111. customRender: '',
  112. align: 'center'
  113. },
  114. {
  115. label: '使用占计划比(%)',
  116. prop: 'proportion',
  117. customRender: '',
  118. align: 'center'
  119. }
  120. ]
  121. };
  122. },
  123. methods: {
  124. handleSearch() {
  125. this.$refs.tableRef.refresh(true);
  126. },
  127. async loadData(parameter) {
  128. this.setYear()
  129. if (!this.currentClickId) {
  130. const treeList = this.$store.state.tree.treeList
  131. let res = []
  132. if (treeList.code === '000000') {
  133. res = treeList
  134. } else {
  135. res = await getTree()
  136. this.$store.dispatch('tree/setTree',res)
  137. }
  138. this.treeData = res?.data
  139. this.currentClick = res?.data[0]
  140. this.currentClickId = this.currentClick?.cusareaId
  141. }
  142. const params = {
  143. areaId: this.currentClickId,
  144. year: this.currentYear
  145. }
  146. const payload = omit(assign({}, parameter, params), []);
  147. return getAreaList(payload);
  148. },
  149. downloadHandler() {
  150. this.download(
  151. 'wpr/stat/area/export',
  152. {
  153. ...this.queryParams
  154. },
  155. `FmsCrop_${new Date().getTime()}.xlsx`
  156. );
  157. },
  158. setYear() {
  159. let date = new Date
  160. let currentYear = date.getFullYear()
  161. this.currentYear = currentYear
  162. for (let i = 0; i < 5; i++) {
  163. this.options.push({
  164. label: currentYear - i,
  165. value: currentYear - i
  166. })
  167. }
  168. },
  169. setCurrentData(areaId) {
  170. this.currentClickId = areaId
  171. this.$refs.tableRef.refresh(false);
  172. },
  173. }
  174. };
  175. </script>
  176. <style lang="scss" scoped>
  177. .el-row-container{
  178. height: 100%;
  179. }
  180. .elrow-main__col-top {
  181. display: flex;
  182. align-items: center;
  183. justify-content: space-between;
  184. margin-bottom: 15px;
  185. .top-left {
  186. height: 100%;
  187. display: flex;
  188. align-items: center;
  189. i {
  190. background-color: #40d5ec;
  191. height: 45%;
  192. width: 5px;
  193. margin-right: 5px;
  194. }
  195. }
  196. .el-icon-download{
  197. font-size:26px;
  198. color:#14A478;
  199. cursor: pointer;
  200. }
  201. }
  202. </style>