Nenhuma Descrição

config-data.tsx 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import type { FormSchemaGetter } from '#/adapter/form';
  2. import type { VxeGridProps } from '#/adapter/vxe-table';
  3. import {
  4. selectAllSysAreaList,
  5. selectAllSysStation,
  6. } from '#/api/system/infoEntry/stationInfo/stationInfo';
  7. // 获取过滤后的岗位列表
  8. import { getFilteredPositions } from '../../utils/positionFilter';
  9. export const querySchema: FormSchemaGetter = () => [
  10. {
  11. component: 'ApiSelect',
  12. fieldName: 'areaId',
  13. label: '片区',
  14. componentProps: {
  15. placeholder: '请选择片区',
  16. clearable: true,
  17. api: async () => {
  18. const resp = await selectAllSysAreaList();
  19. const data = resp || [];
  20. return Array.isArray(data)
  21. ? data.map((item: any) => ({
  22. label: item.areaName,
  23. value: item.id,
  24. }))
  25. : [];
  26. },
  27. labelField: 'label',
  28. valueField: 'value',
  29. },
  30. },
  31. {
  32. component: 'ApiSelect',
  33. fieldName: 'stationId',
  34. label: '油站',
  35. componentProps: {
  36. placeholder: '请选择油站',
  37. clearable: true,
  38. api: async () => {
  39. const resp = await selectAllSysStation();
  40. const data = resp || [];
  41. return Array.isArray(data)
  42. ? data.map((item: any) => ({
  43. label: item.stationName,
  44. value: item.id.toString(),
  45. }))
  46. : [];
  47. },
  48. labelField: 'label',
  49. valueField: 'value',
  50. },
  51. },
  52. {
  53. component: 'Select',
  54. fieldName: 'completionStatus',
  55. label: '状态',
  56. componentProps: {
  57. placeholder: '请选择完成状态',
  58. options: [
  59. { label: '按时完成', value: 2 },
  60. { label: '逾期完成', value: 1 },
  61. ],
  62. },
  63. },
  64. {
  65. component: 'DatePicker',
  66. componentProps: {
  67. type: 'daterange',
  68. format: 'YYYY-MM-DD HH:mm:ss',
  69. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  70. startPlaceholder: '开始日期',
  71. endPlaceholder: '结束日期',
  72. },
  73. fieldName: 'surveyStartTime',
  74. label: '提交时间',
  75. },
  76. {
  77. component: 'Select',
  78. fieldName: 'isComment',
  79. label: '评论',
  80. componentProps: {
  81. placeholder: '请选择评论状态',
  82. options: [
  83. { label: '未评', value: 0 },
  84. { label: '已评', value: 1 },
  85. ],
  86. },
  87. },
  88. {
  89. component: 'ApiSelect',
  90. fieldName: 'position',
  91. label: '岗位',
  92. componentProps: {
  93. placeholder: '请选择岗位',
  94. clearable: true,
  95. api: getFilteredPositions,
  96. labelField: 'label',
  97. valueField: 'value',
  98. },
  99. },
  100. {
  101. component: 'Select',
  102. fieldName: 'createType',
  103. label: '创建',
  104. componentProps: {
  105. placeholder: '请选择创建方式',
  106. options: [
  107. { label: '系统', value: 0 },
  108. { label: '新增', value: 1 },
  109. ],
  110. },
  111. },
  112. {
  113. component: 'Input',
  114. fieldName: 'executorName',
  115. label: '执行人',
  116. componentProps: {
  117. placeholder: '请输入执行人',
  118. },
  119. },
  120. ];
  121. export const columns: VxeGridProps['columns'] = [
  122. {
  123. type: 'checkbox',
  124. width: 80,
  125. },
  126. {
  127. field: 'action',
  128. fixed: 'right',
  129. slots: { default: 'action' },
  130. title: '操作',
  131. width: 150,
  132. },
  133. {
  134. field: 'taskName',
  135. title: '任务名称',
  136. minWidth: 150,
  137. },
  138. {
  139. field: 'stationName',
  140. title: '油站',
  141. minWidth: 120,
  142. },
  143. {
  144. field: 'executorName',
  145. title: '执行人',
  146. minWidth: 120,
  147. },
  148. {
  149. field: 'position',
  150. title: '岗位',
  151. minWidth: 120,
  152. },
  153. {
  154. field: 'isComment',
  155. title: '评论',
  156. minWidth: 100,
  157. align: 'center',
  158. formatter: (cellValue: number) => {
  159. return cellValue === 1 ? '已评' : '未评';
  160. },
  161. },
  162. {
  163. field: 'deadline',
  164. title: '截止时间',
  165. minWidth: 180,
  166. },
  167. {
  168. field: 'processTime',
  169. title: '提交时间',
  170. minWidth: 180,
  171. },
  172. {
  173. field: 'completionStatus',
  174. title: '任务状态',
  175. minWidth: 120,
  176. align: 'center',
  177. formatter: ({ row }) => {
  178. return row.completionStatus === 2 ? '按时完成' : '逾期完成';
  179. },
  180. },
  181. {
  182. field: 'createType',
  183. title: '创建',
  184. minWidth: 100,
  185. align: 'center',
  186. formatter: (cellValue: number) => {
  187. return cellValue === 0 ? '系统' : '新增';
  188. },
  189. },
  190. {
  191. field: 'shiftDate',
  192. title: '上班日期',
  193. minWidth: 180,
  194. },
  195. {
  196. field: 'shiftId',
  197. title: '上班班次',
  198. minWidth: 120,
  199. },
  200. ];