image.png

  1. const schema = {
  2. "type": "object",
  3. "properties": {
  4. "star": {
  5. "type": "number",
  6. "title": "星级",
  7. "x-decorator": "FormItem",
  8. "x-component": "Rate",
  9. "x-validator": [],
  10. "x-component-props": {},
  11. "x-decorator-props": {},
  12. "x-designable-id": "ns6c0ns0xlg",
  13. "x-index": 0,
  14. "name": "star"
  15. },
  16. "avatar": {
  17. "type": "Array<object>",
  18. "title": "图片",
  19. "x-decorator": "FormItem",
  20. "x-component": "Upload",
  21. "x-component-props": {
  22. "textContent": "Upload",
  23. "method": "GET",
  24. "multiple": true
  25. },
  26. "x-validator": [],
  27. "x-decorator-props": {
  28. "tooltip": "",
  29. "asterisk": false
  30. },
  31. "name": "avatar",
  32. "x-designable-id": "1lw5ssnzv0j",
  33. "x-index": 1,
  34. "required": true,
  35. "description": "请上传酒店星级证明图片"
  36. }
  37. },
  38. "x-designable-id": "q8xn8lsfta7"
  39. }

餐厅

选择无,隐藏后面的表单
image.png

  1. const schema = {
  2. "type": "object",
  3. "properties": {
  4. "restaurant": {
  5. "type": "boolean",
  6. "title": "餐厅",
  7. "x-decorator": "FormItem",
  8. "x-component": "Radio.Group",
  9. "enum": [
  10. {
  11. "children": [],
  12. "label": "有",
  13. "value": true
  14. },
  15. {
  16. "children": [],
  17. "label": "无",
  18. "value": false
  19. }
  20. ],
  21. "x-validator": [],
  22. "x-component-props": {
  23. "optionType": "button",
  24. "buttonStyle": "solid"
  25. },
  26. "x-decorator-props": {},
  27. "name": "restaurant",
  28. "x-designable-id": "zd6iggh08j7",
  29. "x-index": 0,
  30. "default": true
  31. },
  32. "items": {
  33. "type": "object",
  34. "x-validator": [],
  35. "name": "items",
  36. "title": "TOTAL",
  37. "x-designable-id": "jwkzp4y6rhn",
  38. "x-index": 1,
  39. "x-reactions": {
  40. "dependencies": [
  41. {
  42. "property": "value",
  43. "type": "boolean",
  44. "source": "restaurant",
  45. "name": "restaurant"
  46. }
  47. ],
  48. "fulfill": {
  49. "state": {
  50. "visible": "{{$deps.restaurant}}"
  51. }
  52. }
  53. },
  54. "properties": {
  55. "name": {
  56. "type": "string",
  57. "title": "餐厅名称",
  58. "x-decorator": "FormItem",
  59. "x-component": "Input",
  60. "x-validator": [],
  61. "x-component-props": {
  62. "placeholder": "请输入餐厅名称"
  63. },
  64. "x-decorator-props": {},
  65. "name": "name",
  66. "x-designable-id": "7awrtm80f44",
  67. "x-index": 0,
  68. "required": true
  69. },
  70. "times": {
  71. "type": "string[]",
  72. "title": "营业时间",
  73. "x-decorator": "FormItem",
  74. "x-component": "TimePicker.RangePicker",
  75. "x-validator": [],
  76. "x-component-props": {
  77. "format": "HH:mm"
  78. },
  79. "x-decorator-props": {},
  80. "name": "times",
  81. "x-designable-id": "oop8aptuxdt",
  82. "x-index": 1
  83. },
  84. "server": {
  85. "type": "Array<string | number>",
  86. "title": "餐厅提供",
  87. "x-decorator": "FormItem",
  88. "x-component": "Checkbox.Group",
  89. "enum": [
  90. {
  91. "children": [],
  92. "label": "早餐",
  93. "value": 1
  94. },
  95. {
  96. "children": [],
  97. "label": "午餐",
  98. "value": 2
  99. }
  100. ],
  101. "x-validator": [],
  102. "x-decorator-props": {},
  103. "name": "server",
  104. "x-designable-id": "hoo8eztr4di",
  105. "x-index": 2
  106. },
  107. "avatar": {
  108. "type": "Array<object>",
  109. "title": "图片",
  110. "x-decorator": "FormItem",
  111. "x-component": "Upload",
  112. "x-component-props": {
  113. "textContent": "Upload"
  114. },
  115. "x-validator": [],
  116. "x-decorator-props": {},
  117. "name": "avatar",
  118. "x-designable-id": "1lw5ssnzv0j",
  119. "x-index": 3
  120. }
  121. }
  122. }
  123. },
  124. "x-designable-id": "q8xn8lsfta7"
  125. }