DbfExport.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="m-b-16px">
  3. <qm-button type="primary" :icon="h(SettingOutlined)"
  4. >设置扫描点代码</qm-button
  5. >
  6. <a-tag v-if="scanSiteCode" class="m-l-12px" color="blue"
  7. >扫描点代码:{{ scanSiteCode }}</a-tag
  8. >
  9. </div>
  10. <a-table
  11. :columns="columns"
  12. :row-key="(record) => record.subjectCode"
  13. :data-source="dataList"
  14. :pagination="false"
  15. :loading="loading"
  16. bordered
  17. >
  18. <template #bodyCell="{ column, record }">
  19. <template v-if="column.dataIndex === 'operation'">
  20. <qm-button type="text" @click="onExportAnswer(record)"
  21. >导出扫描答案DBF</qm-button
  22. >
  23. <qm-button type="text" @click="onExportPackage(record)"
  24. >导出打包DBF</qm-button
  25. >
  26. </template>
  27. </template>
  28. </a-table>
  29. </template>
  30. <script setup lang="ts">
  31. import { ref, h, onMounted } from "vue";
  32. import { SettingOutlined } from "@ant-design/icons-vue";
  33. import type { TableProps } from "ant-design-vue";
  34. import { SubjectItem } from "@/ap/types/base";
  35. import { subjectList } from "@/ap/base";
  36. import { markSiteCodeInfo } from "@/ap/resultExport";
  37. defineOptions({
  38. name: "DbfExport",
  39. });
  40. const loading = ref(false);
  41. const dataList = ref<SubjectItem[]>([]);
  42. const columns: TableProps["columns"] = [
  43. {
  44. title: "科目代码",
  45. dataIndex: "subjectCode",
  46. },
  47. {
  48. title: "科目名称",
  49. dataIndex: "subjectName",
  50. },
  51. {
  52. title: "操作",
  53. dataIndex: "operation",
  54. width: "180px",
  55. },
  56. ];
  57. const scanSiteCode = ref("");
  58. async function getScanSiteCode() {
  59. const res = await markSiteCodeInfo();
  60. scanSiteCode.value = res.scanSite;
  61. }
  62. async function getData() {
  63. const res = await subjectList();
  64. dataList.value = res || [];
  65. }
  66. async function onExportAnswer(record: SubjectItem) {
  67. console.log(record);
  68. }
  69. async function onExportPackage(record: SubjectItem) {
  70. console.log(record);
  71. }
  72. onMounted(() => {
  73. // getScanSiteCode()
  74. // getData()
  75. });
  76. </script>