Test.vue 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div>
  3. <fm-generate-form
  4. :data="jsonData"
  5. :remote="remoteFuncs"
  6. :value="editData"
  7. :remote-option="dynamicData"
  8. ref="generateForm"
  9. >
  10. </fm-generate-form>
  11. <el-button type="primary" @click="handleSubmit">Submit</el-button>
  12. <el-button type="primary" @click="handleSetData">Set Data</el-button>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. data () {
  18. return {
  19. jsonData: {},
  20. editData: {},
  21. remoteFuncs: {
  22. },
  23. dynamicData: {
  24. }
  25. }
  26. },
  27. mounted () {
  28. setTimeout(() => {
  29. this.jsonData = {"list":[{"type":"table","icon":"icon-table","options":{"defaultValue":[],"customClass":"","labelWidth":100,"isLabelWidth":false,"hidden":false,"dataBind":true,"disabled":true,"required":false,"remoteFunc":"func_1605076564020","remoteOption":"option_1605076564020"},"tableColumns":[{"type":"input","icon":"icon-input","options":{"width":"200px","defaultValue":"","required":false,"requiredMessage":"","dataType":"","dataTypeCheck":false,"dataTypeMessage":"","pattern":"","patternCheck":false,"patternMessage":"","placeholder":"","customClass":"","disabled":false,"labelWidth":100,"isLabelWidth":false,"hidden":false,"dataBind":true,"showPassword":false,"remoteFunc":"func_1605076566682","remoteOption":"option_1605076566682","tableColumn":true},"name":"单行文本","novalid":{},"key":"1605076566682","model":"input_1605076566682","rules":[]},{"type":"input","icon":"icon-input","options":{"width":"200px","defaultValue":"","required":false,"requiredMessage":"","dataType":"","dataTypeCheck":false,"dataTypeMessage":"","pattern":"","patternCheck":false,"patternMessage":"","placeholder":"","customClass":"","disabled":false,"labelWidth":100,"isLabelWidth":false,"hidden":false,"dataBind":true,"showPassword":false,"remoteFunc":"func_1605076568070","remoteOption":"option_1605076568070","tableColumn":true},"name":"单行文本","novalid":{},"key":"1605076568070","model":"input_1605076568070","rules":[]},{"type":"input","icon":"icon-input","options":{"width":"200px","defaultValue":"","required":false,"requiredMessage":"","dataType":"","dataTypeCheck":false,"dataTypeMessage":"","pattern":"","patternCheck":false,"patternMessage":"","placeholder":"","customClass":"","disabled":false,"labelWidth":100,"isLabelWidth":false,"hidden":false,"dataBind":true,"showPassword":false,"remoteFunc":"func_1605076579478","remoteOption":"option_1605076579478","tableColumn":true},"name":"单行文本","novalid":{},"key":"1605076579478","model":"input_1605076579478","rules":[]}],"name":"子表单","key":"1605076564020","model":"table_1605076564020","rules":[]}],"config":{"labelWidth":100,"labelPosition":"right","size":"small","customClass":"","ui":"element","layout":"horizontal","labelCol":3,"width":"100%","hideLabel":false,"hideErrorMessage":false}}
  30. this.$nextTick(() => {
  31. this.$refs.generateForm.setData({
  32. table_1605076564020: [
  33. {
  34. input_1605076566682: '1',
  35. input_1605076568070: '2',
  36. input_1605076579478: '3'
  37. }
  38. ]
  39. })
  40. })
  41. }, 2000)
  42. },
  43. methods: {
  44. handleSubmit () {
  45. this.$refs.generateForm.getData().then(data => {
  46. // Data verification succeeded
  47. alert(JSON.stringify(data))
  48. }).catch(e => {
  49. // Data verification failed
  50. })
  51. },
  52. handleSetData () {
  53. this.$refs.generateForm.setData({
  54. table_1605076564020: [
  55. {
  56. input_1605076566682: '1',
  57. input_1605076568070: '2',
  58. input_1605076579478: '3'
  59. }
  60. ]
  61. })
  62. }
  63. }
  64. }
  65. </script>//N3OrtxpS6PTeNYPFz+JxcPSSmnaUG+albvVnpx7PQJl1HaDepL8w+t3SZpLt667ZXNJpHxN8jBiumy4T4wFYKbE2lZIWr25k8YfutXSH2lG7fgKS8L+cP4/pZX9H62pGf0r/JOjGpGGDjOo1zcbz0UGBdFhWbU6i8MnOa+sELKOK2SMkvoAywXkUTTZO1ael2Zxi3ePV4PK7fgKS8L+cP4wwhxVRzsP+u0Vf901rnORdMw2yEmyxU0DqV/Ro32AwZvQlehq+btMOYKsj1rItmqfDLqrrbeqPjE0sxn6GWUnOLmo5OQj6qeF84l3W+ZRoQsFyMTgHVKv9uBfZifckfQMVF1WQ0BtYFvYQTWaIp/MkiaW+fYjpvDuGzriOzy35u2lnx7t+/NwLpvunWR+aQqp0mhQbF6SQNN2VVaRW4cM4u7IRwbDVkPgEjN9+SKdT3DJkTrE8qLwst7OWgNvso1OJ1+licYUGac2q1R/n/hY=