index.vue 8.7 KB

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