ScanCheckMiss.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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 === 'scannedText'">
  21. {{ record[column.dataIndex] }}
  22. </template>
  23. <template v-if="column.dataIndex === 'subjectName'">
  24. {{ record.subjectCode + "-" + record.subjectName }}
  25. </template>
  26. <template v-if="column.dataIndex === 'examSite'">
  27. {{ getExamSiteName(record.examSite) }}
  28. </template>
  29. </template>
  30. </a-table>
  31. </div>
  32. </template>
  33. <script name="ScanCheckMiss" lang="ts" setup>
  34. import { ref, reactive, computed } from "vue";
  35. import SelectSubject from "@/components/SelectSubject/index.vue";
  36. import { useUserStore } from "@/store";
  37. import { useRequest } from "vue-request";
  38. import useTable from "@/hooks/useTable";
  39. import {
  40. getSiteList,
  41. getCampusList,
  42. getScannedList,
  43. exportScanned,
  44. getProvince,
  45. getExamRoom,
  46. } from "@/ap/scanManage";
  47. import type { TableColumnsType } from "@qmth/ui";
  48. const userStore = useUserStore();
  49. //考点下拉
  50. const { data: examSiteOptions, run: runSite } = useRequest(getSiteList);
  51. const { data: examCampusOptions, run: runCampus } = useRequest(getCampusList);
  52. const { data: provinceOptions, run: runProvince } = useRequest(getProvince);
  53. const { data: examRoomOptions, run: runExamRoom } = useRequest(getExamRoom);
  54. runSite({ examId: userStore.curExam?.id });
  55. runCampus({ examId: userStore.curExam?.id });
  56. runProvince({ examId: userStore.curExam?.id });
  57. runExamRoom({ examId: userStore.curExam?.id });
  58. const params = reactive({
  59. subjectCode: "",
  60. province: "",
  61. examSite: "",
  62. campusCode: "",
  63. examRoom: "",
  64. scanned: null,
  65. });
  66. const transParams = computed(() => {
  67. return { ...params, examId: userStore.curExam?.id };
  68. });
  69. const { dataList, pagination, loading, getList, toPage } = useTable(
  70. getScannedList,
  71. transParams,
  72. false
  73. );
  74. const fields = computed(() => {
  75. return [
  76. {
  77. cell: "subjectCode",
  78. type: "select",
  79. colSpan: 3,
  80. label: "科目",
  81. },
  82. {
  83. prop: "province",
  84. type: "select",
  85. colSpan: 3,
  86. label: "省份",
  87. attrs: {
  88. options: (Array.isArray(provinceOptions.value)
  89. ? provinceOptions.value
  90. : []
  91. ).map((item: any) => ({
  92. value: item,
  93. label: item,
  94. })),
  95. // fieldNames: { label: "name", value: "code" },
  96. allowClear: true,
  97. },
  98. },
  99. {
  100. prop: "examSite",
  101. type: "select",
  102. colSpan: 3,
  103. label: "考点",
  104. attrs: {
  105. options: examSiteOptions.value || [],
  106. fieldNames: { label: "name", value: "code" },
  107. allowClear: true,
  108. },
  109. },
  110. {
  111. prop: "campusCode",
  112. type: "select",
  113. colSpan: 3,
  114. label: "校区",
  115. attrs: {
  116. options: examCampusOptions.value || [],
  117. fieldNames: { label: "name", value: "code" },
  118. allowClear: true,
  119. },
  120. },
  121. {
  122. prop: "examRoom",
  123. type: "select",
  124. colSpan: 3,
  125. label: "考场号",
  126. attrs: {
  127. options: (Array.isArray(examRoomOptions.value)
  128. ? examRoomOptions.value
  129. : []
  130. ).map((item: any) => ({
  131. value: item,
  132. label: item,
  133. })),
  134. // fieldNames: { label: "name", value: "code" },
  135. allowClear: true,
  136. },
  137. },
  138. {
  139. prop: "scanned",
  140. type: "select",
  141. colSpan: 3,
  142. label: "扫描状态",
  143. attrs: {
  144. options: [
  145. { value: true, label: "已扫描" },
  146. { value: false, label: "未扫描" },
  147. ],
  148. allowClear: true,
  149. },
  150. },
  151. {
  152. type: "buttons",
  153. colSpan: 5,
  154. children: [
  155. {
  156. text: "查询",
  157. onClick: () => {
  158. toPage(1);
  159. },
  160. },
  161. {
  162. text: "导出",
  163. attrs: {
  164. type: "default",
  165. loading: exportLoading.value,
  166. },
  167. onClick: () => {
  168. exportFile();
  169. },
  170. },
  171. ],
  172. },
  173. ];
  174. });
  175. const columns: TableColumnsType = [
  176. {
  177. title: "科目",
  178. dataIndex: "subjectName",
  179. },
  180. {
  181. title: "考点",
  182. dataIndex: "examSite",
  183. },
  184. {
  185. title: "校区",
  186. dataIndex: "campusCode",
  187. },
  188. {
  189. title: "考场号",
  190. dataIndex: "examRoom",
  191. },
  192. {
  193. title: "扫描状态",
  194. dataIndex: "scannedText",
  195. },
  196. ];
  197. const exportLoading = ref(false);
  198. const exportFile = async () => {
  199. if (exportLoading.value) return;
  200. exportLoading.value = true;
  201. exportScanned(transParams.value)
  202. .then(() => {
  203. window.$message.success("导出成功!");
  204. })
  205. .finally(() => {
  206. exportLoading.value = false;
  207. });
  208. };
  209. const getExamSiteName = (code: string) => {
  210. let find = ((examSiteOptions.value as any) || []).find((item: any) => {
  211. return item.code == code;
  212. });
  213. return find?.name || "";
  214. };
  215. </script>
  216. <style lang="less" scoped>
  217. .scan-check-miss {
  218. padding: 20px;
  219. }
  220. </style>