CourseStatistic.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. <template>
  2. <section class="content" style="margin-top: -18px;">
  3. <div class="box box-info">
  4. <!-- 头信息 -->
  5. <div
  6. class="box-header with-border"
  7. style="background-color:#d3dce6;margin-bottom:20px;"
  8. >
  9. <h2 class="box-title">课程统计</h2>
  10. <div class="box-tools pull-right">
  11. <button type="button" class="btn btn-box-tool" data-widget="collapse">
  12. <i class="fa fa-minus"></i>
  13. </button>
  14. </div>
  15. </div>
  16. <!-- 正文信息 -->
  17. <div class="box-body">
  18. <el-form
  19. :model="formSearch"
  20. :inline="true"
  21. label-position="right"
  22. label-width="100px"
  23. >
  24. <el-form-item label="学校">
  25. <el-select
  26. v-model="formSearch.orgId"
  27. placeholder="请选择"
  28. clearable
  29. @change="searchExamList(formSearch.orgId);"
  30. >
  31. <el-option
  32. v-for="item in orgList"
  33. :label="item.orgName"
  34. :value="item.orgId"
  35. :key="item.orgId"
  36. ></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="考试">
  40. <el-select
  41. v-model="formSearch.examId"
  42. @change="searchRecords"
  43. placeholder="请选择"
  44. >
  45. <el-option
  46. v-for="item in examList"
  47. :label="item.examName"
  48. :value="item.examId"
  49. :key="item.examId"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="试卷状态">
  54. <el-select
  55. v-model="formSearch.paperStatus"
  56. clearable
  57. placeholder="请选择"
  58. >
  59. <el-option label="请选择" value=""></el-option>
  60. <el-option
  61. v-for="item in coursePaperStatusList"
  62. :label="item.label"
  63. :value="item.value"
  64. :key="item.value"
  65. ></el-option>
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="课程名称">
  69. <el-select
  70. v-model="formSearch.courseId"
  71. placeholder="请选择"
  72. filterable
  73. clearable
  74. remote
  75. :remote-method="searchCourseList"
  76. >
  77. <el-option label="请选择" value=""></el-option>
  78. <el-option
  79. v-for="item in courseList"
  80. :label="item.name"
  81. :value="item.id"
  82. :key="item.id"
  83. ></el-option>
  84. </el-select>
  85. </el-form-item>
  86. <el-form-item label="试卷名称">
  87. <el-input
  88. v-model="formSearch.paperName"
  89. style="width: 221px"
  90. ></el-input>
  91. </el-form-item>
  92. <el-form-item style="padding-left: 30px">
  93. <el-button
  94. size="small"
  95. type="primary"
  96. icon="el-icon-search"
  97. @click="searchRecords"
  98. >查询
  99. </el-button>
  100. <el-button
  101. size="small"
  102. type="primary"
  103. icon="el-icon-menu"
  104. @click="openAllotAllDialog"
  105. >分配待指定试卷
  106. </el-button>
  107. <el-button
  108. size="small"
  109. type="primary"
  110. icon="el-icon-download"
  111. @click="openExportAllDialog"
  112. >整体导出
  113. </el-button>
  114. <el-button
  115. size="small"
  116. type="primary"
  117. icon="el-icon-download"
  118. @click="openExportDialog"
  119. >批量导出
  120. </el-button>
  121. <el-button
  122. size="small"
  123. type="primary"
  124. icon="el-icon-refresh"
  125. @click="refreshStatistic"
  126. >刷新
  127. </el-button>
  128. </el-form-item>
  129. </el-form>
  130. <!-- 数据列表 -->
  131. <el-table
  132. v-loading="loading"
  133. :data="tableData"
  134. element-loading-text="数据加载中"
  135. style="width:100%;"
  136. border
  137. >
  138. <el-table-column type="selection" width="55"> </el-table-column>
  139. <el-table-column label="课程名称" prop="courseName" />
  140. <el-table-column width="150" label="课程代码" prop="courseCode" />
  141. <el-table-column width="80" label="试卷类型" prop="paperType" />
  142. <el-table-column width="80" label="试卷状态">
  143. <template slot-scope="scope">
  144. <span
  145. @click="openAllotDialog(scope.row);"
  146. style="cursor: pointer"
  147. >{{ scope.row.paperStatusName }}</span
  148. >
  149. </template>
  150. </el-table-column>
  151. <el-table-column width="200" label="试卷名称" prop="paperName" />
  152. <el-table-column width="80" label="试卷P数" prop="paperP" />
  153. <el-table-column width="100" label="考生人数" prop="totalStudent" />
  154. <el-table-column width="180" label="操作" :context="_self">
  155. <template slot-scope="scope">
  156. <el-button
  157. size="mini"
  158. icon="el-icon-view"
  159. v-show="scope.row.paperStatus > 1"
  160. @click="preview(scope.row);"
  161. >预览
  162. </el-button>
  163. <el-button
  164. size="mini"
  165. icon="el-icon-download"
  166. v-show="scope.row.paperStatus > 1"
  167. @click="download(scope.row);"
  168. >下载
  169. </el-button>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. <!-- 分页 -->
  174. <div class="page pull-right">
  175. <el-pagination
  176. @current-change="handlePager"
  177. :current-page="formSearch.pageNo"
  178. :page-size="formSearch.pageSize"
  179. :total="totalElements"
  180. layout="total, prev, pager, next, jumper"
  181. ></el-pagination>
  182. </div>
  183. </div>
  184. <el-dialog
  185. title="试卷指定"
  186. width="380px"
  187. :visible.sync="allotDialog"
  188. @close="closeAllotDialog"
  189. >
  190. <el-form
  191. :model="allotForm"
  192. ref="allotForm"
  193. :rules="rules"
  194. label-position="right"
  195. label-width="80px"
  196. >
  197. <el-form-item label="课程名称" prop="courseName">
  198. <el-input
  199. v-model="allotForm.courseName"
  200. :disabled="true"
  201. class="w220"
  202. >
  203. {{ allotForm.courseName }}</el-input
  204. >
  205. </el-form-item>
  206. <el-form-item label="试卷类型" prop="paperType">
  207. <el-input
  208. v-model="allotForm.paperType"
  209. :disabled="true"
  210. class="w220"
  211. >
  212. {{ allotForm.paperType }}</el-input
  213. >
  214. </el-form-item>
  215. <el-form-item label="试卷名称" prop="coursePaperId">
  216. <el-select
  217. v-model="allotForm.coursePaperId"
  218. placeholder="请选择"
  219. class="w220"
  220. >
  221. <el-option
  222. v-for="item in coursePaperList"
  223. :value="item.coursePaperId"
  224. :key="item.coursePaperId"
  225. :label="item.paperName"
  226. ></el-option>
  227. </el-select>
  228. </el-form-item>
  229. <div style="text-align: center">
  230. <el-button type="primary" @click="saveAllot">确 定</el-button>
  231. <el-button @click="closeAllotDialog">取 消</el-button>
  232. </div>
  233. </el-form>
  234. </el-dialog>
  235. <el-dialog title="试卷整体分配" :visible.sync="allotAllDialog">
  236. <el-form
  237. :model="allotAllForm"
  238. label-position="right"
  239. label-width="100px"
  240. >
  241. <el-row :gutter="10">
  242. <el-col :md="20">
  243. <el-form-item label="学校名称">
  244. <el-select
  245. v-model="allotAllForm.orgId"
  246. @change="searchExamList(allotAllForm.orgId, 2);"
  247. >
  248. <el-option label="请选择" value></el-option>
  249. <el-option
  250. v-for="item in orgList"
  251. :label="item.orgName"
  252. :value="item.orgId"
  253. :key="item.orgId"
  254. ></el-option>
  255. </el-select>
  256. </el-form-item>
  257. </el-col>
  258. </el-row>
  259. <el-row :gutter="10">
  260. <el-col :md="20">
  261. <el-form-item label="考试名称">
  262. <el-select v-model="allotAllForm.examId">
  263. <el-option label="请选择" value></el-option>
  264. <el-option
  265. v-for="item in examList"
  266. :label="item.examName"
  267. :value="item.examId"
  268. :key="item.examId"
  269. ></el-option>
  270. </el-select>
  271. </el-form-item>
  272. </el-col>
  273. </el-row>
  274. <el-row :gutter="10">
  275. <el-col :span="20">
  276. <el-form-item>
  277. <span style="font-size:20px;color: red;"
  278. >警告!确定后,选中考试中待指定的课程会在推送试卷中随机选取一套试卷,是否确定执行?</span
  279. >
  280. </el-form-item>
  281. </el-col>
  282. </el-row>
  283. <el-row>
  284. <el-col
  285. :span="24"
  286. class="text-center"
  287. style="border-top: 2px solid;padding-top: 10px;"
  288. >
  289. <el-button
  290. type="primary"
  291. :disabled="
  292. allotAllForm.orgId === '' || allotAllForm.examId === ''
  293. "
  294. @click="saveAllotAll"
  295. >确定</el-button
  296. >
  297. </el-col>
  298. </el-row>
  299. </el-form>
  300. </el-dialog>
  301. <el-dialog title="导出" :visible.sync="exportDialog">
  302. <el-form :model="exportForm" label-position="right" label-width="80px">
  303. <el-checkbox-group v-model="exportForm.types">
  304. <el-checkbox label="1">试卷</el-checkbox>
  305. <el-checkbox label="2">答案</el-checkbox>
  306. <el-checkbox label="3">试卷结构</el-checkbox>
  307. </el-checkbox-group>
  308. <div style="text-align: center">
  309. <el-button type="primary" @click="doExport">确定导出</el-button>
  310. <el-button @click="closeExportDialog">取 消</el-button>
  311. </div>
  312. </el-form>
  313. </el-dialog>
  314. <el-dialog title="试卷整体导出" :visible.sync="exportAllDialog">
  315. <el-form
  316. :model="exportAllForm"
  317. label-position="right"
  318. label-width="100px"
  319. >
  320. <el-row :gutter="10">
  321. <el-col :md="20">
  322. <el-form-item label="学校名称">
  323. <el-select
  324. v-model="exportAllForm.orgId"
  325. @change="searchExamList(exportAllForm.orgId, 3);"
  326. >
  327. <el-option label="请选择" value></el-option>
  328. <el-option
  329. v-for="item in orgList"
  330. :label="item.orgName"
  331. :value="item.orgId"
  332. :key="item.orgId"
  333. ></el-option>
  334. </el-select>
  335. </el-form-item>
  336. </el-col>
  337. </el-row>
  338. <el-row :gutter="10">
  339. <el-col :md="20">
  340. <el-form-item label="考试名称">
  341. <el-select
  342. v-model="exportAllForm.examId"
  343. @change="searchExamCoursePaperTotal"
  344. >
  345. <el-option label="请选择" value></el-option>
  346. <el-option
  347. v-for="item in examList"
  348. :label="item.examName"
  349. :value="item.examId"
  350. :key="item.examId"
  351. ></el-option>
  352. </el-select>
  353. </el-form-item>
  354. </el-col>
  355. </el-row>
  356. <el-row :gutter="10">
  357. <el-col :md="20">
  358. <el-form-item label="试卷总数">{{
  359. exportAllForm.allNum
  360. }}</el-form-item>
  361. </el-col>
  362. </el-row>
  363. <el-row :gutter="10">
  364. <el-col :md="20">
  365. <el-form-item label="已有试卷数">{{
  366. exportAllForm.existNum
  367. }}</el-form-item>
  368. </el-col>
  369. </el-row>
  370. <el-row :gutter="10">
  371. <el-col :md="20">
  372. <el-form-item label="缺少试卷数">{{
  373. exportAllForm.missNum
  374. }}</el-form-item>
  375. </el-col>
  376. </el-row>
  377. <el-row :gutter="10">
  378. <el-col :md="20">
  379. <el-form-item label="导出内容">
  380. <el-checkbox-group v-model="exportAllForm.types">
  381. <el-checkbox label="1">试卷</el-checkbox>
  382. <el-checkbox label="2">答案</el-checkbox>
  383. <el-checkbox label="3">试卷结构</el-checkbox>
  384. </el-checkbox-group>
  385. </el-form-item>
  386. </el-col>
  387. </el-row>
  388. <el-row :gutter="10">
  389. <el-col
  390. :span="24"
  391. class="text-center"
  392. style="border-top: 2px solid;padding-top: 10px;"
  393. >
  394. <el-button
  395. type="primary"
  396. :disabled="exportAllForm.existNum == 0"
  397. @click="doExportAll"
  398. >确定导出</el-button
  399. >
  400. </el-col>
  401. </el-row>
  402. </el-form>
  403. </el-dialog>
  404. </div>
  405. </section>
  406. </template>
  407. <script>
  408. import { CORE_API, PRINT_API } from "@/constants/constants";
  409. import { userRole, coursePaperStatusList } from "../constants/constants.js";
  410. import { mapState } from "vuex";
  411. export default {
  412. data() {
  413. return {
  414. formSearch: {
  415. orgId: "",
  416. examId: "",
  417. courseId: "",
  418. paperStatus: "",
  419. paperName: "",
  420. pageNo: 1,
  421. pageSize: 10
  422. },
  423. curUserRole: userRole,
  424. hasPermit: false,
  425. totalElements: 0,
  426. loading: false,
  427. tableData: [],
  428. orgList: [],
  429. examList: [],
  430. courseList: [],
  431. coursePaperList: [],
  432. coursePaperStatusList: coursePaperStatusList,
  433. allotDialog: false,
  434. allotForm: {
  435. id: "",
  436. coursePaperId: "",
  437. courseName: "",
  438. paperType: ""
  439. },
  440. allotAllDialog: false,
  441. allotAllForm: {
  442. orgId: "",
  443. examId: ""
  444. },
  445. exportDialog: false,
  446. exportForm: {
  447. orgId: "",
  448. examId: "",
  449. courseCode: "",
  450. courseName: "",
  451. paperType: "",
  452. coursePaperId: "",
  453. courseId: "",
  454. id: ""
  455. },
  456. exportAllDialog: false,
  457. exportAllForm: {
  458. orgId: "",
  459. examId: "",
  460. exportList: [],
  461. allNum: 0,
  462. existNum: 0,
  463. missNum: 0,
  464. types: []
  465. },
  466. rules: {
  467. coursePaperId: [
  468. { required: true, message: "试卷不能为空!", trigger: "change" }
  469. ],
  470. courseName: [
  471. { required: true, message: "课程不能为空!", trigger: "change" }
  472. ],
  473. paperType: [
  474. { required: true, message: "试卷类型不能为空!", trigger: "change" }
  475. ]
  476. }
  477. };
  478. },
  479. methods: {
  480. searchExamCoursePaperTotal() {
  481. /* xxx */
  482. },
  483. openAllotDialog(row) {
  484. /* 试卷状态为"已有"时,打开试卷指定弹窗 */
  485. if (row.paperStatus > 0) {
  486. this.allotDialog = true;
  487. this.allotForm.id = row.id;
  488. this.allotForm.coursePaperId = row.coursePaperId;
  489. this.allotForm.courseName = row.courseName;
  490. this.allotForm.paperType = row.paperType;
  491. let params = {
  492. orgId: row.orgId,
  493. examId: row.examId,
  494. courseId: row.courseId
  495. };
  496. let url = PRINT_API + "/course/paper/list";
  497. this.$http.post(url, params).then(
  498. response => {
  499. this.coursePaperList = response.data;
  500. },
  501. error => {
  502. console.log(error);
  503. }
  504. );
  505. }
  506. },
  507. closeAllotDialog() {
  508. /* 关闭试卷指定弹窗 */
  509. this.allotDialog = false;
  510. },
  511. saveAllot() {
  512. /* 保存试卷指定 */
  513. this.$refs.allotForm.validate(valid => {
  514. if (!valid) {
  515. return false;
  516. }
  517. let url =
  518. PRINT_API +
  519. "/course/paper/allot/" +
  520. this.allotForm.id +
  521. "/" +
  522. this.allotForm.coursePaperId;
  523. this.$http.post(url).then(
  524. () => {
  525. this.$notify({
  526. message: "试卷指定成功!",
  527. type: "success"
  528. });
  529. this.allotDialog = false;
  530. this.searchRecords();
  531. },
  532. () => {
  533. this.$notify({
  534. message: "试卷指定失败!",
  535. type: "error"
  536. });
  537. }
  538. );
  539. });
  540. },
  541. openAllotAllDialog() {
  542. /* 打开分配待指定试卷弹窗 */
  543. this.allotAllDialog = true;
  544. },
  545. closeAllotAllDialog() {
  546. /* 关闭分配待指定试卷弹窗 */
  547. this.allotAllDialog = false;
  548. },
  549. saveAllotAll() {
  550. /* 保存分配待指定试卷 */
  551. },
  552. openExportDialog() {
  553. /* 打开批量导出弹窗 */
  554. this.exportDialog = true;
  555. },
  556. closeExportDialog() {
  557. /* 关闭批量导出弹窗 */
  558. this.exportDialog = false;
  559. },
  560. doExport() {
  561. /* 批量导出 */
  562. },
  563. openExportAllDialog() {
  564. /* 打开整体导出弹窗 */
  565. this.exportAllDialog = true;
  566. },
  567. closeExportAllDialog() {
  568. /* 关闭整体导出弹窗 */
  569. this.exportAllDialog = false;
  570. },
  571. doExportAll() {
  572. /* 整体导出 */
  573. },
  574. handlePager(current) {
  575. /* 处理分页 */
  576. this.formSearch.pageNo = current;
  577. this.searchRecords();
  578. },
  579. searchRecords() {
  580. /* 查询记录列表 */
  581. let orgId = this.formSearch.orgId;
  582. if (this.isEmptyNumber(orgId)) {
  583. this.$notify({
  584. message: "请选择学校!",
  585. type: "warning"
  586. });
  587. return;
  588. }
  589. let examId = this.formSearch.examId;
  590. if (this.isEmptyNumber(examId)) {
  591. this.$notify({
  592. message: "请选择考试!",
  593. type: "warning"
  594. });
  595. return;
  596. }
  597. this.loading = true;
  598. let url = PRINT_API + "/course/statistic/list";
  599. this.$http.post(url, this.formSearch).then(
  600. response => {
  601. this.tableData = response.data.content;
  602. this.totalElements = response.data.totalElements;
  603. this.loading = false;
  604. },
  605. error => {
  606. console.log(error);
  607. this.loading = false;
  608. }
  609. );
  610. },
  611. searchExamList(orgId) {
  612. /* 查询考试列表 */
  613. this.formSearch.examId = "";
  614. this.examList = [];
  615. this.tableData = [];
  616. if (!this.isEmptyNumber(orgId)) {
  617. let url = PRINT_API + "/printing/project/exam/list?orgId=" + orgId;
  618. this.$http.post(url).then(response => {
  619. this.examList = response.data;
  620. });
  621. }
  622. },
  623. searchCourseList(query) {
  624. /* 查询课程列表 */
  625. this.courseList = [];
  626. let url = CORE_API + "/course/query?enable=true";
  627. if (!this.isEmptyStr(query)) {
  628. url += "&name=" + query;
  629. }
  630. this.$http.get(url).then(response => {
  631. this.courseList = response.data;
  632. });
  633. },
  634. refreshStatistic() {
  635. /* 刷新当前统计信息 */
  636. this.$notify({
  637. message: "Todo...",
  638. type: "warning"
  639. });
  640. },
  641. preview(row) {
  642. /* 预览试卷PDF */
  643. console.log(row);
  644. this.$notify({
  645. message: "Todo...",
  646. type: "warning"
  647. });
  648. },
  649. download(row) {
  650. /* 下载试卷结构 */
  651. console.log(row);
  652. this.$notify({
  653. message: "Todo...",
  654. type: "warning"
  655. });
  656. }
  657. },
  658. computed: {
  659. ...mapState({ user: state => state.user })
  660. },
  661. created() {
  662. this.loadOrgList();
  663. this.loadUserRole(this.user);
  664. if (this.curUserRole.isSuperLeader || this.curUserRole.isPM) {
  665. this.hasPermit = true;
  666. } else {
  667. this.hasPermit = false;
  668. }
  669. }
  670. };
  671. </script>
  672. <style scoped>
  673. .page {
  674. margin-top: 10px;
  675. }
  676. .pull-right {
  677. float: right;
  678. }
  679. .pull-left {
  680. float: left;
  681. }
  682. .w220 {
  683. width: 220px;
  684. }
  685. </style>