SourceGroup.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. Ext.define('erp.view.hr.emplmana.SourceGroup',{
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. layout: 'anchor',
  10. items: [{
  11. xtype: 'erpFormPanel',
  12. anchor: '100% 30%',
  13. deleteUrl: 'hr/employee/deleteSourceGroupAllDetail.action',
  14. updateUrl: 'hr/employee/updateSourceGroupDetail.action',
  15. getIdUrl: 'common/getId.action?seq=CS$USERRESOURCE_SEQ',
  16. },{
  17. xtype: 'erpGridPanel2',
  18. anchor: '100% 70%',
  19. /*
  20. xtype: 'gridpanel',
  21. id: 'grid',
  22. anchor : '100% 70%',
  23. requires: ['erp.view.core.plugin.CopyPasteMenu'],
  24. columns: [{
  25. style :"text-align:center",
  26. text:'<font color="red">资源编号</font>',
  27. logic:"necessaryField",
  28. width: 160,
  29. dataIndex: 'sc_code',
  30. editor: {
  31. xtype: 'dbfindtrigger'
  32. },
  33. dbfind: 'Source|sc_code',
  34. allowBlank:false,
  35. },{
  36. style :"text-align:center",
  37. text: 'ID',
  38. width: 0,
  39. hidden : true,
  40. dataIndex: 'sc_id',
  41. },{
  42. style :"text-align:center",
  43. text: '资源名称',
  44. width: 120,
  45. dataIndex: 'sc_name',
  46. },{
  47. style :"text-align:center",
  48. xtype: 'actioncolumn',
  49. header: '操作',
  50. width: 100,
  51. align: 'center',
  52. items: [{
  53. icon: basePath + 'resource/images/16/delete.png',
  54. tooltip: '删除',
  55. handler: function(view, rowIndex, colIndex) {
  56. var rec = view.getStore().getAt(rowIndex);
  57. view.ownerCt.deleteRecord(rec);
  58. }
  59. }]
  60. }],
  61. necessaryField: 'sc_code',
  62. GridUtil: Ext.create('erp.util.GridUtil'),
  63. dbfinds: [{
  64. field: 'sc_code',
  65. dbGridField: 'sc_code'
  66. },{
  67. field: 'sc_name',
  68. dbGridField: 'sc_name'
  69. },{
  70. field: 'sc_id',
  71. dbGridField: 'sc_id'
  72. }],
  73. columnLines: true,
  74. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  75. clicksToEdit: 1
  76. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  77. store: new Ext.data.Store({
  78. fields: ['sc_id', 'sc_code', 'sc_name'],
  79. data: [{},{},{},{}]
  80. }),
  81. deleteRecord: function(record) {
  82. if(record.get('sc_id') && record.get('sc_id') >= 0) {
  83. var grid = this, url = "hr/employee/deleteSourceGroup.action";
  84. var form = Ext.getCmp('form');
  85. grid.setLoading(true);
  86. Ext.Ajax.request({
  87. url : basePath + url,
  88. params: {
  89. caller: caller,
  90. id: record.get('sc_id'),
  91. key: Ext.getCmp(form.keyField).value
  92. },
  93. method : 'post',
  94. callback : function(opt, success, response){
  95. grid.setLoading(false);
  96. success && grid.store.remove(record);
  97. }
  98. });
  99. } else {
  100. this.store.remove(record);
  101. }
  102. }
  103. */}]
  104. }]
  105. });
  106. me.callParent(arguments);
  107. }
  108. });