shopInfo.data.ts 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. import { FormSchema } from '/@/components/Table';
  2. import { getBaiduAdd, getSprotProject } from '/@/api/common/api';
  3. import { h } from 'vue';
  4. import { JAreaSelect } from '/@/components/Form';
  5. import { InputGroup, Input, Button, message } from 'ant-design-vue';
  6. export const formSchema: FormSchema[] = [
  7. {
  8. label: '',
  9. field: 'id',
  10. component: 'Input',
  11. show: false,
  12. },
  13. {
  14. field: 'type',
  15. label: '业务类型',
  16. component: 'Select',
  17. componentProps: {
  18. options: [
  19. { label: '学校', value: 0 },
  20. { label: '体育馆', value: 1 },
  21. ],
  22. },
  23. required: true,
  24. },
  25. {
  26. field: 'name',
  27. label: '营业名称',
  28. component: 'Input',
  29. required: true,
  30. },
  31. {
  32. field: 'province',
  33. label: '营业地址',
  34. component: 'JAreaSelect',
  35. slot: 'address',
  36. required: true,
  37. },
  38. {
  39. field: 'address',
  40. label: '详细地址',
  41. component: 'Input',
  42. required: true,
  43. render: ({ model }) => {
  44. return h(
  45. InputGroup,
  46. {
  47. compact: true,
  48. },
  49. () => [
  50. h(Input, {
  51. value: model['address'],
  52. style: 'width: calc(100% - 70px)',
  53. onChange: (e) => {
  54. model['address'] = e.target.value;
  55. },
  56. }),
  57. h(
  58. Button,
  59. {
  60. onClick: async () => {
  61. if (!model['address'] || !model['province']) return message.warning('请输入地址');
  62. const res = await getBaiduAdd({ address: `${model['province']}${model['city']}${model['area']}${model['address']}` });
  63. model['latitude'] = res.latitude;
  64. model['longitude'] = res.longitude;
  65. },
  66. },
  67. () => '定位'
  68. ),
  69. ]
  70. );
  71. },
  72. },
  73. {
  74. field: 'province',
  75. label: '',
  76. component: 'JAreaSelect',
  77. show: false,
  78. },
  79. {
  80. field: 'city',
  81. label: '',
  82. component: 'JAreaSelect',
  83. show: false,
  84. },
  85. {
  86. field: 'area',
  87. label: '',
  88. component: 'JAreaSelect',
  89. show: false,
  90. },
  91. {
  92. field: 'longitude',
  93. label: '经度',
  94. component: 'Input',
  95. required: true,
  96. colProps: {
  97. sm: 8,
  98. },
  99. componentProps: {
  100. placeholder: '输入详细地址后点击定位,自动填充',
  101. },
  102. },
  103. {
  104. field: 'latitude',
  105. label: '维度',
  106. component: 'Input',
  107. required: true,
  108. colProps: {
  109. sm: 8,
  110. },
  111. componentProps: {
  112. placeholder: '输入详细地址后点击定位,自动填充',
  113. },
  114. },
  115. {
  116. field: 'title1',
  117. colSlot: 'title1',
  118. label: '',
  119. component: 'RangePicker',
  120. labelWidth: 0,
  121. },
  122. {
  123. field: 'runStatus',
  124. label: '经营状态',
  125. component: 'RadioGroup',
  126. required: true,
  127. componentProps: {
  128. options: [
  129. { label: '营业', value: 0 },
  130. { label: '休息', value: 1 },
  131. ],
  132. },
  133. defaultValue: 0,
  134. },
  135. {
  136. field: 'runType',
  137. label: '营业时间',
  138. component: 'RadioGroup',
  139. required: true,
  140. componentProps: {
  141. options: [
  142. { label: '全天', value: 0 },
  143. { label: '自定义', value: 1 },
  144. ],
  145. },
  146. ifShow(model) {
  147. return model.model['runStatus'] == 0;
  148. },
  149. defaultValue: 0,
  150. colProps: { span: 8 },
  151. },
  152. {
  153. label: '',
  154. component: 'RangeTime',
  155. field: 'Time',
  156. colProps: { span: 6 },
  157. ifShow(renderCallbackParams) {
  158. return renderCallbackParams.model['runType'] == 1;
  159. },
  160. },
  161. {
  162. field: 'phone',
  163. label: '客服电话',
  164. component: 'Input',
  165. required: true,
  166. slot: 'phone',
  167. },
  168. {
  169. field: 'facility',
  170. label: '设施/服务',
  171. component: 'JCheckbox',
  172. required: true,
  173. componentProps: {
  174. dictCode: 'facilities_service',
  175. },
  176. },
  177. {
  178. field: 'categoryId',
  179. label: '运动项目',
  180. component: 'ApiSelect',
  181. required: true,
  182. componentProps: {
  183. api: getSprotProject,
  184. params: {
  185. pageSize: 50,
  186. },
  187. labelField: 'name',
  188. valueField: 'id',
  189. resultField: 'records',
  190. mode: 'multiple',
  191. // options: sportList.records.map((it) => {
  192. // return {
  193. // label: it.name,
  194. // value: it.id,
  195. // };
  196. // }),
  197. },
  198. },
  199. {
  200. field: 'title3',
  201. colSlot: 'title3',
  202. label: '',
  203. component: 'RangePicker',
  204. labelWidth: 0,
  205. },
  206. {
  207. field: 'video',
  208. label: '视频',
  209. component: 'Input',
  210. slot: 'VideoUpload',
  211. },
  212. {
  213. field: 'cover',
  214. label: '图片',
  215. component: 'JImageUpload',
  216. required: true,
  217. componentProps: {
  218. tipText: '最多支持10张;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  219. aspectRatioW: 5,
  220. aspectRatioH: 4,
  221. isProportion: true,
  222. },
  223. },
  224. {
  225. field: 'title4',
  226. colSlot: 'title4',
  227. label: '',
  228. component: 'RangePicker',
  229. labelWidth: 0,
  230. ifShow(renderCallbackParams) {
  231. return renderCallbackParams.model.type == 1;
  232. },
  233. },
  234. {
  235. field: 'before',
  236. label: '图片(前)',
  237. component: 'JImageUpload',
  238. colProps: { xl: 12 },
  239. componentProps: {
  240. isProportion: true,
  241. tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
  242. },
  243. ifShow(renderCallbackParams) {
  244. return renderCallbackParams.model.type == 1;
  245. },
  246. },
  247. {
  248. field: 'after',
  249. label: '图片(后)',
  250. component: 'JImageUpload',
  251. colProps: { xl: 12 },
  252. componentProps: {
  253. isProportion: true,
  254. tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
  255. aspectRatioW: 1,
  256. aspectRatioH: 1,
  257. },
  258. ifShow(renderCallbackParams) {
  259. return renderCallbackParams.model.type == 1;
  260. },
  261. },
  262. {
  263. field: 'left',
  264. label: '图片(左)',
  265. component: 'JImageUpload',
  266. colProps: { xl: 12 },
  267. componentProps: {
  268. isProportion: true,
  269. tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
  270. aspectRatioW: 1,
  271. aspectRatioH: 1,
  272. },
  273. ifShow(renderCallbackParams) {
  274. return renderCallbackParams.model.type == 1;
  275. },
  276. },
  277. {
  278. field: 'right',
  279. label: '图片(右)',
  280. component: 'JImageUpload',
  281. componentProps: {
  282. isProportion: true,
  283. tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
  284. aspectRatioW: 1,
  285. aspectRatioH: 1,
  286. },
  287. colProps: { xl: 12 },
  288. ifShow(renderCallbackParams) {
  289. return renderCallbackParams.model.type == 1;
  290. },
  291. },
  292. {
  293. field: 'up',
  294. label: '图片(上)',
  295. component: 'JImageUpload',
  296. componentProps: {
  297. isProportion: true,
  298. tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
  299. aspectRatioW: 1,
  300. aspectRatioH: 1,
  301. },
  302. colProps: { xl: 12 },
  303. ifShow(renderCallbackParams) {
  304. return renderCallbackParams.model.type == 1;
  305. },
  306. },
  307. {
  308. field: 'down',
  309. label: '图片(下)',
  310. component: 'JImageUpload',
  311. componentProps: {
  312. isProportion: true,
  313. tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
  314. aspectRatioW: 1,
  315. aspectRatioH: 1,
  316. },
  317. colProps: { xl: 12 },
  318. ifShow(renderCallbackParams) {
  319. return renderCallbackParams.model.type == 1;
  320. },
  321. },
  322. ];