building.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. import VillageInfoApi, { CommonInfoModel, VillageBulidingInfo } from "@/api/inhert/VillageInfoApi";
  2. import type { CheckBoxListProps } from "@/components/dynamic/wrappers/CheckBoxList.vue";
  3. import type { PickerIdFieldProps } from "@/components/dynamic/wrappers/PickerIdField";
  4. import type { FieldProps } from "@/components/form/Field.vue";
  5. import type { SingleForm } from "../forms";
  6. import type { UploaderFieldProps } from "@/components/form/UploaderField.vue";
  7. import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo";
  8. import { villageCommonContent } from "./common";
  9. export function villageInfoBuildingForm(title: string) : SingleForm {
  10. return [VillageBulidingInfo, (r) => ({
  11. formItems: [
  12. {
  13. label: '基础信息',
  14. name: 'baseInfo',
  15. type: 'flat-group',
  16. childrenColProps: { span: 24 },
  17. children: [
  18. {
  19. label: '建筑名称',
  20. name: 'name',
  21. type: 'text',
  22. defaultValue: '',
  23. additionalProps: {
  24. placeholder: '请输入建筑名称',
  25. },
  26. rules: [{
  27. required: true,
  28. message: '请输入建筑名称',
  29. }]
  30. },
  31. {
  32. label: '建筑编码',
  33. name: 'code',
  34. type: 'text',
  35. defaultValue: '',
  36. additionalProps: {
  37. placeholder: '请输入建筑编码',
  38. },
  39. rules: [{
  40. required: true,
  41. message: '请输入建筑编码',
  42. }]
  43. },
  44. {
  45. label: '产权归属',
  46. name: 'ownership',
  47. type: 'select-id',
  48. additionalProps: {
  49. loadData: async () =>
  50. (await VillageInfoApi.getCategoryChildList(152))
  51. .map((p) => ({
  52. value: p.id,
  53. text: p.title,
  54. }))
  55. ,
  56. } as PickerIdFieldProps,
  57. formProps: { showRightArrow: true } as FieldProps,
  58. rules: [{
  59. required: true,
  60. message: '请选择产权归属',
  61. }],
  62. },
  63. {
  64. label: '位置',
  65. name: 'position',
  66. type: 'text',
  67. defaultValue: '',
  68. additionalProps: {
  69. placeholder: '请输入位置',
  70. },
  71. rules: [{
  72. required: true,
  73. message: '请输入位置',
  74. }]
  75. },
  76. {
  77. label: '建筑类型',
  78. name: 'buildingType',
  79. type: 'select-id',
  80. additionalProps: {
  81. loadData: async () =>
  82. (await VillageInfoApi.getCategoryChildList(163))
  83. .map((p) => ({
  84. value: p.id,
  85. text: p.title,
  86. }))
  87. ,
  88. } as PickerIdFieldProps,
  89. formProps: { showRightArrow: true } as FieldProps,
  90. rules: [{
  91. required: true,
  92. message: '请选择建筑类型',
  93. }],
  94. },
  95. {
  96. label: '其他建筑类型',
  97. name: 'otherBuildingType',
  98. type: 'text',
  99. defaultValue: '',
  100. additionalProps: { placeholder: '其他建筑类型' },
  101. show: { callback: (_, m) => m.buildingType == 170 },
  102. rules: [{
  103. required: true,
  104. message: '请输入其他建筑类型',
  105. }]
  106. },
  107. ]
  108. },
  109. {
  110. label: '简介和故事',
  111. name: 'extraInfo',
  112. type: 'flat-group',
  113. childrenColProps: { span: 24 },
  114. children: [
  115. {
  116. label: '建筑中的故事',
  117. name: 'story',
  118. type: 'richtext',
  119. defaultValue: '',
  120. additionalProps: {
  121. placeholder: '请输入建筑中的故事',
  122. maxLength: 5000,
  123. showWordLimit: true,
  124. },
  125. rules: [{
  126. required: true,
  127. message: '请输入建筑中的故事',
  128. }]
  129. },
  130. {
  131. label: '功能特点',
  132. name: 'funcFeatures',
  133. type: 'richtext',
  134. defaultValue: '',
  135. additionalProps: {
  136. placeholder: '请输入功能特点',
  137. maxLength: 5000,
  138. showWordLimit: true,
  139. },
  140. rules: []
  141. },
  142. ...villageCommonContent(r, {
  143. title: title,
  144. showContent: false,
  145. showTitle: false,
  146. }).formItems
  147. ]
  148. },
  149. {
  150. label: '详细信息',
  151. name: 'detailsInfo',
  152. type: 'flat-group',
  153. childrenColProps: { span: 24 },
  154. children: [
  155. {
  156. label: '保护级别',
  157. name: 'protectionLevel',
  158. type: 'select-id',
  159. additionalProps: {
  160. loadData: async () =>
  161. (await VillageInfoApi.getCategoryChildList(171))
  162. .map((p) => ({
  163. value: p.id,
  164. text: p.title,
  165. }))
  166. ,
  167. } as PickerIdFieldProps,
  168. formProps: { showRightArrow: true } as FieldProps,
  169. rules: [{
  170. required: true,
  171. message: '请选择建筑类型',
  172. }],
  173. },
  174. {
  175. label: '其他保护级别',
  176. name: 'otherProtectionLevel',
  177. type: 'text',
  178. defaultValue: '',
  179. show: { callback: (_, m) => m.protectionLevel == 177 },
  180. additionalProps: { placeholder: '其他保护级别' },
  181. rules: [{
  182. required: true,
  183. message: '请输入其他保护级别',
  184. }]
  185. },
  186. {
  187. label: '总占地面积',
  188. name: 'area',
  189. type: 'text',
  190. defaultValue: '',
  191. additionalProps: {
  192. placeholder: '请输入总占地面积',
  193. },
  194. rules: [{
  195. required: true,
  196. message: '请输入总占地面积',
  197. }]
  198. },
  199. {
  200. label: '建筑面积',
  201. name: 'buildingArea',
  202. type: 'text',
  203. defaultValue: '',
  204. additionalProps: {
  205. placeholder: '请输入建筑面积',
  206. },
  207. rules: [{
  208. required: true,
  209. message: '请输入建筑面积',
  210. }]
  211. },
  212. {
  213. label: '建筑层数',
  214. name: 'floor',
  215. type: 'number',
  216. defaultValue: 0,
  217. additionalProps: {
  218. min: 0,
  219. max: 1000,
  220. },
  221. rules: [{
  222. required: true,
  223. message: '请输入建筑层数',
  224. }]
  225. },
  226. {
  227. label: '所含建筑幢数',
  228. name: 'num',
  229. type: 'number',
  230. defaultValue: 0,
  231. additionalProps: {
  232. min: 0,
  233. max: 1000,
  234. },
  235. rules: [{
  236. required: true,
  237. message: '请输入所含建筑幢数',
  238. }]
  239. },
  240. {
  241. label: '始建时间(年)',
  242. name: 'age',
  243. type: 'number',
  244. defaultValue: 2025,
  245. additionalProps: {
  246. min: -50000,
  247. max: 2000,
  248. },
  249. rules: [{
  250. required: true,
  251. message: '请输入始建时间',
  252. }]
  253. },
  254. {
  255. label: '承重结构(多选)',
  256. name: 'bearingType',
  257. type: 'check-box-list',
  258. additionalProps: {
  259. multiple: true,
  260. loadData: async () =>
  261. (await VillageInfoApi.getCategoryChildList(246))
  262. .map((p) => ({
  263. value: p.id,
  264. text: p.title,
  265. }))
  266. ,
  267. } as CheckBoxListProps,
  268. defaultValue: [],
  269. rules: [{
  270. required: true,
  271. message: '请选择类型',
  272. }],
  273. },
  274. {
  275. label: '其他承重结构类型',
  276. name: 'otherBearing',
  277. type: 'text',
  278. defaultValue: '',
  279. additionalProps: { placeholder: '其他承重结构类型' },
  280. rules: []
  281. },
  282. {
  283. label: '居民建筑类型',
  284. name: 'residentialBuildingType',
  285. type: 'text',
  286. defaultValue: '',
  287. additionalProps: { placeholder: '居民建筑类型' },
  288. rules: []
  289. },
  290. {
  291. label: '修缮过程',
  292. name: 'repairProcess',
  293. type: 'textarea',
  294. defaultValue: '',
  295. additionalProps: {
  296. placeholder: '修缮过程',
  297. maxLength: 5000,
  298. showWordLimit: true,
  299. },
  300. rules: []
  301. },
  302. {
  303. label: '建筑风貌',
  304. name: 'architecturalStyle',
  305. type: 'textarea',
  306. defaultValue: '',
  307. additionalProps: {
  308. placeholder: '建筑风貌',
  309. maxLength: 5000,
  310. showWordLimit: true,
  311. },
  312. rules: []
  313. },
  314. {
  315. label: '院落布局',
  316. name: 'layout',
  317. type: 'textarea',
  318. defaultValue: '',
  319. additionalProps: {
  320. placeholder: '院落布局',
  321. maxLength: 5000,
  322. showWordLimit: true,
  323. },
  324. rules: []
  325. },
  326. ]
  327. },
  328. {
  329. label: '建筑做法',
  330. name: 'detailsInfo',
  331. type: 'flat-group',
  332. childrenColProps: { span: 24 },
  333. children: [
  334. {
  335. label: '屋面形式(多选)',
  336. name: 'roofForm',
  337. type: 'check-box-list',
  338. additionalProps: {
  339. multiple: true,
  340. loadData: async () =>
  341. (await VillageInfoApi.getCategoryChildList(264))
  342. .map((p) => ({
  343. value: p.id,
  344. text: p.title,
  345. }))
  346. ,
  347. } as CheckBoxListProps,
  348. defaultValue: [],
  349. rules: [],
  350. },
  351. {
  352. label: '屋面形式说明',
  353. name: 'roofDescribe',
  354. type: 'textarea',
  355. defaultValue: '',
  356. additionalProps: {
  357. placeholder: '屋面形式说明',
  358. maxLength: 5000,
  359. showWordLimit: true,
  360. },
  361. rules: []
  362. },
  363. {
  364. label: '围护墙体(多选)',
  365. name: 'wallType',
  366. type: 'check-box-list',
  367. additionalProps: {
  368. multiple: true,
  369. loadData: async () =>
  370. (await VillageInfoApi.getCategoryChildList(271))
  371. .map((p) => ({
  372. value: p.id,
  373. text: p.title,
  374. }))
  375. ,
  376. } as CheckBoxListProps,
  377. defaultValue: [],
  378. rules: [],
  379. },
  380. {
  381. label: '围护墙体说明',
  382. name: 'otherBuildingType',
  383. type: 'textarea',
  384. defaultValue: '',
  385. additionalProps: {
  386. placeholder: '围护墙体说明',
  387. maxLength: 5000,
  388. showWordLimit: true,
  389. },
  390. rules: []
  391. },
  392. {
  393. label: '地面做法(多选)',
  394. name: 'floorType',
  395. type: 'check-box-list',
  396. additionalProps: {
  397. multiple: true,
  398. loadData: async () =>
  399. (await VillageInfoApi.getCategoryChildList(258))
  400. .map((p) => ({
  401. value: p.id,
  402. text: p.title,
  403. }))
  404. ,
  405. } as CheckBoxListProps,
  406. defaultValue: [],
  407. rules: [],
  408. },
  409. {
  410. label: '地面做法说明',
  411. name: 'floorDescribe',
  412. type: 'textarea',
  413. defaultValue: '',
  414. additionalProps: {
  415. placeholder: '地面做法说明',
  416. maxLength: 5000,
  417. showWordLimit: true,
  418. },
  419. rules: []
  420. },
  421. {
  422. label: '特殊工艺做法',
  423. name: 'specialProcess',
  424. type: 'text',
  425. defaultValue: '',
  426. additionalProps: { placeholder: '特殊工艺做法' },
  427. rules: []
  428. },
  429. ]
  430. },
  431. {
  432. label: '建筑用途',
  433. name: 'detailsInfo',
  434. type: 'flat-group',
  435. childrenColProps: { span: 24 },
  436. children: [
  437. {
  438. label: '历史功能',
  439. name: 'funcHistory',
  440. type: 'textarea',
  441. defaultValue: '',
  442. additionalProps: {
  443. placeholder: '历史功能',
  444. maxLength: 5000,
  445. showWordLimit: true,
  446. },
  447. rules: []
  448. },
  449. {
  450. label: '现状用途(多选)',
  451. name: 'purpose',
  452. type: 'check-box-list',
  453. additionalProps: {
  454. multiple: true,
  455. loadData: async () =>
  456. (await VillageInfoApi.getCategoryChildList(252))
  457. .map((p) => ({
  458. value: p.id,
  459. text: p.title,
  460. }))
  461. ,
  462. } as CheckBoxListProps,
  463. defaultValue: [],
  464. rules: [],
  465. },
  466. {
  467. label: '其他现状用途',
  468. name: 'otherPurpose',
  469. type: 'textarea',
  470. defaultValue: '',
  471. additionalProps: {
  472. placeholder: '其他现状用途',
  473. maxLength: 5000,
  474. showWordLimit: true,
  475. },
  476. rules: []
  477. },
  478. {
  479. label: '改扩建情况及维修状况',
  480. name: 'repair',
  481. type: 'textarea',
  482. defaultValue: '',
  483. additionalProps: {
  484. placeholder: '改扩建情况及维修状况',
  485. maxLength: 5000,
  486. showWordLimit: true,
  487. },
  488. rules: []
  489. },
  490. {
  491. label: '改扩建情况及维修状况说明',
  492. name: 'repairDescribe',
  493. type: 'textarea',
  494. defaultValue: '',
  495. additionalProps: {
  496. placeholder: '改扩建情况及维修状况说明',
  497. maxLength: 5000,
  498. showWordLimit: true,
  499. },
  500. rules: []
  501. },
  502. ]
  503. },
  504. ]
  505. }), { title: title, typeName: 'nature' }]
  506. }
  507. export const villageInfoDistributionForm : SingleForm = [CommonInfoModel, (r) => ({
  508. formItems: [
  509. {
  510. label: '建筑数量',
  511. name: 'num',
  512. type: 'number',
  513. defaultValue: '',
  514. additionalProps: {
  515. min: 0,
  516. max: 100,
  517. },
  518. rules: [{
  519. required: true,
  520. message: '请输入建筑数量',
  521. }]
  522. },
  523. {
  524. label: '分布图',
  525. name: 'distribution',
  526. type: 'uploader',
  527. defaultValue: '',
  528. additionalProps: {
  529. upload: useAliOssUploadCo('xiangyuan/distribution'),
  530. maxFileSize: 1024 * 1024 * 20,
  531. single: true,
  532. } as UploaderFieldProps,
  533. rules: [{
  534. required: true,
  535. message: '请上传分布图',
  536. }]
  537. },
  538. {
  539. label: '营造智慧',
  540. name: 'wisdom',
  541. type: 'richtext',
  542. defaultValue: '',
  543. additionalProps: {
  544. placeholder: '请输入营造智慧',
  545. maxLength: 5000,
  546. showWordLimit: true,
  547. },
  548. rules: [{
  549. required: true,
  550. message: '请输入营造智慧',
  551. }]
  552. },
  553. ...villageCommonContent(r, {
  554. title: '建筑分布',
  555. showContent: false,
  556. showTitle: false,
  557. }).formItems
  558. ]
  559. }), { title: '建筑分布', typeName: '', }]