ProductSNRule.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. editor: {
  71. xtype: "textfield",
  72. hideTrigger: true,
  73. store: null,
  74. queryMode: "local",
  75. editable: true,
  76. cls: null,
  77. minValue: "0",
  78. maxLength: 4000,
  79. positiveNum: false
  80. }
  81. },{
  82. style :"text-align:center",
  83. text: '<font color="red">长度</font>',
  84. logic:"necessaryField",
  85. width: 80,
  86. dataIndex: 'psr_length',
  87. editor: {
  88. xtype: "textfield",
  89. hideTrigger: true,
  90. store: null,
  91. queryMode: "local",
  92. editable: true,
  93. cls: null,
  94. minValue: "0",
  95. maxLength: 4000,
  96. positiveNum: false
  97. },
  98. xtype: 'numbercolumn',
  99. align: "right",
  100. format: ""
  101. },{
  102. style :"text-align:center",
  103. text: '更新人',
  104. width: 100,
  105. dataIndex: 'psr_inman'
  106. },{
  107. style :"text-align:center",
  108. text: '更新日期',
  109. width: 150,
  110. dataIndex: 'psr_indate',
  111. readOnly: true,
  112. align:"left",
  113. format:"Y-m-d H:i:s",
  114. xtype:"datecolumn"
  115. },{
  116. style :"text-align:center",
  117. xtype: 'actioncolumn',
  118. header: '操作',
  119. width: 100,
  120. align: 'center',
  121. items: [{
  122. icon: basePath + 'resource/images/16/delete.png',
  123. tooltip: '删除',
  124. handler: function(view, rowIndex, colIndex) {
  125. var rec = view.getStore().getAt(rowIndex);
  126. warnMsg('确定删除?', function(btn){
  127. if(btn == 'yes'){
  128. view.ownerCt.deleteRecord(rec);
  129. } else if(btn == 'no'){
  130. return;
  131. }
  132. })
  133. }
  134. }]
  135. }],
  136. GridUtil: Ext.create('erp.util.GridUtil'),
  137. dbfinds: [],
  138. columnLines: true,
  139. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  140. clicksToEdit: 1
  141. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  142. store: new Ext.data.Store({
  143. fields: ['psr_id', 'psr_type', 'psr_prefix', 'psr_length', 'psr_inman','psr_indate'],
  144. data: [{},{}]
  145. }),
  146. necessaryFields:[ 'psr_length','psr_type'],
  147. deleteRecord: function(record) {
  148. if(record.get('psr_id') && record.get('psr_id') >= 0) {
  149. var grid = this, url = "scm/product/deleteProductSNRuleDetail.action";
  150. var form = Ext.getCmp('form');
  151. grid.setLoading(true);
  152. Ext.Ajax.request({
  153. url : basePath + url,
  154. params: {
  155. caller: caller,
  156. id: record.get('psr_id'),
  157. pr_id: Ext.getCmp(form.keyField).value
  158. },
  159. method : 'post',
  160. callback : function(opt, success, response){
  161. grid.setLoading(false);
  162. success && window.location.reload();
  163. }
  164. });
  165. }else{
  166. showError('删除明细为空!');
  167. }
  168. }
  169. }]
  170. }]
  171. });
  172. me.callParent(arguments);
  173. }
  174. });