JNodeManSetField.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. console.log(text[0]);
  34. for(var i=1; i<=me.tfnumber; i++){
  35. console.log(text[i-1]);
  36. me.add({
  37. xtype:'multifield',
  38. name :'nodedealmancode',
  39. secondname :'nodedealman',
  40. fieldLabel:'节点'+i,
  41. value:text[i-1].split('#')[0],
  42. secondvalue:text[i-1].split('#')[1]
  43. });
  44. }
  45. } else {
  46. f.hide();
  47. }
  48. // me.expand(true);
  49. }
  50. },
  51. getSubmitData : function() {
  52. var names = new Array();
  53. var c = this.query('multifield');
  54. Ext.each(c, function(){
  55. if(!Ext.isEmpty(this.value)) {
  56. names.push(this.value+"#"+this.secondvalue);
  57. }
  58. });
  59. return names.join(';');
  60. },
  61. addItem: function(count){
  62. var me = this; this.removeAll();
  63. for(var i=1;i<parseInt(count)+1;i++){
  64. this.add({
  65. xtype:'multifield',
  66. name :'nodedealmancode',
  67. secondname :'nodedealman',
  68. fieldLabel:'节点'+i,
  69. listeners : {
  70. aftertrigger : function(t, r) {
  71. t.setValue(r.get('em_code'));
  72. }
  73. }
  74. });
  75. }
  76. me.expand(true);
  77. }
  78. });