FormPanel.js 4.6 KB

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