TargetReportDetail.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. <template>
  2. <el-dialog
  3. class="page-dialog"
  4. :visible.sync="modalIsShow"
  5. :close-on-click-modal="false"
  6. :close-on-press-escape="false"
  7. :show-close="false"
  8. append-to-body
  9. fullscreen
  10. @opened="initData"
  11. >
  12. <div slot="title" class="box-justify">
  13. <div>
  14. 报告详情<span class="color-gray ml-2"
  15. >{{ course.courseName }}({{ course.courseCode }})</span
  16. >
  17. </div>
  18. <div>
  19. <el-button type="primary" :loading="downloading" @click="toSave"
  20. >保存报告</el-button
  21. >
  22. <el-button type="primary" :loading="downloading" @click="toExport"
  23. >导出报告</el-button
  24. >
  25. <el-button type="danger" @click="cancel">退出</el-button>
  26. </div>
  27. </div>
  28. <div v-if="modalIsShow">
  29. <!-- base info -->
  30. <div class="page-head">
  31. <h2>
  32. <span>课程基本情况</span>
  33. </h2>
  34. </div>
  35. <div class="part-box part-box-pad">
  36. <table class="table table-tiny">
  37. <colgroup>
  38. <col width="100" />
  39. <col />
  40. <col width="100" />
  41. <col />
  42. <col width="100" />
  43. <col />
  44. <col width="100" />
  45. <col />
  46. </colgroup>
  47. <tr>
  48. <td class="td-bg">课程编码</td>
  49. <td>{{ commonInfo.courseCode }}</td>
  50. <td class="td-bg">课程名称</td>
  51. <td>{{ commonInfo.courseName }}</td>
  52. <td class="td-bg">课程类别</td>
  53. <td>
  54. <el-input
  55. v-model="courseBasicInfo.courseType"
  56. placeholder="请填写课程类别"
  57. size="small"
  58. :maxlength="30"
  59. ></el-input>
  60. </td>
  61. <td class="td-bg">学分</td>
  62. <td>
  63. <el-input-number
  64. v-model="courseBasicInfo.credit"
  65. placeholder="请录入学分"
  66. size="small"
  67. :min="0"
  68. :max="999"
  69. :controls="false"
  70. style="width: 100px"
  71. ></el-input-number>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td class="td-bg">考核方式</td>
  76. <td>
  77. <el-input
  78. v-model="courseBasicInfo.evaluationMode"
  79. placeholder="请填写考核方式"
  80. size="small"
  81. :maxlength="30"
  82. ></el-input>
  83. </td>
  84. <td class="td-bg">开课时间</td>
  85. <td>{{ courseBasicInfo.openTime }}</td>
  86. <td class="td-bg">授课对象</td>
  87. <td>{{ courseBasicInfo.teachingObject }}</td>
  88. <td class="td-bg">学时</td>
  89. <td>
  90. <el-input-number
  91. v-model="courseBasicInfo.period"
  92. placeholder="请录入学时"
  93. :min="0"
  94. :max="999"
  95. :controls="false"
  96. size="small"
  97. style="width: 100px"
  98. ></el-input-number>
  99. </td>
  100. </tr>
  101. <tr>
  102. <td class="td-bg">选课人数</td>
  103. <td>
  104. <el-input-number
  105. v-model="courseBasicInfo.selectionCount"
  106. placeholder="请录入选课人数"
  107. :min="0"
  108. :max="999"
  109. :controls="false"
  110. size="small"
  111. style="width: 125px"
  112. ></el-input-number>
  113. </td>
  114. <td class="td-bg">参评人数</td>
  115. <td>{{ courseBasicInfo.participantCount }}</td>
  116. <td class="td-bg">课程目标达成度期望值</td>
  117. <td colspan="3">
  118. <el-select
  119. v-model="courseBasicInfo.courseDegree"
  120. size="small"
  121. style="width: 100%"
  122. >
  123. <el-option
  124. v-for="item in expectancyList"
  125. :key="item"
  126. :value="item"
  127. :label="item"
  128. ></el-option>
  129. </el-select>
  130. </td>
  131. </tr>
  132. <tr>
  133. <td class="td-bg">任课老师</td>
  134. <td>{{ courseBasicInfo.teacher }}</td>
  135. <td class="td-bg">评价负责人</td>
  136. <td>
  137. <el-input
  138. v-model="courseBasicInfo.director"
  139. placeholder="请填写评价负责人姓名"
  140. size="small"
  141. :maxlength="30"
  142. ></el-input>
  143. </td>
  144. <td class="td-bg">评价参与人</td>
  145. <td colspan="3">
  146. <el-input
  147. v-model="courseBasicInfo.participant"
  148. placeholder="请填写评价人姓名"
  149. size="small"
  150. :maxlength="30"
  151. ></el-input>
  152. </td>
  153. </tr>
  154. </table>
  155. </div>
  156. <div class="page-head">
  157. <h2>
  158. <span>课程目标考核分布</span>
  159. <el-popover
  160. popper-class="el-popper-dark"
  161. placement="right-start"
  162. width="500"
  163. trigger="hover"
  164. >
  165. <i class="el-icon-question" slot="reference"></i>
  166. <div>
  167. <p>
  168. 课程目标分布会自动按题库系统里试卷下试题标记的属性内容进行显示
  169. </p>
  170. </div>
  171. </el-popover>
  172. </h2>
  173. </div>
  174. <div class="part-box part-box-pad">
  175. <el-table :data="questionInfoTable">
  176. <el-table-column
  177. label="试题号"
  178. prop="name"
  179. width="140"
  180. align="center"
  181. fixed="left"
  182. ></el-table-column>
  183. <el-table-column
  184. label="合计"
  185. prop="totalScore"
  186. width="100"
  187. align="center"
  188. fixed="left"
  189. ></el-table-column>
  190. <el-table-column
  191. v-for="struct in paperStructs"
  192. :key="struct.mainNumber"
  193. :label="struct.mainNumber"
  194. align="center"
  195. >
  196. <el-table-column
  197. v-for="subNumber in struct.subNumbers"
  198. :key="subNumber"
  199. :label="subNumber"
  200. :prop="`${struct.mainNumber}_${subNumber}`"
  201. align="center"
  202. >
  203. </el-table-column>
  204. </el-table-column>
  205. </el-table>
  206. <div class="chart-box" style="height: 300px; margin-top: 20px">
  207. <v-chart
  208. v-if="questionInfoChartOption"
  209. :option="questionInfoChartOption"
  210. ></v-chart>
  211. </div>
  212. </div>
  213. <div class="page-head">
  214. <h2>
  215. <span>课程目标达成评价结果</span>
  216. <el-popover
  217. popper-class="el-popper-dark"
  218. placement="right-start"
  219. width="500"
  220. trigger="hover"
  221. >
  222. <i class="el-icon-question" slot="reference"></i>
  223. <div>
  224. <p>1.评价依据:填写通过考核什么内容实现课程目标的评价;</p>
  225. <p>2.目标分值:对应考核环节的满分;</p>
  226. <p>
  227. 3.权重:对应考核环节在对应的课程目标中的权重,目标下各项权重相加等于1;
  228. </p>
  229. <p>4.实际平均分:为参与评价的学生在该环节的平均分;</p>
  230. <p>5.目标达成评价值:∑(实际平均分/目标分值*权重);</p>
  231. <p>6.整体课程目标达成评价值:为课程分目标达成评价值的最小值。</p>
  232. </div>
  233. </el-popover>
  234. </h2>
  235. </div>
  236. <div class="part-box part-box-pad">
  237. <h4 class="part-title">课程考核成绩评价结果</h4>
  238. <table class="table">
  239. <tr class="td-bg">
  240. <th>课程目标</th>
  241. <th>评价依据</th>
  242. <th>评价环节</th>
  243. <th>权重</th>
  244. <th>目标分值</th>
  245. <th>实际平均分</th>
  246. <th>目标达成评价值</th>
  247. </tr>
  248. <template v-for="item in courseTargetList">
  249. <tr
  250. v-for="(evaluation, eindex) in item.evaluationList"
  251. :key="`${item.targetId}-${eindex}`"
  252. >
  253. <td
  254. v-if="!eindex"
  255. :rowspan="item.evaluationList.length"
  256. style="width: 240px"
  257. >
  258. {{ item.targetName }}
  259. </td>
  260. <td v-if="!eindex" :rowspan="item.evaluationList.length">
  261. <p
  262. v-for="edesc in item.graduationRequirementPoint.split('\n')"
  263. :key="edesc"
  264. >
  265. {{ edesc }}
  266. </p>
  267. </td>
  268. <td style="width: 140px">{{ evaluation.evaluation }}</td>
  269. <td
  270. v-if="!eindex"
  271. style="width: 80px"
  272. :rowspan="item.evaluationList.length - 1"
  273. >
  274. {{ item.normalTargetWeight }}
  275. </td>
  276. <td
  277. v-else-if="eindex === item.evaluationList.length - 1"
  278. style="width: 80px"
  279. >
  280. {{ evaluation.targetWeight }}
  281. </td>
  282. <td style="width: 100px">{{ evaluation.targetScore }}</td>
  283. <td style="width: 100px">{{ evaluation.targetAvgScore }}</td>
  284. <td
  285. v-if="!eindex"
  286. :rowspan="item.evaluationList.length"
  287. style="width: 140px"
  288. >
  289. {{ item.evaluationValue }}
  290. </td>
  291. </tr>
  292. </template>
  293. <tr>
  294. <td colspan="6">课程总目标</td>
  295. <td>{{ courseTargetValue }}</td>
  296. </tr>
  297. </table>
  298. <div class="chart-box" style="height: 400px; margin-top: 20px">
  299. <v-chart
  300. v-if="courseTargetListChartOption"
  301. :option="courseTargetListChartOption"
  302. ></v-chart>
  303. </div>
  304. <h4 class="part-title">课程考核成绩评价明细结果</h4>
  305. <el-table
  306. :data="studentScoreTable"
  307. :span-method="studentScoreSpanMethod"
  308. >
  309. <el-table-column
  310. label="姓名"
  311. prop="name"
  312. min-width="120"
  313. align="center"
  314. fixed="left"
  315. ></el-table-column>
  316. <el-table-column
  317. label="学号"
  318. prop="studentCode"
  319. width="100"
  320. align="center"
  321. fixed="left"
  322. ></el-table-column>
  323. <el-table-column
  324. v-for="(target, tindex) in courseTargets"
  325. :key="tindex"
  326. :label="target.targetName"
  327. align="center"
  328. >
  329. <el-table-column width="140" align="center">
  330. <template slot="header">
  331. 期末考试({{ target.finalWeight | percentFilter }})
  332. </template>
  333. <el-table-column
  334. label="期末成绩"
  335. :prop="`${target.targetId}-final`"
  336. width="140"
  337. align="center"
  338. >
  339. </el-table-column>
  340. </el-table-column>
  341. <el-table-column min-width="120" align="center">
  342. <template slot="header">
  343. 平时考试({{ target.usualWeight | percentFilter }})
  344. </template>
  345. <el-table-column
  346. v-for="work in target.usualWorks"
  347. :key="`${target.targetId}${work}`"
  348. :label="work"
  349. :prop="`${target.targetId}-usual-${work}`"
  350. min-width="100"
  351. align="center"
  352. >
  353. </el-table-column>
  354. </el-table-column>
  355. </el-table-column>
  356. <el-table-column
  357. label="学生成绩"
  358. prop="score"
  359. align="center"
  360. width="100"
  361. ></el-table-column>
  362. </el-table>
  363. </div>
  364. </div>
  365. <div slot="footer"></div>
  366. </el-dialog>
  367. </template>
  368. <script>
  369. // import { reportData } from "./data";
  370. import {
  371. targetReportDetail,
  372. exportTargetReport,
  373. targetReportSave,
  374. targetReportChangeCheck,
  375. } from "../api";
  376. import { downloadByApi } from "@/plugins/download";
  377. import { calcSum } from "@/plugins/utils";
  378. export default {
  379. name: "target-report-detail",
  380. props: {
  381. course: {
  382. type: Object,
  383. default() {
  384. return {};
  385. },
  386. },
  387. },
  388. filters: {
  389. percentFilter(val) {
  390. const num = val || 0;
  391. const perc = num % 10 ? 2 : 1;
  392. return ((num || 0) / 100).toFixed(perc);
  393. },
  394. },
  395. data() {
  396. return {
  397. modalIsShow: false,
  398. expectancyList: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0],
  399. commonInfo: {},
  400. courseBasicInfo: {},
  401. paperStructs: [],
  402. questionInfoTable: [],
  403. courseTargetList: [],
  404. courseTargetValue: 0.67,
  405. questionInfoChartOption: null,
  406. courseTargetListChartOption: null,
  407. courseTargets: [],
  408. targetColumnCounts: [],
  409. studentScoreTable: [],
  410. downloading: false,
  411. };
  412. },
  413. methods: {
  414. cancel() {
  415. this.modalIsShow = false;
  416. },
  417. open() {
  418. this.modalIsShow = true;
  419. },
  420. resetData() {
  421. this.commonInfo = {};
  422. this.courseBasicInfo = {};
  423. this.paperStructs = [];
  424. this.questionInfoTable = [];
  425. this.courseTargetList = [];
  426. this.courseTargetValue = 0.67;
  427. this.questionInfoChartOption = null;
  428. this.courseTargetListChartOption = null;
  429. this.courseTargets = [];
  430. this.targetColumnCounts = [];
  431. this.studentScoreTable = [];
  432. this.downloading = false;
  433. },
  434. buildData(data) {
  435. this.commonInfo = data.commonInfo;
  436. this.courseBasicInfo = data.courseBasicInfo;
  437. this.courseTargetValue =
  438. data.courseEvaluationResultInfo.targetEvaluationSumValue;
  439. this.courseTargetList = data.courseEvaluationResultInfo.targetList.map(
  440. (target) => {
  441. target.normalTargetWeight = calcSum(
  442. target.evaluationList.slice(0, -1).map((elem) => elem.targetWeight)
  443. );
  444. return target;
  445. }
  446. );
  447. const {
  448. courseEvaluationSpreadInfo: { questionInfo, scoreList },
  449. } = data;
  450. this.parsePaperStructs(questionInfo);
  451. this.parseQuestionInfoTable(questionInfo);
  452. this.questionInfoChartOption = this.getQuestionInfoChartOption(scoreList);
  453. this.courseTargetListChartOption = this.getCourseTargetListChartOption();
  454. let examStudentList =
  455. data.courseEvaluationResultDetailInfo.examStudentList;
  456. examStudentList.pop();
  457. examStudentList.splice(examStudentList.length - 2, 1);
  458. this.parseCourseTargets(examStudentList);
  459. this.parseStudentScoreTable(examStudentList);
  460. },
  461. async initData() {
  462. this.resetData();
  463. await this.checkChange();
  464. const data = await targetReportDetail({
  465. examId: this.course.examId,
  466. courseCode: this.course.courseCode,
  467. teachCourseId: this.course.teachCourseId,
  468. });
  469. this.buildData(data);
  470. },
  471. async checkChange() {
  472. const res = await targetReportChangeCheck({
  473. examId: this.course.examId,
  474. courseCode: this.course.courseCode,
  475. teachCourseId: this.course.teachCourseId,
  476. report: true,
  477. });
  478. if (res.courseTargetChange) {
  479. this.$notify.warning("课程目标与已保存不一致,请重新设置权重!");
  480. }
  481. if (res.evaluationChange) {
  482. this.$notify.warning(
  483. "评价方式与已保存不一致,请重新设置权重及导入新的平时成绩!"
  484. );
  485. }
  486. if (res.targetScoreChange) {
  487. this.$notify.warning(res.targetScoreChangeStr);
  488. }
  489. },
  490. parsePaperStructs(questionInfo) {
  491. if (!questionInfo || !questionInfo.length) return;
  492. const structMap = {};
  493. questionInfo.forEach((item) => {
  494. if (!structMap[item.mainNumber]) {
  495. structMap[item.mainNumber] = [];
  496. }
  497. structMap[item.mainNumber].push(item.subNumber + "");
  498. });
  499. this.paperStructs = Object.keys(structMap).map((mainNumber) => {
  500. return {
  501. mainNumber,
  502. subNumbers: structMap[mainNumber],
  503. };
  504. });
  505. },
  506. parseQuestionInfoTable(questionInfo) {
  507. const targetMap = {};
  508. const tData = {
  509. name: "目标分值",
  510. totalScore: calcSum(questionInfo.map((item) => item.score || 0)),
  511. };
  512. questionInfo.forEach((question) => {
  513. const qno = `${question.mainNumber}_${question.subNumber}`;
  514. tData[qno] = question.score;
  515. question.targetList.forEach((target) => {
  516. if (!targetMap[target.targetId]) {
  517. targetMap[target.targetId] = {
  518. name: target.targetName,
  519. totalScore: 0,
  520. };
  521. }
  522. if (target.dimensionList.length) {
  523. targetMap[target.targetId][qno] = question.score;
  524. targetMap[target.targetId].totalScore += question.score;
  525. } else {
  526. targetMap[target.targetId][qno] = "";
  527. }
  528. });
  529. });
  530. this.questionInfoTable = [tData, ...Object.values(targetMap)];
  531. },
  532. getQuestionInfoChartOption(scoreList) {
  533. const scoreRange = scoreList.scoreRange.map((item) => {
  534. return {
  535. name: `${item.minScore}~${item.maxScore}`,
  536. value: item.rate,
  537. };
  538. });
  539. scoreRange.unshift({
  540. name: "不及格",
  541. value: scoreList.failRate,
  542. });
  543. let options = {
  544. color: ["#556dff", "#3A5AE5"],
  545. title: {
  546. text: "成绩分布图",
  547. left: "center",
  548. },
  549. grid: {
  550. left: 40,
  551. top: 60,
  552. right: 80,
  553. bottom: 40,
  554. containLabel: true,
  555. },
  556. xAxis: {
  557. type: "category",
  558. name: "成绩(分)",
  559. nameTextStyle: {
  560. color: "#363D59",
  561. },
  562. data: scoreRange.map((item) => item.name),
  563. axisLabel: {
  564. color: "#6F7482",
  565. interval: 0,
  566. fontSize: 12,
  567. margin: 12,
  568. },
  569. axisLine: {
  570. show: true,
  571. lineStyle: {
  572. color: "#EFF0F5",
  573. },
  574. },
  575. splitLine: {
  576. show: false,
  577. },
  578. axisTick: {
  579. show: false,
  580. },
  581. axisPointer: {
  582. type: "shadow",
  583. },
  584. },
  585. yAxis: {
  586. type: "value",
  587. name: "百分比(%)",
  588. nameTextStyle: {
  589. color: "#363D59",
  590. },
  591. axisLabel: {
  592. color: "#6F7482",
  593. },
  594. axisLine: {
  595. lineStyle: {
  596. color: "#EFF0F5",
  597. },
  598. },
  599. splitLine: {
  600. lineStyle: {
  601. color: "#EFF0F5",
  602. },
  603. },
  604. },
  605. series: [
  606. {
  607. name: "占比",
  608. type: "bar",
  609. barWidth: 60,
  610. data: scoreRange.map((item) => item.value),
  611. label: {
  612. show: true,
  613. formatter: "{c}%",
  614. position: "top",
  615. },
  616. },
  617. ],
  618. };
  619. return options;
  620. },
  621. getCourseTargetListChartOption() {
  622. let options = {
  623. color: ["#556dff", "#f59a23"],
  624. title: {
  625. text: "课程目标达成评价值",
  626. left: "center",
  627. },
  628. grid: {
  629. left: 40,
  630. top: 40,
  631. right: 80,
  632. bottom: 30,
  633. containLabel: true,
  634. },
  635. legend: {
  636. top: 0,
  637. data: ["期望值", "达成值"],
  638. itemWidth: 12,
  639. itemHeight: 4,
  640. itemGap: 22,
  641. right: 40,
  642. },
  643. xAxis: {
  644. type: "category",
  645. name: "课程目标",
  646. nameTextStyle: {
  647. color: "#363D59",
  648. },
  649. data: this.courseTargetList.map((item) => item.targetName),
  650. axisLabel: {
  651. color: "#6F7482",
  652. interval: 0,
  653. fontSize: 12,
  654. margin: 12,
  655. },
  656. axisLine: {
  657. show: true,
  658. lineStyle: {
  659. color: "#EFF0F5",
  660. },
  661. },
  662. splitLine: {
  663. show: false,
  664. },
  665. axisTick: {
  666. show: false,
  667. },
  668. axisPointer: {
  669. type: "shadow",
  670. },
  671. },
  672. yAxis: {
  673. type: "value",
  674. name: "期望值",
  675. min: 0,
  676. max: 1,
  677. interval: 0.1,
  678. nameTextStyle: {
  679. color: "#363D59",
  680. },
  681. axisLabel: {
  682. color: "#6F7482",
  683. },
  684. axisLine: {
  685. lineStyle: {
  686. color: "#EFF0F5",
  687. },
  688. },
  689. splitLine: {
  690. lineStyle: {
  691. color: "#EFF0F5",
  692. },
  693. },
  694. },
  695. series: [
  696. {
  697. name: "达成值",
  698. type: "bar",
  699. barWidth: 60,
  700. data: this.courseTargetList.map((item) => item.evaluationValue),
  701. label: {
  702. show: true,
  703. position: "top",
  704. },
  705. },
  706. {
  707. name: "期望值",
  708. type: "line",
  709. symbol: "none",
  710. data: this.courseTargetList.map(
  711. (item) => this.courseBasicInfo.courseDegree || 0
  712. ),
  713. },
  714. ],
  715. };
  716. return options;
  717. },
  718. parseCourseTargets(examStudentList) {
  719. if (!examStudentList || !examStudentList.length) return;
  720. const targetList = examStudentList[0].targetList;
  721. const targetVals = {};
  722. this.courseTargetList.forEach((target) => {
  723. targetVals[target.targetId] = target.evaluationValue;
  724. });
  725. let tColumnCounts = [];
  726. this.courseTargets = targetList.map((target) => {
  727. const ntarget = {
  728. targetId: target.targetId,
  729. targetName: target.targetName,
  730. finalWeight: target.finalScore.targetWeight,
  731. usualWeight: target.usualScore.targetWeight,
  732. evaluationValue: targetVals[target.targetId],
  733. };
  734. ntarget.finalDimensions = ["期末成绩"];
  735. ntarget.usualWorks = target.usualScore.scoreList.map(
  736. (item) => item.evaluation
  737. );
  738. tColumnCounts.push(
  739. ntarget.finalDimensions.length + ntarget.usualWorks.length
  740. );
  741. return ntarget;
  742. });
  743. let tCount = 0;
  744. this.targetColumnCounts = tColumnCounts.map((item) => {
  745. tCount += item;
  746. return tCount;
  747. });
  748. },
  749. parseStudentScoreTable(examStudentList) {
  750. const lastIndex = examStudentList.length - 1;
  751. const studentScoreTable = examStudentList.map((student, sindex) => {
  752. const nitem = {
  753. name: student.name,
  754. studentCode: student.studentCode,
  755. score: student.score,
  756. };
  757. const finalScoreKey =
  758. lastIndex === sindex ? "matrixAvgScore" : "targetScoreSum";
  759. const workScoreKey = lastIndex === sindex ? "matrixAvgScore" : "score";
  760. student.targetList.forEach((target, index) => {
  761. nitem[`${target.targetId}-final`] = target.finalScore[finalScoreKey];
  762. target.usualScore.scoreList.forEach((work) => {
  763. nitem[`${target.targetId}-usual-${work.evaluation}`] =
  764. work[workScoreKey];
  765. });
  766. });
  767. return nitem;
  768. });
  769. const targetData = {
  770. name: "课程目标达成度",
  771. score: "",
  772. };
  773. this.courseTargets.forEach((target) => {
  774. targetData[`${target.targetId}-final`] = target.evaluationValue;
  775. });
  776. studentScoreTable.push(targetData);
  777. const fTarget = this.courseTargets[0];
  778. studentScoreTable.push({
  779. name: "课程达成度",
  780. [`${fTarget.targetId}-final`]: this.courseTargetValue,
  781. });
  782. this.studentScoreTable = studentScoreTable;
  783. },
  784. studentScoreSpanMethod({ row, column, rowIndex, columnIndex }) {
  785. const lineCount = this.studentScoreTable.length - 1;
  786. const maxTargetColumnCount = this.targetColumnCounts.slice(-1)[0];
  787. if (rowIndex === lineCount) {
  788. if (columnIndex === 0) {
  789. return [1, 2];
  790. } else if (columnIndex === 2) {
  791. return [1, maxTargetColumnCount + 1];
  792. } else {
  793. return [0, 0];
  794. }
  795. }
  796. if (rowIndex === lineCount - 1) {
  797. const colsMap = {};
  798. const targetColumns = [0, ...this.targetColumnCounts.slice(0, -1)];
  799. targetColumns.map((item, index) => {
  800. colsMap[item] = this.targetColumnCounts[index] - item;
  801. });
  802. if (columnIndex === 0) {
  803. return [1, 2];
  804. } else {
  805. if (targetColumns.includes(columnIndex - 2)) {
  806. return [1, colsMap[columnIndex - 2]];
  807. } else if (columnIndex < maxTargetColumnCount + 2) {
  808. return [0, 0];
  809. } else {
  810. return [1, 1];
  811. }
  812. }
  813. }
  814. if (rowIndex === lineCount - 2) {
  815. if (columnIndex === 0) {
  816. return [1, 2];
  817. } else if (columnIndex === 1) {
  818. return [0, 0];
  819. } else {
  820. return [1, 1];
  821. }
  822. }
  823. },
  824. async toSave() {
  825. if (this.downloading) return;
  826. this.downloading = true;
  827. const res = await targetReportSave({
  828. examId: this.course.examId,
  829. courseName: this.course.courseName,
  830. courseCode: this.course.courseCode,
  831. teachCourseId: this.course.teachCourseId,
  832. ...this.courseBasicInfo,
  833. }).catch(() => {});
  834. this.downloading = false;
  835. if (!res) return;
  836. this.$message.success("保存成功!");
  837. this.initData();
  838. },
  839. async toExport() {
  840. if (this.downloading) return;
  841. this.downloading = true;
  842. const res = await downloadByApi(() => {
  843. const datas = {
  844. examId: this.course.examId,
  845. courseCode: this.course.courseCode,
  846. teachCourseId: this.course.teachCourseId,
  847. };
  848. return exportTargetReport(datas);
  849. }).catch((e) => {
  850. this.$message.error(e || "下载失败,请重新尝试!");
  851. });
  852. this.downloading = false;
  853. if (!res) return;
  854. this.$message.success("下载成功!");
  855. },
  856. },
  857. };
  858. </script>
  859. <style scoped>
  860. .td-bg {
  861. color: #8b8fa1;
  862. font-weight: 500;
  863. }
  864. </style>