index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. <template>
  2. <div class="maintenance">
  3. <div class="maintenance_top">
  4. <!-- <el-select
  5. size="mini"
  6. v-model="tabIndex"
  7. placeholder="请选择"
  8. clearable
  9. @change="getTableData"
  10. >
  11. <el-option
  12. v-for="item in tabOptions"
  13. :key="item.id"
  14. :label="item.name"
  15. :value="item.id"
  16. >
  17. </el-option>
  18. </el-select> -->
  19. <div class="station">
  20. 时间:
  21. <div class="">
  22. <el-date-picker
  23. size="mini"
  24. v-model="pickerTime"
  25. type="month"
  26. value-format="YYYY-MM"
  27. placeholder="选择年月"
  28. popper-class="date-select"
  29. >
  30. </el-date-picker>
  31. </div>
  32. </div>
  33. <div class="but">
  34. <el-button round size="mini" class="buttons" @click="getTableData"
  35. >搜索</el-button
  36. >
  37. <el-button round size="mini" class="buttons" @click="downXlsxFn"
  38. >导出</el-button
  39. >
  40. </div>
  41. </div>
  42. <div
  43. style="
  44. background: rgba(0, 0, 0, 0.4);
  45. height: calc(100% - 43px);
  46. padding-bottom: 15px;
  47. "
  48. >
  49. <div class="maintenance_title clearfix">
  50. <div class="leftContent floatLeft"><span>检修KPI</span></div>
  51. </div>
  52. <div class="economicTable1">
  53. <el-table
  54. :data="maintenanceData"
  55. stripe
  56. size="mini"
  57. height="calc(100% - 40px - 20px)"
  58. ref="maintenance_table"
  59. style="width: 100%"
  60. border
  61. >
  62. <el-table-column
  63. prop="stationName"
  64. label="场站"
  65. align="center"
  66. show-overflow-tooltip
  67. />
  68. <el-table-column
  69. prop="overhaulTeam"
  70. label="检修班组"
  71. align="center"
  72. width="60px"
  73. show-overflow-tooltip
  74. />
  75. <el-table-column
  76. prop="years"
  77. label="年份"
  78. align="center"
  79. width="60px"
  80. show-overflow-tooltip
  81. />
  82. <el-table-column
  83. prop="month"
  84. label="月份"
  85. align="center"
  86. width="60px"
  87. show-overflow-tooltip
  88. />
  89. <el-table-column
  90. v-for="(item, index) in tableHeader"
  91. :key="index"
  92. :label="item.title"
  93. align="center"
  94. >
  95. <el-table-column
  96. v-for="(subItem, subIndex) in item.children"
  97. :key="subIndex"
  98. :prop="subItem.code"
  99. :label="subItem.title"
  100. align="center"
  101. show-overflow-tooltip
  102. >
  103. <el-table-column
  104. v-for="(thiItem, thiIndex) in subItem.children"
  105. :key="thiIndex"
  106. sortable
  107. width="63"
  108. :prop="thiItem.code"
  109. :label="thiItem.title"
  110. align="center"
  111. show-overflow-tooltip
  112. >
  113. </el-table-column>
  114. </el-table-column>
  115. </el-table-column>
  116. <el-table-column
  117. prop="remark"
  118. label="总评分"
  119. align="center"
  120. width="100"
  121. show-overflow-tooltip
  122. />
  123. </el-table>
  124. <el-pagination
  125. @size-change="handleSizeChange"
  126. @current-change="handleCurrentChange"
  127. :current-page="page.currentPage"
  128. :page-size="page.pagesize"
  129. :page-sizes="[21, 50, 100, 500]"
  130. layout="total, sizes, prev, pager, next, jumper"
  131. :total="page.total"
  132. >
  133. </el-pagination>
  134. </div>
  135. </div>
  136. </div>
  137. </template>
  138. <script>
  139. import utils from "@/utills/downXlsx";
  140. import dayjs from "dayjs";
  141. import { maintenanceKPI } from "@/api/kpiApi/index.js";
  142. export default {
  143. name: "maintenance", //检修KPI
  144. components: {},
  145. data() {
  146. return {
  147. stationVal: "",
  148. stationOptions: [],
  149. pickerTime: "",
  150. maintenanceData: [],
  151. tabIndex: -1,
  152. tabOptions: [
  153. { id: -1, name: "风电" },
  154. { id: -2, name: "光伏" },
  155. ],
  156. tableHeader: [
  157. {
  158. title: "生产效率指标",
  159. children: [
  160. {
  161. title: "风能利用率",
  162. children: [
  163. { title: "值(%)", code: "fnlyl_value" },
  164. { title: "评分", code: "fnlyl_mark" },
  165. ],
  166. },
  167. {
  168. title: "计划检修损失率",
  169. children: [
  170. { title: "值(%)", code: "jhjxssl_value" },
  171. { title: "评分", code: "jhjxssl_mark" },
  172. ],
  173. },
  174. {
  175. title: "非计划检修损失率",
  176. children: [
  177. { title: "值(%)", code: "fjhjxssl_value" },
  178. { title: "评分", code: "fjhjxssl_mark" },
  179. ],
  180. },
  181. {
  182. title: "缺陷单接单及时率",
  183. children: [
  184. { title: "值(%)", code: "qxdjdjsl_value" },
  185. { title: "评分", code: "qxdjdjsl_mark" },
  186. ],
  187. },
  188. {
  189. title: "到达消缺地点及时率",
  190. children: [
  191. { title: "值(%)", code: "ddxqddjsl_value" },
  192. { title: "评分", code: "ddxqddjsl_mark" },
  193. ],
  194. },
  195. {
  196. title: "真实消缺及时率",
  197. children: [
  198. { title: "值(%)", code: "zsxqjsl_value" },
  199. { title: "评分", code: "zsxqjsl_mark" },
  200. ],
  201. },
  202. {
  203. title: "MTBF",
  204. children: [
  205. { title: "值(小时)", code: "mtbf_value" },
  206. { title: "评分", code: "mtbf_mark" },
  207. ],
  208. },
  209. {
  210. title: "MTTR",
  211. children: [
  212. { title: "值(小时)", code: "mttr_value" },
  213. { title: "评分", code: "mttr_mark" },
  214. ],
  215. },
  216. ],
  217. },
  218. {
  219. title: "综合分析指标",
  220. children: [
  221. {
  222. title: "设备利用小时",
  223. children: [
  224. { title: "值(小时)", code: "sblyxs_value" },
  225. { title: "评分", code: "sblyxs_mark" },
  226. ],
  227. },
  228. {
  229. title: "设备可利用率",
  230. children: [
  231. { title: "值(%)", code: "sbklyl_value" },
  232. { title: "评分", code: "sbklyl_mark" },
  233. ],
  234. },
  235. {
  236. title: "等效可用系数",
  237. children: [
  238. { title: "值(%)", code: "dxkyxs_value" },
  239. { title: "评分", code: "dxkyxs_mark" },
  240. ],
  241. },
  242. {
  243. title: "隐患发现准确率",
  244. children: [
  245. { title: "值(%)", code: "yhfxzql_value" },
  246. { title: "评分", code: "yhfxzql_mark" },
  247. ],
  248. },
  249. ],
  250. },
  251. ],
  252. page: {
  253. pagesize: 21,
  254. currentPage: 1,
  255. total: 0,
  256. },
  257. };
  258. },
  259. created() {
  260. this.pickerTime = dayjs().format("YYYY-MM");
  261. },
  262. mounted() {
  263. this.getTableData();
  264. },
  265. computed: {},
  266. methods: {
  267. handleSizeChange(val) {
  268. this.page.currentPage = 1;
  269. this.page.pagesize = val;
  270. this.getTableData();
  271. },
  272. handleCurrentChange(val) {
  273. this.page.currentPage = val;
  274. this.getTableData();
  275. },
  276. getTableData() {
  277. let that = this;
  278. let params = {
  279. pageNum: that.page.currentPage,
  280. pageSize: that.page.pagesize,
  281. years: that.pickerTime
  282. ? this.pickerTime.substring(0, this.pickerTime.indexOf("-")) * 1
  283. : null,
  284. month: that.pickerTime
  285. ? this.pickerTime.substring(
  286. this.pickerTime.indexOf("-") + 1,
  287. this.pickerTime.length
  288. ) * 1
  289. : null,
  290. };
  291. maintenanceKPI(params).then((res) => {
  292. if (res) {
  293. that.maintenanceData = res.data.records;
  294. that.page.total = res.data.total;
  295. }
  296. });
  297. },
  298. downXlsxFn() {
  299. let header = [];
  300. this.tableHeader.forEach((it) => {
  301. if (it.title !== "操作") {
  302. header.push(it.title);
  303. }
  304. });
  305. if (this.maintenanceData.length > 0) {
  306. utils.exportExcel(
  307. this.$refs["maintenance_table"].$el,
  308. header,
  309. `${this.pickerTime}检修评价KPI`
  310. );
  311. }
  312. },
  313. },
  314. };
  315. </script>
  316. <style lang="less" scoped>
  317. .maintenance {
  318. padding: 0 20px;
  319. height: 100%;
  320. .maintenance_title {
  321. .leftContent {
  322. width: 242px;
  323. height: 41px;
  324. line-height: 41px;
  325. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  326. span {
  327. font-size: 16px;
  328. font-family: Microsoft YaHei;
  329. font-weight: 400;
  330. color: #05bb4c;
  331. margin-left: 25px;
  332. }
  333. }
  334. }
  335. .clearfix::after {
  336. content: "";
  337. clear: both;
  338. height: 0;
  339. line-height: 0;
  340. visibility: hidden;
  341. display: block;
  342. }
  343. .clearfix {
  344. zoom: 1;
  345. }
  346. .maintenance_top {
  347. display: flex;
  348. flex-direction: row;
  349. align-items: center;
  350. margin-top: 10px;
  351. margin-bottom: 10px;
  352. .station {
  353. display: flex;
  354. flex-direction: row;
  355. align-items: center;
  356. font-size: 14px;
  357. font-family: Microsoft YaHei;
  358. font-weight: 400;
  359. color: #b3b3b3;
  360. margin-right: 10px;
  361. margin-left: 10px;
  362. }
  363. .tabCut {
  364. display: inline-block;
  365. margin: 0 10px;
  366. div {
  367. display: inline-block;
  368. width: 60px;
  369. height: 27px;
  370. border: 1px solid #274934;
  371. text-align: center;
  372. line-height: 25px;
  373. cursor: pointer;
  374. }
  375. div:nth-child(1) {
  376. border-radius: 13px 0px 0px 13px;
  377. }
  378. div:nth-child(2) {
  379. border-radius: 0px 13px 13px 0px;
  380. cursor: not-allowed;
  381. }
  382. .active {
  383. background-color: rgba(5, 187, 76, 0.9);
  384. color: #fff;
  385. }
  386. }
  387. .search-input {
  388. margin-left: 10px;
  389. .el-input__inner {
  390. width: 175px;
  391. }
  392. .el-input__suffix {
  393. right: -50px;
  394. }
  395. }
  396. .but {
  397. display: flex;
  398. flex-direction: row;
  399. align-content: center;
  400. margin-left: 20px;
  401. .buttons {
  402. background-color: rgba(5, 187, 76, 0.2);
  403. border: 1px solid #3b6c53;
  404. color: #b3b3b3;
  405. font-size: 14px;
  406. &:hover,
  407. &.active {
  408. background-color: rgba(5, 187, 76, 0.5);
  409. color: #ffffff;
  410. }
  411. }
  412. }
  413. }
  414. .economicTable1 {
  415. height: calc(100% - 42px);
  416. .el-table ::v-deep {
  417. .el-table__header {
  418. border-collapse: collapse;
  419. }
  420. .el-table__body-wrapper {
  421. .el-table__body {
  422. font-size: 13px;
  423. // border: 1px solid #eceef5;
  424. // border-collapse: collapse;
  425. }
  426. }
  427. th {
  428. height: 20px;
  429. line-height: 20px;
  430. font-size: 14px;
  431. &.el-table__cell {
  432. border: 1px solid rgba(255, 255, 255, 0.8) !important;
  433. &:nth-child(1) {
  434. border-left-width: 0 !important;
  435. // border-left-width: 0 !important;
  436. }
  437. &.is-leaf {
  438. // border-bottom-width: 1px !important;
  439. }
  440. }
  441. }
  442. td {
  443. height: 25px;
  444. line-height: 25px;
  445. font-size: 14px;
  446. &.el-table__cell {
  447. border-bottom: 1px solid #434141 !important;
  448. &:nth-child(1) {
  449. border-left-width: 0 !important;
  450. // border-left-width: 0 !important;
  451. }
  452. &.is-leaf {
  453. // border-bottom-width: 1px !important;
  454. }
  455. }
  456. }
  457. }
  458. .el-pagination {
  459. display: flex;
  460. justify-content: flex-end;
  461. padding-right: 40px;
  462. padding-top: 20px;
  463. .el-pagination__total,
  464. .el-pagination__jump {
  465. color: #fff;
  466. }
  467. }
  468. .el-table__fixed,
  469. .el-table__fixed-right {
  470. background: rgba(0, 0, 0, 1);
  471. border-left: 2px solid #000;
  472. height: calc(100% - 15px) !important;
  473. }
  474. .el-table__fixed::before {
  475. background-color: #2a2a2a;
  476. }
  477. .el-table__fixed-right::before {
  478. background-color: #2a2a2a;
  479. }
  480. }
  481. .el-overlay {
  482. .el-overlay-dialog {
  483. overflow-y: hidden !important;
  484. .el-dialog {
  485. margin-top: 0 !important;
  486. .el-dialog__body {
  487. height: calc(100% - 51px - 32px);
  488. }
  489. }
  490. }
  491. }
  492. .el-picker__popper .el-date-range-picker__header .el-picker-panel__icon-btn {
  493. color: #fff;
  494. }
  495. .el-picker__popper .el-date-table .in-range div {
  496. background: #43516b;
  497. }
  498. }
  499. .historyBtn1 {
  500. cursor: pointer;
  501. color: #05bb4c;
  502. }
  503. </style>