data.ts 22 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  1. import { FormProps, BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Form/index';
  3. import { adapt } from '/@/utils/adapt';
  4. import { h } from 'vue';
  5. import moment from 'moment';
  6. const adaptWidth = adapt();
  7. export const columns: BasicColumn[] = [
  8. {
  9. title: 'ID',
  10. dataIndex: 'id',
  11. editComponentProps: {
  12. prefix: '$',
  13. },
  14. width: 100,
  15. sorter: true,
  16. },
  17. {
  18. title: '企业(单位)名称',
  19. dataIndex: 'name',
  20. width: 200,
  21. sorter: true,
  22. customRender({ record }) {
  23. const dom: object[] = [];
  24. dom.push(h('span', {}, record.name));
  25. if (record.nature === 0) {
  26. dom.push(h('span', { style: { fontSize: '18px', fontWeight: 'bold', color: 'red' } }, '★'));
  27. }
  28. return dom;
  29. },
  30. },
  31. {
  32. title: '法人代表',
  33. dataIndex: 'legalman',
  34. width: 130,
  35. sorter: true,
  36. },
  37. {
  38. title: '成立时间',
  39. dataIndex: 'foundingtime',
  40. width: 150,
  41. customRender({ record }) {
  42. return moment(record.foundingtime).format('YYYY-MM-DD');
  43. },
  44. sorter: true,
  45. },
  46. {
  47. title: '工商登记号',
  48. dataIndex: 'businessNo',
  49. width: 350,
  50. sorter: true,
  51. },
  52. {
  53. title: '单位性质',
  54. dataIndex: 'nature',
  55. width: 160,
  56. customRender: ({ record }) => {
  57. const options = [
  58. '机关事业单位',
  59. '国有企业',
  60. '集体所有制',
  61. '私营企业',
  62. '股份制企业',
  63. '有限合伙企业',
  64. '联营企业',
  65. '外商投资企业',
  66. '个人独资企业',
  67. ];
  68. return options[record.nature];
  69. },
  70. sorter: true,
  71. },
  72. {
  73. title: '行业分类',
  74. dataIndex: 'job',
  75. width: 160,
  76. sorter: true,
  77. },
  78. {
  79. title: '注册资金',
  80. dataIndex: 'regMoney',
  81. width: 160,
  82. sorter: true,
  83. },
  84. {
  85. title: '职工人数',
  86. dataIndex: 'jobnum',
  87. width: 160,
  88. sorter: true,
  89. },
  90. ];
  91. export function getFormConfig(): Partial<FormProps> {
  92. return {
  93. labelWidth: 110,
  94. schemas: [
  95. {
  96. field: `id`,
  97. label: `ID`,
  98. component: 'Input',
  99. componentProps: {
  100. placeholder: 'ID',
  101. },
  102. colProps: {
  103. xl: 12,
  104. xxl: 8,
  105. },
  106. },
  107. {
  108. field: `name`,
  109. label: `企业(单位)名称`,
  110. component: 'Input',
  111. componentProps: {
  112. placeholder: '企业或单位名称',
  113. },
  114. colProps: {
  115. xl: 12,
  116. xxl: 8,
  117. },
  118. },
  119. {
  120. field: `legalman`,
  121. label: `法人代表`,
  122. component: 'Input',
  123. componentProps: {
  124. placeholder: '法人代表',
  125. },
  126. colProps: {
  127. xl: 12,
  128. xxl: 8,
  129. },
  130. },
  131. {
  132. field: `foundingtime`,
  133. label: `成立时间`,
  134. component: 'RangePicker',
  135. componentProps: {
  136. valueFormat: 'YYYY-MM-DD',
  137. },
  138. colProps: {
  139. xl: 12,
  140. xxl: 8,
  141. },
  142. },
  143. {
  144. field: `businessNo`,
  145. label: `工商登记号`,
  146. component: 'Input',
  147. componentProps: {
  148. placeholder: '工商登记号',
  149. },
  150. colProps: {
  151. xl: 12,
  152. xxl: 8,
  153. },
  154. },
  155. {
  156. field: `nature`,
  157. label: `单位性质`,
  158. component: 'Select',
  159. componentProps: {
  160. placeholder: '单位性质',
  161. options: [
  162. {
  163. label: '机关事业单位',
  164. value: 0,
  165. },
  166. {
  167. label: '国有企业',
  168. value: 1,
  169. },
  170. {
  171. label: '集体所有制',
  172. value: 2,
  173. },
  174. {
  175. label: '私营企业',
  176. value: 3,
  177. },
  178. {
  179. label: '股份制企业',
  180. value: 4,
  181. },
  182. {
  183. label: '有限合伙企业',
  184. value: 5,
  185. },
  186. {
  187. label: '联营企业',
  188. value: 6,
  189. },
  190. {
  191. label: '外商投资企业',
  192. value: 7,
  193. },
  194. {
  195. label: '个人独资企业',
  196. value: 8,
  197. },
  198. ],
  199. },
  200. colProps: {
  201. xl: 12,
  202. xxl: 8,
  203. },
  204. },
  205. {
  206. field: `job`,
  207. label: `行业分类`,
  208. component: 'Input',
  209. componentProps: {
  210. placeholder: '行业分类',
  211. },
  212. colProps: {
  213. xl: 12,
  214. xxl: 8,
  215. },
  216. },
  217. {
  218. field: `regMoney`,
  219. label: `注册资金`,
  220. component: 'RangeNumber',
  221. componentProps: {
  222. placeholder: '注册资金',
  223. },
  224. colProps: {
  225. xl: 12,
  226. xxl: 8,
  227. },
  228. },
  229. {
  230. field: `jobnum`,
  231. label: `职工人数`,
  232. component: 'RangeNumber',
  233. componentProps: {
  234. placeholder: '职工人数',
  235. },
  236. colProps: {
  237. xl: 12,
  238. xxl: 8,
  239. },
  240. },
  241. ],
  242. };
  243. }
  244. // =================popup================================
  245. export const schemas: FormSchema[] = [
  246. {
  247. field: 'name',
  248. component: 'Input',
  249. label: '企业名称',
  250. labelWidth: adaptWidth.labelWidth,
  251. colProps: {
  252. span: adaptWidth.elContainer,
  253. },
  254. componentProps: {
  255. placeholder: '企业名称',
  256. },
  257. show: ({ values }) => {
  258. if (values.nature !== 0) {
  259. return true;
  260. }
  261. return false;
  262. },
  263. required: ({ values }) => {
  264. if (values.nature !== 0) {
  265. return true;
  266. }
  267. return false;
  268. },
  269. },
  270. {
  271. field: 'name',
  272. component: 'Input',
  273. label: '单位名称',
  274. labelWidth: adaptWidth.labelWidth,
  275. colProps: {
  276. span: adaptWidth.elContainer,
  277. },
  278. componentProps: {
  279. placeholder: '单位名称',
  280. },
  281. show: ({ values }) => {
  282. if (values.nature === 0) {
  283. return true;
  284. }
  285. return false;
  286. },
  287. required: ({ values }) => {
  288. if (values.nature === 0) {
  289. return true;
  290. }
  291. return false;
  292. },
  293. },
  294. {
  295. field: 'nature',
  296. label: '单位性质',
  297. component: 'Select',
  298. componentProps: {
  299. placeholder: '单位性质',
  300. options: [
  301. {
  302. label: '机关事业单位',
  303. value: 0,
  304. },
  305. {
  306. label: '国有企业',
  307. value: 1,
  308. },
  309. {
  310. label: '集体所有制',
  311. value: 2,
  312. },
  313. {
  314. label: '私营企业',
  315. value: 3,
  316. },
  317. {
  318. label: '股份制企业',
  319. value: 4,
  320. },
  321. {
  322. label: '有限合伙企业',
  323. value: 5,
  324. },
  325. {
  326. label: '联营企业',
  327. value: 6,
  328. },
  329. {
  330. label: '外商投资企业',
  331. value: 7,
  332. },
  333. {
  334. label: '个人独资企业',
  335. value: 8,
  336. },
  337. ],
  338. },
  339. labelWidth: adaptWidth.labelWidth,
  340. colProps: {
  341. span: adaptWidth.elContainer,
  342. },
  343. required: true,
  344. },
  345. {
  346. field: 'legalman',
  347. component: 'Input',
  348. label: '法人代表',
  349. labelWidth: adaptWidth.labelWidth,
  350. colProps: {
  351. span: adaptWidth.elContainer,
  352. },
  353. componentProps: {
  354. placeholder: '法人代表',
  355. },
  356. show: ({ values }) => {
  357. if (values.nature !== 0) {
  358. return true;
  359. }
  360. return false;
  361. },
  362. dynamicRules: ({ values }) => {
  363. return [
  364. {
  365. required: true,
  366. validator: async (_, value: any) => {
  367. let dealValue = '';
  368. if (value) {
  369. dealValue = value.replace(/\s*/g, '');
  370. }
  371. if (values.nature && dealValue === '') {
  372. return Promise.reject('请输入法人代表');
  373. }
  374. },
  375. trigger: 'blur',
  376. },
  377. ];
  378. },
  379. required: ({ values }) => {
  380. if (values.nature !== 0) {
  381. return true;
  382. }
  383. return false;
  384. },
  385. },
  386. {
  387. field: 'level',
  388. component: 'Input',
  389. label: '行政级别',
  390. labelWidth: adaptWidth.labelWidth,
  391. colProps: {
  392. span: adaptWidth.elContainer,
  393. },
  394. componentProps: {
  395. placeholder: '行政级别',
  396. },
  397. show: ({ values }) => {
  398. if (values.nature === 0) {
  399. return true;
  400. }
  401. return false;
  402. },
  403. },
  404. {
  405. field: 'area',
  406. component: 'Input',
  407. label: '所属地区',
  408. labelWidth: adaptWidth.labelWidth,
  409. colProps: {
  410. span: adaptWidth.elContainer,
  411. },
  412. componentProps: {
  413. placeholder: '所属地区',
  414. },
  415. show: ({ values }) => {
  416. if (values.nature === 0) {
  417. return true;
  418. }
  419. return false;
  420. },
  421. },
  422. {
  423. field: 'parent',
  424. component: 'Input',
  425. label: '上级单位',
  426. labelWidth: adaptWidth.labelWidth,
  427. colProps: {
  428. span: adaptWidth.elContainer,
  429. },
  430. componentProps: {
  431. placeholder: '上级单位',
  432. },
  433. show: ({ values }) => {
  434. if (values.nature === 0) {
  435. return true;
  436. }
  437. return false;
  438. },
  439. },
  440. {
  441. field: 'businessNo',
  442. component: 'Input',
  443. label: '工商登记号',
  444. labelWidth: adaptWidth.labelWidth,
  445. colProps: {
  446. span: adaptWidth.elContainer,
  447. },
  448. componentProps: {
  449. placeholder: '工商登记号',
  450. },
  451. show: ({ values }) => {
  452. if (values.nature !== 0) {
  453. return true;
  454. }
  455. return false;
  456. },
  457. dynamicRules: ({ values }) => {
  458. return [
  459. {
  460. required: true,
  461. validator: async (_, value: any) => {
  462. let dealValue = '';
  463. if (value) {
  464. dealValue = value.replace(/\s*/g, '');
  465. }
  466. if (values.nature && dealValue === '') {
  467. return Promise.reject('请输入工商登记号');
  468. }
  469. },
  470. trigger: 'blur',
  471. },
  472. ];
  473. },
  474. required: ({ values }) => {
  475. if (values.nature !== 0) {
  476. return true;
  477. }
  478. return false;
  479. },
  480. },
  481. {
  482. field: 'centralTax',
  483. component: 'Input',
  484. label: '国税税号',
  485. labelWidth: adaptWidth.labelWidth,
  486. colProps: {
  487. span: adaptWidth.elContainer,
  488. },
  489. componentProps: {
  490. placeholder: '国税税号',
  491. },
  492. show: ({ values }) => {
  493. if (values.nature !== 0) {
  494. return true;
  495. }
  496. return false;
  497. },
  498. },
  499. {
  500. field: 'landTax',
  501. component: 'Input',
  502. label: '地税税号',
  503. labelWidth: adaptWidth.labelWidth,
  504. colProps: {
  505. span: adaptWidth.elContainer,
  506. },
  507. componentProps: {
  508. placeholder: '地税税号',
  509. },
  510. show: ({ values }) => {
  511. if (values.nature !== 0) {
  512. return true;
  513. }
  514. return false;
  515. },
  516. },
  517. {
  518. field: 'foundingtime',
  519. component: 'DatePicker',
  520. label: '成立时间',
  521. labelWidth: adaptWidth.labelWidth,
  522. colProps: {
  523. span: adaptWidth.elContainer,
  524. },
  525. componentProps: {
  526. placeholder: '成立时间',
  527. },
  528. show: ({ values }) => {
  529. if (values.nature !== 0) {
  530. return true;
  531. }
  532. return false;
  533. },
  534. required: ({ values }) => {
  535. if (values.nature !== 0) {
  536. return true;
  537. }
  538. return false;
  539. },
  540. },
  541. {
  542. field: 'job',
  543. component: 'Input',
  544. label: '行业分类',
  545. labelWidth: adaptWidth.labelWidth,
  546. colProps: {
  547. span: adaptWidth.elContainer,
  548. },
  549. componentProps: {
  550. placeholder: '行业分类',
  551. },
  552. show: ({ values }) => {
  553. if (values.nature !== 0) {
  554. return true;
  555. }
  556. return false;
  557. },
  558. dynamicRules: ({ values }) => {
  559. return [
  560. {
  561. required: true,
  562. validator: async (_, value: any) => {
  563. let dealValue = '';
  564. if (value) {
  565. dealValue = value.replace(/\s*/g, '');
  566. }
  567. if (values.nature && dealValue === '') {
  568. return Promise.reject('请输入行业分类');
  569. }
  570. },
  571. trigger: 'blur',
  572. },
  573. ];
  574. },
  575. required: ({ values }) => {
  576. if (values.nature !== 0) {
  577. return true;
  578. }
  579. return false;
  580. },
  581. },
  582. {
  583. field: 'jobnum',
  584. component: 'Input',
  585. label: '职工人数',
  586. labelWidth: adaptWidth.labelWidth,
  587. colProps: {
  588. span: adaptWidth.elContainer,
  589. },
  590. componentProps: {
  591. type: 'number',
  592. placeholder: '职工人数',
  593. },
  594. },
  595. {
  596. field: 'partynum',
  597. component: 'Input',
  598. label: '党员数',
  599. labelWidth: adaptWidth.labelWidth,
  600. colProps: {
  601. span: adaptWidth.elContainer,
  602. },
  603. componentProps: {
  604. type: 'number',
  605. placeholder: '党员数',
  606. },
  607. },
  608. {
  609. field: 'tel',
  610. component: 'Input',
  611. label: '电话',
  612. labelWidth: adaptWidth.labelWidth,
  613. colProps: {
  614. span: adaptWidth.elContainer,
  615. },
  616. componentProps: {
  617. placeholder: '电话',
  618. },
  619. },
  620. {
  621. field: 'fax',
  622. component: 'Input',
  623. label: '传真',
  624. labelWidth: adaptWidth.labelWidth,
  625. colProps: {
  626. span: adaptWidth.elContainer,
  627. },
  628. componentProps: {
  629. placeholder: '传真',
  630. },
  631. },
  632. {
  633. field: 'zipcode',
  634. component: 'Input',
  635. label: '邮编',
  636. labelWidth: adaptWidth.labelWidth,
  637. colProps: {
  638. span: adaptWidth.elContainer,
  639. },
  640. componentProps: {
  641. placeholder: '邮箱',
  642. },
  643. },
  644. {
  645. field: 'address',
  646. component: 'Input',
  647. label: '地址',
  648. labelWidth: adaptWidth.labelWidth,
  649. colProps: {
  650. span: adaptWidth.elContainer,
  651. },
  652. componentProps: {
  653. placeholder: '地址',
  654. },
  655. required: true,
  656. },
  657. {
  658. field: 'culturalnum',
  659. component: 'Input',
  660. label: '大专以上文化人数',
  661. labelWidth: adaptWidth.labelWidth,
  662. colProps: {
  663. span: adaptWidth.elContainer,
  664. },
  665. componentProps: {
  666. type: 'number',
  667. placeholder: '大专以上文化人数',
  668. },
  669. show: ({ values }) => {
  670. if (values.nature !== 0) {
  671. return true;
  672. }
  673. return false;
  674. },
  675. },
  676. {
  677. field: 'laidnum',
  678. component: 'Input',
  679. label: '安置下岗人数',
  680. labelWidth: adaptWidth.labelWidth,
  681. colProps: {
  682. span: adaptWidth.elContainer,
  683. },
  684. componentProps: {
  685. type: 'number',
  686. placeholder: '安置下岗人数',
  687. },
  688. show: ({ values }) => {
  689. if (values.nature !== 0) {
  690. return true;
  691. }
  692. return false;
  693. },
  694. },
  695. {
  696. field: 'partyCase',
  697. component: 'Input',
  698. label: '党、团工会情况',
  699. labelWidth: adaptWidth.labelWidth,
  700. colProps: {
  701. span: adaptWidth.elContainer,
  702. },
  703. componentProps: {
  704. placeholder: '党、团工会情况',
  705. },
  706. show: ({ values }) => {
  707. if (values.nature !== 0) {
  708. return true;
  709. }
  710. return false;
  711. },
  712. },
  713. {
  714. field: 'web',
  715. component: 'Input',
  716. label: '网址',
  717. labelWidth: adaptWidth.labelWidth,
  718. colProps: {
  719. span: adaptWidth.elContainer,
  720. },
  721. componentProps: {
  722. placeholder: '网址',
  723. },
  724. rules: [
  725. {
  726. validator: async (_, value: any) => {
  727. const regex =
  728. /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;
  729. if (value && !regex.test(value)) {
  730. return Promise.reject('请填写有效的网址');
  731. }
  732. },
  733. trigger: 'blur',
  734. },
  735. ],
  736. },
  737. {
  738. field: 'email',
  739. component: 'Input',
  740. label: '电子邮箱',
  741. labelWidth: adaptWidth.labelWidth,
  742. colProps: {
  743. span: adaptWidth.elContainer,
  744. },
  745. componentProps: {
  746. placeholder: '电子邮箱',
  747. },
  748. show: ({ values }) => {
  749. if (values.nature !== 0) {
  750. return true;
  751. }
  752. return false;
  753. },
  754. },
  755. {
  756. field: 'technology',
  757. label: '高新技术企业认证',
  758. component: 'Switch',
  759. labelWidth: adaptWidth.labelWidth,
  760. colProps: {
  761. span: adaptWidth.elContainer,
  762. },
  763. componentProps: {
  764. placeholder: '高新技术企业认证',
  765. },
  766. show: ({ values }) => {
  767. if (values.nature !== 0) {
  768. return true;
  769. }
  770. return false;
  771. },
  772. },
  773. {
  774. field: 'technologyDept',
  775. component: 'Input',
  776. label: '高新技术企业认证部门',
  777. labelWidth: adaptWidth.labelWidth,
  778. colProps: {
  779. span: adaptWidth.elContainer,
  780. },
  781. show: ({ values }) => {
  782. if (values.technology && values.nature !== 0) {
  783. return true;
  784. }
  785. return false;
  786. },
  787. componentProps: {
  788. placeholder: '高新技术企业认证部门',
  789. },
  790. required: ({ values }) => {
  791. if (values.technology && values.nature !== 0) {
  792. return true;
  793. }
  794. return false;
  795. },
  796. },
  797. {
  798. field: 'foreignTrade',
  799. label: '外贸自营进出口权',
  800. component: 'Switch',
  801. labelWidth: adaptWidth.labelWidth,
  802. colProps: {
  803. span: adaptWidth.elContainer,
  804. },
  805. componentProps: {
  806. placeholder: '外贸自营进出口权',
  807. },
  808. show: ({ values }) => {
  809. if (values.nature !== 0) {
  810. return true;
  811. }
  812. return false;
  813. },
  814. },
  815. {
  816. field: 'foreignTradeDept',
  817. component: 'Input',
  818. label: '外贸自营进出口权批准部门',
  819. labelWidth: adaptWidth.labelWidth,
  820. colProps: {
  821. span: adaptWidth.elContainer,
  822. },
  823. show: ({ values }) => {
  824. if (values.foreignTrade && values.nature !== 0) {
  825. return true;
  826. }
  827. return false;
  828. },
  829. componentProps: {
  830. placeholder: '外贸自营进出口权批准部门',
  831. },
  832. required: ({ values }) => {
  833. if (values.foreignTrade && values.nature !== 0) {
  834. return true;
  835. }
  836. return false;
  837. },
  838. },
  839. {
  840. field: 'quality',
  841. label: '质量管理、质量保证系列认证标准',
  842. component: 'Switch',
  843. labelWidth: adaptWidth.labelWidth,
  844. colProps: {
  845. span: adaptWidth.elContainer,
  846. },
  847. componentProps: {
  848. placeholder: '质量管理、质量保证系列认证标准',
  849. },
  850. show: ({ values }) => {
  851. if (values.nature !== 0) {
  852. return true;
  853. }
  854. return false;
  855. },
  856. },
  857. {
  858. field: 'qualityDept',
  859. component: 'Input',
  860. label: '质量管理、质量保证系列认证标准认证部门',
  861. labelWidth: adaptWidth.labelWidth,
  862. colProps: {
  863. span: adaptWidth.elContainer,
  864. },
  865. show: ({ values }) => {
  866. if (values.quality && values.nature !== 0) {
  867. return true;
  868. }
  869. return false;
  870. },
  871. componentProps: {
  872. placeholder: '质量管理、质量保证系列认证标准认证部门',
  873. },
  874. required: ({ values }) => {
  875. if (values.quality && values.nature !== 0) {
  876. return true;
  877. }
  878. return false;
  879. },
  880. },
  881. {
  882. field: 'regMoney',
  883. component: 'Input',
  884. label: '注册资金(万元)',
  885. labelWidth: adaptWidth.labelWidth,
  886. colProps: {
  887. span: adaptWidth.elContainer,
  888. },
  889. componentProps: {
  890. type: 'number',
  891. placeholder: '注册资金(万元)',
  892. },
  893. show: ({ values }) => {
  894. if (values.nature !== 0) {
  895. return true;
  896. }
  897. return false;
  898. },
  899. dynamicRules: ({ values }) => {
  900. return [
  901. {
  902. required: true,
  903. validator: async (_, value: any) => {
  904. let dealValue = '';
  905. if (value) {
  906. dealValue = value.replace(/\s*/g, '');
  907. }
  908. if (values.nature && dealValue === '') {
  909. return Promise.reject('请输入注册资金');
  910. }
  911. if (values.nature && value < 0) {
  912. return Promise.reject('注册资金不能小于0');
  913. }
  914. },
  915. trigger: 'blur',
  916. },
  917. ];
  918. },
  919. required: ({ values }) => {
  920. if (values.nature !== 0) {
  921. return true;
  922. }
  923. return false;
  924. },
  925. },
  926. {
  927. field: 'money',
  928. component: 'Input',
  929. label: '资产(万元)',
  930. labelWidth: adaptWidth.labelWidth,
  931. colProps: {
  932. span: adaptWidth.elContainer,
  933. },
  934. componentProps: {
  935. type: 'number',
  936. placeholder: '资产(万元)',
  937. },
  938. show: ({ values }) => {
  939. if (values.nature !== 0) {
  940. return true;
  941. }
  942. return false;
  943. },
  944. },
  945. {
  946. field: 'ownerMoney',
  947. component: 'Input',
  948. label: '所有者权益(万元)',
  949. labelWidth: adaptWidth.labelWidth,
  950. colProps: {
  951. span: adaptWidth.elContainer,
  952. },
  953. componentProps: {
  954. type: 'number',
  955. placeholder: '所有者权益(万元)',
  956. },
  957. show: ({ values }) => {
  958. if (values.nature !== 0) {
  959. return true;
  960. }
  961. return false;
  962. },
  963. },
  964. {
  965. field: 'sellMoney',
  966. component: 'Input',
  967. label: '销售收入(万元)',
  968. labelWidth: adaptWidth.labelWidth,
  969. colProps: {
  970. span: adaptWidth.elContainer,
  971. },
  972. componentProps: {
  973. type: 'number',
  974. placeholder: '销售收入(万元)',
  975. },
  976. show: ({ values }) => {
  977. if (values.nature !== 0) {
  978. return true;
  979. }
  980. return false;
  981. },
  982. },
  983. {
  984. field: 'product',
  985. component: 'InputTextArea',
  986. label: '主要经营项目',
  987. labelWidth: adaptWidth.labelWidth,
  988. colProps: {
  989. span: adaptWidth.elContainer,
  990. },
  991. componentProps: {
  992. placeholder: '主要经营项目',
  993. },
  994. show: ({ values }) => {
  995. if (values.nature !== 0) {
  996. return true;
  997. }
  998. return false;
  999. },
  1000. dynamicRules: ({ values }) => {
  1001. return [
  1002. {
  1003. required: true,
  1004. validator: async (_, value: any) => {
  1005. let dealValue = '';
  1006. if (value) {
  1007. dealValue = value.replace(/\s*/g, '');
  1008. }
  1009. if (values.nature && dealValue === '') {
  1010. return Promise.reject('请输入主要经营项目');
  1011. }
  1012. },
  1013. trigger: 'blur',
  1014. },
  1015. ];
  1016. },
  1017. required: ({ values }) => {
  1018. if (values.nature !== 0) {
  1019. return true;
  1020. }
  1021. return false;
  1022. },
  1023. },
  1024. ];