station.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div class="station">
  3. <div class="btns">
  4. <!-- <button class="btn green">保存</button> -->
  5. <button class="btn green" @click="back">返回</button>
  6. <button class="btn green" @click="backForm">表底</button>
  7. </div>
  8. <div class="table-D">
  9. <!-- 表格 -->
  10. <el-table
  11. :data="tableData"
  12. style="width: 100%; overflow-y: auto;min-width='80vh';"
  13. :cell-style="addClass"
  14. max-height="80vh"
  15. >
  16. <el-table-column
  17. v-for="(i, index) in tableClu.slice(0, 2)"
  18. :key="index"
  19. :prop="i"
  20. :label="i === 'name' ? '名称' : i"
  21. width="140"
  22. >
  23. <template #default="scope">
  24. {{ scope.row[i] }}
  25. </template>
  26. </el-table-column>
  27. <el-table-column
  28. v-for="(k, index) in tableCluObj"
  29. :key="index"
  30. :label="k.split('_')[0]"
  31. align="center"
  32. >
  33. <el-table-column
  34. v-for="i in tableClu.slice(2 + index * 2, 4 + index * 2)"
  35. :key="i"
  36. :prop="i"
  37. label="当日值"
  38. align="center"
  39. width="100"
  40. >
  41. <template #default="scope">
  42. <!-- <el-input
  43. v-if="tableString.indexOf(i) != -1"
  44. :disabled="scope.row['是否可编辑'] == 1 || timeNow.isConfirm == 1"
  45. size="mini"
  46. @change="changeNum(scope.row)"
  47. v-model="scope.row[i]"
  48. ></el-input> -->
  49. <el-input
  50. v-if="tableString.indexOf(i) != -1"
  51. :disabled="true"
  52. size="mini"
  53. @change="changeNum(scope.row)"
  54. v-model="scope.row[i]"
  55. ></el-input>
  56. <label v-else>{{ scope.row[i] }}</label>
  57. </template>
  58. </el-table-column>
  59. </el-table-column>
  60. </el-table>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import api from "@api/economic/index.js";
  66. export default {
  67. data() {
  68. return {
  69. tableData: [],
  70. tableClu: [],
  71. tableCluObj: [],
  72. tableString: [],
  73. timeNow: {},
  74. };
  75. },
  76. created() {
  77. (this.timeNow = this.$route.query), this.getCZList();
  78. },
  79. methods: {
  80. // 场站
  81. getCZList() {
  82. api
  83. .analysisplusTjfxlist({
  84. wpid: this.timeNow.wpid,
  85. theday: this.timeNow.theday,
  86. })
  87. .then((res) => {
  88. for (let k of res.data[0] ? Object.keys(res.data[0]) : "") {
  89. for (let i of res.data) {
  90. if (typeof i[k] == "object") {
  91. if (i[k] != null) {
  92. for (let p of res.data[0] ? Object.keys(i[k]) : "") {
  93. i[k + p] = i[k][p];
  94. }
  95. }
  96. }
  97. }
  98. }
  99. this.tableData = res.data;
  100. for (let i of res.data[0] ? Object.keys(res.data[0]) : "") {
  101. if (typeof res.data[0][i] != "object") {
  102. if (i != "是否可编辑" && i != "id") {
  103. this.tableClu.push(i);
  104. }
  105. } else {
  106. this.tableCluObj.push(i);
  107. }
  108. this.tableClu.sort(function (n, m) {
  109. return parseInt(n.split("_")[1]) - parseInt(m.split("_")[1]);
  110. });
  111. this.tableCluObj.sort(function (n, m) {
  112. return parseInt(n.split("_")[1]) - parseInt(m.split("_")[1]);
  113. });
  114. }
  115. for (let i of this.tableCluObj) {
  116. this.tableString.push(i + "当日值(编辑)");
  117. }
  118. });
  119. },
  120. back() {
  121. this.$router.push({
  122. path: "/others/statisticAnalysis",
  123. query: {
  124. theday: this.timeNow.theday,
  125. wpid: this.timeNow.wpid,
  126. beginDate: this.timeNow.beginDate,
  127. endDate: this.timeNow.endDate,
  128. },
  129. });
  130. },
  131. backForm() {
  132. this.$router.push({
  133. path: "/others/statisticAnalysis/form",
  134. query: {
  135. theday: this.timeNow.theday,
  136. wpid: this.timeNow.wpid,
  137. beginDate: this.timeNow.beginDate,
  138. endDate: this.timeNow.endDate,
  139. },
  140. });
  141. },
  142. addClass({ row, column, rowIndex, columnIndex }) {
  143. // if(columnIndex === 4){
  144. // if (parseFloat(row.麻黄山风电场) < 0) {
  145. // return "background:yellow";
  146. // }
  147. // if (parseFloat(row.牛首山风电场) < 0) {
  148. // return "background:yellow";
  149. // }
  150. // if (parseFloat(row.青山风电场) < 0) {
  151. // return "background:yellow";
  152. // }
  153. // if (parseFloat(row.石板泉风电场) < 0) {
  154. // return "background:yellow";
  155. // }
  156. // if (parseFloat(row.香山风电场) < 0) {
  157. // return "background:yellow";
  158. // }
  159. // if (parseFloat(row.大武口电站) < 0) {
  160. // return "background:yellow";
  161. // }
  162. // if (parseFloat(row.平罗光伏电站) < 0) {
  163. // return "background:yellow";
  164. // }
  165. // if (parseFloat(row.宣和光伏发电站) < 0) {
  166. // return "background:yellow";
  167. // }
  168. },
  169. changeNum(v) {
  170. const date = this.routerData.data.theday;
  171. const wpid = this.routerData.data.wpid;
  172. v.date = date;
  173. v.wpid = wpid;
  174. this.sendData.push(v);
  175. },
  176. },
  177. };
  178. </script>
  179. <style lang="less" scoped>
  180. .btn:hover {
  181. color: #fff;
  182. }
  183. .btn {
  184. margin: 20px;
  185. }
  186. .table-D {
  187. margin: 20px 20px 0 20px;
  188. }
  189. /deep/.el-table thead.is-group th.el-table__cell {
  190. background-color: rgb(37, 36, 36);
  191. }
  192. </style>