MakeSNRule.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. Ext.define('erp.view.pm.make.MakeSNRule',{
  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. updateUrl: 'pm/make/updateMakeSNRule.action',
  14. getIdUrl: 'common/getId.action?seq=MakeStepChange_SEQ',
  15. keyField: 'ma_id'
  16. },{
  17. xtype: 'gridpanel',
  18. id: 'grid',
  19. mainField: 'msr_maid',
  20. anchor : '100% 70%',
  21. columns: [{
  22. style :"text-align:center",
  23. text: '<font color="red">类型</font>',
  24. width: 100,
  25. dataIndex: 'msr_type',
  26. editor:{
  27. xtype:"combo",
  28. format:"",
  29. hideTrigger:false,
  30. store:{
  31. fields:[
  32. 'display',
  33. 'value'
  34. ],
  35. data:[
  36. {
  37. display:"转换前",
  38. value:"before"
  39. },
  40. {
  41. display:"转换后",
  42. value:"after"
  43. }
  44. ]
  45. },
  46. queryMode:"local",
  47. displayField:"display",
  48. valueField:"value",
  49. editable:false,
  50. cls:null,
  51. minValue:null,
  52. maxLength:4000,
  53. positiveNum:false
  54. },
  55. xtype: "combocolumn"
  56. },{
  57. style :"text-align:center",
  58. text: 'ID',
  59. width: 0,
  60. hidden : true,
  61. dataIndex: 'msr_id',
  62. ignore: true,
  63. },{
  64. style :"text-align:center",
  65. text: '<font color="red">序列号前缀</font>',
  66. width: 120,
  67. dataIndex: 'msr_prefix',
  68. logic:"necessaryField",
  69. editor: {
  70. xtype: "textfield",
  71. hideTrigger: true,
  72. store: null,
  73. queryMode: "local",
  74. editable: true,
  75. cls: null,
  76. minValue: "0",
  77. maxLength: 4000,
  78. positiveNum: false
  79. }
  80. },{
  81. style :"text-align:center",
  82. text: '<font color="red">数量</font>',
  83. width: 80,
  84. dataIndex: 'msr_qty',
  85. logic:"necessaryField",
  86. editor: {
  87. xtype: "numberfield",
  88. hideTrigger: true,
  89. store: null,
  90. queryMode: "local",
  91. editable: true,
  92. cls: null,
  93. minValue: "0",
  94. maxLength: 4000,
  95. positiveNum: false
  96. },
  97. xtype: 'numbercolumn',
  98. align: "right",
  99. format: ""
  100. },{
  101. style :"text-align:center",
  102. text: '<font color="red">长度</font>',
  103. logic:"necessaryField",
  104. width: 80,
  105. dataIndex: 'msr_length',
  106. editor: {
  107. xtype: "numberfield",
  108. hideTrigger: true,
  109. store: null,
  110. queryMode: "local",
  111. editable: true,
  112. cls: null,
  113. minValue: "0",
  114. maxLength: 4000,
  115. positiveNum: false
  116. },
  117. xtype: 'numbercolumn',
  118. align: "right",
  119. format: ""
  120. },{
  121. style :"text-align:center",
  122. text: '<font color="red">进制</font>',
  123. logic:"necessaryField",
  124. width: 100,
  125. dataIndex: 'msr_system',
  126. editor:{
  127. xtype:"combo",
  128. format:"",
  129. hideTrigger:false,
  130. store:{
  131. fields:[
  132. 'display',
  133. 'value'
  134. ],
  135. data:[
  136. {
  137. display:"十进制",
  138. value:"decimal"
  139. },
  140. {
  141. display:"十六进制",
  142. value:"hexadecimal"
  143. },
  144. {
  145. display:"三十二进制",
  146. value:"32hexadecimal"
  147. },
  148. {
  149. display:"三十六进制",
  150. value:"36hexadecimal"
  151. }
  152. ]
  153. },
  154. queryMode:"local",
  155. displayField:"display",
  156. valueField:"value",
  157. editable:false,
  158. cls:null,
  159. minValue:null,
  160. maxLength:4000,
  161. positiveNum:false
  162. },
  163. xtype: "combocolumn"
  164. },{
  165. style :"text-align:center",
  166. text: '<font color="red">起始序列号</font>',
  167. logic:"necessaryField",
  168. width: 120,
  169. dataIndex: 'msr_startno',
  170. editor: {
  171. xtype: "textfield",
  172. hideTrigger: true,
  173. store: null,
  174. queryMode: "local",
  175. editable: true,
  176. cls: null,
  177. minValue: "0",
  178. maxLength: 4000,
  179. positiveNum: false
  180. }
  181. },{
  182. style :"text-align:center",
  183. text: '结束序列号',
  184. width: 120,
  185. dataIndex: 'msr_endno'
  186. },{
  187. style :"text-align:center",
  188. text: '更新人',
  189. width: 100,
  190. dataIndex: 'msr_updateman'
  191. },{
  192. style :"text-align:center",
  193. text: '更新日期',
  194. width: 150,
  195. dataIndex: 'msr_updatedate',
  196. readOnly: true,
  197. align:"left",
  198. format:"Y-m-d H:i:s",
  199. xtype:"datecolumn"
  200. },{
  201. style :"text-align:center",
  202. xtype: 'actioncolumn',
  203. header: '操作',
  204. width: 100,
  205. align: 'center',
  206. items: [{
  207. icon: basePath + 'resource/images/16/delete.png',
  208. tooltip: '删除',
  209. handler: function(view, rowIndex, colIndex) {
  210. var rec = view.getStore().getAt(rowIndex);
  211. warnMsg('确定删除?', function(btn){
  212. if(btn == 'yes'){
  213. view.ownerCt.deleteRecord(rec);
  214. } else if(btn == 'no'){
  215. return;
  216. }
  217. })
  218. }
  219. }]
  220. }],
  221. GridUtil: Ext.create('erp.util.GridUtil'),
  222. dbfinds: [],
  223. columnLines: true,
  224. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  225. clicksToEdit: 1
  226. }),Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  227. store: new Ext.data.Store({
  228. fields: ['msr_id', 'msr_type', 'msr_prefix','msr_qty', 'msr_length', 'msr_system','msr_startno', 'msr_endno', 'msr_updateman','msr_updatedate'],
  229. data: [{},{}]
  230. }),
  231. necessaryFields:['msr_prefix','msr_qty', 'msr_length', 'msr_system','msr_startno'],
  232. deleteRecord: function(record) {
  233. if(record.get('msr_id') && record.get('msr_id') >= 0) {
  234. var grid = this, url = "pm/make/deleteMakeSNRuleDetail.action";
  235. var form = Ext.getCmp('form');
  236. grid.setLoading(true);
  237. Ext.Ajax.request({
  238. url : basePath + url,
  239. params: {
  240. caller: caller,
  241. id: record.get('msr_id'),
  242. key: Ext.getCmp(form.keyField).value
  243. },
  244. method : 'post',
  245. callback : function(opt, success, response){
  246. grid.setLoading(false);
  247. success && grid.store.remove(record);
  248. }
  249. });
  250. } else {
  251. this.store.remove(record);
  252. }
  253. }
  254. }]
  255. }]
  256. });
  257. me.callParent(arguments);
  258. }
  259. });