shopInfo.data.ts 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  219. },
  220. },
  221. {
  222. field: 'title4',
  223. colSlot: 'title4',
  224. label: '',
  225. component: 'RangePicker',
  226. labelWidth: 0,
  227. ifShow(renderCallbackParams) {
  228. return renderCallbackParams.model.type == 1;
  229. },
  230. },
  231. {
  232. field: 'before',
  233. label: '图片(前)',
  234. component: 'JImageUpload',
  235. colProps: { xl: 12 },
  236. componentProps: {
  237. tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  238. },
  239. ifShow(renderCallbackParams) {
  240. return renderCallbackParams.model.type == 1;
  241. },
  242. },
  243. {
  244. field: 'after',
  245. label: '图片(后)',
  246. component: 'JImageUpload',
  247. colProps: { xl: 12 },
  248. componentProps: {
  249. tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  250. },
  251. ifShow(renderCallbackParams) {
  252. return renderCallbackParams.model.type == 1;
  253. },
  254. },
  255. {
  256. field: 'left',
  257. label: '图片(左)',
  258. component: 'JImageUpload',
  259. colProps: { xl: 12 },
  260. componentProps: {
  261. tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  262. },
  263. ifShow(renderCallbackParams) {
  264. return renderCallbackParams.model.type == 1;
  265. },
  266. },
  267. {
  268. field: 'right',
  269. label: '图片(右)',
  270. component: 'JImageUpload',
  271. componentProps: {
  272. tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  273. },
  274. colProps: { xl: 12 },
  275. ifShow(renderCallbackParams) {
  276. return renderCallbackParams.model.type == 1;
  277. },
  278. },
  279. {
  280. field: 'up',
  281. label: '图片(上)',
  282. component: 'JImageUpload',
  283. componentProps: {
  284. tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  285. },
  286. colProps: { xl: 12 },
  287. ifShow(renderCallbackParams) {
  288. return renderCallbackParams.model.type == 1;
  289. },
  290. },
  291. {
  292. field: 'down',
  293. label: '图片(下)',
  294. component: 'JImageUpload',
  295. componentProps: {
  296. tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
  297. },
  298. colProps: { xl: 12 },
  299. ifShow(renderCallbackParams) {
  300. return renderCallbackParams.model.type == 1;
  301. },
  302. },
  303. ];