Ei kuvausta

employeePerfor-data.tsx 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. import type { FormSchemaGetter } from '#/adapter/form';
  2. import type { VxeGridProps } from '#/adapter/vxe-table';
  3. import { selectAllSysStation } from '#/api/system/infoEntry/stationInfo/stationInfo';
  4. // 获取过滤后的岗位列表
  5. import { getFilteredPositions } from '../../utils/positionFilter';
  6. export const queryFormSchema: FormSchemaGetter = () => [
  7. {
  8. component: 'ApiSelect',
  9. fieldName: 'stationId',
  10. label: '油站',
  11. componentProps: {
  12. placeholder: '请选择油站',
  13. clearable: true,
  14. api: async () => {
  15. const resp = await selectAllSysStation();
  16. const data = resp || [];
  17. return Array.isArray(data)
  18. ? data.map((item: any) => ({
  19. label: item.stationName,
  20. value: item.id.toString(),
  21. }))
  22. : [];
  23. },
  24. labelField: 'label',
  25. valueField: 'value',
  26. },
  27. },
  28. {
  29. component: 'ApiSelect',
  30. fieldName: 'position',
  31. label: '岗位',
  32. componentProps: {
  33. placeholder: '请选择岗位',
  34. clearable: true,
  35. api: getFilteredPositions,
  36. labelField: 'label',
  37. valueField: 'value',
  38. },
  39. },
  40. {
  41. component: 'Select',
  42. fieldName: 'isComment',
  43. label: '是否评论',
  44. componentProps: {
  45. placeholder: '请选择是否评论',
  46. options: [
  47. { label: '是', value: 1 },
  48. { label: '否', value: 0 },
  49. ],
  50. },
  51. },
  52. {
  53. component: 'Select',
  54. fieldName: 'createType',
  55. label: '创建类型',
  56. componentProps: {
  57. placeholder: '请选择创建类型',
  58. options: [
  59. { label: '系统', value: 0 },
  60. { label: '新增', value: 1 },
  61. ],
  62. },
  63. },
  64. {
  65. component: 'Select',
  66. fieldName: 'completionStatus',
  67. label: '完成状态',
  68. componentProps: {
  69. placeholder: '请选择完成状态',
  70. options: [
  71. { label: '按时完成', value: 2 },
  72. { label: '逾期完成', value: 1 },
  73. ],
  74. },
  75. },
  76. {
  77. component: 'DatePicker',
  78. componentProps: {
  79. type: 'daterange',
  80. format: 'YYYY-MM-DD HH:mm:ss',
  81. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  82. startPlaceholder: '开始日期',
  83. endPlaceholder: '结束日期',
  84. },
  85. fieldName: 'deadline',
  86. label: '截止时间',
  87. },
  88. {
  89. component: 'DatePicker',
  90. componentProps: {
  91. type: 'daterange',
  92. format: 'YYYY-MM-DD HH:mm:ss',
  93. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  94. startPlaceholder: '开始日期',
  95. endPlaceholder: '结束日期',
  96. },
  97. fieldName: 'processTime',
  98. label: '处理时间',
  99. },
  100. {
  101. component: 'Input',
  102. fieldName: 'executorName',
  103. label: '执行人姓名',
  104. componentProps: {
  105. placeholder: '请输入执行人姓名',
  106. },
  107. },
  108. ];
  109. export const tableColumns: VxeGridProps['columns'] = [
  110. {
  111. field: 'userName',
  112. title: '姓名',
  113. fixed: 'left',
  114. minWidth: 100,
  115. },
  116. {
  117. field: 'postIdName',
  118. title: '岗位',
  119. minWidth: 120,
  120. },
  121. {
  122. field: 'month',
  123. title: '月份',
  124. minWidth: 100,
  125. },
  126. {
  127. field: 'customerService',
  128. title: '顾客服务(30分)',
  129. minWidth: 120,
  130. },
  131. {
  132. field: 'safetyAssessment',
  133. title: '安全考核(15分)',
  134. minWidth: 120,
  135. },
  136. {
  137. field: 'dailyPerformance',
  138. title: '日常综合表现(24分)',
  139. minWidth: 120,
  140. },
  141. {
  142. field: 'performanceScore',
  143. title: '业绩表现(20分)',
  144. minWidth: 120,
  145. },
  146. {
  147. field: 'selfEvaluation',
  148. title: '自主评分(10分)',
  149. minWidth: 120,
  150. },
  151. {
  152. field: 'totalScore',
  153. title: '总分',
  154. minWidth: 100,
  155. },
  156. {
  157. field: 'scoreLevel',
  158. title: '考评等级(参考)',
  159. minWidth: 120,
  160. },
  161. {
  162. field: 'performanceLevel',
  163. title: '绩效等级',
  164. minWidth: 100,
  165. },
  166. {
  167. field: 'comments',
  168. title: '评语',
  169. minWidth: 150,
  170. },
  171. {
  172. field: 'bonusPercentage',
  173. title: '奖金比例%',
  174. minWidth: 100,
  175. },
  176. {
  177. field: 'bonusDescription',
  178. title: '奖金包说明',
  179. minWidth: 150,
  180. },
  181. {
  182. field: 'evaluationLevel',
  183. title: '考评等级',
  184. minWidth: 100,
  185. },
  186. {
  187. field: 'deductionAmount',
  188. title: '扣款金额',
  189. minWidth: 100,
  190. },
  191. {
  192. field: 'deductionDescription',
  193. title: '扣款说明',
  194. minWidth: 150,
  195. },
  196. {
  197. field: 'stationName',
  198. title: '油站',
  199. minWidth: 120,
  200. },
  201. {
  202. field: 'taskName',
  203. title: '任务名称',
  204. minWidth: 150,
  205. },
  206. {
  207. field: 'executorName',
  208. title: '执行人姓名',
  209. minWidth: 120,
  210. },
  211. {
  212. field: 'deadline',
  213. title: '截止时间',
  214. minWidth: 180,
  215. },
  216. {
  217. field: 'processTime',
  218. title: '处理时间',
  219. minWidth: 180,
  220. },
  221. {
  222. field: 'completionStatus',
  223. title: '完成状态',
  224. minWidth: 120,
  225. align: 'center',
  226. formatter: ({ row }) => {
  227. return row.completionStatus === 2 ? '按时完成' : '逾期完成';
  228. },
  229. },
  230. {
  231. field: 'isComment',
  232. title: '是否评论',
  233. minWidth: 100,
  234. align: 'center',
  235. formatter: (cellValue: number) => {
  236. return cellValue === 1 ? '是' : '否';
  237. },
  238. },
  239. {
  240. field: 'createType',
  241. title: '创建类型',
  242. minWidth: 100,
  243. align: 'center',
  244. formatter: (cellValue: number) => {
  245. return cellValue === 0 ? '系统' : '新增';
  246. },
  247. },
  248. {
  249. field: 'action',
  250. fixed: 'right',
  251. slots: { default: 'action' },
  252. title: '操作',
  253. width: 150,
  254. },
  255. ];
  256. export const drawerFormSchema: FormSchemaGetter = () => [
  257. {
  258. component: 'Input',
  259. dependencies: {
  260. show: () => false,
  261. triggerFields: [''],
  262. },
  263. fieldName: 'id',
  264. },
  265. {
  266. component: 'Input',
  267. fieldName: 'performanceLevel',
  268. label: '绩效等级',
  269. componentProps: {
  270. placeholder: '请输入绩效等级',
  271. maxlength: 50,
  272. },
  273. },
  274. {
  275. component: 'Input',
  276. fieldName: 'comments',
  277. label: '评语',
  278. componentProps: {
  279. placeholder: '请输入评语',
  280. maxlength: 500,
  281. type: 'textarea',
  282. rows: 3,
  283. },
  284. },
  285. {
  286. component: 'InputNumber',
  287. fieldName: 'bonusPercentage',
  288. label: '奖金比例%',
  289. componentProps: {
  290. placeholder: '请输入奖金比例',
  291. min: 0,
  292. max: 100,
  293. step: 1,
  294. style: {
  295. width: '100%',
  296. },
  297. },
  298. },
  299. {
  300. component: 'Input',
  301. fieldName: 'bonusDescription',
  302. label: '奖金包说明',
  303. componentProps: {
  304. placeholder: '请输入奖金包说明',
  305. maxlength: 200,
  306. type: 'textarea',
  307. rows: 2,
  308. },
  309. },
  310. {
  311. component: 'Select',
  312. fieldName: 'evaluationLevel',
  313. label: '考评等级',
  314. componentProps: {
  315. placeholder: '请选择考评等级',
  316. options: [
  317. { label: '优秀', value: '优秀' },
  318. { label: '良好', value: '良好' },
  319. { label: '合格', value: '合格' },
  320. { label: '需改进', value: '需改进' },
  321. ],
  322. },
  323. },
  324. {
  325. component: 'InputNumber',
  326. fieldName: 'deductionAmount',
  327. label: '扣款金额',
  328. componentProps: {
  329. placeholder: '请输入扣款金额',
  330. min: 0,
  331. step: 1,
  332. style: {
  333. width: '100%',
  334. },
  335. },
  336. },
  337. {
  338. component: 'Input',
  339. fieldName: 'deductionDescription',
  340. label: '扣款说明',
  341. componentProps: {
  342. placeholder: '请输入扣款说明',
  343. maxlength: 200,
  344. type: 'textarea',
  345. rows: 2,
  346. },
  347. },
  348. ];
  349. /**
  350. * 表单字段到 API 字段的映射
  351. */
  352. export function mapFormToApi(formValues: any, page: any) {
  353. const apiParams = {
  354. pageNum: page.currentPage,
  355. pageSize: page.pageSize,
  356. };
  357. // 处理截止时间
  358. if (formValues.deadline) {
  359. apiParams.deadlineStartTime = formValues.deadline[0];
  360. apiParams.deadlineEndTime = formValues.deadline[1];
  361. }
  362. // 处理处理时间
  363. if (formValues.processTime) {
  364. apiParams.processStartTime = formValues.processTime[0];
  365. apiParams.processEndTime = formValues.processTime[1];
  366. }
  367. // 其他字段
  368. Object.keys(formValues).forEach((key) => {
  369. if (key !== 'deadline' && key !== 'processTime') {
  370. apiParams[key] = formValues[key];
  371. }
  372. });
  373. return apiParams;
  374. }