jxpj.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <div>
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">年月:</div>
  7. <div class="search-input">
  8. <el-date-picker v-model="date" type="month" placeholder="选择年月" popper-class="date-select"
  9. value-format="YYYY-MM"></el-date-picker>
  10. </div>
  11. </div>
  12. <div class="query-actions">
  13. <button class="btn green" @click="handleSubmit">查询</button>
  14. <button class="btn green" @click="contrast">对比</button>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="table-box">
  19. <div class="title">运行评价</div>
  20. <ComTable ref="curRef" :data="tableData" :pageSize="20" :pageable="false" height="73vh"
  21. v-loading="tableLoading" element-loading-text="拼命加载中.." element-loading-background="rgba(0, 0, 0, 0.8)">
  22. </ComTable>
  23. </div>
  24. <el-dialog title="运行评价对比" v-model="dialogVisible" width="70%" top="10vh" custom-class="modal">
  25. <dayinfo :gridDatas="dialogData1" :chartDatas="dialogData2" :column='column' />
  26. </el-dialog>
  27. </div>
  28. </template>
  29. <script>
  30. import ComTable from "@/components/coms/table/table-unpage.vue";
  31. import Dayinfo from "./dayinfo.vue";
  32. export default {
  33. name: "gradeassessment",
  34. components: {
  35. ComTable,
  36. Dayinfo
  37. },
  38. data() {
  39. let that = this;
  40. return {
  41. dialogVisible: false,
  42. date: "",
  43. tableLoading: true,
  44. dataIds: new Set(),
  45. dialogData1: [],
  46. dialogData2: [],
  47. column: [],
  48. indicator: ["风能利用率(%)","计划检修损失率(%)","非计划检修损失率(%)","缺陷下单及时率(%)","到达消缺地点及时率(%)","真实消缺及时率(%)","MTBF(小时)","MTTR(小时)"],
  49. tableData: {
  50. column: [{
  51. name: "",
  52. field: "fj",
  53. is_num: false,
  54. is_light: false,
  55. sortable: false,
  56. width: '70px',
  57. template: () => {
  58. return "<input class='check curCheckBox checkItem' type='CheckBox'/>";
  59. },
  60. click: function(event, data) {
  61. if (event.target.checked == false) {
  62. that.dataIds.delete(data.id);
  63. }
  64. if (event.target.checked) {
  65. if (that.dataIds.size < 2) {
  66. that.dataIds.add(data.id);
  67. } else {
  68. event.target.checked = false;
  69. }
  70. }
  71. },
  72. },
  73. {
  74. name: "场站",
  75. field: "wpid",
  76. is_num: false,
  77. is_light: false,
  78. },
  79. {
  80. name: "综合排名",
  81. field: "zpm",
  82. is_num: false,
  83. is_light: false,
  84. width: '100px',
  85. },
  86. {
  87. name: "等级",
  88. field: "grade",
  89. is_num: false,
  90. is_light: false,
  91. sortable: true,
  92. width: '70px',
  93. },
  94. {
  95. name: "风能利用率(%)",
  96. field: "fnlyl",
  97. is_num: false,
  98. is_light: false,
  99. sortable: true,
  100. },
  101. {
  102. name: "计划检修损失率(%)",
  103. field: "jhjxssl",
  104. is_num: false,
  105. is_light: false,
  106. sortable: true,
  107. },
  108. {
  109. name: "非计划检修损失率(%)",
  110. field: "fjhjxssl",
  111. is_num: false,
  112. is_light: false,
  113. sortable: true,
  114. },
  115. {
  116. name: "缺陷单接单及时率(%)",
  117. field: "qxdjdjsl",
  118. is_num: false,
  119. is_light: false,
  120. sortable: true,
  121. },
  122. {
  123. name: "到达消缺地点及时率(%)",
  124. field: "ddxqddjsl",
  125. is_num: false,
  126. is_light: false,
  127. sortable: true,
  128. },
  129. {
  130. name: "真实消缺及时率(%)",
  131. field: "zsxqjsl",
  132. is_num: false,
  133. is_light: false,
  134. sortable: true,
  135. },
  136. {
  137. name: "MTBF(小时)",
  138. field: "mtbf",
  139. is_num: false,
  140. is_light: false,
  141. sortable: true,
  142. },
  143. {
  144. name: "MTTR(小时)",
  145. field: "mttr",
  146. is_num: false,
  147. is_light: false,
  148. sortable: true,
  149. },
  150. {
  151. name: "操作",
  152. field: "sjbz",
  153. is_num: false,
  154. is_light: false,
  155. sortable: true,
  156. id: "id",
  157. template: () => {
  158. return "<el-button type='text' style='cursor: pointer;'>详情</el-button>";
  159. },
  160. click: function(event, data) {
  161. that.contrast(that.dataIds.add(data.id))
  162. },
  163. },
  164. ],
  165. data: [],
  166. },
  167. };
  168. },
  169. created() {
  170. this.date = this.getDate();
  171. this.getTable(this.date);
  172. },
  173. methods: {
  174. clearCheckBox() {
  175. this.$refs.curRef.clearCheckBox();
  176. this.dataIds = new Set();
  177. },
  178. // 获取表格数据
  179. getTable() {
  180. let that = this;
  181. that.tableLoading = true;
  182. that.API.requestData({
  183. timeout: 60000,
  184. method: "GET",
  185. baseURL: "http://10.155.32.4:8034",
  186. subUrl: '/evaluation/maintenance',
  187. data: {
  188. month: that.date
  189. },
  190. success(res) {
  191. that.tableLoading = false;
  192. if (res.code === 200) {
  193. var data = [];
  194. res.data.forEach((item, index) => {
  195. item["index"] = index;
  196. data[index] = item;
  197. });
  198. that.tableData.data = data;
  199. }
  200. },
  201. Error(res) {
  202. console.log("tag", res);
  203. },
  204. });
  205. },
  206. // 查询
  207. handleSubmit() {
  208. this.clearCheckBox();
  209. this.getTable(this.date);
  210. },
  211. // 日信息对比
  212. contrast(one) {
  213. var that = this;
  214. if (that.dataIds.size == 2 || one) {
  215. that.dialogVisible = true;
  216. const tmpArr = Array.from(that.dataIds);
  217. if (one) {
  218. const data = {
  219. gaid1: tmpArr[0]
  220. };
  221. } else {
  222. const data = {
  223. gaid1: tmpArr[0],
  224. gaid2: tmpArr[1],
  225. };
  226. }
  227. const dialogData1 = [];
  228. that.tableData.data.forEach(ele => {
  229. tmpArr.forEach(ele2 => {
  230. if (ele.id == ele2) {
  231. dialogData1.push(ele)
  232. }
  233. })
  234. })
  235. that.dialogData1 = dialogData1;
  236. const chartData = [{
  237. indicator: that.indicator,
  238. data: [],
  239. }];
  240. const data1 = [],
  241. data2 = [];
  242. let column = [];
  243. chartData[0].indicator.forEach(ele => {
  244. that.tableData.column.forEach(ele2 => {
  245. if (ele2.name == ele) {
  246. column.push({
  247. name: ele,
  248. field: ele2.field,
  249. rank: ele2.field + 'pm',
  250. score: ele2.field + 'pf'
  251. })
  252. let data1Name = '',
  253. data2Name = '';
  254. dialogData1.forEach((ele3, index3) => {
  255. if (index3 == 0) {
  256. data1.push({
  257. name: ele,
  258. data1: ele3[ele2.field]
  259. })
  260. data1Name = ele3.wpid
  261. }
  262. if (that.dataIds.size == 2) {
  263. if (index3 == 1) {
  264. data2.push({
  265. name: ele,
  266. data1: ele3[ele2.field]
  267. })
  268. data2Name = ele3.wpid
  269. }
  270. }
  271. })
  272. data1.push({
  273. name: data1Name
  274. });
  275. if (that.dataIds.size == 2) {
  276. data2.push({
  277. name: data2Name
  278. });
  279. }
  280. }
  281. })
  282. })
  283. that.column = column;
  284. if (data1) {
  285. chartData[0].data.push(that.getChartData(data1, chartData[0].indicator));
  286. }
  287. if (that.dataIds.size == 2) {
  288. if (data2) {
  289. chartData[0].data.push(that.getChartData(data2, chartData[0].indicator));
  290. }
  291. }
  292. that.dialogData2 = chartData;
  293. }
  294. this.clearCheckBox();
  295. },
  296. getChartData(resData, indicator) {
  297. const chartData = {};
  298. const rowMap = {};
  299. resData.forEach(function(rowData, index) {
  300. rowMap[rowData["name"]] = rowData["data1"];
  301. });
  302. chartData["name"] = resData[resData.length - 1]["name"];
  303. chartData["value"] = [];
  304. indicator.forEach(ele => {
  305. chartData["value"].push(rowMap[ele]);
  306. })
  307. return chartData;
  308. },
  309. // 获取日期
  310. getDate() {
  311. var date = new Date();
  312. var year = date.getFullYear(),
  313. month = date.getMonth() + 1,
  314. day = date.getDate() - 1;
  315. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  316. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  317. return year + "-" + month;
  318. },
  319. },
  320. };
  321. </script>
  322. <style scoped>
  323. .newsDiv {
  324. color: rgba(255, 255, 255, 0.75);
  325. background-color: rgba(255, 255, 255, 0.1);
  326. margin-bottom: 8px;
  327. line-height: 3.4259vh;
  328. padding: 0 15px;
  329. }
  330. .newspan {
  331. line-height: 30px;
  332. cursor: pointer;
  333. padding: 0 1vw;
  334. margin: 0 2px;
  335. color: #9ca5a8;
  336. transition: color 0.2s ease-in-out;
  337. position: relative;
  338. }
  339. .newspan:hover {
  340. background: linear-gradient(to top,
  341. rgba(5, 187, 76, 0.5),
  342. rgba(5, 187, 76, 0));
  343. color: white;
  344. position: relative;
  345. }
  346. .newspan:hover::after {
  347. content: "";
  348. position: absolute;
  349. width: 100%;
  350. height: 0.463vh;
  351. border: 0.093vh solid #05bb4c;
  352. border-top: 0;
  353. left: 0;
  354. bottom: 0;
  355. box-sizing: border-box;
  356. }
  357. .active {
  358. background: linear-gradient(to top,
  359. rgba(5, 187, 76, 0.5),
  360. rgba(5, 187, 76, 0));
  361. color: white;
  362. position: relative;
  363. }
  364. .active::after {
  365. content: "";
  366. position: absolute;
  367. width: 100%;
  368. height: 0.463vh;
  369. border: 0.093vh solid #05bb4c;
  370. border-top: 0;
  371. left: 0;
  372. bottom: 0;
  373. box-sizing: border-box;
  374. }
  375. .title {
  376. background: rgba(255, 255, 255, 0.1);
  377. margin-bottom: 8px;
  378. padding: 1vh;
  379. }
  380. </style>
  381. <style lang="less">
  382. .decision-page-2 {
  383. .content .project-table {
  384. tbody {
  385. height: calc(100vh - 24.5vh);
  386. }
  387. }
  388. .project-table {
  389. overflow: auto;
  390. tbody {
  391. height: 239px;
  392. }
  393. th,
  394. td {
  395. color: #b2bdc0;
  396. &:nth-child(1) {
  397. width: 50px;
  398. }
  399. &:nth-child(2) {
  400. width: 50px;
  401. }
  402. }
  403. }
  404. .action {
  405. text-decoration: underline;
  406. color: @green;
  407. cursor: pointer;
  408. }
  409. }
  410. </style>