ArgsField.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Ext.define('erp.view.core.form.ArgsField', {
  2. extend: 'Ext.form.FieldSet',
  3. alias: 'widget.argsfield',
  4. autoScroll:true,
  5. collapsible: true,
  6. collapsed: false,
  7. title: '',
  8. height: 22,
  9. style: 'background:#f1f1f1;',
  10. margin: '2 2 2 2',
  11. initComponent: function() {
  12. this.columnWidth = 1;//强制占一行
  13. this.cls = '';
  14. this.callParent(arguments);
  15. this.setTitle('<span><img src="' + basePath + 'resource/images/icon/detail.png" width=20 height=20/>&nbsp;&nbsp;参数设置</span>');
  16. },
  17. layout:'column',
  18. setValue: function(value){
  19. this.value = value;
  20. },
  21. getValue:function(){
  22. return "niubi";
  23. },
  24. items:[],
  25. listeners : {
  26. afterrender: function(f){
  27. var me = this;
  28. if(f.value != null && f.value.toString().trim() != ''){
  29. var text = f.value.split(',');
  30. for(var i=1; i<=text.length; i++){
  31. me.addItem(Ext.create('erp.view.core.form.ArgTypeField', {
  32. xtype: 'argtypefield',
  33. name: '参数' + i,
  34. columnWidth: 0.33,
  35. labelWidth: 50,
  36. readOnly: true,
  37. value: text[i-1],
  38. fieldStyle:"background:#fffac0;color:#515151;",
  39. fieldLabel:'参数' + i,
  40. listeners:{
  41. }
  42. }));
  43. }
  44. } else {
  45. me.addItem(Ext.create('Ext.form.field.TextArea', {
  46. xtype: 'textareafield',
  47. name: 'empty',
  48. columnWidth: 1,
  49. height: 30,
  50. frame: false,
  51. readOnly: true,
  52. value: '无参数',
  53. fieldLabel: '',
  54. listeners:{
  55. }
  56. }));
  57. }
  58. }
  59. },
  60. addItem: function(item){
  61. this.add(item);
  62. }
  63. });