Home.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <fm-making-form ref="makingForm" clearable upload preview generate-code generate-json
  3. :custom-fields="customFields"
  4. :global-config="globalConfig"
  5. :field-config="fieldConfig"
  6. name="sample"
  7. cache
  8. :json-templates="jsonTemplates"
  9. :field-models="fieldModels"
  10. :z-index="300"
  11. style="height: 700px;"
  12. >
  13. <template #widgetconfig="{type, data, customProps}">
  14. <el-form-item v-if="type === 'button'" label="Loading">
  15. <el-switch v-model="customProps.loading"></el-switch>
  16. </el-form-item>
  17. <el-form-item v-if="type === 'custom' && data.el=== 'custom-width-height'" label="Tip">
  18. <el-input v-model="customProps.tip"></el-input>
  19. </el-form-item>
  20. </template>
  21. </fm-making-form>
  22. </template>
  23. <script>
  24. import json0 from './json0.js'
  25. import json1 from './json1.js'
  26. import json2 from './json2.js'
  27. import json3 from './json3.js'
  28. import json4 from './json4.js'
  29. import json5 from './json5.js'
  30. import json6 from './json6.js'
  31. import json7 from './json7.js'
  32. import json8 from './json8.js'
  33. import json9 from './json9.js'
  34. import json10 from './json10.js'
  35. import json11 from './json11.js'
  36. export default {
  37. data() {
  38. return {
  39. customFields: [
  40. {
  41. name: '自定义组件',
  42. el: 'custom-width-height',
  43. options: {
  44. defaultValue: {},
  45. labelWidth: 0,
  46. isLabelWidth: false,
  47. hidden: false,
  48. disabled: false,
  49. dataBind: true,
  50. required: false,
  51. pattern: '',
  52. validator: '',
  53. extendProps: {},
  54. customProps: {}
  55. },
  56. events: {
  57. onChange: '',
  58. 'on-test': '',
  59. }
  60. },{
  61. name: '图表示例',
  62. el: 'custom-chart',
  63. options: {
  64. defaultValue: [
  65. { year: '1951 年', sales: 38 },
  66. { year: '1952 年', sales: 52 },
  67. { year: '1956 年', sales: 61 },
  68. { year: '1957 年', sales: 145 },
  69. { year: '1958 年', sales: 48 },
  70. { year: '1959 年', sales: 38 },
  71. { year: '1960 年', sales: 38 },
  72. { year: '1962 年', sales: 38 },
  73. ],
  74. customClass: '',
  75. labelWidth: 100,
  76. isLabelWidth: false,
  77. hidden: false,
  78. dataBind: true,
  79. required: false,
  80. pattern: '',
  81. }
  82. },
  83. {
  84. name: 'vant时间选择',
  85. el: 'custom-vant-field',
  86. options: {
  87. defaultValue: '',
  88. customClass: '',
  89. labelWidth: 100,
  90. isLabelWidth: false,
  91. hidden: false,
  92. dataBind: true,
  93. required: false,
  94. pattern: '',
  95. }
  96. }
  97. ],
  98. globalConfig: {
  99. // styleSheets: '.a .el-form-item__label{color: red;}',
  100. dataSource: [
  101. {
  102. key: 'upload',
  103. name: 'Get Upload Token',
  104. url: 'https://tools-server.making.link/api/uptoken',
  105. method: "GET",
  106. auto: true,
  107. responseFunc: 'return res.uptoken;',
  108. },
  109. {
  110. key: 'getoptions',
  111. name: 'Get Options',
  112. url: 'https://tools-server.making.link/api/new/options',
  113. method: 'GET',
  114. auto: true,
  115. responseFunc: 'return res.data;',
  116. }
  117. ]
  118. },
  119. fieldConfig: [
  120. {
  121. type: 'fileupload',
  122. options: {
  123. domain: 'https://tcdn.form.making.link/',
  124. action: 'https://tools-server.making.link/api/transfer',
  125. }
  126. },
  127. {
  128. type: 'imgupload',
  129. options: {
  130. domain: 'https://tcdn.form.making.link/',
  131. action: 'https://tools-server.making.link/api/transfer',
  132. }
  133. },
  134. {
  135. type: 'select',
  136. options: {
  137. options: [
  138. {value: '1111'},
  139. {value: '2222'},
  140. {value: '3333'}
  141. ]
  142. }
  143. }
  144. ],
  145. jsonTemplates: [
  146. {
  147. title: '空白表单',
  148. enTitle: 'Empty form',
  149. json: json0,
  150. url: 'images/json00.png'
  151. },
  152. {
  153. title: '典型表单',
  154. enTitle: 'Typical form',
  155. json: json1,
  156. url: 'images/json1.png'
  157. },
  158. {
  159. title: '快速注册表单',
  160. enTitle: 'Quick Sign-up Form',
  161. json: json2,
  162. url: 'images/json2.png'
  163. },
  164. {
  165. title: '复杂表格 - 人员履历表',
  166. enTitle: 'Complex forms',
  167. json: json3,
  168. url: 'images/json3.png'
  169. },
  170. {
  171. title: '步骤表单',
  172. enTitle: 'Step form',
  173. json: json4,
  174. url: 'images/json4.png'
  175. },
  176. {
  177. title: '数据源应用 - 主子表省市区联动',
  178. enTitle: 'Data source application',
  179. json: json5,
  180. url: 'images/json5.png'
  181. },
  182. {
  183. title: '动态值 - 数据统计',
  184. enTitle: 'Event application',
  185. json: json6,
  186. url: 'images/json6.png'
  187. },
  188. {
  189. title: '响应式表单',
  190. enTitle: 'Reactive form',
  191. json: json7,
  192. url: 'images/json7.png'
  193. },
  194. {
  195. title: '复杂表格 - 动态增减表单项',
  196. enTitle: 'Complex forms',
  197. json: json8,
  198. url: 'images/json8.png'
  199. },
  200. {
  201. title: '可查询的分页数据列表',
  202. enTitle: 'Searchable paging data list',
  203. json: json9,
  204. url: 'images/json9.png'
  205. },
  206. {
  207. title: '中后台数据增删改查',
  208. enTitle: 'CRUD',
  209. json: json10,
  210. url: 'images/json10.png'
  211. },
  212. {
  213. title: '用户弹框选择',
  214. enTitle: 'The user select from the box',
  215. json: json11,
  216. url: 'images/json11.png'
  217. }
  218. ],
  219. fieldModels: [{fieldId: 'ID'}]
  220. }
  221. },
  222. mounted () {
  223. },
  224. methods: {
  225. }
  226. }
  227. </script>