Source.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. Ext.define('erp.view.pm.mes.Source',{
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. id:'SourceViewport',
  10. layout: 'anchor',
  11. items: [{
  12. xtype: 'erpFormPanel',
  13. anchor: '100% 30%',
  14. saveUrl: 'pm/mes/saveSource.action',
  15. deleteUrl: 'pm/mes/deleteSource.action',
  16. updateUrl: 'pm/mes/updateSource.action',
  17. getIdUrl: 'common/getId.action?seq=Source_SEQ',
  18. submitUrl: 'pm/mes/submitSource.action',
  19. auditUrl: 'pm/mes/auditSource.action',
  20. resAuditUrl: 'pm/mes/resAuditSource.action',
  21. resSubmitUrl: 'pm/mes/resSubmitSource.action',
  22. keyField: 'sc_id',
  23. codeField: 'sc_code',
  24. statusField: 'sc_status',
  25. statuscodeField: 'sc_statuscode'
  26. },{
  27. xtype: 'gridpanel',
  28. id: 'grid',
  29. anchor : '100% 70%',
  30. requires: ['erp.view.core.plugin.CopyPasteMenu'],
  31. columns: [{
  32. style :"text-align:center",
  33. text: '组别编号',
  34. width: 160,
  35. dataIndex: 'ur_groupcode',
  36. editor: {
  37. xtype: 'dbfindtrigger'
  38. },
  39. dbfind: 'CSUSERGROUP|UG_CODE',
  40. ignore: true,
  41. },{
  42. style :"text-align:center",
  43. text: 'ID',
  44. width: 0,
  45. hidden : true,
  46. dataIndex: 'ur_id',
  47. ignore: true,
  48. },{
  49. style :"text-align:center",
  50. text: '组别名称',
  51. width: 120,
  52. dataIndex: 'ug_name',
  53. ignore: true,
  54. logic:'ignore'
  55. },{
  56. text: '岗位资源编号',
  57. style :"text-align:center",
  58. width: 0,
  59. hidden : true,
  60. dataIndex: 'ur_resourcecode',
  61. ignore: true
  62. },{
  63. text: '维护人',
  64. style :"text-align:center",
  65. width: 100,
  66. hidden : false,
  67. readOnly: true,
  68. dataIndex: 'ug_inman',
  69. logic: 'ignore'
  70. },{
  71. text: '维护日期',
  72. style :"text-align:center",
  73. width: 120,
  74. hidden : false,
  75. readOnly: true,
  76. xtype: "datecolumn",
  77. dataIndex: 'ug_indate',
  78. logic: 'ignore'
  79. },{
  80. style :"text-align:center",
  81. xtype: 'actioncolumn',
  82. header: '操作',
  83. width: 100,
  84. align: 'center',
  85. items: [{
  86. icon: basePath + 'resource/images/16/delete.png',
  87. tooltip: '删除',
  88. handler: function(view, rowIndex, colIndex) {
  89. var rec = view.getStore().getAt(rowIndex);
  90. view.ownerCt.deleteRecord(rec);
  91. }
  92. }]
  93. }],
  94. necessaryField: 'ur_groupcode',
  95. GridUtil: Ext.create('erp.util.GridUtil'),
  96. dbfinds: [{
  97. field: 'ur_groupcode',
  98. dbGridField: 'UG_CODE'
  99. },{
  100. field: 'ug_name',
  101. dbGridField: 'UG_NAME'
  102. },{
  103. field: 'ug_inman',
  104. dbGridField: 'UG_INMAN'
  105. },{
  106. field: 'ug_indate',
  107. dbGridField: 'UG_INDATE'
  108. }],
  109. columnLines: true,
  110. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  111. clicksToEdit: 1
  112. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  113. store: new Ext.data.Store({
  114. fields: ['ur_groupcode', 'ur_id', 'ug_name','ur_resourcecode'],
  115. data: [{},{},{},{}]
  116. }),
  117. deleteRecord: function(record) {
  118. if(record.get('ur_id') && record.get('ur_id') >= 0) {
  119. var grid = this, url = "pm/mes/deleteSourceDetail.action";
  120. var form = Ext.getCmp('form');
  121. grid.setLoading(true);
  122. Ext.Ajax.request({
  123. url : basePath + url,
  124. params: {
  125. caller: caller,
  126. id: record.get('ur_id'),
  127. key: Ext.getCmp(form.keyField).value
  128. },
  129. method : 'post',
  130. callback : function(opt, success, response){
  131. grid.setLoading(false);
  132. success && grid.store.remove(record);
  133. }
  134. });
  135. } else {
  136. this.store.remove(record);
  137. }
  138. }
  139. }]
  140. }]
  141. });
  142. me.callParent(arguments);
  143. }
  144. });