yxpj.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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: ["复位及时率(%)", "mttf", "缺陷下单及时率(%)", "缺陷验收及时率(%)", "设备利用小时", "限电损失率(%)","性能损失率(%)", "综合场用电量", "状态转换及时率(%)"],
  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: "fwjsl",
  104. is_num: false,
  105. is_light: false,
  106. sortable: true,
  107. },
  108. {
  109. name: "mttf",
  110. field: "mttf",
  111. is_num: false,
  112. is_light: false,
  113. sortable: true,
  114. },
  115. {
  116. name: "平均小风切入风速",
  117. field: "pjxfqrfs",
  118. is_num: false,
  119. is_light: false,
  120. sortable: true,
  121. },
  122. {
  123. name: "缺陷下单及时率(%)",
  124. field: "qxxdjsl",
  125. is_num: false,
  126. is_light: false,
  127. sortable: true,
  128. },
  129. {
  130. name: "缺陷验收及时率(%)",
  131. field: "qxysjsl",
  132. is_num: false,
  133. is_light: false,
  134. sortable: true,
  135. },
  136. {
  137. name: "设备利用小时",
  138. field: "sblyxs",
  139. is_num: false,
  140. is_light: false,
  141. sortable: true,
  142. },
  143. {
  144. name: "限电损失率(%)",
  145. field: "xdssl",
  146. is_num: false,
  147. is_light: false,
  148. sortable: true,
  149. },
  150. {
  151. name: "性能损失率(%)",
  152. field: "xnssl",
  153. is_num: false,
  154. is_light: false,
  155. sortable: true,
  156. },
  157. {
  158. name: "综合场用电量",
  159. field: "zhcydl",
  160. is_num: false,
  161. is_light: false,
  162. sortable: true,
  163. },
  164. {
  165. name: "状态转换及时率(%)",
  166. field: "ztzhjsl",
  167. is_num: false,
  168. is_light: false,
  169. sortable: true,
  170. },
  171. {
  172. name: "操作",
  173. field: "sjbz",
  174. is_num: false,
  175. is_light: false,
  176. sortable: true,
  177. id: "id",
  178. template: () => {
  179. return "<el-button type='text' style='cursor: pointer;'>详情</el-button>";
  180. },
  181. click: function (event, data) {
  182. that.contrast(that.dataIds.add(data.id))
  183. },
  184. },
  185. ],
  186. data: [],
  187. },
  188. };
  189. },
  190. created() {
  191. this.date = this.getDate();
  192. this.getTable(this.date);
  193. },
  194. methods: {
  195. clearCheckBox() {
  196. this.$refs.curRef.clearCheckBox();
  197. this.dataIds = new Set();
  198. },
  199. // 获取表格数据
  200. getTable() {
  201. let that = this;
  202. that.tableLoading = true;
  203. that.API.requestData({
  204. timeout: 60000,
  205. method: "GET",
  206. baseURL: "http://10.155.32.4:8034",
  207. subUrl: '/evaluation/operation',
  208. data: {
  209. month: that.date
  210. },
  211. success(res) {
  212. that.tableLoading = false;
  213. if (res.code === 200) {
  214. var data = [];
  215. res.data.forEach((item, index) => {
  216. item["index"] = index;
  217. data[index] = item;
  218. });
  219. that.tableData.data = data;
  220. }
  221. },
  222. Error(res) {
  223. console.log("tag", res);
  224. },
  225. });
  226. },
  227. // 查询
  228. handleSubmit() {
  229. this.clearCheckBox();
  230. this.getTable(this.date);
  231. },
  232. // 日信息对比
  233. contrast(one) {
  234. var that = this;
  235. if (that.dataIds.size == 2 || one) {
  236. that.dialogVisible = true;
  237. const tmpArr = Array.from(that.dataIds);
  238. if(one){
  239. const data = {
  240. gaid1: tmpArr[0]
  241. };
  242. }else{
  243. const data = {
  244. gaid1: tmpArr[0],
  245. gaid2: tmpArr[1],
  246. };
  247. }
  248. const dialogData1 = [];
  249. that.tableData.data.forEach(ele => {
  250. tmpArr.forEach(ele2 => {
  251. if (ele.id == ele2) {
  252. dialogData1.push(ele)
  253. }
  254. })
  255. })
  256. that.dialogData1 = dialogData1;
  257. const chartData = [{
  258. indicator: that.indicator,
  259. data: [],
  260. }];
  261. const data1 = [],
  262. data2 = [];
  263. let column = [];
  264. chartData[0].indicator.forEach(ele => {
  265. that.tableData.column.forEach(ele2 => {
  266. if (ele2.name == ele) {
  267. column.push({
  268. name: ele,
  269. field: ele2.field,
  270. rank: ele2.field + 'pm',
  271. score: ele2.field + 'pf'
  272. })
  273. let data1Name = '',data2Name = '';
  274. dialogData1.forEach((ele3, index3) => {
  275. if (index3 == 0) {
  276. data1.push({
  277. name: ele,
  278. data1: ele3[ele2.field]
  279. })
  280. data1Name = ele3.wpid
  281. }
  282. if(that.dataIds.size == 2){
  283. if (index3 == 1) {
  284. data2.push({
  285. name: ele,
  286. data1: ele3[ele2.field]
  287. })
  288. data2Name = ele3.wpid
  289. }
  290. }
  291. })
  292. data1.push({name: data1Name});
  293. if(that.dataIds.size == 2){
  294. data2.push({name: data2Name});
  295. }
  296. }
  297. })
  298. })
  299. that.column = column;
  300. if (data1) {
  301. chartData[0].data.push(that.getChartData(data1,chartData[0].indicator));
  302. }
  303. if(that.dataIds.size == 2){
  304. if (data2) {
  305. chartData[0].data.push(that.getChartData(data2,chartData[0].indicator));
  306. }
  307. }
  308. that.dialogData2 = chartData;
  309. }
  310. this.clearCheckBox();
  311. },
  312. getChartData(resData,indicator) {
  313. const chartData = {};
  314. const rowMap = {};
  315. resData.forEach(function(rowData, index) {
  316. rowMap[rowData["name"]] = rowData["data1"];
  317. });
  318. chartData["name"] = resData[resData.length - 1]["name"];
  319. chartData["value"] = [];
  320. indicator.forEach(ele=>{
  321. chartData["value"].push(rowMap[ele]);
  322. })
  323. return chartData;
  324. },
  325. // 获取日期
  326. getDate() {
  327. var date = new Date();
  328. var year = date.getFullYear(),
  329. month = date.getMonth() + 1,
  330. day = date.getDate() - 1;
  331. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  332. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  333. return year + "-" + month;
  334. },
  335. },
  336. };
  337. </script>
  338. <style scoped>
  339. .newsDiv {
  340. color: rgba(255, 255, 255, 0.75);
  341. background-color: rgba(255, 255, 255, 0.1);
  342. margin-bottom: 8px;
  343. line-height: 3.4259vh;
  344. padding: 0 15px;
  345. }
  346. .newspan {
  347. line-height: 30px;
  348. cursor: pointer;
  349. padding: 0 1vw;
  350. margin: 0 2px;
  351. color: #9ca5a8;
  352. transition: color 0.2s ease-in-out;
  353. position: relative;
  354. }
  355. .newspan:hover {
  356. background: linear-gradient(to top,
  357. rgba(5, 187, 76, 0.5),
  358. rgba(5, 187, 76, 0));
  359. color: white;
  360. position: relative;
  361. }
  362. .newspan:hover::after {
  363. content: "";
  364. position: absolute;
  365. width: 100%;
  366. height: 0.463vh;
  367. border: 0.093vh solid #05bb4c;
  368. border-top: 0;
  369. left: 0;
  370. bottom: 0;
  371. box-sizing: border-box;
  372. }
  373. .active {
  374. background: linear-gradient(to top,
  375. rgba(5, 187, 76, 0.5),
  376. rgba(5, 187, 76, 0));
  377. color: white;
  378. position: relative;
  379. }
  380. .active::after {
  381. content: "";
  382. position: absolute;
  383. width: 100%;
  384. height: 0.463vh;
  385. border: 0.093vh solid #05bb4c;
  386. border-top: 0;
  387. left: 0;
  388. bottom: 0;
  389. box-sizing: border-box;
  390. }
  391. .title {
  392. background: rgba(255, 255, 255, 0.1);
  393. margin-bottom: 8px;
  394. padding: 1vh;
  395. }
  396. </style>
  397. <style lang="less">
  398. .decision-page-2 {
  399. .content .project-table {
  400. tbody {
  401. height: calc(100vh - 24.5vh);
  402. }
  403. }
  404. .project-table {
  405. overflow: auto;
  406. tbody {
  407. height: 239px;
  408. }
  409. th,
  410. td {
  411. color: #b2bdc0;
  412. &:nth-child(1) {
  413. width: 50px;
  414. }
  415. &:nth-child(2) {
  416. width: 50px;
  417. }
  418. }
  419. }
  420. .action {
  421. text-decoration: underline;
  422. color: @green;
  423. cursor: pointer;
  424. }
  425. }
  426. </style>