FormPanel.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. bbar:{
  28. frame:true,
  29. items:['->',{
  30. text:'保存',
  31. formBind:true,
  32. name:'save'
  33. },'->']
  34. },
  35. items: [{
  36. bind:'{companyId}',
  37. xtype: 'hidden',
  38. name: 'companyId',
  39. fieldLabel: 'id',
  40. allowBlank: true,
  41. width:600
  42. },{
  43. bind:'{en_name}',
  44. xtype: 'textfield',
  45. name: 'en_name',
  46. fieldLabel: '公司名称',
  47. allowBlank: true,
  48. editable:false,
  49. readOnly:true,
  50. width:600
  51. },{
  52. bind:'{en_address}',
  53. xtype: 'textfield',
  54. name: 'en_address',
  55. fieldLabel: '公司地址',
  56. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  57. allowBlank: false,
  58. width:600
  59. },{
  60. bind:'{en_tel}',
  61. xtype: 'textfield',
  62. name: 'en_tel',
  63. fieldLabel: '电话',
  64. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  65. allowBlank: false,
  66. width:500
  67. },{
  68. bind:'{en_fax}',
  69. xtype: 'textfield',
  70. name: 'en_fax',
  71. fieldLabel: '传真',
  72. allowBlank: true,
  73. width:500
  74. },{
  75. bind:'{en_begindate}',
  76. xtype : "datefield",
  77. name : "en_begindate",
  78. format:'Y-m-d H:i:s',
  79. fieldLabel : "开账日期",
  80. allowBlank : true,
  81. editable:false,
  82. hideTrigger:true,
  83. readOnly:true,
  84. width:500
  85. },{
  86. bind:'{en_pricemethod}',
  87. displayField : "display",
  88. editable:false,
  89. hideTrigger : false,
  90. maxLength : 100.0,
  91. width:500,
  92. minValue : null,
  93. queryMode : "local",
  94. valueField : "value",
  95. xtype : "combo",
  96. value:'WACC',
  97. store:{
  98. fields: ['display', 'value'],
  99. data : [
  100. {"display":"加权平均法", "value":'WACC'},
  101. {"display":"先进先出法", "value":'FIFO'}
  102. ]
  103. },
  104. name : "en_pricemethod",
  105. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  106. fieldLabel : "库存计算方式",
  107. allowBlank : false,
  108. },{
  109. bind:'{en_signet}',
  110. name : "en_signet",
  111. fieldLabel : "打印章上传",
  112. allowBlank : false,
  113. width:500,
  114. xtype: 'filefield',
  115. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  116. emptyText: '请选择图片',
  117. buttonText: '',
  118. buttonConfig: {
  119. iconCls: 'x-fa fa-picture-o'
  120. }
  121. },{
  122. bind:'{en_logo}',
  123. name : "en_logo",
  124. fieldLabel : "Logo上传",
  125. allowBlank : false,
  126. width:500,
  127. xtype: 'filefield',
  128. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  129. emptyText: '请选择图片',
  130. buttonText: '',
  131. buttonConfig: {
  132. iconCls: 'x-fa fa-picture-o'
  133. }
  134. },{
  135. ignore:true,
  136. bind:'{updateTime}',
  137. xtype : "datefield",
  138. name : "updateTime",
  139. fieldLabel : "更新时间",
  140. allowBlank : true,
  141. hideTrigger:true,
  142. format:'Y-m-d H:i:s',
  143. editable:false,
  144. readOnly:true,
  145. width:500,
  146. }],
  147. initComponent: function () {
  148. var me = this,
  149. viewModel = me.getViewModel();
  150. var url = me._readUrl;
  151. me.BaseUtil.request({url })
  152. .then(function(res) {
  153. if(res.success) {
  154. var d = res.data;
  155. viewModel.setData(d)
  156. }
  157. })
  158. .catch(function(response) {
  159. console.error(response);
  160. });
  161. me.callParent(arguments);
  162. },
  163. refresh:function(){
  164. this.ownerCt.setTitle('参数设置')
  165. }
  166. });