evaluationReport.vue 18 KB

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