RuleExamroom.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="rule-examroom">
  3. <div class="part-box">
  4. <el-table ref="TableList" :data="dataList" border stripe>
  5. <el-table-column prop="schoolId" label="学校ID"></el-table-column>
  6. <el-table-column prop="schoolName" label="学校名称"></el-table-column>
  7. <el-table-column prop="createTime" label="上传时间"></el-table-column>
  8. <el-table-column label="操作" align="center">
  9. <template slot-scope="scope">
  10. <el-button
  11. class="btn-table-icon"
  12. type="text"
  13. icon="icon icon-upload-act"
  14. @click="toUpload(scope.row)"
  15. title="上传登记表"
  16. ></el-button>
  17. <el-button
  18. class="btn-table-icon"
  19. type="text"
  20. icon="icon icon-circle-right"
  21. @click="toView(scope.row.path)"
  22. title="预览登记表"
  23. v-if="scope.row.id"
  24. ></el-button>
  25. <el-button
  26. class="btn-table-icon"
  27. type="text"
  28. icon="icon icon-delete"
  29. @click="toDelete(scope.row)"
  30. title="删除登记表"
  31. v-if="scope.row.id"
  32. ></el-button>
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. <div class="part-page">
  37. <el-pagination
  38. background
  39. layout="prev, pager, next"
  40. :current-page="current"
  41. :total="total"
  42. :page-size="size"
  43. @current-change="toPage"
  44. hide-on-single-page
  45. >
  46. </el-pagination>
  47. </div>
  48. </div>
  49. <upload-file-dialog
  50. :paper-attachment="curAttachment"
  51. :format="['pdf']"
  52. @confirm="uploadConfirm"
  53. ref="UploadFileDialog"
  54. ></upload-file-dialog>
  55. </div>
  56. </template>
  57. <script>
  58. import { checkinExamList, saveCheckinExam, deleteCheckinExam } from "../api";
  59. import UploadFileDialog from "@/components/UploadFileDialog";
  60. export default {
  61. name: "rule-examroom",
  62. components: { UploadFileDialog },
  63. data() {
  64. return {
  65. schoolId: this.$ls.get("schoolId"),
  66. dataList: [],
  67. current: 1,
  68. size: this.GLOBAL.pageSize,
  69. total: 0,
  70. curAttachment: {},
  71. curCheckinExam: {}
  72. };
  73. },
  74. mounted() {
  75. this.toPage(1);
  76. },
  77. methods: {
  78. async getList() {
  79. const datas = {
  80. schoolId: this.schoolId,
  81. pageNumber: this.current,
  82. pageSize: this.size
  83. };
  84. const data = await checkinExamList(datas);
  85. this.dataList = data.records;
  86. this.total = data.total;
  87. },
  88. toPage(page) {
  89. this.current = page;
  90. this.getList();
  91. },
  92. toUpload(row) {
  93. this.curCheckinExam = row;
  94. this.curAttachment = {
  95. attachmentId: row.attachmentId,
  96. filename: ""
  97. };
  98. this.$refs.UploadFileDialog.open();
  99. console.log(row);
  100. },
  101. toDelete(row) {
  102. this.$confirm("确定要删除当前学校登记表吗?", "删除警告", {
  103. cancelButtonClass: "el-button--danger is-plain",
  104. confirmButtonClass: "el-button--primary",
  105. type: "warning"
  106. })
  107. .then(async () => {
  108. await deleteCheckinExam(row.id);
  109. this.$message.success("删除成功!");
  110. this.deletePageLastItem();
  111. })
  112. .catch(() => {});
  113. },
  114. toView(path) {
  115. window.open(path);
  116. },
  117. async uploadConfirm(attachment) {
  118. const datas = {
  119. attachmentId: attachment.attachmentId,
  120. createId: "",
  121. id: this.curCheckinExam.id,
  122. schoolId: this.curCheckinExam.schoolId,
  123. updateId: ""
  124. };
  125. const userId = this.$ls.get("user", { id: "" }).id;
  126. const modInfo = this.curCheckinExam.id
  127. ? { updateId: userId }
  128. : { createId: userId };
  129. await saveCheckinExam(Object.assign(datas, modInfo));
  130. this.$message.success("编辑成功!");
  131. this.getList();
  132. }
  133. }
  134. };
  135. </script>