forms.ts 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  1. import VillageInfoApi, { CommonInfoModel, VillageBulidingInfo, VillageEnvInfo } from "@/api/inhert/VillageInfoApi";
  2. import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo";
  3. import type { IDynamicFormOptions, IDynamicFormItem, IDynamicFormRef, IDynamicFormItemCallbackAdditionalProps } from "@/components/dynamic";
  4. import type { CheckBoxListProps } from "@/components/dynamic/wrappers/CheckBoxList.vue";
  5. import type { CheckBoxToIntProps } from "@/components/dynamic/wrappers/CheckBoxToInt";
  6. import type { PickerIdFieldProps } from "@/components/dynamic/wrappers/PickerIdField";
  7. import type { RadioIdFieldProps } from "@/components/dynamic/wrappers/RadioIdField";
  8. import type { FieldProps } from "@/components/form/Field.vue";
  9. import type { PickerFieldProps } from "@/components/form/PickerField.vue";
  10. import type { StepperProps } from "@/components/form/Stepper.vue";
  11. import type { UploaderInstance } from "@/components/form/Uploader.vue";
  12. import type { UploaderFieldInstance, UploaderFieldProps } from "@/components/form/UploaderField.vue";
  13. import type { RowProps } from "@/components/layout/grid/Row.vue";
  14. import type { NewDataModel } from "@imengyu/js-request-transform";
  15. import type { Ref } from "vue";
  16. import { villageCommonContent } from "./data/common";
  17. import { villageInfoBuildingForm } from "./data/building";
  18. import { villageInfoCulture, villageInfoFolkCultureForm } from "./data/cultural";
  19. import { villageInfoFoodProductsForm } from "./data/food";
  20. import { villageInfoOverviewForm } from "./data/overview";
  21. import { ichFormItems } from "./data/ich";
  22. import { villageInfoEnvironmentForm } from "./data/environment";
  23. export type SingleForm = [NewDataModel, (formRef: Ref<IDynamicFormRef>) => IDynamicFormOptions]
  24. export type GroupForm = Record<number, SingleForm>
  25. //TODO: 关联的文化资源ID
  26. const villageInfoForm : Record<string, GroupForm> = {
  27. 'overview': villageInfoOverviewForm,
  28. 'cultural': villageInfoCulture,
  29. 'story': {
  30. [0]: [CommonInfoModel, () => ({
  31. formItems: [
  32. {
  33. label: '标题',
  34. name: 'title',
  35. type: 'text',
  36. defaultValue: '',
  37. additionalProps: {
  38. placeholder: '请输入标题',
  39. },
  40. rules: [{
  41. required: true,
  42. message: '请输入标题',
  43. }]
  44. },
  45. {
  46. label: '简介',
  47. name: 'intro',
  48. type: 'richtext',
  49. defaultValue: '',
  50. additionalProps: {
  51. placeholder: '请输入内容',
  52. },
  53. rules: [{
  54. required: true,
  55. message: '请输入内容',
  56. }]
  57. },
  58. {
  59. label: '内容',
  60. name: 'content',
  61. type: 'richtext',
  62. defaultValue: '',
  63. additionalProps: {
  64. placeholder: '请输入内容',
  65. },
  66. rules: [{
  67. required: true,
  68. message: '请输入内容',
  69. }]
  70. }
  71. ]
  72. })],
  73. },
  74. 'figure': {
  75. [0]: [CommonInfoModel, () => ({
  76. formItems: [
  77. {
  78. label: '标题',
  79. name: 'name',
  80. type: 'text',
  81. defaultValue: '',
  82. additionalProps: {
  83. placeholder: '请输入标题',
  84. },
  85. rules: [{
  86. required: true,
  87. message: '请输入标题',
  88. }]
  89. },
  90. {
  91. label: '简介',
  92. name: 'brief',
  93. type: 'richtext',
  94. defaultValue: '',
  95. additionalProps: {
  96. placeholder: '请输入简介',
  97. maxLength: 500,
  98. showWordLimit: true,
  99. } as FieldProps,
  100. rules: [{
  101. required: true,
  102. message: '请输入简介',
  103. }]
  104. },
  105. {
  106. label: '内容',
  107. name: 'intro',
  108. type: 'richtext',
  109. defaultValue: '',
  110. additionalProps: {
  111. placeholder: '请输入内容',
  112. },
  113. rules: [{
  114. required: true,
  115. message: '请输入内容',
  116. }]
  117. }
  118. ]
  119. })],
  120. },
  121. 'element': {
  122. [0]: [CommonInfoModel, () => ({
  123. formItems: [
  124. {
  125. label: '名称',
  126. name: 'name',
  127. type: 'text',
  128. defaultValue: '',
  129. additionalProps: {
  130. placeholder: '请输入名称',
  131. },
  132. rules: [{
  133. required: true,
  134. message: '请输入名称',
  135. }]
  136. },
  137. {
  138. label: '位置',
  139. name: 'position',
  140. type: 'text',
  141. defaultValue: '',
  142. additionalProps: {
  143. placeholder: '请输入位置',
  144. },
  145. rules: [{
  146. required: true,
  147. message: '请输入位置',
  148. }]
  149. },
  150. {
  151. label: '年代',
  152. name: 'age',
  153. type: 'select-id',
  154. additionalProps: {
  155. loadData: async () =>
  156. (await VillageInfoApi.getCategoryChildList(103))
  157. .map((p) => ({
  158. value: p.id,
  159. text: p.title,
  160. }))
  161. ,
  162. } as PickerIdFieldProps,
  163. formProps: { showRightArrow: true } as FieldProps,
  164. rules: [{
  165. required: true,
  166. message: '请选择年代',
  167. }],
  168. },
  169. {
  170. label: '要素类型',
  171. name: 'elementType',
  172. type: 'select-id',
  173. additionalProps: {
  174. loadData: async () =>
  175. (await VillageInfoApi.getCategoryChildList(178))
  176. .map((p) => ({
  177. value: p.id,
  178. text: p.title,
  179. }))
  180. ,
  181. } as PickerIdFieldProps,
  182. formProps: { showRightArrow: true } as FieldProps,
  183. rules: [{
  184. required: true,
  185. message: '请选择 要素类型',
  186. }],
  187. },
  188. {
  189. label: '编号',
  190. name: 'code',
  191. type: 'text',
  192. defaultValue: '',
  193. additionalProps: {
  194. placeholder: '(可选)请输入编号',
  195. },
  196. },
  197. {
  198. label: '环境特点',
  199. name: 'environment',
  200. type: 'richtext',
  201. defaultValue: '',
  202. additionalProps: {
  203. placeholder: '请输入环境特点',
  204. maxLength: 500,
  205. showWordLimit: true,
  206. } as FieldProps,
  207. rules: [{
  208. required: true,
  209. message: '请输入环境特点',
  210. }]
  211. },
  212. {
  213. label: '文化故事',
  214. name: 'story',
  215. type: 'richtext',
  216. defaultValue: '',
  217. additionalProps: {
  218. placeholder: '请输入文化故事',
  219. maxLength: 1000,
  220. showWordLimit: true,
  221. } as FieldProps,
  222. rules: [{
  223. required: true,
  224. message: '请输入文化故事',
  225. }]
  226. },
  227. {
  228. label: '保存状况',
  229. name: 'condition',
  230. type: 'richtext',
  231. defaultValue: '',
  232. additionalProps: {
  233. placeholder: '请输入保存状况',
  234. maxLength: 500,
  235. showWordLimit: true,
  236. } as FieldProps,
  237. rules: [{
  238. required: true,
  239. message: '请输入保存状况',
  240. }]
  241. },
  242. {
  243. label: '功能特点',
  244. name: 'funcFeatures',
  245. type: 'richtext',
  246. defaultValue: '',
  247. additionalProps: {
  248. placeholder: '请输入功能特点',
  249. maxLength: 300,
  250. showWordLimit: true,
  251. } as FieldProps,
  252. rules: [{
  253. required: true,
  254. message: '请输入功能特点',
  255. }]
  256. },
  257. ]
  258. })]
  259. },
  260. 'environment': {
  261. [0]: villageInfoEnvironmentForm
  262. },
  263. 'building': {
  264. [1]: villageInfoBuildingForm,
  265. [2]: villageInfoBuildingForm,
  266. [3]: villageInfoBuildingForm,
  267. },
  268. 'distribution': {
  269. [0]: [CommonInfoModel, () => ({
  270. formItems: [
  271. {
  272. label: '建筑数量',
  273. name: 'num',
  274. type: 'number',
  275. defaultValue: '',
  276. additionalProps: {
  277. min: 0,
  278. max: 100,
  279. },
  280. rules: [{
  281. required: true,
  282. message: '请输入建筑数量',
  283. }]
  284. },
  285. {
  286. label: '分布图',
  287. name: 'distribution',
  288. type: 'uploader',
  289. defaultValue: '',
  290. additionalProps: {
  291. upload: useAliOssUploadCo('xiangyuan/distribution'),
  292. maxFileSize: 1024 * 1024 * 20,
  293. single: true,
  294. } as UploaderFieldProps,
  295. rules: [{
  296. required: true,
  297. message: '请上传分布图',
  298. }]
  299. },
  300. {
  301. label: '营造智慧',
  302. name: 'wisdom',
  303. type: 'richtext',
  304. defaultValue: '',
  305. additionalProps: {
  306. placeholder: '请输入营造智慧',
  307. maxLength: 200,
  308. showWordLimit: true,
  309. },
  310. rules: [{
  311. required: true,
  312. message: '请输入营造智慧',
  313. }]
  314. },
  315. ]
  316. })],
  317. },
  318. 'relic': {
  319. [0]: [CommonInfoModel, () => ({
  320. formItems: [
  321. {
  322. label: '建筑名称',
  323. name: 'name',
  324. type: 'text',
  325. defaultValue: '',
  326. additionalProps: {
  327. placeholder: '请输入建筑名称',
  328. },
  329. rules: [{
  330. required: true,
  331. message: '请输入建筑名称',
  332. }]
  333. },
  334. {
  335. label: '文物编码',
  336. name: 'code',
  337. type: 'text',
  338. defaultValue: '',
  339. additionalProps: {
  340. placeholder: '请输入文物编码',
  341. },
  342. rules: [{
  343. required: true,
  344. message: '请输入文物编码',
  345. }]
  346. },
  347. {
  348. label: '年代',
  349. name: 'age',
  350. type: 'select-id',
  351. additionalProps: {
  352. loadData: async () =>
  353. (await VillageInfoApi.getCategoryChildList(103))
  354. .map((p) => ({
  355. value: p.id,
  356. text: p.title,
  357. }))
  358. ,
  359. } as PickerIdFieldProps,
  360. formProps: { showRightArrow: true } as FieldProps,
  361. rules: [{
  362. required: true,
  363. message: '请选择年代',
  364. }],
  365. },
  366. {
  367. label: '简介',
  368. name: 'intro',
  369. type: 'richtext',
  370. defaultValue: '',
  371. additionalProps: {},
  372. rules: [{
  373. required: true,
  374. message: '请输入简介',
  375. }]
  376. },
  377. {
  378. label: '描述',
  379. name: 'description',
  380. type: 'richtext',
  381. defaultValue: '',
  382. additionalProps: {},
  383. rules: [{
  384. required: true,
  385. message: '请输入描述',
  386. }]
  387. },
  388. {
  389. label: '保护级别',
  390. name: 'level',
  391. type: 'select-id',
  392. additionalProps: {
  393. loadData: async () =>
  394. (await VillageInfoApi.getCategoryChildList(158))
  395. .map((p) => ({
  396. value: p.id,
  397. text: p.title,
  398. }))
  399. ,
  400. } as PickerIdFieldProps,
  401. formProps: { showRightArrow: true } as FieldProps,
  402. rules: [{
  403. required: true,
  404. message: '请选择保护级别',
  405. }],
  406. },
  407. {
  408. label: '文物类型',
  409. name: 'crType',
  410. type: 'select-id',
  411. additionalProps: {
  412. loadData: async () =>
  413. (await VillageInfoApi.getCategoryChildList(3))
  414. .map((p) => ({
  415. value: p.id,
  416. text: p.title,
  417. }))
  418. ,
  419. } as PickerIdFieldProps,
  420. formProps: { showRightArrow: true } as FieldProps,
  421. rules: [{
  422. required: true,
  423. message: '请选择文物类型',
  424. }],
  425. },
  426. {
  427. label: '经纬度',
  428. name: 'lonlat',
  429. type: 'select-lonlat',
  430. defaultValue: '',
  431. additionalProps: {},
  432. formProps: { showRightArrow: true } as FieldProps,
  433. rules: [{
  434. required: true,
  435. message: '请输入经纬度',
  436. }]
  437. },
  438. {
  439. name: '',
  440. label: '平面坐标XY',
  441. type: 'flat-simple',
  442. children: [
  443. {
  444. label: '',
  445. name: 'mapX',
  446. type: 'number',
  447. defaultValue: 0,
  448. additionalProps: {
  449. min: -250,
  450. max: 250,
  451. } as StepperProps,
  452. formProps: {
  453. labelWidth: '0rpx',
  454. labelPosition: 'left',
  455. showBottomBorder: false,
  456. },
  457. rules: [{
  458. required: true,
  459. message: '请输入X',
  460. }]
  461. },
  462. {
  463. label: '',
  464. name: 'mapY',
  465. type: 'number',
  466. defaultValue: 0,
  467. additionalProps: {
  468. min: -250,
  469. max: 250,
  470. } as StepperProps,
  471. formProps: {
  472. labelWidth: '0rpx',
  473. labelPosition: 'left',
  474. showBottomBorder: false,
  475. },
  476. rules: [{
  477. required: true,
  478. message: '请输入Y',
  479. }]
  480. },
  481. ]
  482. },
  483. {
  484. label: '地址',
  485. name: 'address',
  486. type: 'text',
  487. defaultValue: '',
  488. additionalProps: {
  489. placeholder: '请输入地址',
  490. },
  491. rules: [{
  492. required: true,
  493. message: '请输入地址',
  494. }]
  495. },
  496. {
  497. label: '图片',
  498. name: 'images',
  499. type: 'uploader',
  500. defaultValue: '',
  501. additionalProps: {
  502. upload: useAliOssUploadCo('xiangyuan/relic'),
  503. maxFileSize: 1024 * 1024 * 20,
  504. maxUploadCount: 20,
  505. } as UploaderFieldProps,
  506. rules: []
  507. },
  508. {
  509. label: '文化故事',
  510. name: 'content',
  511. type: 'richtext',
  512. defaultValue: '',
  513. additionalProps: {
  514. placeholder: '文化故事',
  515. maxLength: 5000,
  516. showWordLimit: true,
  517. } as FieldProps,
  518. rules: []
  519. },
  520. {
  521. label: '方位',
  522. name: 'orientation',
  523. type: 'text',
  524. defaultValue: '',
  525. additionalProps: { placeholder: '方位' },
  526. rules: []
  527. },
  528. {
  529. label: '相对距离',
  530. name: 'distance',
  531. type: 'text',
  532. defaultValue: '',
  533. additionalProps: { placeholder: '相对距离' },
  534. rules: []
  535. },
  536. ]
  537. })],
  538. },
  539. 'folk_culture': {
  540. [1]: villageInfoFolkCultureForm('节庆活动'),
  541. [2]: villageInfoFolkCultureForm('祭祀崇礼'),
  542. [3]: villageInfoFolkCultureForm('婚丧嫁娶'),
  543. [4]: villageInfoFolkCultureForm('地方方言'),
  544. [5]: villageInfoFolkCultureForm('特色文化'),
  545. },
  546. 'ich': {
  547. [0]: ichFormItems,
  548. },
  549. 'travel_guide': {
  550. [0]: [CommonInfoModel, () => ({
  551. formItems: [
  552. {
  553. label: '入村路线',
  554. name: 'villageRoute',
  555. type: 'text',
  556. defaultValue: '',
  557. additionalProps: {
  558. placeholder: '请输入入村路线',
  559. },
  560. rules: [{
  561. required: true,
  562. message: '请输入入村路线',
  563. }]
  564. },
  565. {
  566. label: '距离县城(KM)',
  567. name: 'county',
  568. type: 'number',
  569. defaultValue: '',
  570. additionalProps: { min: 0 },
  571. rules: [{
  572. required: true,
  573. message: '请输入距离县城',
  574. }]
  575. },
  576. {
  577. label: '距离镇区中心(KM)',
  578. name: 'town',
  579. type: 'number',
  580. defaultValue: '',
  581. additionalProps: { min: 0 },
  582. rules: [{
  583. required: true,
  584. message: '请输入距离镇区中心',
  585. }]
  586. },
  587. {
  588. label: '距离市中心(KM)',
  589. name: 'city',
  590. type: 'number',
  591. defaultValue: '',
  592. additionalProps: { min: 0 },
  593. rules: [{
  594. required: true,
  595. message: '请输入距离市中心',
  596. }]
  597. },
  598. {
  599. label: '最近高速收费站名称',
  600. name: 'tollStationName',
  601. type: 'text',
  602. defaultValue: '',
  603. additionalProps: {
  604. placeholder: '请输入最近高速收费站名称',
  605. },
  606. rules: [{
  607. required: true,
  608. message: '请输入最近高速收费站名称',
  609. }]
  610. },
  611. //有无公交车
  612. {
  613. label: '有无公交车',
  614. name: 'isBus',
  615. type: 'check-box-int',
  616. defaultValue: 0,
  617. additionalProps: {
  618. text: '有',
  619. },
  620. rules: [{
  621. required: true,
  622. message: '请选择有无公交车',
  623. }]
  624. },
  625. {
  626. label: '公交车介绍',
  627. name: 'busIntro',
  628. type: 'text',
  629. show: { callback: (_, rawModel) => (rawModel.isBus === 1) },
  630. defaultValue: '',
  631. additionalProps: {
  632. placeholder: '请输入公交车介绍',
  633. },
  634. rules: []
  635. },
  636. {
  637. label: '最近高速收费站名称',
  638. name: 'tollStation',
  639. type: 'text',
  640. defaultValue: '',
  641. additionalProps: {
  642. placeholder: '请输入最近高速收费站名称',
  643. },
  644. rules: []
  645. },
  646. {
  647. label: '距离最近火车站',
  648. name: 'trainStation',
  649. type: 'text',
  650. defaultValue: '',
  651. additionalProps: {
  652. placeholder: '请输入距离最近火车站',
  653. },
  654. rules: []
  655. },
  656. {
  657. label: '其他交通方式',
  658. name: 'otherBus',
  659. type: 'text',
  660. defaultValue: '',
  661. additionalProps: {
  662. placeholder: '请输入其他交通方式',
  663. },
  664. rules: []
  665. },
  666. {
  667. label: '景区全景图',
  668. name: 'panorama',
  669. type: 'uploader',
  670. defaultValue: '',
  671. additionalProps: {
  672. upload: useAliOssUploadCo('xiangyuan/travel/panorama'),
  673. maxFileSize: 1024 * 1024 * 20,
  674. single: true,
  675. } as UploaderFieldProps,
  676. rules: []
  677. },
  678. {
  679. label: '其他图',
  680. name: 'otherImage',
  681. type: 'uploader',
  682. defaultValue: '',
  683. additionalProps: {
  684. upload: useAliOssUploadCo('xiangyuan/travel/guide'),
  685. maxFileSize: 1024 * 1024 * 20,
  686. single: true,
  687. } as UploaderFieldProps,
  688. rules: []
  689. },
  690. //解说牌
  691. {
  692. label: '有无解说牌',
  693. name: 'introBoard',
  694. type: 'check-box-int',
  695. defaultValue: 0,
  696. additionalProps: {
  697. text: '有',
  698. },
  699. rules: [{
  700. required: true,
  701. message: '请选择有无解说牌',
  702. }]
  703. },
  704. {
  705. label: '其他解说牌',
  706. name: 'otherIntroBoard',
  707. type: 'text',
  708. defaultValue: '',
  709. additionalProps: {
  710. placeholder: '请输入其他解说牌',
  711. },
  712. rules: []
  713. },
  714. {
  715. label: '有无解指示牌',
  716. name: 'indicateBoard',
  717. type: 'check-box-int',
  718. defaultValue: 0,
  719. additionalProps: {
  720. text: '有',
  721. },
  722. rules: [{
  723. required: true,
  724. message: '请选择有无指示牌',
  725. }]
  726. },
  727. {
  728. label: '其他指示牌',
  729. name: 'otherIndicateBoard',
  730. type: 'text',
  731. defaultValue: '',
  732. additionalProps: {
  733. placeholder: '请输入其他指示牌',
  734. },
  735. rules: []
  736. },
  737. {
  738. label: '有无安全告示牌',
  739. name: 'safeBoard',
  740. type: 'check-box-int',
  741. defaultValue: 0,
  742. additionalProps: {
  743. text: '有',
  744. },
  745. rules: [{
  746. required: true,
  747. message: '请选择有无安全告示牌',
  748. }]
  749. },
  750. {
  751. label: '其他指示牌',
  752. name: 'otherSafeBoard',
  753. type: 'text',
  754. defaultValue: '',
  755. additionalProps: {
  756. placeholder: '请输入其他安全告示牌',
  757. },
  758. rules: []
  759. },
  760. {
  761. label: '有无游客服务中心',
  762. name: 'visitorCenter',
  763. type: 'check-box-int',
  764. defaultValue: 0,
  765. additionalProps: {
  766. text: '有',
  767. },
  768. rules: [{
  769. required: true,
  770. message: '请选择有有无游客服务中心',
  771. }]
  772. },
  773. {
  774. label: '游客服务中心面积',
  775. name: 'visitorCenterArea',
  776. type: 'text',
  777. defaultValue: '',
  778. additionalProps: {
  779. placeholder: '请输入游客服务中心面积',
  780. },
  781. rules: []
  782. },
  783. {
  784. label: '商业设施',
  785. name: 'business',
  786. type: 'select-id',
  787. additionalProps: {
  788. loadData: async () =>
  789. (await VillageInfoApi.getCategoryChildList(282))
  790. .map((p) => ({
  791. value: p.id,
  792. text: p.title,
  793. }))
  794. ,
  795. } as PickerIdFieldProps,
  796. formProps: { showRightArrow: true } as FieldProps,
  797. rules: [{
  798. required: true,
  799. message: '请选择商业设施',
  800. }],
  801. },
  802. {
  803. label: '其他商业设施',
  804. name: 'otherBusiness',
  805. type: 'text',
  806. defaultValue: '',
  807. additionalProps: {
  808. placeholder: '请输入其他商业设施',
  809. },
  810. rules: []
  811. },
  812. //医疗点
  813. {
  814. label: '有无医疗点',
  815. name: 'medicalPoint',
  816. type: 'select',
  817. defaultValue: 0,
  818. additionalProps: {
  819. columns: [[
  820. { value: 0, text: '无' },
  821. { value: 1, text: '有' },
  822. { value: 2, text: '其他' }
  823. ]],
  824. singleValue: true,
  825. } as PickerFieldProps,
  826. formProps: {
  827. showRightArrow: true,
  828. },
  829. rules: [{
  830. required: true,
  831. message: '请选择有无医疗点',
  832. }]
  833. },
  834. {
  835. label: '其他医疗点',
  836. name: 'otherMedicalPoint',
  837. type: 'text',
  838. show: { callback: (_, rawModel) => (rawModel.medicalPoint === 2) },
  839. defaultValue: '',
  840. additionalProps: {
  841. placeholder: '请输入其他医疗点',
  842. },
  843. rules: []
  844. },
  845. //医疗点
  846. {
  847. label: '有无游览车',
  848. name: 'tourBus',
  849. type: 'select',
  850. defaultValue: 0,
  851. additionalProps: {
  852. columns: [[
  853. { value: 0, text: '无' },
  854. { value: 1, text: '有' },
  855. { value: 2, text: '其他' }
  856. ]],
  857. singleValue: true,
  858. } as PickerFieldProps,
  859. formProps: {
  860. showRightArrow: true,
  861. },
  862. rules: [{
  863. required: true,
  864. message: '请选择有无游览车',
  865. }]
  866. },
  867. {
  868. label: '其他游览车',
  869. name: 'otherTourBus',
  870. type: 'text',
  871. show: { callback: (_, rawModel) => (rawModel.tourBus === 2) },
  872. defaultValue: '',
  873. additionalProps: {
  874. placeholder: '请输入其他游览车',
  875. },
  876. rules: []
  877. },
  878. //
  879. {
  880. label: '机动车停车场(单位:辆)',
  881. name: 'parkingLot',
  882. type: 'number',
  883. defaultValue: 0,
  884. additionalProps: { min: 0 },
  885. rules: []
  886. },
  887. {
  888. label: '分类垃圾点(单位:处)',
  889. name: 'garbagePoint',
  890. type: 'number',
  891. defaultValue: 0,
  892. additionalProps: { min: 0 },
  893. rules: []
  894. },
  895. {
  896. label: '公共卫生间(单位:处)',
  897. name: 'publicToilets',
  898. type: 'number',
  899. defaultValue: 0,
  900. additionalProps: { min: 0 },
  901. rules: []
  902. },
  903. ]
  904. })],
  905. },
  906. 'route': {
  907. [1]: [CommonInfoModel, () => ({
  908. formItems: [
  909. {
  910. label: '游览路线',
  911. name: 'route',
  912. type: 'text',
  913. defaultValue: '',
  914. additionalProps: {
  915. placeholder: '请输入游览路线',
  916. },
  917. rules: [{
  918. required: true,
  919. message: '请输入游览路线',
  920. }]
  921. },
  922. {
  923. label: '路线名称',
  924. name: 'name',
  925. type: 'text',
  926. defaultValue: '',
  927. additionalProps: {
  928. placeholder: '请输入路线名称',
  929. },
  930. rules: [{
  931. required: true,
  932. message: '请输入路线名称',
  933. }]
  934. },
  935. {
  936. label: '描述',
  937. name: 'desc',
  938. type: 'richtext',
  939. defaultValue: '',
  940. additionalProps: {
  941. placeholder: '请输入描述',
  942. maxLength: 200,
  943. showWordLimit: true,
  944. },
  945. rules: [{
  946. required: true,
  947. message: '请输入描述',
  948. }]
  949. },
  950. {
  951. label: '起始点',
  952. name: 'startPoint',
  953. type: 'text',
  954. defaultValue: '',
  955. additionalProps: {
  956. placeholder: '请输入起始点',
  957. },
  958. rules: [{
  959. required: true,
  960. message: '请输入起始点',
  961. }]
  962. },
  963. {
  964. label: '终止点',
  965. name: 'endPoint',
  966. type: 'text',
  967. defaultValue: '',
  968. additionalProps: {
  969. placeholder: '请输入终止点',
  970. },
  971. rules: [{
  972. required: true,
  973. message: '请输入终止点',
  974. }]
  975. },
  976. {
  977. label: '预计时长(小时)',
  978. name: 'estimate',
  979. type: 'number',
  980. defaultValue: 1,
  981. additionalProps: {
  982. min: 1,
  983. },
  984. rules: [{
  985. required: true,
  986. message: '请输入预计时长',
  987. }]
  988. },
  989. ]
  990. })],
  991. [2]: [CommonInfoModel, () => ({
  992. formItems: [
  993. {
  994. label: '活动标题',
  995. name: 'activity',
  996. type: 'text',
  997. defaultValue: '',
  998. additionalProps: {
  999. placeholder: '请输入活动标题',
  1000. },
  1001. rules: [{
  1002. required: true,
  1003. message: '请输入活动标题',
  1004. }]
  1005. },
  1006. {
  1007. label: '活动开始时间',
  1008. name: 'startTime',
  1009. type: 'datetime',
  1010. defaultValue: '',
  1011. additionalProps: {
  1012. type: 'datetime',
  1013. },
  1014. rules: [{
  1015. required: true,
  1016. message: '请选择活动开始时间',
  1017. }],
  1018. },
  1019. {
  1020. label: '活动结束时间',
  1021. name: 'endTime',
  1022. type: 'datetime',
  1023. defaultValue: '',
  1024. additionalProps: {
  1025. type: 'datetime',
  1026. },
  1027. rules: [{
  1028. required: true,
  1029. message: '请选择活动结束时间',
  1030. }],
  1031. },
  1032. {
  1033. label: '活动时长(分钟)',
  1034. name: 'duration',
  1035. type: 'number',
  1036. defaultValue: 0,
  1037. additionalProps: {
  1038. min: 0,
  1039. },
  1040. rules: [{
  1041. required: true,
  1042. message: '请选择活动时长',
  1043. }],
  1044. },
  1045. ]
  1046. })],
  1047. [3]: [CommonInfoModel, () => ({
  1048. formItems: [
  1049. {
  1050. label: '特色',
  1051. name: 'advant',
  1052. type: 'richtext',
  1053. defaultValue: '',
  1054. additionalProps: {
  1055. placeholder: '请输入特色',
  1056. maxLength: 300,
  1057. showWordLimit: true,
  1058. } as FieldProps,
  1059. rules: [{
  1060. required: true,
  1061. message: '请输入特色',
  1062. }]
  1063. },
  1064. {
  1065. label: '文化背景',
  1066. name: 'intro',
  1067. type: 'richtext',
  1068. defaultValue: '',
  1069. additionalProps: {
  1070. placeholder: '请输入文化背景',
  1071. maxLength: 300,
  1072. showWordLimit: true,
  1073. } as FieldProps,
  1074. rules: [{
  1075. required: true,
  1076. message: '请输入文化背景',
  1077. }]
  1078. },
  1079. {
  1080. label: '精彩推荐',
  1081. name: 'recommend',
  1082. type: 'richtext',
  1083. defaultValue: '',
  1084. additionalProps: {
  1085. placeholder: '请输入精彩推荐',
  1086. maxLength: 300,
  1087. showWordLimit: true,
  1088. } as FieldProps,
  1089. rules: [{
  1090. required: true,
  1091. message: '请输入精彩推荐',
  1092. }]
  1093. },
  1094. {
  1095. label: '推荐描述',
  1096. name: 'reason',
  1097. type: 'richtext',
  1098. defaultValue: '',
  1099. additionalProps: {
  1100. placeholder: '请输入推荐描述',
  1101. maxLength: 300,
  1102. showWordLimit: true,
  1103. } as FieldProps,
  1104. rules: [{
  1105. required: true,
  1106. message: '请输入推荐描述',
  1107. }]
  1108. },
  1109. {
  1110. label: '活动亮点',
  1111. name: 'highlight',
  1112. type: 'richtext',
  1113. defaultValue: '',
  1114. additionalProps: {
  1115. placeholder: '请输入活动亮点',
  1116. maxLength: 300,
  1117. showWordLimit: true,
  1118. } as FieldProps,
  1119. rules: [{
  1120. required: true,
  1121. message: '请输入活动亮点',
  1122. }]
  1123. },
  1124. {
  1125. label: '图片视频',
  1126. name: 'images',
  1127. type: 'uploader',
  1128. defaultValue: '',
  1129. additionalProps: {
  1130. upload: useAliOssUploadCo('xiangyuan/activity'),
  1131. maxFileSize: 1024 * 1024 * 20,
  1132. maxUploadCount: 20,
  1133. } as UploaderFieldProps,
  1134. rules: []
  1135. },
  1136. ]
  1137. })]
  1138. },
  1139. 'food_product': {
  1140. [1]: villageInfoFoodProductsForm,
  1141. [2]: villageInfoFoodProductsForm,
  1142. [3]: villageInfoFoodProductsForm,
  1143. [4]: villageInfoFoodProductsForm,
  1144. [5]: villageInfoFoodProductsForm,
  1145. [6]: villageInfoFoodProductsForm,
  1146. },
  1147. 'collect': {
  1148. [1]: [CommonInfoModel, () => ({
  1149. formItems: [
  1150. {
  1151. label: '标题',
  1152. name: 'name',
  1153. type: 'text',
  1154. defaultValue: '',
  1155. additionalProps: {
  1156. placeholder: '请输入标题',
  1157. } as FieldProps,
  1158. rules: [{
  1159. required: true,
  1160. message: '请输入标题',
  1161. }]
  1162. },
  1163. {
  1164. label: '组图',
  1165. name: 'images',
  1166. type: 'uploader',
  1167. defaultValue: '',
  1168. additionalProps: {
  1169. upload: useAliOssUploadCo('xiangyuan/note'),
  1170. maxFileSize: 1024 * 1024 * 10,
  1171. maxUploadCount: 10,
  1172. } as UploaderFieldProps,
  1173. rules: []
  1174. },
  1175. {
  1176. label: '视频',
  1177. name: 'video',
  1178. type: 'uploader',
  1179. defaultValue: '',
  1180. additionalProps: {
  1181. upload: useAliOssUploadCo('xiangyuan/note'),
  1182. maxFileSize: 1024 * 1024 * 100,
  1183. maxUploadCount: 1,
  1184. } as UploaderFieldProps,
  1185. rules: []
  1186. },
  1187. {
  1188. label: '关键字',
  1189. name: 'keywords',
  1190. type: 'text',
  1191. defaultValue: '',
  1192. additionalProps: {
  1193. placeholder: '请输入关键字,多个关键字用逗号分隔',
  1194. } as FieldProps,
  1195. rules: []
  1196. },
  1197. {
  1198. label: '描述',
  1199. name: 'desc',
  1200. type: 'richtext',
  1201. defaultValue: '',
  1202. additionalProps: {
  1203. placeholder: '请输入描述',
  1204. maxLength: 200,
  1205. showWordLimit: true,
  1206. } as FieldProps,
  1207. rules: []
  1208. },
  1209. {
  1210. label: '内容',
  1211. name: 'content',
  1212. type: 'richtext',
  1213. defaultValue: '',
  1214. additionalProps: {
  1215. placeholder: '请输入内容',
  1216. maxLength: 2000,
  1217. showWordLimit: true,
  1218. } as FieldProps,
  1219. rules: []
  1220. }
  1221. ]
  1222. })]
  1223. },
  1224. }
  1225. export function getVillageInfoForm(subType: string, subId: number) {
  1226. const group = villageInfoForm[subType];
  1227. if (!group)
  1228. throw new Error('subType ' + subType + ' not found');
  1229. return group[subId];
  1230. }