index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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. <div class="date">
  47. <div
  48. class="day"
  49. :class="current === '1' ? 'active' : ''"
  50. @click="handleChange('1')"
  51. >
  52. 小于3米风速
  53. </div>
  54. <div
  55. class="mouth"
  56. :class="current === '2' ? 'active' : ''"
  57. @click="handleChange('2')"
  58. >
  59. 大于3米风速
  60. </div>
  61. <div
  62. class="year"
  63. :class="current === '3' ? 'active' : ''"
  64. @click="handleChange('3')"
  65. >
  66. 大于4米风速
  67. </div>
  68. </div>
  69. <el-button round size="mini" class="searchColor" @click="getTableDate"
  70. >搜索</el-button
  71. >
  72. <!-- <el-button round size="mini">导出</el-button> -->
  73. </div>
  74. <div class="data-bodys">
  75. <div class="line clearfix">
  76. <div class="leftContent left"><span>状态转换率</span></div>
  77. </div>
  78. <div class="economicTable">
  79. <el-table
  80. :data="tableData"
  81. style="width: 100%"
  82. size="mini"
  83. stripe
  84. height="100%"
  85. >
  86. <el-table-column
  87. align="center"
  88. prop="wpid"
  89. label="风场"
  90. width="200"
  91. sortable
  92. ></el-table-column>
  93. <el-table-column
  94. align="center"
  95. prop="wfz"
  96. label="5分钟 / 转换次数(次)"
  97. sortable
  98. ></el-table-column>
  99. <el-table-column
  100. align="center"
  101. prop="wfzfwl"
  102. label="5分钟 / 转换率(%)"
  103. sortable
  104. ></el-table-column>
  105. <el-table-column
  106. align="center"
  107. prop="sfz"
  108. label="10分钟 / 转换次数(次)"
  109. sortable
  110. ></el-table-column>
  111. <el-table-column
  112. align="center"
  113. prop="sfzfwl"
  114. label="10分钟 / 转换率(%)"
  115. sortable
  116. ></el-table-column>
  117. <el-table-column
  118. align="center"
  119. prop="swfz"
  120. label="15分钟 / 转换次数(次)"
  121. sortable
  122. ></el-table-column>
  123. <el-table-column
  124. align="center"
  125. prop="swfzfwl"
  126. label="15分钟 / 转换率(%)"
  127. sortable
  128. ></el-table-column>
  129. <el-table-column
  130. align="center"
  131. prop="esfz"
  132. label="20分钟 / 转换次数(次)"
  133. sortable
  134. ></el-table-column>
  135. <el-table-column
  136. align="center"
  137. prop="esfzfwl"
  138. label="20分钟 / 转换率(%)"
  139. sortable
  140. ></el-table-column>
  141. </el-table>
  142. </div>
  143. </div>
  144. </div>
  145. </template>
  146. <script>
  147. import dayjs from "dayjs";
  148. import { companys, conversionRate } from "@/api/curveAnalyse";
  149. export default {
  150. name: "stateEfficiency",
  151. components: {},
  152. data() {
  153. return {
  154. starTime: "",
  155. endTime: "",
  156. company: "",
  157. companyOptions: [],
  158. tableData: [],
  159. current: "1",
  160. };
  161. },
  162. filters: {},
  163. computed: {},
  164. created() {
  165. let date = new Date();
  166. date.setDate(1);
  167. let month = parseInt(date.getMonth() + 1);
  168. let day = date.getDate();
  169. if (month < 10) {
  170. month = "0" + month;
  171. }
  172. if (day < 10) {
  173. day = "0" + day;
  174. }
  175. this.starTime = dayjs().add(-1, "day").format("YYYY-MM-DD");
  176. this.endTime = dayjs().format("YYYY-MM-DD");
  177. this.initialization();
  178. },
  179. methods: {
  180. initialization() {
  181. companys().then(({ data: res }) => {
  182. this.companyOptions = res.data;
  183. this.company = res.data[0].id;
  184. this.getTableDate();
  185. });
  186. },
  187. getTableDate() {
  188. conversionRate({
  189. companyId: this.company,
  190. beginDate: this.starTime,
  191. endDate: this.endTime,
  192. }).then(({ data: res }) => {
  193. if (res) {
  194. const current = this.current;
  195. if (current == "1") {
  196. this.tableData = res.data.小于3米风速;
  197. } else if (current == "2") {
  198. this.tableData = res.data.大于3米风速;
  199. } else {
  200. this.tableData = res.data.大于4米风速;
  201. }
  202. }
  203. });
  204. },
  205. handleChange(val) {
  206. this.current = val;
  207. this.getTableDate();
  208. },
  209. },
  210. mounted() {},
  211. beforeUnmount() {},
  212. };
  213. </script>
  214. <style lang="less" scoped>
  215. .title {
  216. display: flex;
  217. flex-direction: row;
  218. align-items: center;
  219. margin-top: 10px;
  220. .station {
  221. display: flex;
  222. flex-direction: row;
  223. align-items: center;
  224. font-size: 14px;
  225. font-family: Microsoft YaHei;
  226. font-weight: 400;
  227. color: #b3b3b3;
  228. margin-left: 10px;
  229. }
  230. .search-input {
  231. margin-left: 10px;
  232. }
  233. .but {
  234. display: flex;
  235. flex-direction: row;
  236. align-content: center;
  237. margin-left: 20px;
  238. }
  239. .buttons {
  240. background-color: rgba(5, 187, 76, 0.2);
  241. border: 1px solid #3b6c53;
  242. color: #b3b3b3;
  243. font-size: 14px;
  244. &:hover {
  245. background-color: rgba(5, 187, 76, 0.5);
  246. color: #ffffff;
  247. }
  248. }
  249. }
  250. .parcel-box {
  251. height: 100%;
  252. width: 100%;
  253. padding: 0 30px;
  254. padding-bottom: 10px;
  255. .line {
  256. padding-bottom: 5px;
  257. .leftContent {
  258. width: 242px;
  259. height: 41px;
  260. line-height: 41px;
  261. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  262. span {
  263. font-size: 16px;
  264. font-family: Microsoft YaHei;
  265. font-weight: 400;
  266. color: #05bb4c;
  267. margin-left: 25px;
  268. }
  269. }
  270. .rightContent {
  271. width: 212px;
  272. height: 28px;
  273. margin-top: 13px;
  274. background: url("../../../../assets/imgs/title_right_bg.png");
  275. }
  276. }
  277. .data-bodys {
  278. display: flex;
  279. flex-direction: column;
  280. background-color: rgba(0, 0, 0, 0.45);
  281. border-radius: 5px;
  282. height: calc(100% - 45px);
  283. padding-top: 10px;
  284. .economicTable {
  285. width: 100%;
  286. height: calc(100% - 40px);
  287. }
  288. }
  289. }
  290. .clearfix::after {
  291. content: "";
  292. clear: both;
  293. height: 0;
  294. line-height: 0;
  295. visibility: hidden;
  296. display: block;
  297. }
  298. .clearfix {
  299. zoom: 1;
  300. }
  301. .left {
  302. float: left;
  303. }
  304. .right {
  305. float: right;
  306. }
  307. .searchColor {
  308. background-color: rgba(5, 187, 76, 0.2);
  309. border: 1px solid #3b6c53;
  310. color: #b3b3b3;
  311. font-size: 14px;
  312. &:hover {
  313. background-color: rgba(5, 187, 76, 0.5);
  314. color: #ffffff;
  315. }
  316. }
  317. .date {
  318. display: flex;
  319. flex-direction: row;
  320. align-items: center;
  321. font-size: 12px;
  322. font-family: Microsoft YaHei;
  323. font-weight: 400;
  324. color: #b3b3b3;
  325. margin: 0 15px;
  326. .day {
  327. display: flex;
  328. align-items: center;
  329. justify-content: center;
  330. width: 100px;
  331. height: 26px;
  332. border: 1px solid #3b6c53;
  333. border-radius: 11px 0px 0px 11px;
  334. background: rgba(67, 81, 107, 0.2);
  335. &.active {
  336. background: rgba(5, 187, 76, 0.4);
  337. color: #ffffff;
  338. }
  339. }
  340. .mouth {
  341. display: flex;
  342. align-items: center;
  343. justify-content: center;
  344. width: 100px;
  345. height: 26px;
  346. border-top: 1px solid #3b6c53;
  347. border-bottom: 1px solid #3b6c53;
  348. background: rgba(67, 81, 107, 0.2);
  349. &.active {
  350. background: rgba(5, 187, 76, 0.4);
  351. color: #ffffff;
  352. }
  353. }
  354. .year {
  355. display: flex;
  356. align-items: center;
  357. justify-content: center;
  358. width: 100px;
  359. height: 26px;
  360. border: 1px solid #3b6c53;
  361. border-radius: 0px 11px 11px 0px;
  362. background: rgba(67, 81, 107, 0.2);
  363. &.active {
  364. background: rgba(5, 187, 76, 0.4);
  365. color: #ffffff;
  366. }
  367. }
  368. }
  369. </style>