engine.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. define(function (require) {
  2. return function () {
  3. var group1 = require('/yvanui/example/group1.js');
  4. var group2 = {
  5. xtype: 'group',
  6. title: '分组框',
  7. items: [[
  8. {label: '输入框1'},
  9. {label: '输入框2'},
  10. {label: '输入框3'},
  11. ]]
  12. };
  13. var $form1;
  14. return {
  15. center: {
  16. border: false,
  17. title: '简单表单',
  18. items: [
  19. {
  20. onRender: function () {
  21. $form1 = $(this);
  22. },
  23. xtype: 'formgroup',
  24. title: '表单1',
  25. items: [
  26. [
  27. {name: 'whCode', xtype: 'numberbox', label: '仓库编号', maxlength: 5},
  28. {name: 'whName', label: '仓库名称', maxlength: 5}
  29. ], [
  30. {
  31. xtype: 'numberbox',
  32. name: 'planPrice',
  33. label: '计划价(¥)',
  34. // validType: 'gtZeroCon',
  35. prompt: '填写数字',
  36. labelWidth: 120,
  37. required: true,
  38. maxlength: 9,
  39. min: 0,
  40. precision: 2,
  41. }
  42. ], [
  43. {xtype: 'datebox', name: 'createAt', label: '新增日期', required: true},
  44. {xtype: 'datetimebox', name: 'createAtTime', label: '新增时间', required: true},
  45. ], [
  46. {
  47. xtype: 'yvselect', name: 'beActive', label: '是否活动', required: true, data: [
  48. {id: 'Y', text: '是'},
  49. {id: 'N', text: '否'}
  50. ], onChange: function (v) {
  51. $.yvan.msg(v);
  52. }
  53. },
  54. //{ xtype: 'yvselect', name: 'packingType', label: '系统标准', required: true, data: $.yvan.bizDict('packingType').combo() },
  55. {
  56. xtype: 'yvselect', name: 'packingType', label: '系统标准', required: true, data: [
  57. {id: '0', text: '未配置'},
  58. {id: '1', text: '现款'},
  59. {id: '2', text: '款到发货'},
  60. {id: '3', text: '货到收款'},
  61. {id: '4', text: '货款在途'},
  62. {id: '5', text: '协议欠款'},
  63. {id: '6', text: '货款已付'},
  64. {id: '7', text: '电汇'},
  65. {id: '9', text: '销售抵款'},
  66. {id: '10', text: '货到付支'},
  67. {id: '11', text: '货到付电'},
  68. {id: '15', text: '限期欠款'},
  69. {id: '16', text: '临时欠款'},
  70. {id: '17', text: '代收货款'}
  71. ],
  72. onChange: function () {
  73. console.log('yvselect onchange', this, arguments);
  74. }
  75. },
  76. {name: 'whareaCode', label: '库区编号', xtype: 'textbox', required: true},
  77. {name: 'whareaName', label: '库区名称', xtype: 'searchbox', required: true},
  78. {xtype: 'hidden', name: 'whareaID'}
  79. ], [
  80. {xtype: 'offset'},
  81. {xtype: 'checkbox', label: '多选1', name: 'checkA11', value: 99},
  82. {xtype: 'checkbox', label: '多选2', name: 'checkA12', value: 99, checked: true},
  83. {xtype: 'checkbox', label: '多选3', name: 'checkA13', value: 99},
  84. {xtype: 'checkbox', label: '多选4-禁用', name: 'checkA14', value: 99, disabled: true},
  85. ], [
  86. {xtype: 'offset'},
  87. {xtype: 'checkbox', label: '多选1', name: 'checkA21', value: 99},
  88. {xtype: 'checkbox', label: '多选2', name: 'checkA22', value: 99},
  89. {xtype: 'checkbox', label: '多选3', name: 'checkA23', value: 99, checked: true},
  90. {xtype: 'checkbox', label: '多选4-禁用', name: 'checkA24', value: 99, disabled: true},
  91. ], [
  92. {xtype: 'offset'},
  93. {xtype: 'radiobutton', label: '单选1-禁用', name: 'rb', value: 'a', disabled: true},
  94. {xtype: 'radiobutton', label: '单选2', name: 'rb', value: 'b'},
  95. {xtype: 'radiobutton', label: '单选3', name: 'rb', value: 'c'},
  96. {xtype: 'radiobutton', label: '单选4', name: 'rb', value: 'd', checked: true},
  97. ], [
  98. {xtype: 'offset'},
  99. {
  100. xtype: 'button', text: '提交', class: 'button-blue', onClick: function () {
  101. var vr = $form1.formGet(true);
  102. if (!vr.validate) {
  103. $.yvan.msg('校验未通过!');
  104. console.log(vr);
  105. return;
  106. }
  107. $.yvan.alert('<pre>' + JSON.stringify(vr, null, ' ') + '</pre>');
  108. }
  109. }, {
  110. xtype: 'button', text: '清空', class: 'button-gray', onClick: function () {
  111. $form1.formClear();
  112. }
  113. }, {
  114. xtype: 'button', text: '设值', class: 'button-yellow', onClick: function () {
  115. $form1.formSet({
  116. createAt: $.yvan.getMoment().format('YYYY-MM-DD'),
  117. createAtTime: $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss'),
  118. beActive: 'Y',
  119. packingType: '17',
  120. whareaCode: 'AA',
  121. whareaName: 'BB',
  122. checkA11: 99,
  123. checkA12: 0,
  124. checkA13: 0,
  125. checkA14: 99,
  126. checkA21: 99,
  127. checkA22: 0,
  128. checkA23: 0,
  129. checkA24: 0,
  130. rb: 'a'
  131. });
  132. }
  133. },
  134. ]
  135. ]
  136. },
  137. group1,
  138. group2
  139. ]
  140. }
  141. };
  142. };
  143. });