ScanCheckMiss.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="scan-check-miss h-full">
  3. <qm-low-form :params="params" :fields="fields" :label-width="80">
  4. <template #subjectCode>
  5. <SelectSubject
  6. v-model="params.subjectCode"
  7. :exam-id="userStore.curExam?.id as number"
  8. ></SelectSubject>
  9. </template>
  10. </qm-low-form>
  11. <a-table
  12. :data-source="dataList"
  13. :columns="columns"
  14. size="middle"
  15. bordered
  16. :loading="loading"
  17. :pagination="pagination"
  18. >
  19. <template #bodyCell="{ column, record }">
  20. <template v-if="column.dataIndex === 'scanned'">
  21. {{ record[column.dataIndex] }}
  22. </template>
  23. </template>
  24. </a-table>
  25. </div>
  26. </template>
  27. <script name="ScanCheckMiss" lang="ts" setup>
  28. import { ref, reactive, computed } from "vue";
  29. import SelectSubject from "@/components/SelectSubject/index.vue";
  30. import { useUserStore } from "@/store";
  31. import { useRequest } from "vue-request";
  32. import useTable from "@/hooks/useTable";
  33. import {
  34. getSiteList,
  35. getCampusList,
  36. getScannedList,
  37. exportScanned,
  38. } from "@/ap/scanManage";
  39. import type { TableColumnsType } from "@qmth/ui";
  40. const userStore = useUserStore();
  41. //考点下拉
  42. const { data: examSiteOptions, run: runSite } = useRequest(getSiteList);
  43. const { data: examCampusOptions, run: runCampus } = useRequest(getCampusList);
  44. runSite({ examId: userStore.curExam?.id });
  45. runCampus({ examId: userStore.curExam?.id });
  46. const params = reactive({
  47. subjectCode: "",
  48. province: "",
  49. examSite: "",
  50. campusCode: "",
  51. examRoom: "",
  52. scanned: null,
  53. });
  54. const transParams = computed(() => {
  55. return { ...params, examId: userStore.curExam?.id };
  56. });
  57. const { dataList, pagination, loading, getList, toPage } = useTable(
  58. getScannedList,
  59. transParams,
  60. true
  61. );
  62. const fields = computed(() => {
  63. return [
  64. {
  65. cell: "subjectCode",
  66. type: "select",
  67. colSpan: 3,
  68. label: "科目",
  69. },
  70. {
  71. prop: "province",
  72. type: "select",
  73. colSpan: 3,
  74. label: "省份",
  75. },
  76. {
  77. prop: "examSite",
  78. type: "select",
  79. colSpan: 3,
  80. label: "考点",
  81. attrs: {
  82. options: examSiteOptions.value || [],
  83. fieldNames: { label: "name", value: "code" },
  84. allowClear: true,
  85. },
  86. },
  87. {
  88. prop: "campusCode",
  89. type: "select",
  90. colSpan: 3,
  91. label: "校区",
  92. attrs: {
  93. options: examCampusOptions.value || [],
  94. fieldNames: { label: "name", value: "code" },
  95. allowClear: true,
  96. },
  97. },
  98. {
  99. prop: "examRoom",
  100. type: "select",
  101. colSpan: 3,
  102. label: "考场号",
  103. allowClear: true,
  104. },
  105. {
  106. prop: "scanned",
  107. type: "select",
  108. colSpan: 3,
  109. label: "扫描状态",
  110. attrs: {
  111. options: [
  112. { value: true, label: "已扫描" },
  113. { value: false, label: "未扫描" },
  114. ],
  115. allowClear: true,
  116. },
  117. },
  118. {
  119. type: "buttons",
  120. colSpan: 5,
  121. children: [
  122. {
  123. text: "查询",
  124. },
  125. {
  126. text: "导出",
  127. attrs: {
  128. type: "default",
  129. loading: exportLoading.value,
  130. },
  131. onClick: () => {
  132. exportFile();
  133. },
  134. },
  135. ],
  136. },
  137. ];
  138. });
  139. const columns: TableColumnsType = [
  140. {
  141. title: "科目",
  142. dataIndex: "subjectName",
  143. },
  144. {
  145. title: "考点",
  146. dataIndex: "examSite",
  147. },
  148. {
  149. title: "校区",
  150. dataIndex: "campusCode",
  151. },
  152. {
  153. title: "考场号",
  154. dataIndex: "examRoom",
  155. },
  156. {
  157. title: "扫描状态",
  158. dataIndex: "scanned",
  159. },
  160. ];
  161. const exportLoading = ref(false);
  162. const exportFile = async () => {
  163. if (exportLoading.value) return;
  164. exportLoading.value = true;
  165. exportScanned(transParams.value)
  166. .then(() => {
  167. window.$message.success("导出成功!");
  168. })
  169. .finally(() => {
  170. exportLoading.value = false;
  171. });
  172. };
  173. </script>
  174. <style lang="less" scoped>
  175. .scan-check-miss {
  176. padding: 20px;
  177. }
  178. </style>