FormPanel.js 3.3 KB

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