data.config.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { requestMagicApi } from '/@/api/magicApi';
  3. import { formatToDate } from '/@/utils/dateUtil';
  4. import { Switch } from 'ant-design-vue';
  5. import { h } from 'vue';
  6. import { useMessage } from '/@/hooks/web/useMessage';
  7. import { postStudentReportRecordSign } from '/@/services/apis/StudentReportRecordController';
  8. export const stateOptions = [
  9. { label: '草稿', value: 0 },
  10. { label: '进行中', value: 1 },
  11. { label: '已结束', value: 2 },
  12. ];
  13. export const tableColumns: BasicColumn[] = [
  14. {
  15. title: '年级',
  16. dataIndex: 'gradeName',
  17. align: 'left',
  18. width: 100,
  19. },
  20. {
  21. title: '班级',
  22. dataIndex: 'classNmae',
  23. align: 'left',
  24. width: 120,
  25. },
  26. {
  27. title: '班主任',
  28. dataIndex: 'teacherName',
  29. align: 'left',
  30. width: 100,
  31. },
  32. {
  33. title: '学生姓名',
  34. dataIndex: 'name',
  35. align: 'left',
  36. width: 100,
  37. },
  38. {
  39. title: '性别',
  40. dataIndex: 'grendCn',
  41. align: 'left',
  42. width: 80,
  43. },
  44. {
  45. title: '身份证号',
  46. dataIndex: 'credentialNumber',
  47. align: 'left',
  48. width: 120,
  49. },
  50. {
  51. title: '手机号',
  52. dataIndex: 'mobile',
  53. align: 'left',
  54. width: 120,
  55. },
  56. {
  57. title: '家长联系电话',
  58. dataIndex: 'parentMobile',
  59. align: 'left',
  60. width: 120,
  61. },
  62. {
  63. title: '学生来源',
  64. dataIndex: 'sourceName',
  65. align: 'left',
  66. },
  67. {
  68. title: '学籍状态',
  69. dataIndex: 'status',
  70. align: 'left',
  71. width: 80,
  72. },
  73. {
  74. title: '报到状态',
  75. dataIndex: 'isReport',
  76. customRender: ({ record }) => {
  77. if (!Reflect.has(record, 'pendingStatus')) {
  78. record.pendingStatus = false;
  79. }
  80. return h(Switch, {
  81. checked: record.isReport === 1,
  82. // checkedChildren: '报到',
  83. // unCheckedChildren: '未报到',
  84. loading: record.pendingStatus,
  85. onChange(checked: boolean) {
  86. record.pendingStatus = true;
  87. const newStatus = checked ? 1 : 0;
  88. const { createMessage } = useMessage();
  89. postStudentReportRecordSign(record.id)
  90. .then(() => {
  91. record.isReport = newStatus;
  92. createMessage.success('已成功修改状态');
  93. })
  94. .catch(() => {
  95. createMessage.error('修改状态失败');
  96. })
  97. .finally(() => {
  98. record.pendingStatus = false;
  99. });
  100. },
  101. });
  102. },
  103. width: 80,
  104. },
  105. {
  106. title: '报到日期',
  107. dataIndex: 'reportDate',
  108. align: 'left',
  109. width: 120,
  110. },
  111. ];
  112. export const searchFormSchema: FormSchema[] = [
  113. {
  114. field: 'baseSemesterId',
  115. label: '学期',
  116. component: 'ApiSelect',
  117. componentProps: {
  118. getPopupContainer: () => document.body,
  119. api: requestMagicApi,
  120. params: { url: 'baseData/semester/option' },
  121. },
  122. colProps: { span: 8 },
  123. },
  124. {
  125. field: 'classId',
  126. label: '班级',
  127. component: 'Input',
  128. colProps: { span: 8 },
  129. },
  130. {
  131. field: 'name',
  132. label: '学生姓名',
  133. component: 'Input',
  134. colProps: { span: 8 },
  135. },
  136. {
  137. field: '身份证号',
  138. label: '状态',
  139. component: 'Input',
  140. colProps: { span: 8 },
  141. },
  142. ];
  143. export const formSchema: FormSchema[] = [
  144. {
  145. label: '计划名称',
  146. field: 'name',
  147. component: 'Input',
  148. required: true,
  149. colProps: { span: 24 },
  150. },
  151. {
  152. field: 'semesterId',
  153. label: '学期',
  154. component: 'ApiSelect',
  155. componentProps: {
  156. getPopupContainer: () => document.body,
  157. api: requestMagicApi,
  158. params: { url: 'baseData/semester/option' },
  159. },
  160. required: true,
  161. colProps: { span: 24 },
  162. },
  163. {
  164. label: '报到时间',
  165. field: 'dateTime',
  166. component: 'RangePicker',
  167. colProps: { span: 24 },
  168. required: true,
  169. componentProps: {
  170. getPopupContainer: () => document.body,
  171. placeholder: ['开始时间', '结束时间'],
  172. format: 'YYYY-MM-DD HH:mm:ss',
  173. showTime: { format: 'HH:mm:ss' },
  174. },
  175. },
  176. {
  177. label: '就读修改时间',
  178. field: 'date',
  179. component: 'RangePicker',
  180. colProps: { span: 24 },
  181. required: true,
  182. componentProps: {
  183. getPopupContainer: () => document.body,
  184. placeholder: ['开始时间', '结束时间'],
  185. format: 'YYYY-MM-DD',
  186. valueFormat: 'YYYY-MM-DD',
  187. showTime: false,
  188. },
  189. },
  190. {
  191. label: '参与班级',
  192. field: 'classIds',
  193. component: 'Input',
  194. required: true,
  195. colProps: { span: 24 },
  196. slot: 'classIds',
  197. },
  198. ];