DecomSetting.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. Ext.define('erp.view.pm.make.DecomSetting',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. initComponent : function(){
  5. var me = this;
  6. Ext.apply(me, {
  7. items: [{
  8. xtype: 'erpFormPanel',
  9. anchor: '100% 30%',
  10. /*keyField: 're_id',
  11. codeField: 're_code',
  12. statusField: 're_status',
  13. statuscodeField: 're_statuscode',*/
  14. updateUrl: 'pm/make/updateDecomSetting.action?caller='+caller,
  15. },{
  16. /*xtype: 'DecomSettingGridPanel',
  17. anchor: '100% 70%',*/
  18. xtype: 'gridpanel',
  19. id: 'grid',
  20. anchor : '100% 70%',
  21. columns: [{
  22. style :"text-align:center",
  23. text: 'ID',
  24. width: 0,
  25. dataIndex: 'msd_id'
  26. },{
  27. style :"text-align:center",
  28. text: '子件编号',
  29. width: 150,
  30. dataIndex: 'msd_fsoncode'
  31. },{
  32. style :"text-align:center",
  33. text: '名称',
  34. width: 200,
  35. dataIndex: 'pr_detail',
  36. ignore: true
  37. },{
  38. style :"text-align:center",
  39. text: '规格',
  40. width: 250,
  41. dataIndex: 'pr_spec',
  42. ignore: true
  43. },{
  44. style :"text-align:center",
  45. text: '上料工序',
  46. width: 120,
  47. dataIndex: 'msd_stepcode'
  48. },{
  49. style :"text-align:center",
  50. xtype: 'actioncolumn',
  51. header: '操作',
  52. width: 100,
  53. align: 'center',
  54. items: [{
  55. icon: basePath + 'resource/images/16/delete.png',
  56. tooltip: '删除',
  57. handler: function(view, rowIndex, colIndex) {
  58. var rec = view.getStore().getAt(rowIndex);
  59. warnMsg('确定删除?', function(btn){
  60. if(btn == 'yes'){
  61. view.ownerCt.deleteRecord(rec);
  62. } else if(btn == 'no'){
  63. return;
  64. }
  65. })
  66. }
  67. }]
  68. }],
  69. GridUtil: Ext.create('erp.util.GridUtil'),
  70. dbfinds: [],
  71. columnLines: true,
  72. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  73. clicksToEdit: 1
  74. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  75. store: new Ext.data.Store({
  76. fields: ['msd_id','msd_fsoncode', 'pr_detail','pr_spec', 'msd_stepcode'],
  77. data: []
  78. }),
  79. deleteRecord: function(record) {
  80. if(record.get('msd_id') && record.get('msd_id') >= 0) {
  81. var grid = this, url = "pm/make/deleteDecomSetting.action";
  82. var form = Ext.getCmp('form');
  83. grid.setLoading(true);
  84. Ext.Ajax.request({
  85. url : basePath + url,
  86. params: {
  87. caller: caller,
  88. id: record.get('msd_id'),
  89. key: Ext.getCmp(form.keyField).value
  90. },
  91. method : 'post',
  92. callback : function(opt, success, response){
  93. grid.setLoading(false);
  94. var res = new Ext.decode(response.responseText);
  95. if(res.exceptionInfo){
  96. showError(res.exceptionInfo);return;
  97. }
  98. if(res.success){
  99. grid.store.remove(record);
  100. };
  101. }
  102. });
  103. } else {
  104. this.store.remove(record);
  105. }
  106. }
  107. }]
  108. });
  109. me.callParent(arguments);
  110. }
  111. });