data.ts 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. import { FormProps, BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Form/index';
  3. import { adapt } from '/@/utils/adapt';
  4. import moment from 'moment';
  5. const adaptWidth = adapt();
  6. export const columns: BasicColumn[] = [
  7. {
  8. title: 'ID',
  9. dataIndex: 'id',
  10. editComponentProps: {
  11. prefix: '$',
  12. },
  13. width: 100,
  14. sorter: true,
  15. },
  16. {
  17. title: '姓名',
  18. dataIndex: 'name',
  19. width: 130,
  20. sorter: true,
  21. },
  22. {
  23. title: '性别',
  24. dataIndex: 'gender',
  25. width: 130,
  26. customRender({ record }) {
  27. const options = ['男', '女'];
  28. return options[record.gender];
  29. },
  30. sorter: true,
  31. },
  32. {
  33. title: '籍贯',
  34. dataIndex: 'origin',
  35. width: 150,
  36. sorter: true,
  37. },
  38. {
  39. title: '出生年月',
  40. dataIndex: 'birthday',
  41. width: 200,
  42. customRender({ record }) {
  43. return moment(record.birthday).format('YYYY-MM-DD');
  44. },
  45. sorter: true,
  46. },
  47. {
  48. title: '党派',
  49. dataIndex: 'party',
  50. width: 150,
  51. customRender({ record }) {
  52. const options = ['无', '民革', '民盟', '民建', '民进', '农工', '致公党', '九三学社', '台盟'];
  53. return options[record.party];
  54. },
  55. sorter: true,
  56. },
  57. {
  58. title: '民族',
  59. dataIndex: 'nation',
  60. width: 160,
  61. sorter: true,
  62. },
  63. {
  64. title: '单位',
  65. dataIndex: 'company',
  66. width: 160,
  67. sorter: true,
  68. },
  69. {
  70. title: '人大职务',
  71. dataIndex: 'peopleJob',
  72. width: 160,
  73. sorter: true,
  74. },
  75. {
  76. title: '政协职务',
  77. dataIndex: 'cppccJob',
  78. width: 160,
  79. sorter: true,
  80. },
  81. {
  82. title: '社会职务',
  83. dataIndex: 'job',
  84. width: 160,
  85. sorter: true,
  86. },
  87. {
  88. title: '联系方式',
  89. dataIndex: 'mobile',
  90. width: 160,
  91. sorter: true,
  92. },
  93. ];
  94. export function getFormConfig(): Partial<FormProps> {
  95. return {
  96. labelWidth: 100,
  97. schemas: [
  98. {
  99. field: `id`,
  100. label: `ID`,
  101. component: 'Input',
  102. componentProps: {
  103. placeholder: 'ID',
  104. },
  105. colProps: {
  106. xl: 12,
  107. xxl: 8,
  108. },
  109. },
  110. {
  111. field: `name`,
  112. label: `姓名`,
  113. component: 'Input',
  114. componentProps: {
  115. placeholder: '姓名',
  116. },
  117. colProps: {
  118. xl: 12,
  119. xxl: 8,
  120. },
  121. },
  122. {
  123. field: `gender`,
  124. label: `性别`,
  125. component: 'Select',
  126. componentProps: {
  127. options: [
  128. {
  129. label: '男',
  130. value: 0,
  131. },
  132. {
  133. label: '女',
  134. value: 1,
  135. },
  136. ],
  137. },
  138. colProps: {
  139. xl: 12,
  140. xxl: 8,
  141. },
  142. },
  143. {
  144. field: `origin`,
  145. label: `籍贯`,
  146. component: 'Input',
  147. componentProps: {
  148. placeholder: '籍贯',
  149. },
  150. colProps: {
  151. xl: 12,
  152. xxl: 8,
  153. },
  154. },
  155. {
  156. field: `birthday`,
  157. label: `出生年月`,
  158. component: 'DatePicker',
  159. componentProps: {
  160. placeholder: '出生年月',
  161. },
  162. colProps: {
  163. xl: 12,
  164. xxl: 8,
  165. },
  166. },
  167. {
  168. field: `party`,
  169. label: `党派`,
  170. component: 'Select',
  171. componentProps: {
  172. options: [
  173. {
  174. label: '无',
  175. value: 0,
  176. },
  177. {
  178. label: '民革',
  179. value: 1,
  180. },
  181. {
  182. label: '民盟',
  183. value: 2,
  184. },
  185. {
  186. label: '民建',
  187. value: 3,
  188. },
  189. {
  190. label: '民进',
  191. value: 4,
  192. },
  193. {
  194. label: '农工',
  195. value: 5,
  196. },
  197. {
  198. label: '致公党',
  199. value: 6,
  200. },
  201. {
  202. label: '九三学社',
  203. value: 7,
  204. },
  205. {
  206. label: '台盟',
  207. value: 8,
  208. },
  209. ],
  210. },
  211. colProps: {
  212. xl: 12,
  213. xxl: 8,
  214. },
  215. },
  216. {
  217. field: `nation`,
  218. label: `民族`,
  219. component: 'Input',
  220. componentProps: {
  221. placeholder: '名族',
  222. },
  223. colProps: {
  224. xl: 12,
  225. xxl: 8,
  226. },
  227. },
  228. {
  229. field: `company`,
  230. label: `单位`,
  231. component: 'Input',
  232. componentProps: {
  233. placeholder: '单位',
  234. },
  235. colProps: {
  236. xl: 12,
  237. xxl: 8,
  238. },
  239. },
  240. {
  241. field: `peopleJob`,
  242. label: `人大职务`,
  243. component: 'Input',
  244. componentProps: {
  245. placeholder: '人大职务',
  246. },
  247. colProps: {
  248. xl: 12,
  249. xxl: 8,
  250. },
  251. },
  252. {
  253. field: `cppccJob`,
  254. label: `政协职务`,
  255. component: 'Input',
  256. componentProps: {
  257. placeholder: '政协职务',
  258. },
  259. colProps: {
  260. xl: 12,
  261. xxl: 8,
  262. },
  263. },
  264. {
  265. field: `job`,
  266. label: `社会职务`,
  267. component: 'Input',
  268. componentProps: {
  269. placeholder: '社会职务',
  270. },
  271. colProps: {
  272. xl: 12,
  273. xxl: 8,
  274. },
  275. },
  276. {
  277. field: `mobile`,
  278. label: `联系方式`,
  279. component: 'Input',
  280. componentProps: {
  281. placeholder: '联系方式',
  282. },
  283. colProps: {
  284. xl: 12,
  285. xxl: 8,
  286. },
  287. },
  288. ],
  289. };
  290. }
  291. // =================popup================================
  292. export const schemas: FormSchema[] = [
  293. {
  294. field: 'name',
  295. component: 'Input',
  296. label: '姓名',
  297. labelWidth: adaptWidth.labelWidth,
  298. colProps: {
  299. span: adaptWidth.elContainer,
  300. },
  301. componentProps: {
  302. placeholder: '姓名',
  303. },
  304. required: true,
  305. },
  306. {
  307. field: 'gender',
  308. component: 'Select',
  309. label: '性别',
  310. labelWidth: adaptWidth.labelWidth,
  311. colProps: {
  312. span: adaptWidth.elContainer,
  313. },
  314. componentProps: {
  315. placeholder: '性别',
  316. options: [
  317. {
  318. label: '男',
  319. value: 0,
  320. },
  321. {
  322. label: '女',
  323. value: 1,
  324. },
  325. ],
  326. },
  327. required: true,
  328. },
  329. {
  330. field: 'birthday',
  331. component: 'DatePicker',
  332. label: '出生年月',
  333. labelWidth: adaptWidth.labelWidth,
  334. colProps: {
  335. span: adaptWidth.elContainer,
  336. },
  337. componentProps: {
  338. placeholder: '出生年月',
  339. },
  340. required: true,
  341. },
  342. {
  343. field: 'origin',
  344. component: 'Input',
  345. label: '籍贯',
  346. labelWidth: adaptWidth.labelWidth,
  347. colProps: {
  348. span: adaptWidth.elContainer,
  349. },
  350. componentProps: {
  351. placeholder: '籍贯',
  352. },
  353. required: true,
  354. },
  355. {
  356. field: 'birthplace',
  357. component: 'Input',
  358. label: '出生地',
  359. labelWidth: adaptWidth.labelWidth,
  360. colProps: {
  361. span: adaptWidth.elContainer,
  362. },
  363. componentProps: {
  364. placeholder: '出生地',
  365. },
  366. required: true,
  367. },
  368. {
  369. field: 'cardNo',
  370. component: 'Input',
  371. label: '身份证号码',
  372. labelWidth: adaptWidth.labelWidth,
  373. colProps: {
  374. span: adaptWidth.elContainer,
  375. },
  376. componentProps: {
  377. placeholder: '身份证号码',
  378. },
  379. required: true,
  380. },
  381. {
  382. field: 'nation',
  383. component: 'Input',
  384. label: '民族',
  385. labelWidth: adaptWidth.labelWidth,
  386. colProps: {
  387. span: adaptWidth.elContainer,
  388. },
  389. componentProps: {
  390. placeholder: '民族',
  391. },
  392. required: true,
  393. },
  394. {
  395. field: 'party',
  396. label: '党派',
  397. component: 'Select',
  398. componentProps: {
  399. placeholder: '党派',
  400. options: [
  401. {
  402. label: '无',
  403. value: 0,
  404. },
  405. {
  406. label: '民革',
  407. value: 1,
  408. },
  409. {
  410. label: '民盟',
  411. value: 2,
  412. },
  413. {
  414. label: '民建',
  415. value: 3,
  416. },
  417. {
  418. label: '民进',
  419. value: 4,
  420. },
  421. {
  422. label: '农工',
  423. value: 5,
  424. },
  425. {
  426. label: '致公党',
  427. value: 6,
  428. },
  429. {
  430. label: '九三学社',
  431. value: 7,
  432. },
  433. {
  434. label: '台盟',
  435. value: 8,
  436. },
  437. ],
  438. },
  439. labelWidth: adaptWidth.labelWidth,
  440. colProps: {
  441. span: adaptWidth.elContainer,
  442. },
  443. required: true,
  444. },
  445. {
  446. field: 'edu',
  447. component: 'Input',
  448. label: '学历',
  449. labelWidth: adaptWidth.labelWidth,
  450. colProps: {
  451. span: adaptWidth.elContainer,
  452. },
  453. componentProps: {
  454. placeholder: '学历',
  455. },
  456. required: true,
  457. },
  458. {
  459. field: 'title',
  460. component: 'Input',
  461. label: '职称',
  462. labelWidth: adaptWidth.labelWidth,
  463. colProps: {
  464. span: adaptWidth.elContainer,
  465. },
  466. componentProps: {
  467. placeholder: '职称',
  468. },
  469. },
  470. {
  471. field: 'job',
  472. component: 'Input',
  473. label: '职务',
  474. labelWidth: adaptWidth.labelWidth,
  475. colProps: {
  476. span: adaptWidth.elContainer,
  477. },
  478. componentProps: {
  479. placeholder: '职务',
  480. },
  481. required: true,
  482. },
  483. {
  484. field: 'address',
  485. component: 'Input',
  486. label: '地址',
  487. labelWidth: adaptWidth.labelWidth,
  488. defaultValue: '',
  489. colProps: {
  490. span: adaptWidth.elContainer,
  491. },
  492. componentProps: {
  493. placeholder: '地址',
  494. },
  495. required: true,
  496. },
  497. {
  498. field: 'zipcode',
  499. component: 'Input',
  500. label: '邮编',
  501. labelWidth: adaptWidth.labelWidth,
  502. defaultValue: '',
  503. colProps: {
  504. span: adaptWidth.elContainer,
  505. },
  506. componentProps: {
  507. placeholder: '邮编',
  508. },
  509. },
  510. {
  511. field: 'tel',
  512. component: 'Input',
  513. label: '电话',
  514. labelWidth: adaptWidth.labelWidth,
  515. defaultValue: '',
  516. colProps: {
  517. span: adaptWidth.elContainer,
  518. },
  519. componentProps: {
  520. placeholder: '电话',
  521. },
  522. },
  523. {
  524. field: 'mobile',
  525. component: 'Input',
  526. label: '手机',
  527. labelWidth: adaptWidth.labelWidth,
  528. defaultValue: '',
  529. colProps: {
  530. span: adaptWidth.elContainer,
  531. },
  532. componentProps: {
  533. placeholder: '手机',
  534. },
  535. required: true,
  536. },
  537. {
  538. field: 'old',
  539. component: 'Input',
  540. label: '办企业前工作单位',
  541. labelWidth: adaptWidth.labelWidth,
  542. defaultValue: '',
  543. colProps: {
  544. span: adaptWidth.elContainer,
  545. },
  546. componentProps: {
  547. placeholder: '办企业前工作单位',
  548. },
  549. },
  550. {
  551. field: 'peopleJob',
  552. component: 'Input',
  553. label: '人大职务',
  554. labelWidth: adaptWidth.labelWidth,
  555. defaultValue: '',
  556. colProps: {
  557. span: adaptWidth.elContainer,
  558. },
  559. componentProps: {
  560. placeholder: '人大职务',
  561. },
  562. },
  563. {
  564. field: 'cppccJob',
  565. component: 'Input',
  566. label: '政协职务',
  567. labelWidth: adaptWidth.labelWidth,
  568. defaultValue: '',
  569. colProps: {
  570. span: adaptWidth.elContainer,
  571. },
  572. componentProps: {
  573. placeholder: '政协职务',
  574. },
  575. },
  576. {
  577. field: 'family',
  578. component: 'FamilyArrCom',
  579. label: '家庭主要成员',
  580. labelWidth: adaptWidth.labelWidth,
  581. colProps: {
  582. span: adaptWidth.elContainer,
  583. },
  584. defaultValue: [],
  585. componentProps: ({ formModel }) => {
  586. return {
  587. placeholder: '家庭主要成员',
  588. value: formModel.family,
  589. onChange: () => {},
  590. };
  591. },
  592. required: true,
  593. },
  594. {
  595. field: 'info',
  596. component: 'InputTextArea',
  597. label: '本人简历',
  598. labelWidth: adaptWidth.labelWidth,
  599. defaultValue: '',
  600. colProps: {
  601. span: adaptWidth.elContainer,
  602. },
  603. componentProps: {
  604. placeholder: '本人简历',
  605. },
  606. },
  607. {
  608. field: 'company',
  609. component: 'Input',
  610. label: '所在单位',
  611. labelWidth: adaptWidth.labelWidth,
  612. defaultValue: '',
  613. colProps: {
  614. span: adaptWidth.elContainer,
  615. },
  616. componentProps: {
  617. placeholder: '所在单位',
  618. },
  619. required: true,
  620. },
  621. ];