relic.ts 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. import VillageInfoApi, { CommonInfoModel } from "@/api/inhert/VillageInfoApi";
  2. import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo";
  3. import type { PickerIdFieldProps } from "@/components/dynamic/wrappers/PickerIdField";
  4. import type { FieldProps } from "@/components/form/Field.vue";
  5. import type { StepperProps } from "@/components/form/Stepper.vue";
  6. import type { UploaderFieldProps } from "@/components/form/UploaderField.vue";
  7. import type { SingleForm } from "../forms";
  8. import { villageCommonContent } from "./common";
  9. export const villageInfoRelicForm : SingleForm = [CommonInfoModel, (r) => ({
  10. formItems: [
  11. {
  12. label: '基础信息',
  13. name: 'baseInfo',
  14. type: 'flat-group',
  15. childrenColProps: { span: 24 },
  16. children: [
  17. {
  18. label: '建筑名称',
  19. name: 'name',
  20. type: 'text',
  21. defaultValue: '',
  22. additionalProps: {
  23. placeholder: '请输入建筑名称',
  24. },
  25. rules: [{
  26. required: true,
  27. message: '请输入建筑名称',
  28. }]
  29. },
  30. {
  31. label: '文物编码',
  32. name: 'code',
  33. type: 'text',
  34. defaultValue: '',
  35. additionalProps: {
  36. placeholder: '请输入文物编码',
  37. },
  38. rules: [{
  39. required: true,
  40. message: '请输入文物编码',
  41. }]
  42. },
  43. {
  44. label: '年代',
  45. name: 'age',
  46. type: 'select-id',
  47. additionalProps: {
  48. loadData: async () =>
  49. (await VillageInfoApi.getCategoryChildList(103))
  50. .map((p) => ({
  51. value: p.id,
  52. text: p.title,
  53. }))
  54. ,
  55. } as PickerIdFieldProps,
  56. formProps: { showRightArrow: true } as FieldProps,
  57. rules: [{
  58. required: true,
  59. message: '请选择年代',
  60. }],
  61. },
  62. {
  63. label: '保护级别',
  64. name: 'level',
  65. type: 'select-id',
  66. additionalProps: {
  67. loadData: async () =>
  68. (await VillageInfoApi.getCategoryChildList(158))
  69. .map((p) => ({
  70. value: p.id,
  71. text: p.title,
  72. }))
  73. ,
  74. } as PickerIdFieldProps,
  75. formProps: { showRightArrow: true } as FieldProps,
  76. rules: [{
  77. required: true,
  78. message: '请选择保护级别',
  79. }],
  80. },
  81. {
  82. label: '文物类型',
  83. name: 'crType',
  84. type: 'select-id',
  85. additionalProps: {
  86. loadData: async () =>
  87. (await VillageInfoApi.getCategoryChildList(3))
  88. .map((p) => ({
  89. value: p.id,
  90. text: p.title,
  91. }))
  92. ,
  93. } as PickerIdFieldProps,
  94. formProps: { showRightArrow: true } as FieldProps,
  95. rules: [{
  96. required: true,
  97. message: '请选择文物类型',
  98. }],
  99. },
  100. ]
  101. },
  102. {
  103. label: '介绍',
  104. name: 'introdInfo',
  105. type: 'flat-group',
  106. childrenColProps: { span: 24 },
  107. children: [
  108. {
  109. label: '简介',
  110. name: 'intro',
  111. type: 'richtext',
  112. defaultValue: '',
  113. additionalProps: {
  114. placeholder: '请输入简介',
  115. maxLength: 200,
  116. showWordLimit: true,
  117. },
  118. rules: [{
  119. required: true,
  120. message: '请输入简介',
  121. }]
  122. },
  123. {
  124. label: '描述',
  125. name: 'description',
  126. type: 'richtext',
  127. defaultValue: '',
  128. additionalProps: {
  129. placeholder: '请输入简介',
  130. maxLength: 200,
  131. showWordLimit: true,
  132. },
  133. rules: [{
  134. required: true,
  135. message: '请输入描述',
  136. }]
  137. },
  138. {
  139. label: '图片',
  140. name: 'images',
  141. type: 'uploader',
  142. defaultValue: '',
  143. additionalProps: {
  144. upload: useAliOssUploadCo('xiangyuan/relic'),
  145. maxFileSize: 1024 * 1024 * 20,
  146. maxUploadCount: 20,
  147. } as UploaderFieldProps,
  148. rules: []
  149. },
  150. {
  151. label: '文化故事',
  152. name: 'content',
  153. type: 'richtext',
  154. defaultValue: '',
  155. additionalProps: {
  156. placeholder: '输入关于此文物的历史文化故事',
  157. maxLength: 5000,
  158. showWordLimit: true,
  159. } as FieldProps,
  160. rules: []
  161. },
  162. ...villageCommonContent(r, {
  163. title: '文物古迹',
  164. showContent: false,
  165. showTitle: false,
  166. }).formItems
  167. ]
  168. },
  169. {
  170. label: '位置信息',
  171. name: 'locationInfo',
  172. type: 'flat-group',
  173. childrenColProps: { span: 24 },
  174. children: [
  175. {
  176. label: '经纬度',
  177. name: 'lonlat',
  178. type: 'select-lonlat',
  179. defaultValue: '',
  180. additionalProps: {},
  181. formProps: { showRightArrow: true } as FieldProps,
  182. rules: [{
  183. required: true,
  184. message: '请输入经纬度',
  185. }]
  186. },
  187. {
  188. label: '地址',
  189. name: 'address',
  190. type: 'select-address',
  191. defaultValue: '',
  192. additionalProps: {},
  193. rules: [{
  194. required: true,
  195. message: '请输入地址',
  196. }]
  197. },
  198. {
  199. label: '方位',
  200. name: 'orientation',
  201. type: 'text',
  202. defaultValue: '',
  203. additionalProps: { placeholder: '方位' },
  204. rules: []
  205. },
  206. {
  207. label: '相对距离',
  208. name: 'distance',
  209. type: 'text',
  210. defaultValue: '',
  211. additionalProps: { placeholder: '相对距离' },
  212. rules: []
  213. },
  214. {
  215. name: '',
  216. label: '平面坐标XY',
  217. type: 'flat-simple',
  218. children: [
  219. {
  220. label: '',
  221. name: 'mapX',
  222. type: 'number',
  223. defaultValue: 0,
  224. additionalProps: {
  225. min: -250,
  226. max: 250,
  227. } as StepperProps,
  228. formProps: {
  229. labelWidth: '0rpx',
  230. labelPosition: 'left',
  231. showBottomBorder: false,
  232. },
  233. rules: [{
  234. required: true,
  235. message: '请输入X',
  236. }]
  237. },
  238. {
  239. label: '',
  240. name: 'mapY',
  241. type: 'number',
  242. defaultValue: 0,
  243. additionalProps: {
  244. min: -250,
  245. max: 250,
  246. } as StepperProps,
  247. formProps: {
  248. labelWidth: '0rpx',
  249. labelPosition: 'left',
  250. showBottomBorder: false,
  251. },
  252. rules: [{
  253. required: true,
  254. message: '请输入Y',
  255. }]
  256. },
  257. ]
  258. },
  259. ]
  260. },
  261. ]
  262. }), { title: '文物古迹', typeName: '', }];