index.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. import { getDictOptions } from '@/utils/dict'
  2. import { cloneDeep } from 'lodash-es'
  3. export const getDictList = () => {
  4. const dictOptionsObj: any = {}
  5. // 性别
  6. // const sex = getDictOptions('system_user_sex')
  7. // 状态
  8. const state = getDictOptions('staff_state_type')
  9. // 在岗职位
  10. const drzw = getDictOptions('post_type')
  11. // 民族
  12. const nation = getDictOptions('nation_type')
  13. // 婚姻情况
  14. const hyzk = getDictOptions('hy_type')
  15. // 户口性质
  16. const hkxz = getDictOptions('hk_type')
  17. // 政治面貌
  18. const zzmm = getDictOptions('polity_type')
  19. // 能力等级
  20. const nldj = getDictOptions('ABILITY_LEVEL')
  21. // 最高学历
  22. const zgxl = getDictOptions('xl_type')
  23. // 紧急联系人关系
  24. const jjlxrgx = getDictOptions('contact_type')
  25. // dictOptionsObj.sex = sex
  26. dictOptionsObj.state = state
  27. dictOptionsObj.drzw = drzw
  28. dictOptionsObj.nation = nation
  29. dictOptionsObj.hyzk = hyzk
  30. dictOptionsObj.hkxz = hkxz
  31. dictOptionsObj.zzmm = zzmm
  32. dictOptionsObj.nldj = nldj
  33. dictOptionsObj.zgxl = zgxl
  34. dictOptionsObj.jjlxrgx = jjlxrgx
  35. return dictOptionsObj
  36. }
  37. export const formConfigList = [
  38. {
  39. title: '基本信息',
  40. children: [
  41. {
  42. name: 'nickname',
  43. title: '员工名称'
  44. },
  45. {
  46. name: 'sex',
  47. title: '性别',
  48. type: 'select',
  49. options: [
  50. {
  51. value: 0,
  52. label: '女'
  53. },
  54. {
  55. value: 1,
  56. label: '男'
  57. }
  58. ]
  59. },
  60. {
  61. name: 'mobilePhone',
  62. title: '手机'
  63. },
  64. {
  65. name: 'state',
  66. title: '状态',
  67. type: 'select',
  68. options: [
  69. {
  70. value: 1,
  71. label: '实习'
  72. },
  73. {
  74. value: 2,
  75. label: '试用'
  76. },
  77. {
  78. value: 3,
  79. label: '正式'
  80. },
  81. {
  82. value: 4,
  83. label: '离职'
  84. }
  85. ]
  86. },
  87. {
  88. name: 'drzw',
  89. title: '在岗职位',
  90. type: 'select',
  91. options: [
  92. {
  93. value: '1',
  94. label: 'JAVA工程师'
  95. },
  96. {
  97. value: '2',
  98. label: '前端工程师'
  99. }
  100. ]
  101. },
  102. {
  103. name: 'nation',
  104. title: '民族',
  105. type: 'select',
  106. options: [
  107. {
  108. value: '1',
  109. label: '汉族'
  110. },
  111. {
  112. value: '2',
  113. label: '其他'
  114. }
  115. ]
  116. },
  117. {
  118. name: 'loginName',
  119. title: '员工工号',
  120. type: 'button'
  121. },
  122. {
  123. name: 'deptName',
  124. title: '所属部门',
  125. type: 'dept-select'
  126. },
  127. {
  128. name: 'qdgs',
  129. title: '签订公司'
  130. },
  131. {
  132. name: 'birthday',
  133. title: '出生日期',
  134. type: 'time'
  135. },
  136. {
  137. name: 'hyzk',
  138. title: '婚姻状况',
  139. type: 'select',
  140. options: [
  141. {
  142. value: 1,
  143. label: '已婚'
  144. },
  145. {
  146. value: 2,
  147. label: '未婚'
  148. }
  149. ]
  150. },
  151. {
  152. name: 'hkxz',
  153. title: '户口性质',
  154. type: 'select',
  155. options: [
  156. {
  157. value: 1,
  158. label: '城镇'
  159. },
  160. {
  161. value: 2,
  162. label: '农村'
  163. }
  164. ]
  165. },
  166. {
  167. name: 'zzmm',
  168. title: '政治面貌',
  169. type: 'select',
  170. options: [
  171. {
  172. value: 1,
  173. label: '群众'
  174. },
  175. {
  176. value: 2,
  177. label: '团员'
  178. },
  179. {
  180. value: 3,
  181. label: '党员'
  182. }
  183. ]
  184. },
  185. {
  186. name: 'xjzdz',
  187. title: '现居住地址'
  188. },
  189. {
  190. name: 'hkszd',
  191. title: '户口所在地'
  192. },
  193. {
  194. name: 'rgssj',
  195. title: '入职时间',
  196. type: 'time'
  197. },
  198. {
  199. name: 'cjgzsj',
  200. title: '参加工作时间',
  201. type: 'time'
  202. },
  203. {
  204. name: 'nldj',
  205. title: '能力等级',
  206. type: 'select',
  207. options: [
  208. {
  209. value: '1',
  210. label: 'L1'
  211. },
  212. {
  213. value: '2',
  214. label: 'L2'
  215. },
  216. {
  217. value: '3',
  218. label: 'L3'
  219. },
  220. {
  221. value: '4',
  222. label: 'L4'
  223. },
  224. {
  225. value: '5',
  226. label: 'L5'
  227. },
  228. {
  229. value: '6',
  230. label: 'L6'
  231. },
  232. {
  233. value: '7',
  234. label: 'L7'
  235. },
  236. {
  237. value: '8',
  238. label: 'L8'
  239. },
  240. {
  241. value: '9',
  242. label: 'L9'
  243. },
  244. {
  245. value: '10',
  246. label: 'L10'
  247. }
  248. ]
  249. },
  250. {
  251. name: 'htqdsj',
  252. title: '合同签订时间',
  253. type: 'time'
  254. },
  255. {
  256. name: 'htdqs',
  257. title: '合同到期时间',
  258. type: 'time'
  259. },
  260. {
  261. name: 'xqah',
  262. title: '兴趣爱好'
  263. },
  264. {
  265. name: 'jntc',
  266. title: '技能特长'
  267. },
  268. {
  269. name: 'cgjl',
  270. title: '成果奖励'
  271. }
  272. ]
  273. },
  274. {
  275. title: '工资卡信息',
  276. children: [
  277. {
  278. name: 'khyh',
  279. title: '开户行'
  280. },
  281. {
  282. name: 'yhzh',
  283. title: '银行卡号'
  284. }
  285. ]
  286. },
  287. {
  288. title: '教育信息',
  289. children: [
  290. {
  291. name: 'byxx',
  292. title: '毕业院校'
  293. },
  294. {
  295. name: 'bysj',
  296. title: '毕业时间',
  297. type: 'time'
  298. },
  299. {
  300. name: 'zgxl',
  301. title: '最高学历',
  302. type: 'select',
  303. options: [
  304. {
  305. value: 1,
  306. label: '高中'
  307. },
  308. {
  309. value: 2,
  310. label: '中专'
  311. },
  312. {
  313. value: 3,
  314. label: '大专'
  315. },
  316. {
  317. value: 4,
  318. label: '本科'
  319. },
  320. {
  321. value: 5,
  322. label: '硕士'
  323. },
  324. {
  325. value: 6,
  326. label: '博士'
  327. }
  328. ]
  329. },
  330. {
  331. name: 'major',
  332. title: '专业'
  333. }
  334. ]
  335. },
  336. {
  337. title: '紧急联系人信息',
  338. children: [
  339. {
  340. name: 'jjlxrxm',
  341. title: '紧急联系人姓名'
  342. },
  343. {
  344. name: 'jjlxrhm',
  345. title: '紧急联系人电话'
  346. },
  347. {
  348. name: 'jjlxrgx',
  349. title: '紧急联系人关系',
  350. type: 'select',
  351. options: [
  352. {
  353. value: 1,
  354. label: '父母'
  355. },
  356. {
  357. value: 2,
  358. label: '夫妻'
  359. },
  360. {
  361. value: 3,
  362. label: '子女'
  363. },
  364. {
  365. value: 4,
  366. label: '兄弟姐妹'
  367. },
  368. {
  369. value: 5,
  370. label: '其他'
  371. }
  372. ]
  373. }
  374. ]
  375. }
  376. ]
  377. export const getConfigDict = () => {
  378. const dictList = getDictList()
  379. const configList = cloneDeep(formConfigList)
  380. // const numberType = ['sex', 'state', 'hyzk', 'hkxz', 'zzmm', 'zgxl', 'jjlxrgx']
  381. configList.forEach((item) => {
  382. item.children.forEach((child: any) => {
  383. if (child.type == 'select' && dictList[child.name]) {
  384. const options = dictList[child.name].map((item) => {
  385. return {
  386. label: item.label,
  387. // value: numberType.includes(child.name) ? Number(item.value) : item.value
  388. value: item.value
  389. }
  390. })
  391. child.options = options
  392. }
  393. })
  394. })
  395. return configList
  396. }
  397. export const formRules = {
  398. nickname: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
  399. }
  400. // 表格
  401. export const tableColumnConfig = [
  402. {
  403. name: 'deptName',
  404. title: '所属部门'
  405. },
  406. {
  407. name: 'state',
  408. title: '状态',
  409. type: 'select',
  410. options: [
  411. {
  412. value: 1,
  413. label: '实习'
  414. },
  415. {
  416. value: 2,
  417. label: '试用'
  418. },
  419. {
  420. value: 3,
  421. label: '正式'
  422. },
  423. {
  424. value: 4,
  425. label: '离职'
  426. }
  427. ]
  428. },
  429. {
  430. name: 'zzmm',
  431. title: '政治面貌',
  432. type: 'select',
  433. options: [
  434. {
  435. value: 1,
  436. label: '群众'
  437. },
  438. {
  439. value: 2,
  440. label: '团员'
  441. },
  442. {
  443. value: 3,
  444. label: '党员'
  445. }
  446. ]
  447. },
  448. {
  449. name: 'hkxz',
  450. title: '户口性质',
  451. type: 'select',
  452. options: [
  453. {
  454. value: 1,
  455. label: '城镇'
  456. },
  457. {
  458. value: 2,
  459. label: '农村'
  460. }
  461. ]
  462. },
  463. {
  464. name: 'byxx',
  465. title: '毕业院校'
  466. },
  467. {
  468. name: 'bysj',
  469. title: '毕业时间',
  470. type: 'time'
  471. },
  472. {
  473. name: 'zgxl',
  474. title: '最高学历',
  475. type: 'select',
  476. options: [
  477. {
  478. value: 1,
  479. label: '高中'
  480. },
  481. {
  482. value: 2,
  483. label: '中专'
  484. },
  485. {
  486. value: 3,
  487. label: '大专'
  488. },
  489. {
  490. value: 4,
  491. label: '本科'
  492. },
  493. {
  494. value: 5,
  495. label: '硕士'
  496. },
  497. {
  498. value: 6,
  499. label: '博士'
  500. }
  501. ]
  502. },
  503. {
  504. name: 'major',
  505. title: '专业'
  506. },
  507. {
  508. name: 'cjgzsj',
  509. title: '参加工作时间',
  510. type: 'time'
  511. },
  512. {
  513. name: 'rgssj',
  514. title: '入职时间',
  515. type: 'time'
  516. },
  517. {
  518. name: 'htdqs',
  519. title: '合同到期时间',
  520. type: 'time'
  521. },
  522. {
  523. name: 'zzsj',
  524. title: '转正时间',
  525. type: 'time'
  526. }
  527. ]
  528. //搜索
  529. export const searchConfig = [
  530. {
  531. name: 'nickname',
  532. title: '员工名称'
  533. },
  534. // {
  535. // name: 'loginName',
  536. // title: '员工工号'
  537. // },
  538. {
  539. name: 'deptName',
  540. title: '所属部门',
  541. type: 'dept-select'
  542. },
  543. {
  544. name: 'state',
  545. title: '状态',
  546. type: 'select',
  547. options: [
  548. {
  549. value: 1,
  550. label: '实习'
  551. },
  552. {
  553. value: 2,
  554. label: '试用'
  555. },
  556. {
  557. value: 3,
  558. label: '正式'
  559. },
  560. {
  561. value: 4,
  562. label: '离职'
  563. }
  564. ]
  565. },
  566. {
  567. name: 'zzmm',
  568. title: '政治面貌',
  569. type: 'select',
  570. options: [
  571. {
  572. value: 1,
  573. label: '群众'
  574. },
  575. {
  576. value: 2,
  577. label: '团员'
  578. },
  579. {
  580. value: 3,
  581. label: '党员'
  582. }
  583. ]
  584. },
  585. {
  586. name: 'hkxz',
  587. title: '户口性质',
  588. type: 'select',
  589. options: [
  590. {
  591. value: 1,
  592. label: '城镇'
  593. },
  594. {
  595. value: 2,
  596. label: '农村'
  597. }
  598. ]
  599. },
  600. {
  601. name: 'zgxl',
  602. title: '最高学历',
  603. type: 'select',
  604. options: [
  605. {
  606. value: 1,
  607. label: '高中'
  608. },
  609. {
  610. value: 2,
  611. label: '中专'
  612. },
  613. {
  614. value: 3,
  615. label: '大专'
  616. },
  617. {
  618. value: 4,
  619. label: '本科'
  620. },
  621. {
  622. value: 5,
  623. label: '硕士'
  624. },
  625. {
  626. value: 6,
  627. label: '博士'
  628. }
  629. ]
  630. }
  631. ]
  632. export const getTableConfigDict = (dataSource) => {
  633. const dictList = getDictList()
  634. const configList = cloneDeep(dataSource)
  635. const numberType = ['sex', 'state', 'hyzk', 'hkxz', 'zzmm', 'zgxl', 'jjlxrgx']
  636. configList.forEach((item) => {
  637. if (item.type == 'select' && dictList[item.name]) {
  638. const options = dictList[item.name].map((item) => {
  639. return {
  640. label: item.label,
  641. value: numberType.includes(item.name) ? Number(item.value) : item.value
  642. }
  643. })
  644. item.options = options
  645. }
  646. })
  647. return configList
  648. }