JNodeManSetField.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Ext.define('erp.view.ma.jprocess.JNodeManSetField',{
  2. extend: 'Ext.form.FieldSet',
  3. id: 'JnodeMan',
  4. alias: 'widget.JNodeManSetField',
  5. autoScroll:true,
  6. collapsible: true,
  7. collapsed: true,
  8. title: '',
  9. style: 'background:#f1f1f1;',
  10. margin: '2 2 2 2',
  11. tfnumber: 0,
  12. requiers:['erp.view.ma.jprocess.MultiField'],
  13. initComponent: function() {
  14. this.columnWidth = 1;//强制占一行
  15. this.cls = '';
  16. this.callParent(arguments);
  17. this.setTitle('<img src="' + basePath + 'resource/images/icon/detail.png" width=20 height=20/>&nbsp;&nbsp;'+this.fieldLabel);
  18. },
  19. layout:'column',
  20. defaults:{
  21. columnWidth:1/3
  22. },
  23. items: [],
  24. setValue: function(value){
  25. this.value = value;
  26. },
  27. listeners : {
  28. afterrender: function(f){
  29. var me = this;
  30. if(f.value != null && f.value.toString().trim() != ''){
  31. var text = f.value.split(';');
  32. me.tfnumber = text.length;
  33. for(var i=1; i<=me.tfnumber; i++){
  34. me.add({
  35. xtype:'multifield',
  36. name :'nodedealmancode',
  37. secondname :'nodedealman',
  38. fieldLabel:'节点'+i,
  39. value:text[i-1].split('#')[0],
  40. secondvalue:text[i-1].split('#')[1]
  41. });
  42. }
  43. } else {
  44. f.hide();
  45. }
  46. // me.expand(true);
  47. }
  48. },
  49. getSubmitData : function() {
  50. var names = new Array();
  51. var c = this.query('multifield');
  52. Ext.each(c, function(){
  53. if(!Ext.isEmpty(this.value)) {
  54. names.push(this.value+"#"+this.secondvalue);
  55. }
  56. });
  57. return names.join(';');
  58. },
  59. addItem: function(count){
  60. var me = this; this.removeAll();
  61. for(var i=1;i<parseInt(count)+1;i++){
  62. this.add({
  63. xtype:'multifield',
  64. name :'nodedealmancode',
  65. secondname :'nodedealman',
  66. fieldLabel:'节点'+i,
  67. listeners : {
  68. aftertrigger : function(t, r) {
  69. t.setValue(r.get('em_code'));
  70. }
  71. }
  72. });
  73. }
  74. me.expand(true);
  75. }
  76. });