index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
  3. <ClassTree class="w-1/3 xl:w-1/4" @select="handleSelect" />
  4. <BasicTable @register="registerTable" class="w-2/3 xl:w-3/4" :searchInfo="searchInfo">
  5. <template #action="{ record }">
  6. <TableAction
  7. :actions="[
  8. {
  9. label: '查看成绩',
  10. onClick: handleView.bind(null, record),
  11. },
  12. ]"
  13. />
  14. </template>
  15. </BasicTable>
  16. <FormDetail @register="registerModal" />
  17. </PageWrapper>
  18. </template>
  19. <script setup lang="ts">
  20. import { reactive } from 'vue';
  21. import { PageWrapper } from '/@/components/Page';
  22. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  23. import ClassTree from '/@/views/educational/class/components/ClassGroup.vue';
  24. import { getXjrUserPage } from '/@/api/dev/studentbasemanager';
  25. import { Recordable } from 'vite-plugin-mock';
  26. import { useModal } from '/@/components/Modal';
  27. import FormDetail from './detail.vue';
  28. const [registerTable, { reload }] = useTable({
  29. api: getXjrUserPage,
  30. title: '学生信息列表',
  31. rowKey: 'id',
  32. columns: [
  33. {
  34. title: '学号',
  35. dataIndex: 'credentialNumber',
  36. align: 'left',
  37. },
  38. {
  39. title: '姓名',
  40. dataIndex: 'name',
  41. align: 'left',
  42. width: 100,
  43. },
  44. {
  45. title: '手机号',
  46. dataIndex: 'mobile',
  47. align: 'left',
  48. width: 120,
  49. },
  50. {
  51. title: '性别',
  52. dataIndex: 'genderCn',
  53. align: 'left',
  54. width: 70,
  55. },
  56. {
  57. title: '班级',
  58. dataIndex: 'className',
  59. align: 'left',
  60. width: 120,
  61. },
  62. {
  63. title: '班主任',
  64. dataIndex: 'teacherName',
  65. align: 'left',
  66. width: 100,
  67. },
  68. ],
  69. formConfig: {
  70. labelWidth: 120,
  71. schemas: [
  72. {
  73. field: 'credentialNumber',
  74. label: '学号',
  75. component: 'Input',
  76. colProps: { span: 8 },
  77. },
  78. {
  79. field: 'name',
  80. label: '姓名',
  81. component: 'Input',
  82. colProps: { span: 8 },
  83. },
  84. {
  85. field: 'mobile',
  86. label: '手机号',
  87. component: 'Input',
  88. colProps: { span: 8 },
  89. },
  90. ],
  91. },
  92. useSearchForm: true,
  93. showTableSetting: true,
  94. bordered: true,
  95. immediate: true,
  96. canResize: true,
  97. actionColumn: {
  98. width: 100,
  99. title: '操作',
  100. dataIndex: 'action',
  101. slots: { customRender: 'action' },
  102. fixed: 'right',
  103. },
  104. });
  105. const searchInfo = reactive<Recordable>({});
  106. const [registerModal, { openModal }] = useModal();
  107. function handleSelect(data) {
  108. searchInfo.treeId = data.id;
  109. searchInfo.treeType = data.type;
  110. reload();
  111. }
  112. const handleView = (record: any) => {
  113. openModal(true, {
  114. baseData: {
  115. ...record,
  116. },
  117. });
  118. };
  119. </script>
  120. <style scoped lang="less"></style>