works.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <div
  3. class="pb_content"
  4. style="
  5. background: unset;
  6. overflow: auto;
  7. padding: 20px;
  8. margin: 0;
  9. box-sizing: border-box;
  10. "
  11. >
  12. <div
  13. style="
  14. position: absolute;
  15. width: 95%;
  16. top: 0;
  17. height: 100%;
  18. overflow: auto;
  19. left: 50%;
  20. transform: translateX(-50%);
  21. "
  22. >
  23. <div
  24. class="pb_content_body"
  25. style="
  26. background: #fff;
  27. padding: 0px 25px;
  28. box-sizing: border-box;
  29. border-radius: 5px;
  30. "
  31. >
  32. <div class="pb_head">
  33. <span class="sub_head">评价管理</span>
  34. <!-- <span>备注:教师可以根据课程、班级条件筛选学生并查看该学生信息</span> -->
  35. <span
  36. v-if="type == '2'"
  37. @click="
  38. goTo(
  39. '/tcStudent?userid=' + userid + '&oid=' + oid + '&org=' + org
  40. )
  41. "
  42. >学生管理</span
  43. >
  44. <span
  45. v-else
  46. @click="
  47. goTo('/course?userid=' + userid + '&oid=' + oid + '&org=' + org)
  48. "
  49. >课程管理</span
  50. >
  51. </div>
  52. <div class="student_head">
  53. <div class="student_search">
  54. <div>项目筛选</div>
  55. <el-select v-model="groupA" @change="search">
  56. <el-option value="0" label="我的课程"></el-option>
  57. <el-option value="1" label="他人课程"></el-option>
  58. </el-select>
  59. <el-input
  60. v-model="cn"
  61. placeholder="筛选项目名称"
  62. @input="search"
  63. ></el-input>
  64. <div @click="
  65. goTo('/studentWorks?userid=' + userid + '&oid=' + oid + '&org=' + org)
  66. ">学生评价管理</div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="pb_content_body">
  71. <div class="student_table">
  72. <el-table
  73. ref="table"
  74. :data="tableData1"
  75. border
  76. :height="tableHeight"
  77. :fit="true"
  78. v-loading="isLoading"
  79. style="width: 100%"
  80. :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
  81. :row-class-name="tableRowClassName"
  82. >
  83. <el-table-column
  84. prop="title"
  85. label="项目"
  86. min-width="30"
  87. align="center"
  88. ></el-table-column>
  89. <el-table-column
  90. prop="uname"
  91. label="创建人"
  92. min-width="30"
  93. align="center"
  94. ></el-table-column>
  95. <el-table-column
  96. prop="time"
  97. label="时间"
  98. min-width="20"
  99. align="center"
  100. ></el-table-column>
  101. <el-table-column label="操作" min-width="30">
  102. <template slot-scope="scope">
  103. <!-- <el-button
  104. type="primary"
  105. size="small"
  106. @click="
  107. goTo(
  108. '/worksDetail?cid=' +
  109. scope.row.courseId +
  110. '&userid=' +
  111. userid +
  112. '&oid=' +
  113. oid
  114. )
  115. "
  116. >查看学生</el-button>-->
  117. <!-- <el-button type="primary" size="small" @click="getWorkData(scope.row)">生成报告</el-button> -->
  118. <el-button
  119. type="primary"
  120. size="small"
  121. @click="getWorkData(scope.row)"
  122. >查看课程</el-button
  123. >
  124. <el-button
  125. type="primary"
  126. size="small"
  127. @click="getStudnet(scope.row)"
  128. >查看报告</el-button
  129. >
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. <div class="student_page">
  135. <el-pagination
  136. background
  137. layout="prev, pager, next"
  138. :page-size="10"
  139. :total="total"
  140. v-if="page"
  141. @current-change="handleCurrentChange"
  142. ></el-pagination>
  143. </div>
  144. </div>
  145. </div>
  146. <!-- <el-dialog
  147. title="查看报告"
  148. :visible.sync="dialogVisible"
  149. :append-to-body="true"
  150. width="750px"
  151. :before-close="handleClose"
  152. class="dialog_diy"
  153. >
  154. <div>
  155. <div class="a_addBox">
  156. <WorkDate :dataJson="dataJson"></WorkDate>
  157. </div>
  158. </div>
  159. <span slot="footer" class="dialog-footer">
  160. <el-button @click="dialogVisible = false">关 闭</el-button>
  161. </span>
  162. </el-dialog>-->
  163. <WorkDate
  164. :dataJson="dataJson"
  165. :uid="userid"
  166. :cid="dataJson.courseId"
  167. :ooid="oid"
  168. v-if="dialogVisible"
  169. class="workdates"
  170. ></WorkDate>
  171. <div class="cancelbox" v-if="dialogVisible">
  172. <el-button @click="dialogVisibleBao = true" type="primary" size="small"
  173. >自定义导出</el-button
  174. >
  175. <el-button @click="cancel" type="primary" size="small">返回</el-button>
  176. <!-- <el-button
  177. type="primary"
  178. size="small"
  179. @click="
  180. goTo(
  181. '/worksDetail?cid=' +
  182. dataJson.courseId +
  183. '&userid=' +
  184. userid +
  185. '&oid=' +
  186. oid
  187. )
  188. "
  189. >查看作业</el-button
  190. >-->
  191. </div>
  192. <el-dialog
  193. title="自定义导出报告"
  194. :visible.sync="dialogVisibleBao"
  195. :append-to-body="true"
  196. width="550px"
  197. :before-close="handleClose"
  198. class="dialog_diy r_diy"
  199. >
  200. <div>
  201. <div>
  202. <Report :cid="dataJson.courseId"></Report>
  203. </div>
  204. </div>
  205. <span slot="footer" class="dialog-footer"> </span>
  206. </el-dialog>
  207. <el-dialog
  208. title="选择学生"
  209. :visible.sync="signDialog"
  210. width="500px"
  211. :before-close="handleClose"
  212. class="dialog_diy check_diy"
  213. >
  214. <div>
  215. <div class="student_search" style="margin-bottom: 10px">
  216. <div>筛选</div>
  217. <div style="display: flex; width: 90%">
  218. <el-select
  219. class="r_select"
  220. v-model="uname"
  221. placeholder="请选择学生"
  222. filterable
  223. @change="searchWork2"
  224. >
  225. <el-option label="所有学生" value></el-option>
  226. <el-option
  227. v-for="item in userAarray"
  228. :key="item.userid"
  229. :label="item.username"
  230. :value="item.userid"
  231. ></el-option>
  232. </el-select>
  233. </div>
  234. </div>
  235. <div>
  236. <el-table
  237. v-loading="isLoading2"
  238. ref="table"
  239. :data="res2"
  240. border
  241. :height="400"
  242. :fit="true"
  243. style="width: 100%"
  244. :row-class-name="tableRowClassName"
  245. :header-cell-style="{ background: 'rgb(238,238,238)' }"
  246. >
  247. <el-table-column
  248. prop="sName"
  249. label="姓名"
  250. min-width="20"
  251. ></el-table-column>
  252. <el-table-column label="操作" min-width="20">
  253. <template slot-scope="scope">
  254. <el-button
  255. type="primary"
  256. size="small"
  257. @click="getReport(scope.row)"
  258. >查看报告</el-button
  259. >
  260. </template>
  261. </el-table-column>
  262. </el-table>
  263. <div style="margin-top: 10px">
  264. <el-pagination
  265. background
  266. layout="prev, pager, next"
  267. :page-size="10"
  268. :total="total2"
  269. @current-change="handleCurrentChange2"
  270. ></el-pagination>
  271. </div>
  272. </div>
  273. </div>
  274. <span slot="footer" class="dialog-footer">
  275. <el-button @click="signDialog = false">关闭</el-button>
  276. </span>
  277. </el-dialog>
  278. <div class="report_box" v-if="reportVisible">
  279. <studentReport
  280. :checkCourse="checkCourse"
  281. :checkStudent="checkStudent"
  282. :oid="oid"
  283. ></studentReport>
  284. </div>
  285. <div class="cancelbox" v-if="reportVisible">
  286. <el-button @click="cancelR" type="primary" size="small">返回</el-button>
  287. </div>
  288. </div>
  289. </template>
  290. <script>
  291. import WorkDate from "./components/workData";
  292. import Report from "./components/report";
  293. import studentReport from "./components/studentReport";
  294. import { T } from "caniuse-lite/data/browserVersions";
  295. export default {
  296. components: {
  297. WorkDate,
  298. Report,
  299. studentReport,
  300. },
  301. data() {
  302. return {
  303. tableHeight: "500px",
  304. isLoading: false,
  305. formLabelWidth: "100px",
  306. tableData1: [],
  307. subject: "",
  308. sClass: "",
  309. subjectJuri: [],
  310. projectJuri: [],
  311. grade: [],
  312. projectchoose: "",
  313. page: 1,
  314. total: 0,
  315. groupA: "0",
  316. cn: "",
  317. userid: this.$route.query.userid,
  318. org: this.$route.query.org,
  319. oid: this.$route.query.oid,
  320. type: this.$route.query.type,
  321. dialogVisible: false,
  322. dialogVisibleBao: false,
  323. dataJson: {},
  324. signDialog: false,
  325. isLoading2: false,
  326. page2: 1,
  327. total2: 0,
  328. res2: [],
  329. checkCourse: "",
  330. reportVisible: false,
  331. checkStudent: "",
  332. userAarray: [],
  333. uname: "",
  334. };
  335. },
  336. mounted() {
  337. this.$nextTick(function () {
  338. this.tableHeight =
  339. window.innerHeight - this.$refs.table.$el.offsetTop - 200;
  340. if (this.tableHeight <= 530) {
  341. this.tableHeight = 530;
  342. }
  343. // 监听窗口大小变化
  344. let self = this;
  345. window.onresize = function () {
  346. self.tableHeight =
  347. window.innerHeight - self.$refs.table.$el.offsetTop - 200;
  348. if (self.tableHeight <= 530) {
  349. self.tableHeight = 530;
  350. }
  351. };
  352. });
  353. },
  354. methods: {
  355. goTo(path) {
  356. this.$router.push(path);
  357. },
  358. tableRowClassName({ row, rowIndex }) {
  359. if ((rowIndex + 1) % 2 === 0) {
  360. return "even_row";
  361. } else {
  362. return "";
  363. }
  364. },
  365. handleClose(done) {
  366. done();
  367. },
  368. handleCurrentChange(val) {
  369. this.page = val;
  370. this.getProject();
  371. },
  372. handleCurrentChange2(val) {
  373. this.page2 = val;
  374. this.getStudnet();
  375. },
  376. //获取班级列表
  377. getClass() {
  378. this.isLoading = true;
  379. let params = {
  380. cu: "",
  381. cn: this.sClass,
  382. page: this.page,
  383. };
  384. this.ajax
  385. .get(this.$store.state.api + "selectClass", params)
  386. .then((res) => {
  387. this.isLoading = false;
  388. this.grade = res.data[0];
  389. })
  390. .catch((err) => {
  391. this.isLoading = false;
  392. console.error(err);
  393. });
  394. },
  395. getProject() {
  396. this.isLoading = true;
  397. let params = {
  398. type: this.groupA,
  399. uid: this.userid,
  400. oid: this.oid,
  401. cn: this.cn,
  402. page: this.page,
  403. };
  404. this.ajax
  405. .get(this.$store.state.api + "getProject", params)
  406. .then((res) => {
  407. this.isLoading = false;
  408. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  409. this.tableData1 = res.data[0];
  410. })
  411. .catch((err) => {
  412. this.isLoading = false;
  413. console.error(err);
  414. });
  415. },
  416. search() {
  417. this.page = 1;
  418. this.getProject();
  419. },
  420. getWorkData(res) {
  421. this.dataJson = res;
  422. this.dialogVisible = true;
  423. },
  424. cancel() {
  425. this.dataJson = "";
  426. this.dialogVisible = false;
  427. },
  428. cancelR() {
  429. this.checkStudent = "";
  430. this.reportVisible = false;
  431. this.signDialog = true;
  432. },
  433. searchWork2() {
  434. (this.page2 = 1), this.getStudnet();
  435. },
  436. getStudnet(row) {
  437. //获取作业
  438. this.signDialog = true;
  439. this.isLoading2 = true;
  440. this.checkCourse = row ? row.courseId : this.checkCourse;
  441. let params = {
  442. cid: this.checkCourse,
  443. uname: this.uname,
  444. stage: "",
  445. task: "",
  446. page: this.page2,
  447. };
  448. this.ajax
  449. .get(this.$store.state.api + "getCourseWorks3", params)
  450. .then((res) => {
  451. this.isLoading2 = false;
  452. this.total2 = res.data[0].length > 0 ? res.data[0][0].num : 0;
  453. this.res2 = res.data[0];
  454. this.getCourseDetail();
  455. })
  456. .catch((err) => {
  457. this.isLoading2 = false;
  458. console.error(err);
  459. });
  460. },
  461. getCourseDetail() {
  462. let params = {
  463. cid: this.checkCourse,
  464. };
  465. this.ajax
  466. .get(this.$store.state.api + "getCourseWorksReport", params)
  467. .then((res) => {
  468. this.userAarray = res.data[1];
  469. })
  470. .catch((err) => {
  471. console.error(err);
  472. });
  473. },
  474. getReport(row) {
  475. this.checkStudent = row.userid;
  476. this.reportVisible = true;
  477. this.signDialog = false;
  478. },
  479. },
  480. created() {
  481. this.page = 1;
  482. // this.getClass();
  483. // this.getGroup();
  484. this.getProject();
  485. },
  486. };
  487. </script>
  488. <style scoped>
  489. .sub_head {
  490. position: relative;
  491. }
  492. .sub_head::after {
  493. content: "";
  494. width: 100%;
  495. background: #5a9cea;
  496. height: 2px;
  497. position: absolute;
  498. left: 0;
  499. bottom: -12px;
  500. }
  501. .pb_head > span:nth-child(2) {
  502. /* font-size: 16px; */
  503. font-size: 26px;
  504. cursor: pointer;
  505. margin-left: 10px;
  506. /* color: #ab582f; */
  507. /* color: #409eff; */
  508. color: #999;
  509. }
  510. .pb_head > span:nth-child(2):hover {
  511. color: #000;
  512. }
  513. .pb_head {
  514. margin: 0 !important;
  515. width: 100% !important;
  516. }
  517. .student_page {
  518. margin-top: 10px;
  519. }
  520. .student_head {
  521. margin-top: 10px;
  522. padding-bottom: 15px;
  523. display: flex;
  524. justify-content: space-between;
  525. }
  526. .student_search {
  527. display: flex;
  528. flex-direction: row;
  529. align-items: center;
  530. }
  531. .student_search > div:nth-child(1) {
  532. line-height: 35px;
  533. font-size: 14px;
  534. min-width: 60px;
  535. }
  536. .student_search > div:nth-child(4) {
  537. min-width: 100px;
  538. margin-left: 10px;
  539. cursor: pointer;
  540. }
  541. .student_search >>> .el-input__inner {
  542. width: 190px;
  543. height: 35px;
  544. margin-left: 10px;
  545. }
  546. .student_table >>> .el-table--border td {
  547. border-right: 0px !important;
  548. }
  549. .student_page {
  550. margin-top: 10px;
  551. }
  552. .student_table >>> .el-table,
  553. .student_table >>> .el-table__body-wrapper {
  554. height: auto !important;
  555. }
  556. .el-table >>> .even_row {
  557. background-color: #f1f1f1 !important;
  558. }
  559. .dialog_diy >>> .el-dialog__header {
  560. padding: 9px 20px 10px;
  561. background: #32455b !important;
  562. }
  563. .dialog_diy >>> .el-dialog__title {
  564. color: #fff;
  565. font-size: 15px;
  566. }
  567. .dialog_diy >>> .el-dialog__headerbtn {
  568. top: 14px;
  569. }
  570. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
  571. color: #fff;
  572. }
  573. .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
  574. color: #fff;
  575. }
  576. .check_diy >>> .el-dialog__body {
  577. padding-bottom: 0;
  578. }
  579. .dialog_diy >>> .el-dialog__body,
  580. .dialog_diy >>> .el-dialog__footer {
  581. background: #fafafa;
  582. }
  583. .r_diy >>> .el-dialog__footer {
  584. padding: 0;
  585. }
  586. .a_addBox {
  587. height: 570px;
  588. overflow: auto;
  589. }
  590. .workdates {
  591. height: 100%;
  592. position: absolute;
  593. top: 0;
  594. background: #fff;
  595. overflow: auto;
  596. z-index: 1;
  597. width: 95%;
  598. left: 50%;
  599. transform: translateX(-50%);
  600. padding: 20px;
  601. box-sizing: border-box;
  602. }
  603. .cancelbox {
  604. position: absolute;
  605. z-index: 2;
  606. left: 50%;
  607. width: 95%;
  608. transform: translateX(-50%);
  609. display: flex;
  610. justify-content: flex-end;
  611. padding: 0 90px 0px 0px;
  612. box-sizing: border-box;
  613. }
  614. .report_box {
  615. height: 100%;
  616. position: absolute;
  617. top: 0;
  618. /* background: #fff; */
  619. background: rgb(231, 242, 252);
  620. overflow: auto;
  621. z-index: 1;
  622. width: 100%;
  623. left: 50%;
  624. transform: translateX(-50%);
  625. padding: 20px;
  626. box-sizing: border-box;
  627. }
  628. </style>