score.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <div class="scoreBox" v-loading="Loading">
  3. <div class="sBox_top">
  4. <div class="sTop_select">
  5. <el-select
  6. v-model="year"
  7. placeholder="请选择学期"
  8. class="student_input"
  9. >
  10. <!-- <el-option label="所有学期" value=""></el-option> -->
  11. <el-option
  12. v-for="(y, yIndex) in yearJuri"
  13. :key="yIndex"
  14. :label="y.name"
  15. :value="y.id"
  16. ></el-option>
  17. </el-select>
  18. </div>
  19. <!-- <div class="sTop_button">查看评分标准</div> -->
  20. </div>
  21. <!-- <table border="1">
  22. <tr>
  23. <td>学习领域</td>
  24. <td>一级发展目标</td>
  25. <td>学期初始评分</td>
  26. <td>期中评分</td>
  27. <td>期末评分</td>
  28. <td>平均分</td>
  29. <td>关联证据</td>
  30. </tr>
  31. <tr v-for="(item, index) in scoreJson" :key="index">
  32. <td>
  33. {{ item.name }}
  34. </td>
  35. </tr>
  36. </table> -->
  37. <div class="sBox_table">
  38. <div class="table_title">
  39. <div>学习领域</div>
  40. <div>一级发展目标</div>
  41. <div>学期初始评分</div>
  42. <div>期中评分</div>
  43. <div>期末评分</div>
  44. <div>平均分</div>
  45. <div>关联证据</div>
  46. </div>
  47. <div class="table_detail">
  48. <div
  49. class="table_ftype"
  50. v-for="(item, index) in scoreType"
  51. :key="index"
  52. >
  53. <div
  54. v-if="scoreJson[item.id].length"
  55. class="ftype_name"
  56. :style="{
  57. minHeight: scoreJson[item.id].length * 50 + 'px',
  58. lineHeight: scoreJson[item.id].length * 50 + 'px'
  59. }"
  60. >
  61. {{ item.name }}
  62. </div>
  63. <div class="table_stype">
  64. <div
  65. class="stype_name"
  66. v-for="(item1, index1) in scoreJson[item.id]"
  67. :key="index + '-' + index1"
  68. :label="item1.id"
  69. >
  70. {{ item1.sname }}
  71. </div>
  72. </div>
  73. <div class="table_score">
  74. <div
  75. class="stype_score"
  76. v-for="(item2, index2) in scoreJson[item.id]"
  77. :key="index + '-' + index2"
  78. :label="item2.id"
  79. >
  80. <div
  81. v-for="(item3, index3) in item2[item2.id]"
  82. :key="index + '-' + index2 + '-' + index3"
  83. :label="item3"
  84. >
  85. <div class="star_box">
  86. <div
  87. class="star"
  88. v-for="sIndex in 5"
  89. :key="'star' + sIndex"
  90. :class="{ starA: item3 >= sIndex }"
  91. @click="
  92. updateStar(item.id, item2.id, index2, index3, sIndex)
  93. "
  94. ></div>
  95. </div>
  96. </div>
  97. <div>
  98. {{ getStarSum(item.id, item2.id, index2) }}
  99. </div>
  100. <div @click="lookSRecordByType(item.id, item2.id)">
  101. <span style="color: #3681fc; cursor: pointer">查看</span>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <!-- <div class="saveBox">
  107. <div style="box-sizing: border-box;padding: 3px 10px;" @click="saveSRJson">保存评分</div>
  108. </div> -->
  109. </div>
  110. </div>
  111. <el-dialog
  112. title="已关联证据"
  113. :visible.sync="dialogVisibleReport"
  114. :append-to-body="true"
  115. width="1000px"
  116. :close-on-click-modal="true"
  117. :before-close="closePop"
  118. class="dialog_diy"
  119. >
  120. <!-- :dialogVisibleReport.sync="dialogVisibleReport" -->
  121. <reportDialog
  122. ref="dialogRef"
  123. :userid="userid"
  124. :fid="fid"
  125. :tid="tid"
  126. :cid="cid"
  127. :oid="oid"
  128. :year="year"
  129. ></reportDialog>
  130. </el-dialog>
  131. </div>
  132. </template>
  133. <script>
  134. import reportDialog from "./reportDialog/index.vue";
  135. export default {
  136. components: {
  137. reportDialog
  138. },
  139. props: {
  140. userid: {
  141. type: String
  142. },
  143. oid: {
  144. type: String
  145. },
  146. org: {
  147. type: String
  148. },
  149. cid: {
  150. type: String
  151. }
  152. },
  153. data() {
  154. return {
  155. isLoading: false,
  156. year: "",
  157. yearJuri: [],
  158. scoreType: [],
  159. scoreJson: {},
  160. dialogVisibleReport: false,
  161. fid: "",
  162. tid: "",
  163. Loading: false
  164. };
  165. },
  166. computed: {
  167. getStarSum() {
  168. return function(id, iid, i) {
  169. let sum = 0;
  170. for (var k = 0; k < this.scoreJson[id][i][iid].length; k++) {
  171. sum += this.scoreJson[id][i][iid][k];
  172. }
  173. return (sum / this.scoreJson[id][i][iid].length).toFixed(1);
  174. };
  175. }
  176. },
  177. watch: {
  178. year(newVal, oldVal){
  179. this.saveSRJson2(oldVal)
  180. }
  181. },
  182. methods: {
  183. closePop() {
  184. this.dialogVisibleReport = false;
  185. },
  186. switchTerm() {
  187. // this.searchStudentScore();
  188. console.log('变化了');
  189. },
  190. searchStudentScore() {
  191. this.isLoading = true;
  192. this.scoreType = [];
  193. this.scoreJson = {};
  194. let params = {
  195. uid: this.userid,
  196. oid: this.oid,
  197. org: this.org,
  198. cu: this.year
  199. };
  200. this.ajax
  201. .get(this.$store.state.api + "selectSETable", params)
  202. .then(res => {
  203. var table = res.data[0]; //个人学期评分
  204. var ftype = res.data[1]; //公共父级分类
  205. var stype = res.data[2]; //公共子级分类
  206. var sctype = res.data[3]; //该学校子级分类
  207. var fctype = res.data[4]; //该学校父级分类
  208. var fotype = res.data[5]; //组织父级分类
  209. var sotype = res.data[6]; //组织子级分类
  210. var allfType = [];
  211. var allsType = [];
  212. if (fotype.length == 0 && sotype.length == 0) {
  213. if (fctype.length == 0 && sctype.length == 0) {
  214. for (var i = 0; i < ftype.length; i++) {
  215. allfType.push(ftype[i]);
  216. }
  217. for (var i = 0; i < stype.length; i++) {
  218. allsType.push(stype[[i]]);
  219. }
  220. } else {
  221. for (var i = 0; i < fctype.length; i++) {
  222. allfType.push(fctype[i]);
  223. }
  224. for (var i = 0; i < sctype.length; i++) {
  225. allsType.push(sctype[[i]]);
  226. }
  227. }
  228. } else {
  229. for (var i = 0; i < fotype.length; i++) {
  230. allfType.push(fotype[i]);
  231. }
  232. for (var i = 0; i < sotype.length; i++) {
  233. allsType.push(sctysotypepe[[i]]);
  234. }
  235. }
  236. if (table.length > 0) {
  237. this.scoreJson = JSON.parse(table[0].json);
  238. } else {
  239. var scoreJson = {};
  240. allfType.forEach(itemA => {
  241. scoreJson[itemA.id] = [];
  242. allsType.forEach(itemB => {
  243. if (itemB.pid === itemA.id) {
  244. scoreJson[itemA.id].push({
  245. [itemB.id]: [0, 0, 0],
  246. sname: itemB.name,
  247. id: itemB.id
  248. });
  249. }
  250. });
  251. });
  252. this.scoreJson = scoreJson;
  253. }
  254. this.scoreType = allfType;
  255. this.Loading = false;
  256. // console.log("this.scoreJson", this.scoreJson);
  257. // console.log("this.scoreType", this.scoreType);
  258. })
  259. .catch(err => {
  260. this.isLoading = false;
  261. console.error(err);
  262. });
  263. },
  264. getYear() {
  265. this.isLoading = true;
  266. this.ajax
  267. .get(this.$store.state.api + "selectTerm")
  268. .then(res => {
  269. this.isLoading = false;
  270. var yearJuri = res.data[0];
  271. for (var i = 0; i < yearJuri.length; i++) {
  272. if (yearJuri[i].defaultC == 1) {
  273. this.year = yearJuri[i].id;
  274. }
  275. }
  276. this.yearJuri = yearJuri;
  277. this.searchStudentScore();
  278. })
  279. .catch(err => {
  280. this.isLoading = false;
  281. console.error(err);
  282. });
  283. },
  284. updateStar(id, iid, i, j, v) {
  285. this.scoreJson[id][i][iid][j] = v;
  286. this.$forceUpdate();
  287. },
  288. lookSRecordByType(fid, tid) {
  289. this.fid = fid;
  290. this.tid = tid;
  291. this.dialogVisibleReport = true;
  292. this.$nextTick(() => {
  293. this.$refs.dialogRef.getData();
  294. });
  295. },
  296. saveSRJson2(val) {
  297. let params = {
  298. uid: this.userid,
  299. j: JSON.stringify(this.scoreJson),
  300. t: val
  301. };
  302. this.ajax
  303. .get(this.$store.state.api + "addSRScore", params)
  304. .then(res => {
  305. // this.$message.success("保存成功!");
  306. this.searchStudentScore();
  307. })
  308. .catch(err => {
  309. console.error(err);
  310. });
  311. },
  312. saveSRJson() {
  313. let params = {
  314. uid: this.userid,
  315. j: JSON.stringify(this.scoreJson),
  316. t: this.year
  317. };
  318. this.ajax
  319. .get(this.$store.state.api + "addSRScore", params)
  320. .then(res => {
  321. // this.$message.success("保存成功!");
  322. this.searchStudentScore();
  323. })
  324. .catch(err => {
  325. console.error(err);
  326. });
  327. }
  328. },
  329. beforeDestroy() {
  330. this.saveSRJson();
  331. },
  332. mounted() {
  333. // this.$nextTick(()=>{
  334. // console.log(this.$refs.dialogRef);
  335. // })
  336. this.Loading = true;
  337. this.getYear();
  338. }
  339. };
  340. </script>
  341. <style scoped>
  342. table {
  343. border-collapse: collapse;
  344. }
  345. table,
  346. th,
  347. td {
  348. border: 1px solid black;
  349. }
  350. td {
  351. box-sizing: border-box;
  352. padding: 15px 25px;
  353. }
  354. .dialog_diy {
  355. box-sizing: border-box;
  356. /* padding: 0 10px 10px 10px; */
  357. }
  358. .dialog_diy >>> .el-dialog {
  359. /* height: 100%; */
  360. margin: 10vh auto !important;
  361. }
  362. .dialog_diy >>> .el-dialog__header {
  363. background: #454545 !important;
  364. padding: 15px 20px;
  365. }
  366. .dialog_diy >>> .el-dialog__body {
  367. height: calc(100% - 124px);
  368. box-sizing: border-box;
  369. /* padding: 0px; */
  370. }
  371. .dialog_diy >>> .el-dialog__title {
  372. color: #fff;
  373. }
  374. .dialog_diy >>> .el-dialog__headerbtn {
  375. top: 19px;
  376. }
  377. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
  378. color: #fff;
  379. }
  380. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
  381. color: #fff;
  382. }
  383. .dialog_diy >>> .el-dialog__body,
  384. .dialog_diy >>> .el-dialog__footer {
  385. background: #fafafa;
  386. }
  387. .scoreBox {
  388. background: #fff;
  389. border-radius: 10px;
  390. width: 98%;
  391. box-sizing: border-box;
  392. padding: 0 15px;
  393. margin: 15px auto;
  394. overflow: auto;
  395. height: calc(100% - 30px);
  396. }
  397. .sBox_top {
  398. width: 100%;
  399. display: flex;
  400. flex-direction: row;
  401. flex-wrap: nowrap;
  402. align-items: center;
  403. margin: 0 auto;
  404. padding: 20px 0;
  405. box-sizing: border-box;
  406. }
  407. .sTop_select >>> .el-input__inner {
  408. height: 35px;
  409. width: 150px;
  410. }
  411. .sTop_select >>> .el-input__suffix {
  412. top: 3px !important;
  413. }
  414. .sTop_button {
  415. background: #3681fc;
  416. color: #fff;
  417. border-radius: 5px;
  418. width: 120px;
  419. height: 35px;
  420. line-height: 35px;
  421. text-align: center;
  422. cursor: pointer;
  423. margin-left: 30px;
  424. }
  425. .sBox_table {
  426. width: 100%;
  427. min-width: calc(150px * 7);
  428. margin: 0 auto;
  429. /* min-width: 1520px; */
  430. font-size: 14px;
  431. }
  432. .table_title {
  433. width: 100%;
  434. min-width: calc(150px * 7);
  435. height: 50px;
  436. background: #e0eafb;
  437. border: 1px solid #d5d8df;
  438. display: flex;
  439. flex-direction: row;
  440. flex-wrap: nowrap;
  441. align-items: center;
  442. }
  443. .table_title > div {
  444. width: calc(100% / 7);
  445. min-width: 150px;
  446. text-align: center;
  447. height: 100%;
  448. line-height: 50px;
  449. border-right: 1px solid #d5d8df;
  450. }
  451. .table_title > div:last-child {
  452. border: none;
  453. }
  454. .table_detail {
  455. width: 100%;
  456. min-width: calc(100% / 7);
  457. height: 100%;
  458. display: flex;
  459. flex-direction: column;
  460. flex-wrap: nowrap;
  461. align-items: flex-start;
  462. }
  463. .table_detail > .table_ftype {
  464. display: flex;
  465. flex-direction: row;
  466. flex-wrap: nowrap;
  467. align-items: center;
  468. width: 100%;
  469. min-width: calc(100% / 7);
  470. height: 100%;
  471. }
  472. .table_ftype > .ftype_name {
  473. width: calc(100% / 7);
  474. min-width: 150px;
  475. /* width: calc(100% / 7);
  476. min-width: calc(100% / 7); */
  477. height: 100%;
  478. min-height: 80px;
  479. line-height: 80px;
  480. text-align: center;
  481. border-left: 1px solid #d5d8df;
  482. border-bottom: 1px solid #d5d8df;
  483. border-right: none;
  484. }
  485. .table_detail > .table_ftype:first-child {
  486. border-top: none;
  487. }
  488. .table_stype {
  489. display: flex;
  490. flex-direction: column;
  491. flex-wrap: nowrap;
  492. align-items: center;
  493. width: calc(100% / 7);
  494. min-width: 150px;
  495. text-align: center;
  496. height: 100%;
  497. min-height: 80px;
  498. border-left: 1px solid #d5d8df;
  499. border-bottom: 1px solid #d5d8df;
  500. }
  501. .table_stype > .stype_name {
  502. width: 100%;
  503. min-width: 150px;
  504. height: calc(100% / 2);
  505. min-height: 50px;
  506. line-height: 50px;
  507. border-right: 1px solid #d5d8df;
  508. border-bottom: 1px solid #d5d8df;
  509. }
  510. .table_stype > .stype_name:last-child {
  511. border-bottom: none;
  512. }
  513. .table_score {
  514. width: calc(100% / 7 * 5);
  515. display: flex;
  516. flex-direction: column;
  517. flex-wrap: nowrap;
  518. align-items: center;
  519. }
  520. .stype_score {
  521. display: flex;
  522. flex-direction: row;
  523. flex-wrap: nowrap;
  524. align-items: center;
  525. width: calc(100% + 4px);
  526. height: 50px;
  527. line-height: 50px;
  528. text-align: center;
  529. }
  530. .stype_score > div {
  531. width: calc(100% / 3);
  532. min-width: 150px;
  533. height: 100%;
  534. border-bottom: 1px solid #d5d8df;
  535. border-right: 1px solid #d5d8df;
  536. }
  537. .stype_score > div >>> .el-rate {
  538. height: 100%;
  539. line-height: 60px;
  540. }
  541. .star_box {
  542. display: flex;
  543. flex-direction: row;
  544. flex-wrap: nowrap;
  545. align-items: center;
  546. max-width: 100%;
  547. min-width: 150px;
  548. height: 100%;
  549. text-align: center;
  550. justify-content: center;
  551. }
  552. .star_box > .star {
  553. width: 19px;
  554. height: 19px;
  555. display: block;
  556. background-image: url("../../../../assets/icon/studentEva/star-no.png");
  557. background-size: 100% 100%;
  558. cursor: pointer;
  559. }
  560. .star_box > .star + .star {
  561. margin-left: 5px;
  562. }
  563. .star_box > .starA {
  564. background-image: url("../../../../assets/icon/studentEva/star.png");
  565. }
  566. .saveBox {
  567. width: 100%;
  568. cursor: pointer;
  569. padding: 10px 0;
  570. box-sizing: border-box;
  571. }
  572. .saveBox > div {
  573. /* width: 70px; */
  574. /* height: 30px; */
  575. color: #fff;
  576. background: #3681fc;
  577. text-align: center;
  578. line-height: 30px;
  579. border-radius: 5px;
  580. float: right;
  581. }
  582. </style>