FormPanel.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. Ext.define('saas.view.sys.baseconfig.FormPanel', {
  2. extend: 'Ext.form.Panel',
  3. xtype: 'sys-baseconfig-formpanel',
  4. controller: 'sys-baseconfig-formpanel',
  5. viewModel: 'sys-baseconfig-formpanel',
  6. //工具类
  7. FormUtil: Ext.create('saas.util.FormUtil'),
  8. BaseUtil: Ext.create('saas.util.BaseUtil'),
  9. //字段属性
  10. _idField: 'id',
  11. _readUrl:'/api/commons/configs/list',
  12. _saveUrl:'/api/commons/configs/update',
  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:'{cucaltor}',
  37. displayField : "display",
  38. editable:false,
  39. hideTrigger : false,
  40. maxLength : 100.0,
  41. width:500,
  42. minValue : null,
  43. queryMode : "local",
  44. valueField : "value",
  45. xtype : "combo",
  46. value:'WACC',
  47. store:{
  48. fields: ['display', 'value'],
  49. data : [
  50. {"display":"加权平均法", "value":'WACC'},
  51. {"display":"先进先出法", "value":'FIFO'}
  52. ]
  53. },
  54. name : "cucaltor",
  55. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  56. fieldLabel : "库存计算方式",
  57. allowBlank : false,
  58. },{
  59. bind:'{defaultCurrency}',
  60. xtype : "textfield",
  61. name : "defaultCurrency",
  62. fieldLabel : "本位币",
  63. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  64. readOnly:true,
  65. ignore:true,
  66. width:500
  67. },{
  68. bind:'{enableB2B}',
  69. xtype: 'combobox',
  70. allowBlank: false,
  71. value:0,
  72. editable: false,
  73. queryMode: 'local',
  74. displayField: 'pi_status',
  75. valueField: 'pi_statuscode',
  76. store: Ext.create('Ext.data.ArrayStore', {
  77. fields: ['pi_statuscode', 'pi_status'],
  78. data: [
  79. [1, "是"],
  80. [0, "否"]
  81. ]
  82. }),
  83. name : "enableB2B",
  84. fieldLabel : "是否开通B2B",
  85. beforeLabelTextTpl : "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>",
  86. width:500
  87. }],
  88. initComponent: function () {
  89. var me = this,
  90. viewModel = me.getViewModel();
  91. var url = me._readUrl;
  92. saas.util.BaseUtil.request({url })
  93. .then(function(res) {
  94. if(res.success) {
  95. var list = res.data.list;
  96. if(list.length>0){
  97. var d = {};
  98. Ext.each(list, function(item, index){
  99. d[item.code] = item.data;
  100. });
  101. viewModel.setData(d);
  102. viewModel._parent.setData(d);
  103. }
  104. }
  105. })
  106. .catch(function(e) {
  107. console.error(e);
  108. });
  109. me.callParent(arguments);
  110. },
  111. refresh:function(){
  112. this.ownerCt.setTitle('参数设置')
  113. }
  114. });