group1.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. define({
  2. xtype: 'formgroup',
  3. title: '分组框',
  4. items: [
  5. [
  6. {label: '三列必填', name: 'f1', required: true, span: 3}
  7. ], [
  8. {label: '两列宽', name: 'f2', required: true, span: 2}
  9. ], [
  10. {label: '验证手机', name: 'f3', xtype: 'numberbox', required: true, validType: 'phoneNum'},
  11. {label: '验证邮箱', name: 'f4', validType: 'email'},
  12. {label: '自定义验证', name: 'f5',},
  13. {label: '验证日期', name: 'f6', xtype: 'datebox'},
  14. ],
  15. [
  16. {label: '验证身份证', name: 'f7', span: 3},
  17. {label: '自定义验证你我他', name: 'f8', labelWidth: 'auto', required: true}
  18. ],
  19. [
  20. {label: '数字范围', name: 'f9', xtype: 'numberbox', prompt: '¥', width: 150},
  21. {label: '-', name: 'f10', xtype: 'numberbox', prompt: '¥', labelWidth: 'auto', width: 90},
  22. ],
  23. [
  24. {label: '开关', name: 'f11', xtype: 'switchbutton'}
  25. ],
  26. [
  27. {
  28. label: '选择框',
  29. name: 'f12',
  30. xtype: 'combobox',
  31. prompt: '全部',
  32. editable: false,
  33. data: [
  34. {id: '0', text: '未审核'},
  35. {id: '1', text: '已审核'},
  36. {id: '3', text: '审核未通过'},
  37. {id: '5', text: '已禁用'}
  38. ]
  39. },
  40. {
  41. label: '搜索选择框',
  42. xtype: 'combobox',
  43. name: 'f13',
  44. editable: true,
  45. prompt: '全部',
  46. data: [
  47. {id: '0', text: '未配置'},
  48. {id: '1', text: '现款'},
  49. {id: '2', text: '款到发货'},
  50. {id: '3', text: '货到收款'},
  51. {id: '4', text: '货款在途'},
  52. {id: '5', text: '协议欠款'},
  53. {id: '6', text: '货款已付'},
  54. {id: '7', text: '电汇'},
  55. {id: '9', text: '销售抵款'},
  56. {id: '10', text: '货到付支'},
  57. {id: '11', text: '货到付电'},
  58. {id: '15', text: '限期欠款'},
  59. {id: '16', text: '临时欠款'},
  60. {id: '17', text: '代收货款'}
  61. ]
  62. }
  63. ],
  64. [
  65. {label: '新增时间', name: 'f14', xtype: 'datebox', width: '210px'},
  66. {label: '-', name: 'f15', xtype: 'datebox', labelWidth: 'auto', width: '144px'},
  67. ],
  68. [
  69. {
  70. xtype: 'checkgroup',
  71. name: 'sg1',
  72. label: '多选组合框',
  73. data: [
  74. {id: 'value1', text: '选项1'},
  75. {id: 'value2', text: '选项2'},
  76. {id: 'value3', text: '选项3'},
  77. {id: 'value4', text: '选项4'},
  78. {id: 'value5', text: '选项5'}
  79. ]
  80. },
  81. ], [
  82. {
  83. xtype: 'radiogroup',
  84. name: 'sg2',
  85. label: '单选组合框',
  86. data: [
  87. {id: 'value21', text: '选项21'},
  88. {id: 'value22', text: '选项22'},
  89. {id: 'value23', text: '选项23'},
  90. {id: 'value24', text: '选项24'},
  91. {id: 'value25', text: '选项25'}
  92. ]
  93. }
  94. ],
  95. [
  96. {xtype: 'offset'},
  97. {
  98. xtype: 'button', text: '提交', class: 'button-blue', onClick: function () {
  99. var vr = $(this).closest('form').formGet(true);
  100. if (!vr.validate) {
  101. $.yvan.msg('校验未通过!');
  102. return;
  103. }
  104. $.yvan.alert('<pre>' + JSON.stringify(vr, null, ' ') + '</pre>');
  105. }
  106. },
  107. {
  108. xtype: 'button', text: '清空', class: 'button-grey', onClick: function () {
  109. $(this).closest('form').formClear();
  110. }
  111. },
  112. {
  113. xtype: 'button', text: '设值', class: 'button-yellow', onClick: function () {
  114. $(this).closest('form').formSet({
  115. f1: 'f1',
  116. f2: 'f2',
  117. f3: '13878787878',
  118. f4: '123456@qq.com',
  119. f5: 'f5',
  120. f6: 'f6',
  121. f7: 'f7',
  122. f8: 'f8',
  123. f9: '9',
  124. f10: '10',
  125. f11: 'f11',
  126. f12: '1',
  127. f13: '11',
  128. f14: 'f14',
  129. f15: 'f15',
  130. sg1: ["value1", "value2", "value4"],
  131. sg2: "value24"
  132. });
  133. }
  134. }
  135. ]
  136. ]
  137. });