FormPanel.js 4.6 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. 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. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  60. allowBlank: false,
  61. width:600
  62. },{
  63. bind:'{en_tel}',
  64. xtype: 'textfield',
  65. name: 'en_tel',
  66. fieldLabel: '电话',
  67. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  68. allowBlank: false,
  69. columnWidth: 0.25
  70. },{
  71. bind:'{en_fax}',
  72. xtype: 'textfield',
  73. name: 'en_fax',
  74. fieldLabel: '传真',
  75. allowBlank: true,
  76. columnWidth: 0.5
  77. },{
  78. bind:'{en_begindate}',
  79. xtype : "datefield",
  80. name : "en_begindate",
  81. format:'Y-m-d H:i:s',
  82. fieldLabel : "开账日期",
  83. allowBlank : true,
  84. editable:false,
  85. hideTrigger:true,
  86. readOnly:true
  87. },{
  88. bind:'{en_pricemethod}',
  89. displayField : "display",
  90. editable:false,
  91. hideTrigger : false,
  92. maxLength : 100.0,
  93. minValue : null,
  94. queryMode : "local",
  95. valueField : "value",
  96. xtype : "combo",
  97. value:'WACC',
  98. store:{
  99. fields: ['display', 'value'],
  100. data : [
  101. {"display":"加权平均法", "value":'WACC'},
  102. {"display":"先进先出法", "value":'FIFO'}
  103. ]
  104. },
  105. name : "en_pricemethod",
  106. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  107. fieldLabel : "库存计算方式",
  108. allowBlank : false,
  109. columnWidth : 0.25
  110. },{
  111. bind:'{en_signet}',
  112. name : "en_signet",
  113. fieldLabel : "打印章上传",
  114. allowBlank : false,
  115. columnWidth : 0.33,
  116. xtype: 'filefield',
  117. emptyText: '请选择图片',
  118. buttonText: '',
  119. buttonConfig: {
  120. iconCls: 'x-fa fa-picture-o'
  121. }
  122. },{
  123. bind:'{en_logo}',
  124. name : "en_logo",
  125. fieldLabel : "Logo上传",
  126. allowBlank : false,
  127. columnWidth : 0.33,
  128. xtype: 'filefield',
  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. columnWidth : 0.25
  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. });