paper-record.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <div>
  3. <el-card>
  4. <mx-condition :query-params="queryParams" @query="handleQuery" use-alias-mapping></mx-condition>
  5. </el-card>
  6. <el-container style="background: #fff; min-height: 500px; display: block">
  7. <el-table :data="examRecord" style="width: 100%" v-loading="tableLoading">
  8. <el-table-column type="index" label="序号" width="50px">
  9. </el-table-column>
  10. <el-table-column prop="subjectName" label="科目"></el-table-column>
  11. <el-table-column prop="name" label="试卷标题">
  12. <template slot-scope="scope">
  13. <el-link @click="clickEditPaperName(scope.row)"><i class="el-icon-edit"></i>{{ scope.row.name }}</el-link>
  14. </template>
  15. </el-table-column>
  16. <el-table-column prop="remark" label="试卷概要"></el-table-column>
  17. <el-table-column prop="status" label="状态"></el-table-column>
  18. <el-table-column prop="createdTime" label="组卷时间"></el-table-column>
  19. <el-table-column label="操作">
  20. <template slot-scope="scope">
  21. <div>
  22. <span style="color: #47c6a2; margin-right: 16px; cursor: pointer"
  23. @click="clickEditPaper(scope.row)">编辑</span>
  24. <span style="color: #ff4e00; margin-right: 16px; cursor: pointer"
  25. @click="clickDownloadPaper(scope.row.paperId)">下载</span>
  26. <i class="el-icon-delete table-delete-icon" @click="clickDeletePopup(scope.row.paperId)"></i>
  27. </div>
  28. <div v-hasPermi="['front:generatingPaperCenter:saveToPersonResources']"
  29. style="color: #608edf; margin-right: 16px; cursor: pointer"
  30. @click="clickSendToResource(scope.row.paperId)">
  31. 发送至个人资源库
  32. </div>
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. <pagination v-if="examRecordTotal > 0" :total="examRecordTotal" :page.sync="pageNum" :limit.sync="pageSize"
  37. @pagination="getPaperRecords"/>
  38. </el-container>
  39. <el-dialog title="修改试卷标题" :visible.sync="dialogPaperNameVisible" width="400px">
  40. <el-input v-model="dialogPaperName" placeholder="请输入试卷标题"></el-input>
  41. <span slot="footer" class="dialog-footer">
  42. <el-button type="primary" @click="savePaperName">确 定</el-button>
  43. </span>
  44. </el-dialog>
  45. </div>
  46. </template>
  47. <script>
  48. import PaperWorkIdentifierMixin from './paper-work-identifier-mixin'
  49. import MxCondition from '@/components/MxCondition/mx-condition'
  50. import {
  51. deletePaper,
  52. download,
  53. listCustomerPaperQeustions,
  54. paperRecords,
  55. saveToPersonResources, updateNameById
  56. } from '@/api/webApi/webQue'
  57. import consts from '@/common/mx-const'
  58. import { mapGetters } from 'vuex'
  59. export default {
  60. mixins: [PaperWorkIdentifierMixin],
  61. name: 'paper-record',
  62. components: { MxCondition },
  63. data() {
  64. return {
  65. queryParams: {
  66. exeSubject: ''
  67. },
  68. queryOutput: null,
  69. tableLoading: false,
  70. pageNum: 1,
  71. pageSize: 20,
  72. examRecord: [],
  73. examRecordTotal: 0,
  74. //
  75. dialogPaperNameVisible: false,
  76. dialogPager: null,
  77. dialogPaperName: ''
  78. }
  79. },
  80. computed: {
  81. ...mapGetters(['period'])
  82. },
  83. methods: {
  84. handleQuery(model) {
  85. this.queryOutput = model
  86. this.pageNum = 1
  87. this.getPaperRecords()
  88. },
  89. getPaperRecords() {
  90. paperRecords({
  91. pageNum: this.pageNum,
  92. pageSize: this.pageSize,
  93. ...this.queryOutput,
  94. ...this.extraData
  95. }).then((res) => {
  96. this.examRecordTotal = res.total
  97. this.examRecord = res.rows
  98. })
  99. },
  100. clickEditPaperName(paper) {
  101. this.dialogPager = paper
  102. this.dialogPaperName = paper.name
  103. this.dialogPaperNameVisible = true
  104. },
  105. clickEditPaper(paper) {
  106. listCustomerPaperQeustions(paper.paperId).then((res) => {
  107. localStorage.setItem(
  108. 'paperData',
  109. JSON.stringify({
  110. paperId: paper.paperId,
  111. paperTitle: paper.name,
  112. subjectId: paper.subjectid
  113. })
  114. )
  115. localStorage.setItem('questionList', JSON.stringify(res.rows))
  116. this.$router.push({
  117. path: '/question-center/generatingPaperCenter/paper',
  118. query: this.extraData
  119. })
  120. })
  121. },
  122. clickDownloadPaper(paperId) {
  123. download(paperId, this.period)
  124. },
  125. async clickDeletePopup(paperId) {
  126. await this.$confirm('是否删除该试卷?', '提示', {
  127. confirmButtonText: '确定',
  128. cancelButtonText: '取消',
  129. type: 'warning'
  130. })
  131. await deletePaper({ paperId })
  132. this.msgSuccess('删除成功!')
  133. this.getPaperRecords()
  134. },
  135. clickSendToResource(paperId) {
  136. this.tableLoading = true;
  137. saveToPersonResources(paperId).then((res) => {
  138. this.tableLoading = false;
  139. this.msgSuccess("发送成功");
  140. });
  141. },
  142. savePaperName() {
  143. const paperName = this.dialogPaperName?.trim();
  144. if (!paperName) {
  145. this.msgError("试卷标题不能为空");
  146. return;
  147. }
  148. updateNameById(this.dialogPager.paperId, paperName).then((res) => {
  149. this.dialogPager.name = paperName;
  150. this.dialogPaperNameVisible = false;
  151. this.msgSuccess("修改成功");
  152. });
  153. }
  154. }
  155. }
  156. </script>
  157. <style scoped>
  158. </style>