FormPanel.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Ext.define('saas.view.sys.config.FormPanel', {
  2. extend: 'Ext.form.Panel',
  3. xtype: 'sys-config-formpanel',
  4. controller: 'sys-config-formpanel',
  5. viewModel: 'sys-config-formpanel',
  6. //工具类
  7. FormUtil: Ext.create('saas.util.FormUtil'),
  8. BaseUtil: Ext.create('saas.util.BaseUtil'),
  9. //字段属性
  10. _idField: 'id',
  11. _readUrl:'/api/commons/enterprise/read',
  12. _saveUrl:'/api/commons/enterprise/save',
  13. //基础属性
  14. frame:true,
  15. initId: 0,
  16. layout: 'vbox',
  17. autoScroll: true,
  18. border: 1,
  19. bodyPadding: 5,
  20. fieldDefaults: {
  21. margin: '0 5 5 30',
  22. labelAlign: 'right',
  23. labelWidth: 90,
  24. width:300,
  25. blankText: '该字段不能为空'
  26. },
  27. tbar:{
  28. style: {
  29. 'border-bottom': '1px solid #35baf6 !important'
  30. },
  31. frame:true,
  32. items:['->',{
  33. text:'保存',
  34. formBind:true,
  35. name:'save'
  36. }]
  37. },
  38. items: [{
  39. bind:'{companyId}',
  40. xtype: 'hidden',
  41. name: 'companyId',
  42. fieldLabel: 'id',
  43. allowBlank: true,
  44. width:600
  45. },{
  46. bind:'{en_name}',
  47. xtype: 'textfield',
  48. name: 'en_name',
  49. fieldLabel: '公司名称',
  50. allowBlank: true,
  51. editable:false,
  52. readOnly:true,
  53. width:600
  54. },{
  55. bind:'{en_address}',
  56. xtype: 'textfield',
  57. name: 'en_address',
  58. fieldLabel: '公司地址',
  59. allowBlank: false,
  60. width:600
  61. },{
  62. bind:'{en_tel}',
  63. xtype: 'textfield',
  64. name: 'en_tel',
  65. fieldLabel: '电话',
  66. allowBlank: false,
  67. columnWidth: 0.25
  68. },{
  69. bind:'{en_fax}',
  70. xtype: 'textfield',
  71. name: 'en_fax',
  72. fieldLabel: '传真',
  73. allowBlank: true,
  74. columnWidth: 0.5
  75. },{
  76. bind:'{en_begindate}',
  77. xtype : "datefield",
  78. name : "en_begindate",
  79. format:'Y-m-d H:i:s',
  80. fieldLabel : "开账日期",
  81. allowBlank : true,
  82. editable:false,
  83. hideTrigger:true,
  84. readOnly:true
  85. },{
  86. bind:'{en_pricemethod}',
  87. displayField : "display",
  88. editable:false,
  89. hideTrigger : false,
  90. maxLength : 100.0,
  91. minValue : null,
  92. queryMode : "local",
  93. valueField : "value",
  94. xtype : "combo",
  95. store:{
  96. fields: ['display', 'value'],
  97. data : [
  98. {"display":"加权平均法", "value":'1'},
  99. {"display":"先进先出法", "value":'0'}
  100. ]
  101. },
  102. name : "en_pricemethod",
  103. fieldLabel : "库存计算方式",
  104. allowBlank : false,
  105. columnWidth : 0.25
  106. },{
  107. bind:'{en_signet}',
  108. xtype : "textfield",
  109. name : "en_signet",
  110. fieldLabel : "打印章上传",
  111. allowBlank : true,
  112. editable:false,
  113. columnWidth : 0.25
  114. },{
  115. ignore:true,
  116. bind:'{updateTime}',
  117. xtype : "datefield",
  118. name : "updateTime",
  119. fieldLabel : "更新时间",
  120. allowBlank : true,
  121. hideTrigger:true,
  122. format:'Y-m-d H:i:s',
  123. editable:false,
  124. readOnly:true,
  125. columnWidth : 0.25
  126. }],
  127. initComponent: function () {
  128. var me = this,
  129. viewModel = me.getViewModel();
  130. var url = me._readUrl;
  131. me.BaseUtil.request({url })
  132. .then(function(res) {
  133. if(res.success) {
  134. var d = res.data;
  135. viewModel.setData(d)
  136. }
  137. })
  138. .catch(function(response) {
  139. console.error(response);
  140. });
  141. me.callParent(arguments);
  142. }
  143. });