evaluationReport.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <div class="evaluationReportPanel">
  3. <h1>评价报告</h1>
  4. <div class="evaluationInfo">
  5. <div class="evaluationBox">
  6. <div class="box">
  7. <span>算法名称:</span>
  8. <b>{{ info.algorithmName }}</b>
  9. </div>
  10. <div class="box">
  11. <span>算法得分:</span>
  12. <b>{{ info.algorithmScore }}</b>
  13. </div>
  14. <div class="box">
  15. <span>测试等级:</span>
  16. <b>{{ info.evaluationLevel }}</b>
  17. </div>
  18. </div>
  19. <div class="desBox">
  20. <span>算法描述:</span>
  21. <b>{{ info.algorithmDescribe }}</b>
  22. </div>
  23. <div class="evaBox">
  24. <span>算法简评:</span>
  25. <b>{{ info.algorithmEvaluation }}</b>
  26. </div>
  27. </div>
  28. <div class="tableBox tableBoxA">
  29. <div class="title">测试得分表</div>
  30. <tableList
  31. :border="true"
  32. :columns="columns"
  33. :getDataWay="getDataWay"
  34. >
  35. </tableList>
  36. </div>
  37. <div class="tableBox tableBoxB">
  38. <div class="title">评价等级</div>
  39. <tableList
  40. :border="true"
  41. :columns="columnsA"
  42. :getDataWay="getDataWayA"
  43. class="colorfulTable"
  44. >
  45. </tableList>
  46. </div>
  47. <div class="tableBox tableBoxC">
  48. <div class="title">算法测试评分细则</div>
  49. <tableList
  50. :border="true"
  51. :columns="columnsB"
  52. :getDataWay="getDataWayB"
  53. :span-method="arraySpanMethod"
  54. >
  55. </tableList>
  56. </div>
  57. <div class="tableBox tableBoxD">
  58. <div class="title">详情得分情况</div>
  59. <tableList
  60. :border="true"
  61. :columns="columnsC"
  62. :getDataWay="getDataWayC"
  63. :row-class-name="errRow"
  64. :span-method="arraySpanMethodA"
  65. >
  66. </tableList>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import tableList from "@/components/grid/TableList";
  72. export default {
  73. name: "evaluationReport", // 评价报告
  74. components: { tableList },
  75. data() {
  76. return {
  77. id: "",
  78. projectType: "",
  79. columns: [
  80. {
  81. label: "测试项目",
  82. prop: "projectName",
  83. },
  84. {
  85. label: "场景数量",
  86. prop: "sceneNum",
  87. },
  88. {
  89. label: "测试权重%",
  90. prop: "weight",
  91. },
  92. {
  93. label: "测试得分",
  94. prop: "score",
  95. },
  96. {
  97. label: "得分率%",
  98. prop: "scoreRatio",
  99. },
  100. ],
  101. pagination: {
  102. //分页使用
  103. currentPage: 1,
  104. pageSize: 10,
  105. position: "right",
  106. pageSizes: [10, 30, 50, 100, 200],
  107. layout: "sizes, total, prev, pager, next, jumper",
  108. },
  109. getDataWay: {
  110. //加载表格数据
  111. dataType: "data",
  112. type: "post",
  113. firstRequest: false,
  114. data: [],
  115. param: {},
  116. },
  117. columnsA: [
  118. {
  119. label: "测试项目",
  120. prop: "name",
  121. },
  122. {
  123. label: "90<总分<100",
  124. prop: "levelA",
  125. },
  126. {
  127. label: "80<总分<90",
  128. prop: "levelB",
  129. },
  130. {
  131. label: "70<总分<80",
  132. prop: "levelC",
  133. },
  134. {
  135. label: "0<总分<70",
  136. prop: "levelD",
  137. },
  138. ],
  139. getDataWayA: {
  140. //加载表格数据
  141. dataType: "data",
  142. type: "post",
  143. firstRequest: false,
  144. data: [
  145. {
  146. index: 1,
  147. name: "评价等级",
  148. levelA: "优秀(G)",
  149. levelB: "良好(A)",
  150. levelC: "一般(M)",
  151. levelD: "较差(P)",
  152. },
  153. {
  154. index: 2,
  155. name: "评价等级",
  156. levelA: "++++++",
  157. levelB: "+++++",
  158. levelC: "++++",
  159. levelD: "+++",
  160. },
  161. ],
  162. param: {},
  163. },
  164. columnsB: [],
  165. getDataWayB: {
  166. //加载表格数据
  167. dataType: "data",
  168. type: "post",
  169. data: [],
  170. param: {},
  171. },
  172. columnsC: [],
  173. getDataWayC: {
  174. //加载表格数据
  175. dataType: "data",
  176. type: "post",
  177. data: [],
  178. param: {},
  179. },
  180. info: {},
  181. sublistNameObj: [], // 存储各级指标名称对应的次数,可对应相应的rowspan
  182. sublistNameObjA: [],
  183. subIndexArr: [], // 存储各级指标名称第一次出现对应的下标,可对应相应的rowIndex
  184. subIndexArrA: [],
  185. };
  186. },
  187. computed: {},
  188. methods: {
  189. arraySpanMethod({ row, column, rowIndex, columnIndex }) {
  190. if (columnIndex === 0 || columnIndex === this.columnsB.length - 1) {
  191. if (this.subIndexArr[0].includes(rowIndex)) {
  192. return [
  193. this.sublistNameObj[0][row.sublistName1 + rowIndex],
  194. 1,
  195. ];
  196. } else {
  197. return [0, 0];
  198. }
  199. } else if (columnIndex === 1) {
  200. if (this.subIndexArr[1].includes(rowIndex)) {
  201. return [
  202. this.sublistNameObj[1][row.sublistName2 + rowIndex],
  203. 1,
  204. ];
  205. } else {
  206. if (row.sublistName2) {
  207. return [0, 0];
  208. } else {
  209. return [1, 1];
  210. }
  211. }
  212. } else if (columnIndex === 2) {
  213. if (this.subIndexArr[2].includes(rowIndex)) {
  214. return [
  215. this.sublistNameObj[2][row.sublistName3 + rowIndex],
  216. 1,
  217. ];
  218. } else {
  219. if (row.sublistName3) {
  220. return [0, 0];
  221. } else {
  222. return [1, 1];
  223. }
  224. }
  225. } else if (columnIndex === 3) {
  226. if (this.subIndexArr[3].includes(rowIndex)) {
  227. return [
  228. this.sublistNameObj[3][row.sublistName4 + rowIndex],
  229. 1,
  230. ];
  231. } else {
  232. if (row.sublistName4) {
  233. return [0, 0];
  234. } else {
  235. return [1, 1];
  236. }
  237. }
  238. } else if (columnIndex === 4) {
  239. if (this.subIndexArr[4].includes(rowIndex)) {
  240. return [
  241. this.sublistNameObj[4][row.sublistName5 + rowIndex],
  242. 1,
  243. ];
  244. } else {
  245. if (row.sublistName5) {
  246. return [0, 0];
  247. } else {
  248. return [1, 1];
  249. }
  250. }
  251. } else if (columnIndex === 5) {
  252. if (this.subIndexArr[5].includes(rowIndex)) {
  253. return [
  254. this.sublistNameObj[5][row.sublistName6 + rowIndex],
  255. 1,
  256. ];
  257. } else {
  258. if (row.sublistName6) {
  259. return [0, 0];
  260. } else {
  261. return [1, 1];
  262. }
  263. }
  264. }
  265. },
  266. arraySpanMethodA({ row, column, rowIndex, columnIndex }) {
  267. if (columnIndex === 0) {
  268. if (this.subIndexArrA[0].includes(rowIndex)) {
  269. return [
  270. this.sublistNameObjA[0][row.sublistName1 + rowIndex],
  271. 1,
  272. ];
  273. } else {
  274. return [0, 0];
  275. }
  276. } else if (columnIndex === 1) {
  277. if (this.subIndexArrA[1].includes(rowIndex)) {
  278. return [
  279. this.sublistNameObjA[1][row.sublistName2 + rowIndex],
  280. 1,
  281. ];
  282. } else {
  283. if (row.sublistName2) {
  284. return [0, 0];
  285. } else {
  286. return [1, 1];
  287. }
  288. }
  289. } else if (columnIndex === 2) {
  290. if (this.subIndexArrA[2].includes(rowIndex)) {
  291. return [
  292. this.sublistNameObjA[2][row.sublistName3 + rowIndex],
  293. 1,
  294. ];
  295. } else {
  296. if (row.sublistName3) {
  297. return [0, 0];
  298. } else {
  299. return [1, 1];
  300. }
  301. }
  302. } else if (columnIndex === 3) {
  303. if (this.subIndexArrA[3].includes(rowIndex)) {
  304. return [
  305. this.sublistNameObjA[3][row.sublistName4 + rowIndex],
  306. 1,
  307. ];
  308. } else {
  309. if (row.sublistName4) {
  310. return [0, 0];
  311. } else {
  312. return [1, 1];
  313. }
  314. }
  315. } else if (columnIndex === 4) {
  316. if (this.subIndexArrA[4].includes(rowIndex)) {
  317. return [
  318. this.sublistNameObjA[4][row.sublistName5 + rowIndex],
  319. 1,
  320. ];
  321. } else {
  322. if (row.sublistName5) {
  323. return [0, 0];
  324. } else {
  325. return [1, 1];
  326. }
  327. }
  328. } else if (columnIndex === 5) {
  329. if (this.subIndexArrA[5].includes(rowIndex)) {
  330. return [
  331. this.sublistNameObjA[5][row.sublistName6 + rowIndex],
  332. 1,
  333. ];
  334. } else {
  335. if (row.sublistName6) {
  336. return [0, 0];
  337. } else {
  338. return [1, 1];
  339. }
  340. }
  341. }
  342. },
  343. errRow({ row, rowIndex }) {
  344. if (row.runState === "Failed") {
  345. return "errColor";
  346. }
  347. },
  348. // 处理数据,通关于配合表格进行合并单元行
  349. dataHandle(data, type) {
  350. let arr = data;
  351. let lastRowSublistName1 = "";
  352. let lastRowSublistName2 = "";
  353. let lastRowSublistName3 = "";
  354. let lastRowSublistName4 = "";
  355. let lastRowSublistName5 = "";
  356. let lastRowSublistName6 = "";
  357. let sublistNameObj1 = {};
  358. let sublistNameObj2 = {};
  359. let sublistNameObj3 = {};
  360. let sublistNameObj4 = {};
  361. let sublistNameObj5 = {};
  362. let sublistNameObj6 = {};
  363. let subIndexArr1 = [];
  364. let subIndexArr2 = [];
  365. let subIndexArr3 = [];
  366. let subIndexArr4 = [];
  367. let subIndexArr5 = [];
  368. let subIndexArr6 = [];
  369. let lastI1 = 0;
  370. let lastI2 = 0;
  371. let lastI3 = 0;
  372. let lastI4 = 0;
  373. let lastI5 = 0;
  374. let lastI6 = 0;
  375. arr.forEach((item, i) => {
  376. let sublistName1 = item.sublistName1;
  377. if (sublistName1 === lastRowSublistName1) {
  378. sublistNameObj1[sublistName1 + lastI1]++;
  379. } else {
  380. lastRowSublistName1 = sublistName1;
  381. subIndexArr1.push(i);
  382. lastI1 = i;
  383. sublistNameObj1[sublistName1 + lastI1] = 1;
  384. }
  385. if (item.sublistName2) {
  386. // 一级后的指标名称可能不存在
  387. let sublistName2 = item.sublistName2;
  388. if (sublistName2 === lastRowSublistName2) {
  389. sublistNameObj2[sublistName2 + lastI2]++;
  390. } else {
  391. lastRowSublistName2 = sublistName2;
  392. subIndexArr2.push(i);
  393. lastI2 = i;
  394. sublistNameObj2[sublistName2 + lastI2] = 1;
  395. }
  396. } else {
  397. lastRowSublistName2 = "";
  398. }
  399. if (item.sublistName3) {
  400. let sublistName3 = item.sublistName3;
  401. if (sublistName3 === lastRowSublistName3) {
  402. sublistNameObj3[sublistName3 + lastI3]++;
  403. } else {
  404. lastRowSublistName3 = sublistName3;
  405. subIndexArr3.push(i);
  406. lastI3 = i;
  407. sublistNameObj3[sublistName3 + lastI3] = 1;
  408. }
  409. } else {
  410. lastRowSublistName3 = "";
  411. }
  412. if (item.sublistName4) {
  413. let sublistName4 = item.sublistName4;
  414. if (sublistName4 === lastRowSublistName4) {
  415. sublistNameObj4[sublistName4 + lastI4]++;
  416. } else {
  417. lastRowSublistName4 = sublistName4;
  418. subIndexArr4.push(i);
  419. lastI4 = i;
  420. sublistNameObj4[sublistName4 + lastI4] = 1;
  421. }
  422. } else {
  423. lastRowSublistName4 = "";
  424. }
  425. if (item.sublistName5) {
  426. let sublistName5 = item.sublistName5;
  427. if (sublistName5 === lastRowSublistName5) {
  428. sublistNameObj5[sublistName5 + lastI5]++;
  429. } else {
  430. lastRowSublistName5 = sublistName5;
  431. subIndexArr5.push(i);
  432. lastI5 = i;
  433. sublistNameObj5[sublistName5 + lastI5] = 1;
  434. }
  435. } else {
  436. lastRowSublistName5 = "";
  437. }
  438. if (item.sublistName6) {
  439. let sublistName6 = item.sublistName6;
  440. if (sublistName6 === lastRowSublistName6) {
  441. sublistNameObj6[sublistName6 + lastI6]++;
  442. } else {
  443. lastRowSublistName6 = sublistName6;
  444. subIndexArr6.push(i);
  445. lastI6 = i;
  446. sublistNameObj6[sublistName6 + lastI6] = 1;
  447. }
  448. } else {
  449. lastRowSublistName6 = "";
  450. }
  451. });
  452. let arr1 = [
  453. subIndexArr1,
  454. subIndexArr2,
  455. subIndexArr3,
  456. subIndexArr4,
  457. subIndexArr5,
  458. subIndexArr6,
  459. ];
  460. let arr2 = [
  461. sublistNameObj1,
  462. sublistNameObj2,
  463. sublistNameObj3,
  464. sublistNameObj4,
  465. sublistNameObj5,
  466. sublistNameObj6,
  467. ];
  468. if (type === 1) {
  469. this.subIndexArr = arr1;
  470. this.sublistNameObj = arr2;
  471. } else if (type === 2) {
  472. this.subIndexArrA = arr1;
  473. this.sublistNameObjA = arr2;
  474. }
  475. },
  476. },
  477. mounted() {
  478. if (this.$route.query.id) {
  479. this.id = this.$route.query.id;
  480. this.projectType = this.$route.query.projectType || "1";
  481. if (this.id) {
  482. this.$axios({
  483. method: "post",
  484. url: this.$api.workManagement.selectProjectReportById,
  485. data: {
  486. id: this.id,
  487. projectType: this.projectType,
  488. },
  489. }).then((res) => {
  490. if (res.code == 200 && res.info) {
  491. this.info = res.info;
  492. this.getDataWay.data = res.info.algorithmScoreList;
  493. this.columnsB = res.info.subListScoreLiTitle;
  494. this.dataHandle(res.info.subListScoreLi, 1);
  495. this.getDataWayB.data = res.info.subListScoreLi;
  496. this.columnsC = res.info.sceneScoreLiTitle;
  497. this.dataHandle(res.info.sceneScoreLi, 2);
  498. this.getDataWayC.data = res.info.sceneScoreLi;
  499. } else {
  500. this.$message.error(res.message || "获取信息失败");
  501. }
  502. });
  503. }
  504. }
  505. },
  506. };
  507. </script>
  508. <style lang='less' scoped>
  509. .evaluationReportPanel {
  510. min-width: 900px;
  511. width: 60%;
  512. margin: 0 auto;
  513. h1 {
  514. padding: 40px 0 60px;
  515. font-size: 36px;
  516. color: @themeColor;
  517. text-align: center;
  518. }
  519. .evaluationInfo {
  520. font-size: 16px;
  521. span,
  522. b {
  523. display: block;
  524. font-weight: normal;
  525. }
  526. span {
  527. width: 80px;
  528. color: @gray;
  529. }
  530. b {
  531. flex: 1;
  532. }
  533. }
  534. .evaluationBox {
  535. display: flex;
  536. justify-content: space-between;
  537. .box {
  538. display: flex;
  539. width: 30%;
  540. span {
  541. padding-right: 10px;
  542. // color: @color;
  543. }
  544. b {
  545. padding-bottom: 3px;
  546. border-bottom: 1px solid @gray;
  547. text-align: center;
  548. }
  549. }
  550. }
  551. .desBox,
  552. .evaBox {
  553. display: flex;
  554. b {
  555. padding: 12px;
  556. border: 1px solid @gray;
  557. }
  558. }
  559. .desBox {
  560. padding: 40px 0;
  561. }
  562. .tableBox {
  563. padding: 60px 0;
  564. .title {
  565. padding-bottom: 20px;
  566. font-size: 18px;
  567. text-align: center;
  568. font-weight: bold;
  569. }
  570. }
  571. .tableBoxB,
  572. .tableBoxC,
  573. .tableBoxD {
  574. padding: 0 0 60px;
  575. }
  576. .colorfulTable {
  577. /deep/ .el-table__body {
  578. .el-table__row:nth-child(2) {
  579. td:nth-child(2) {
  580. background-color: #c1db69;
  581. }
  582. td:nth-child(3) {
  583. background-color: #faf54a;
  584. }
  585. td:nth-child(4) {
  586. background-color: #ff9d33;
  587. }
  588. td:last-child {
  589. background-color: #f56c6c;
  590. }
  591. }
  592. }
  593. }
  594. /deep/ .el-table .errColor td {
  595. color: red;
  596. }
  597. }
  598. </style>