data.config.ts 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { requestMagicApi } from '/@/api/magicApi';
  3. import { Switch } from 'ant-design-vue';
  4. import { h } from 'vue';
  5. import { useMessage } from '/@/hooks/web/useMessage';
  6. import { postStudentReportRecordSign } from '/@/services/apis/StudentReportRecordController';
  7. import { getDataOption } from '/@/api/system/dic';
  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: 'className',
  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: 'gender',
  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: 'studentTypeCn',
  65. align: 'left',
  66. },
  67. {
  68. title: '就读方式',
  69. dataIndex: 'stduyStatusCn',
  70. align: 'left',
  71. width: 80,
  72. },
  73. {
  74. title: '学籍状态',
  75. dataIndex: 'archivesStatusCn',
  76. align: 'left',
  77. width: 80,
  78. },
  79. {
  80. title: '报到状态',
  81. dataIndex: 'isReport',
  82. slots: 'isReport',
  83. customRender: ({ record }) => {
  84. if (!Reflect.has(record, 'pendingStatus')) {
  85. record.pendingStatus = false;
  86. }
  87. return h(Switch, {
  88. checked: record.isReport === 1,
  89. // checkedChildren: '报到',
  90. // unCheckedChildren: '未报到',
  91. loading: record.pendingStatus,
  92. onChange(checked: boolean) {
  93. record.pendingStatus = true;
  94. const newStatus = checked ? 1 : 0;
  95. const { createMessage } = useMessage();
  96. postStudentReportRecordSign({ id: record.id })
  97. .then(() => {
  98. record.isReport = newStatus;
  99. record.reportTime = checked ? new Date() : null;
  100. createMessage.success('已成功修改状态');
  101. })
  102. .catch(() => {
  103. createMessage.error('修改状态失败');
  104. })
  105. .finally(() => {
  106. record.pendingStatus = false;
  107. });
  108. },
  109. });
  110. },
  111. width: 80,
  112. },
  113. {
  114. title: '报到日期',
  115. dataIndex: 'reportTime',
  116. align: 'left',
  117. width: 170,
  118. },
  119. ];
  120. export const searchFormSchema: FormSchema[] = [
  121. {
  122. field: 'className',
  123. label: '班级',
  124. component: 'Input',
  125. colProps: { span: 8 },
  126. },
  127. {
  128. field: 'name',
  129. label: '学生姓名',
  130. component: 'Input',
  131. colProps: { span: 8 },
  132. },
  133. {
  134. field: 'credentialNumber',
  135. label: '身份证号',
  136. component: 'Input',
  137. colProps: { span: 8 },
  138. },
  139. {
  140. field: 'studentType',
  141. label: '学生来源',
  142. component: 'ApiSelect',
  143. colProps: { span: 8 },
  144. componentProps: {
  145. getPopupContainer: () => document.body,
  146. api: getDataOption,
  147. params: { code: 'student_type' },
  148. },
  149. },
  150. {
  151. field: 'stduyStatus',
  152. label: '就读方式',
  153. component: 'ApiSelect',
  154. colProps: { span: 8 },
  155. componentProps: {
  156. api: getDataOption,
  157. params: { code: 'stduy_status' },
  158. getPopupContainer: () => document.body,
  159. },
  160. },
  161. {
  162. field: 'archivesStatus',
  163. label: '学籍状态',
  164. component: 'ApiSelect',
  165. colProps: { span: 8 },
  166. componentProps: {
  167. api: getDataOption,
  168. params: { code: 'archives_status' },
  169. getPopupContainer: () => document.body,
  170. },
  171. },
  172. {
  173. field: 'isReport',
  174. label: '报到状态',
  175. component: 'Select',
  176. colProps: { span: 8 },
  177. componentProps: {
  178. getPopupContainer: () => document.body,
  179. options: [
  180. { label: '未报到', value: 0 },
  181. { label: '已报到', value: 1 },
  182. ],
  183. },
  184. },
  185. {
  186. field: '[reportTimeStart,reportTimeEnd]',
  187. label: '报到日期',
  188. component: 'RangePicker',
  189. colProps: { span: 8 },
  190. componentProps: {
  191. getPopupContainer: () => document.body,
  192. placeholder: ['开始时间', '结束时间'],
  193. format: 'YYYY-MM-DD',
  194. showTime: false,
  195. },
  196. },
  197. {
  198. field: 'gradeId',
  199. label: '年级',
  200. component: 'ApiSelect',
  201. componentProps: {
  202. getPopupContainer: () => document.body,
  203. api: requestMagicApi,
  204. params: { url: 'baseData/grade/option' },
  205. },
  206. colProps: { span: 8 },
  207. },
  208. ];
  209. export const formSchema: FormSchema[] = [
  210. {
  211. label: '计划名称',
  212. field: 'name',
  213. component: 'Input',
  214. required: true,
  215. colProps: { span: 24 },
  216. },
  217. {
  218. field: 'semesterId',
  219. label: '学期',
  220. component: 'ApiSelect',
  221. componentProps: {
  222. getPopupContainer: () => document.body,
  223. api: requestMagicApi,
  224. params: { url: 'baseData/semester/option' },
  225. },
  226. required: true,
  227. colProps: { span: 24 },
  228. },
  229. {
  230. label: '报到时间',
  231. field: 'dateTime',
  232. component: 'RangePicker',
  233. colProps: { span: 24 },
  234. required: true,
  235. componentProps: {
  236. getPopupContainer: () => document.body,
  237. placeholder: ['开始时间', '结束时间'],
  238. format: 'YYYY-MM-DD HH:mm:ss',
  239. showTime: { format: 'HH:mm:ss' },
  240. },
  241. },
  242. {
  243. label: '就读修改时间',
  244. field: 'date',
  245. component: 'RangePicker',
  246. colProps: { span: 24 },
  247. required: true,
  248. componentProps: {
  249. getPopupContainer: () => document.body,
  250. placeholder: ['开始时间', '结束时间'],
  251. format: 'YYYY-MM-DD',
  252. valueFormat: 'YYYY-MM-DD',
  253. showTime: false,
  254. },
  255. },
  256. {
  257. label: '参与班级',
  258. field: 'classIds',
  259. component: 'Input',
  260. required: true,
  261. colProps: { span: 24 },
  262. slot: 'classIds',
  263. },
  264. ];