data.config.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. import { attendanceModeOptions, outintStatusOptions, timeIntervalOptions } from '../data.config';
  2. import { getDataOption } from '/@/api/system/dic';
  3. import { BasicColumn, FormSchema } from '/@/components/Table';
  4. import { dateUtil, formatToDate } from '/@/utils/dateUtil';
  5. export const tableColumns: BasicColumn[] = [
  6. // {
  7. // title: '时间段',
  8. // dataIndex: 'timeInterval',
  9. // align: 'left',
  10. // width: 80,
  11. // customRender: ({ record }) => {
  12. // return timeIntervalOptions.find((item) => item.value === record.timeInterval)?.label;
  13. // },
  14. // },
  15. {
  16. title: '教师姓名',
  17. dataIndex: 'teacherName',
  18. align: 'left',
  19. },
  20. {
  21. title: '手机号码',
  22. dataIndex: 'mobile',
  23. align: 'left',
  24. // width: 120,
  25. },
  26. {
  27. title: '考勤状态',
  28. dataIndex: 'status',
  29. align: 'left',
  30. // width: 80,
  31. },
  32. {
  33. title: '考勤时间',
  34. dataIndex: 'recordTime',
  35. align: 'left',
  36. // width: 150,
  37. },
  38. {
  39. title: '考勤方式',
  40. dataIndex: 'attendanceMode',
  41. align: 'left',
  42. // width: 80,
  43. customRender: ({ record }) => {
  44. return attendanceModeOptions.find((item) => item.value === record.attendanceMode)?.label;
  45. },
  46. },
  47. {
  48. title: '车牌号',
  49. dataIndex: 'carNumber',
  50. align: 'left',
  51. // width: 120,
  52. },
  53. ];
  54. export const tableRecordColumns: BasicColumn[] = [
  55. {
  56. title: '教师姓名',
  57. dataIndex: 'name',
  58. align: 'left',
  59. },
  60. {
  61. title: '性别',
  62. dataIndex: 'gender',
  63. align: 'left',
  64. width: 70,
  65. },
  66. {
  67. title: '手机号码',
  68. dataIndex: 'phone',
  69. align: 'left',
  70. width: 120,
  71. },
  72. {
  73. title: '记录时间',
  74. dataIndex: 'recordTime',
  75. align: 'left',
  76. width: 150,
  77. // customRender: ({ record }) => {
  78. // return `${formatToDate(record.recordTime)}`;
  79. // },
  80. },
  81. {
  82. title: '记录照片',
  83. dataIndex: 'facePhoto',
  84. align: 'left',
  85. width: 140,
  86. },
  87. {
  88. title: '进出属性',
  89. dataIndex: 'status',
  90. align: 'left',
  91. width: 80,
  92. customRender: ({ record }) => {
  93. return outintStatusOptions.find((item) => item.value === record.status)?.label;
  94. },
  95. },
  96. ];
  97. export const searchFormSchema: FormSchema[] = [
  98. {
  99. field: 'date',
  100. label: '日期',
  101. component: 'DatePicker',
  102. colProps: { span: 8 },
  103. defaultValue: formatToDate(new Date()),
  104. componentProps: {
  105. showTime: false,
  106. format: 'YYYY-MM-DD',
  107. valueFormat: 'YYYY-MM-DD',
  108. getPopupContainer: () => document.body,
  109. disabledDate: (current) => {
  110. return current && current > dateUtil().endOf('day');
  111. },
  112. },
  113. },
  114. {
  115. field: 'timePeriod',
  116. label: '时间段',
  117. component: 'Select',
  118. defaultValue: 1,
  119. componentProps: {
  120. getPopupContainer: () => document.body,
  121. options: timeIntervalOptions.filter((row) => row.value === 1 || row.value === 2),
  122. },
  123. colProps: { span: 8 },
  124. },
  125. {
  126. field: 'attendanceStatus',
  127. label: '考勤状态',
  128. component: 'ApiSelect',
  129. componentProps: {
  130. getPopupContainer: () => document.body,
  131. api: getDataOption,
  132. params: { code: 'attendance_status' },
  133. },
  134. colProps: { span: 8 },
  135. },
  136. {
  137. field: 'name',
  138. label: '姓名',
  139. component: 'Input',
  140. colProps: { span: 8 },
  141. },
  142. {
  143. field: 'attendanceMode',
  144. label: '考勤方式',
  145. component: 'Select',
  146. componentProps: {
  147. getPopupContainer: () => document.body,
  148. options: attendanceModeOptions,
  149. },
  150. colProps: { span: 8 },
  151. },
  152. {
  153. field: 'carNumber',
  154. label: '车牌号',
  155. component: 'Input',
  156. colProps: { span: 8 },
  157. },
  158. ];
  159. export const searchRecordFormSchema: FormSchema[] = [
  160. {
  161. field: 'startTime',
  162. label: '日期',
  163. component: 'DatePicker',
  164. colProps: { span: 8 },
  165. defaultValue: formatToDate(new Date()),
  166. componentProps: {
  167. showTime: false,
  168. format: 'YYYY-MM-DD',
  169. valueFormat: 'YYYY-MM-DD',
  170. getPopupContainer: () => document.body,
  171. disabledDate: (current) => {
  172. return current && current > dateUtil().endOf('day');
  173. },
  174. },
  175. },
  176. {
  177. field: 'name',
  178. label: '姓名',
  179. component: 'Input',
  180. colProps: { span: 8 },
  181. },
  182. {
  183. field: 'status',
  184. label: '进出属性',
  185. component: 'Select',
  186. componentProps: {
  187. getPopupContainer: () => document.body,
  188. options: outintStatusOptions,
  189. },
  190. colProps: { span: 8 },
  191. },
  192. ];