ProductSNRule.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. Ext.define('erp.view.scm.product.ProductSNRule',{
  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. bodyStyle: 'background:#f1f1f1;',
  11. items: [{
  12. xtype: 'erpFormPanel',
  13. anchor: '100% 30%',
  14. saveUrl: 'scm/product/saveProductSNRule.action',
  15. deleteUrl: 'scm/product/deleteProductSNRule.action',
  16. updateUrl: 'scm/product/updateProductSNRule.action',
  17. getIdUrl: 'common/getId.action?seq=PRODUCTSNRULE_SEQ',
  18. keyField: 'psr_id'
  19. },{
  20. xtype: 'gridpanel',
  21. id: 'grid',
  22. anchor : '100% 70%',
  23. columns: [{
  24. style :"text-align:center",
  25. text: '<font color="red">类型</font>',
  26. width: 100,
  27. dataIndex: 'psr_type',
  28. editor:{
  29. xtype:"combo",
  30. format:"",
  31. hideTrigger:false,
  32. store:{
  33. fields:[
  34. 'display',
  35. 'value'
  36. ],
  37. data:[
  38. {
  39. display:"转换前",
  40. value:"before"
  41. },
  42. {
  43. display:"转换后",
  44. value:"after"
  45. }
  46. ]
  47. },
  48. queryMode:"local",
  49. displayField:"display",
  50. valueField:"value",
  51. editable:false,
  52. cls:null,
  53. minValue:null,
  54. maxLength:4000,
  55. positiveNum:false
  56. },
  57. xtype: "combocolumn"
  58. },{
  59. style :"text-align:center",
  60. text: 'ID',
  61. width: 0,
  62. hidden : true,
  63. dataIndex: 'psr_id',
  64. ignore: true,
  65. },{
  66. style :"text-align:center",
  67. text: '<font color="red">序列号前缀</font>',
  68. width: 120,
  69. dataIndex: 'psr_prefix',
  70. logic:"necessaryField",
  71. editor: {
  72. xtype: "textfield",
  73. hideTrigger: true,
  74. store: null,
  75. queryMode: "local",
  76. editable: true,
  77. cls: null,
  78. minValue: "0",
  79. maxLength: 4000,
  80. positiveNum: false
  81. }
  82. },{
  83. style :"text-align:center",
  84. text: '<font color="red">长度</font>',
  85. logic:"necessaryField",
  86. width: 80,
  87. dataIndex: 'psr_length',
  88. editor: {
  89. xtype: "textfield",
  90. hideTrigger: true,
  91. store: null,
  92. queryMode: "local",
  93. editable: true,
  94. cls: null,
  95. minValue: "0",
  96. maxLength: 4000,
  97. positiveNum: false
  98. },
  99. xtype: 'numbercolumn',
  100. align: "right",
  101. format: ""
  102. },{
  103. style :"text-align:center",
  104. text: '更新人',
  105. width: 100,
  106. dataIndex: 'psr_inman'
  107. },{
  108. style :"text-align:center",
  109. text: '更新日期',
  110. width: 150,
  111. dataIndex: 'psr_indate',
  112. readOnly: true,
  113. align:"left",
  114. format:"Y-m-d H:i:s",
  115. xtype:"datecolumn"
  116. },{
  117. style :"text-align:center",
  118. xtype: 'actioncolumn',
  119. header: '操作',
  120. width: 100,
  121. align: 'center',
  122. items: [{
  123. icon: basePath + 'resource/images/16/delete.png',
  124. tooltip: '删除',
  125. handler: function(view, rowIndex, colIndex) {
  126. var rec = view.getStore().getAt(rowIndex);
  127. warnMsg('确定删除?', function(btn){
  128. if(btn == 'yes'){
  129. view.ownerCt.deleteRecord(rec);
  130. } else if(btn == 'no'){
  131. return;
  132. }
  133. })
  134. }
  135. }]
  136. }],
  137. GridUtil: Ext.create('erp.util.GridUtil'),
  138. dbfinds: [],
  139. columnLines: true,
  140. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  141. clicksToEdit: 1
  142. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  143. store: new Ext.data.Store({
  144. fields: ['psr_id', 'psr_type', 'psr_prefix', 'psr_length', 'psr_inman','psr_indate'],
  145. data: [{},{}]
  146. }),
  147. necessaryFields:['psr_prefix', 'psr_length','psr_type'],
  148. deleteRecord: function(record) {
  149. if(record.get('psr_id') && record.get('psr_id') >= 0) {
  150. var grid = this, url = "scm/product/deleteProductSNRuleDetail.action";
  151. var form = Ext.getCmp('form');
  152. grid.setLoading(true);
  153. Ext.Ajax.request({
  154. url : basePath + url,
  155. params: {
  156. caller: caller,
  157. id: record.get('psr_id'),
  158. pr_id: Ext.getCmp(form.keyField).value
  159. },
  160. method : 'post',
  161. callback : function(opt, success, response){
  162. grid.setLoading(false);
  163. success && window.location.reload();
  164. }
  165. });
  166. }else{
  167. showError('删除明细为空!');
  168. }
  169. }
  170. }]
  171. }]
  172. });
  173. me.callParent(arguments);
  174. }
  175. });