index.vue 7.1 KB

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