index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <div class="parcel-box">
  3. <div class="title">
  4. <el-select
  5. size="mini"
  6. v-model="company"
  7. placeholder="请选择"
  8. @change="getTableDate"
  9. >
  10. <el-option
  11. v-for="item in companyOptions"
  12. :key="item.id"
  13. :label="item.aname"
  14. :value="item.id"
  15. >
  16. </el-option>
  17. </el-select>
  18. <div class="station">
  19. 开始日期
  20. <div class="search-input">
  21. <el-date-picker
  22. v-model="starTime"
  23. type="date"
  24. value-format="YYYY-MM-DD"
  25. placeholder="选择日期"
  26. popper-class="date-select"
  27. >
  28. </el-date-picker>
  29. </div>
  30. </div>
  31. <div class="station">
  32. 结束日期
  33. <div class="search-input">
  34. <el-date-picker
  35. v-model="endTime"
  36. type="date"
  37. value-format="YYYY-MM-DD"
  38. placeholder="选择日期"
  39. popper-class="date-select"
  40. >
  41. </el-date-picker>
  42. </div>
  43. </div>
  44. <el-button round size="mini" class="searchColor" @click="getTableDate"
  45. >搜索</el-button
  46. >
  47. <!-- <el-button round size="mini">导出</el-button> -->
  48. </div>
  49. <div class="data-bodys">
  50. <div class="line clearfix">
  51. <div class="leftContent left"><span>复位及时率</span></div>
  52. <div class="rightContent right"></div>
  53. </div>
  54. <div class="economicTable">
  55. <el-table
  56. :data="tableData"
  57. style="width: 100%"
  58. size="mini"
  59. stripe
  60. height="85vh"
  61. >
  62. <el-table-column
  63. align="center"
  64. prop="unit"
  65. label="风场"
  66. width="200"
  67. sortable
  68. ></el-table-column>
  69. <el-table-column
  70. align="center"
  71. prop="five"
  72. label="5分钟 / 复位次数"
  73. sortable
  74. ></el-table-column>
  75. <el-table-column
  76. align="center"
  77. prop="fives"
  78. label="5分钟 / 复位率"
  79. sortable
  80. ></el-table-column>
  81. <el-table-column
  82. align="center"
  83. prop="ten"
  84. label="10分钟 / 复位次数"
  85. sortable
  86. ></el-table-column>
  87. <el-table-column
  88. align="center"
  89. prop="tens"
  90. label="10分钟 / 复位率"
  91. sortable
  92. ></el-table-column>
  93. <el-table-column
  94. align="center"
  95. prop="fifteen"
  96. label="15分钟 / 复位次数"
  97. sortable
  98. ></el-table-column>
  99. <el-table-column
  100. align="center"
  101. prop="fifteens"
  102. label="15分钟 / 复位率"
  103. sortable
  104. ></el-table-column>
  105. <el-table-column
  106. align="center"
  107. prop="twenty"
  108. label="20分钟 / 复位次数"
  109. sortable
  110. ></el-table-column>
  111. <el-table-column
  112. align="center"
  113. prop="twentys"
  114. label="20分钟 / 复位率"
  115. sortable
  116. ></el-table-column>
  117. </el-table>
  118. </div>
  119. </div>
  120. </div>
  121. </template>
  122. <script>
  123. import dayjs from "dayjs";
  124. import { companys, timelyRate } from "@/api/curveAnalyse";
  125. export default {
  126. name: "restorationEfficiency",
  127. components: {},
  128. data() {
  129. return {
  130. starTime: "",
  131. endTime: "",
  132. company: "",
  133. companyOptions: [],
  134. tableData: [],
  135. };
  136. },
  137. watch: {},
  138. filters: {},
  139. computed: {},
  140. created() {
  141. let date = new Date();
  142. date.setDate(1);
  143. let month = parseInt(date.getMonth() + 1);
  144. let day = date.getDate();
  145. if (month < 10) {
  146. month = "0" + month;
  147. }
  148. if (day < 10) {
  149. day = "0" + day;
  150. }
  151. this.starTime = date.getFullYear() + "-" + month + "-" + day;
  152. this.endTime = dayjs(new Date().getTime()).format("YYYY-MM-DD");
  153. this.initialization();
  154. },
  155. methods: {
  156. initialization() {
  157. companys().then(({ data: res }) => {
  158. this.companyOptions = res.data;
  159. this.company = res.data[0].id;
  160. this.getTableDate();
  161. });
  162. },
  163. getTableDate() {
  164. timelyRate({
  165. companyId: this.company,
  166. beginDate: this.starTime,
  167. endDate: this.endTime,
  168. }).then(({ data: res }) => {
  169. if (res) {
  170. let data = [];
  171. res.data.forEach((item, index) => {
  172. data[index] = {
  173. unit: item.wpid,
  174. five: item.wfz,
  175. fives: item.wfzfwl,
  176. ten: item.sfz,
  177. tens: item.sfzfwl,
  178. fifteen: item.swfz,
  179. fifteens: item.swfzfwl,
  180. twenty: item.esfz,
  181. twentys: item.esfzfwl,
  182. is_light: false,
  183. };
  184. });
  185. this.tableData = data;
  186. }
  187. });
  188. },
  189. },
  190. mounted() {},
  191. beforeUnmount() {},
  192. };
  193. </script>
  194. <style lang="less" scoped>
  195. .title {
  196. display: flex;
  197. flex-direction: row;
  198. align-items: center;
  199. margin-top: 10px;
  200. padding-left: 20px;
  201. .station {
  202. display: flex;
  203. flex-direction: row;
  204. align-items: center;
  205. font-size: 14px;
  206. font-family: Microsoft YaHei;
  207. font-weight: 400;
  208. color: #b3b3b3;
  209. margin-left: 10px;
  210. }
  211. .search-input {
  212. margin-left: 10px;
  213. }
  214. .but {
  215. display: flex;
  216. flex-direction: row;
  217. align-content: center;
  218. margin-left: 20px;
  219. }
  220. .buttons {
  221. background-color: rgba(5, 187, 76, 0.2);
  222. border: 1px solid #3b6c53;
  223. color: #b3b3b3;
  224. font-size: 14px;
  225. &:hover {
  226. background-color: rgba(5, 187, 76, 0.5);
  227. color: #ffffff;
  228. }
  229. }
  230. }
  231. .data-bodys {
  232. display: flex;
  233. flex-direction: column;
  234. background-color: rgba(0, 0, 0, 0.45);
  235. border-radius: 5px;
  236. padding: 5px;
  237. }
  238. .parcel-box {
  239. padding: 0 20px;
  240. box-sizing: border-box;
  241. .line {
  242. padding-bottom: 5px;
  243. .leftContent {
  244. width: 242px;
  245. height: 41px;
  246. line-height: 41px;
  247. background: url("../../../../assets/imgs/title_left_bg.png");
  248. span {
  249. font-size: 16px;
  250. font-family: Microsoft YaHei;
  251. font-weight: 400;
  252. color: #ffffff;
  253. margin-left: 25px;
  254. }
  255. }
  256. .rightContent {
  257. width: 212px;
  258. height: 28px;
  259. margin-top: 13px;
  260. background: url("../../../../assets/imgs/title_right_bg.png");
  261. }
  262. }
  263. }
  264. .clearfix::after {
  265. content: "";
  266. clear: both;
  267. height: 0;
  268. line-height: 0;
  269. visibility: hidden;
  270. display: block;
  271. }
  272. .clearfix {
  273. zoom: 1;
  274. }
  275. .left {
  276. float: left;
  277. }
  278. .right {
  279. float: right;
  280. }
  281. .searchColor {
  282. background-color: rgba(5, 187, 76, 0.2);
  283. border: 1px solid #3b6c53;
  284. color: #b3b3b3;
  285. font-size: 14px;
  286. margin-left: 10px;
  287. &:hover {
  288. background-color: rgba(5, 187, 76, 0.5);
  289. color: #ffffff;
  290. }
  291. }
  292. </style>