CraftMaterial.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. Ext.define('erp.view.pm.mes.CraftMaterial',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'erpFormPanel',
  10. anchor: '100% 30%'
  11. },{
  12. xtype: 'grid',
  13. anchor: '100% 48%',
  14. id:'qgrid',
  15. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  16. columns: [{
  17. text: '物料编号',
  18. dataIndex: 'sp_soncode',
  19. flex: 1,
  20. renderer:function(val, meta, record){
  21. meta.style = "background: #e0e0e0;";
  22. return val;
  23. }
  24. },{
  25. text: '物料名称',
  26. dataIndex: 'pr_detail',
  27. flex: 1 ,
  28. renderer:function(val, meta, record){
  29. meta.style = "background: #e0e0e0;";
  30. return val;
  31. }
  32. },{
  33. text: '物料规格',
  34. dataIndex: 'pr_spec',
  35. flex: 1 ,
  36. renderer:function(val, meta, record){
  37. meta.style = "background: #e0e0e0;";
  38. return val;
  39. }
  40. },{
  41. text: '物料ID',
  42. dataIndex: 'pr_id',
  43. flex: 1,
  44. hidden:true
  45. },{
  46. text: '条码前缀',
  47. dataIndex: 'pr_prefix',
  48. flex: 1,
  49. editor :{
  50. xtype:'textfield'
  51. }
  52. },{
  53. text: '条码长度',
  54. dataIndex: 'pr_length',
  55. flex: 1,
  56. editor :{
  57. xtype:'numberfield',
  58. minValue: 1,
  59. maxValue: 30
  60. }
  61. },{
  62. text: '替代料编号',
  63. dataIndex: 'sp_repcode',
  64. flex: 1 ,
  65. renderer:function(val, meta, record){
  66. meta.style = "background: #e0e0e0;";
  67. return val;
  68. }
  69. },{
  70. text: '是否采集',
  71. dataIndex: 'if_pick',
  72. flex: 1 ,
  73. renderer:function(val, meta, record){
  74. meta.style = "background: #e0e0e0;";
  75. if(val == '未采集'){
  76. return '<span style="color:red;">' + val + '</span>';
  77. }
  78. else return val;
  79. }
  80. },{
  81. text: 'id',
  82. dataIndex: 'sp_id',
  83. flex: 1 ,
  84. hidden:true
  85. },{
  86. text: '采集类型',
  87. dataIndex: 'sp_type',
  88. flex: 1 ,
  89. hidden:true
  90. }],
  91. plugins: [
  92. Ext.create('Ext.grid.plugin.CellEditing', {
  93. clicksToEdit: 1
  94. })
  95. ],
  96. columnLines: true,
  97. store: Ext.create('Ext.data.Store',{
  98. fields: ['sp_soncode','pr_detail','pr_spec','pr_id','pr_prefix','sp_repcode','if_pick'],
  99. data: [ {},{},{},{},{},{},{},{},{},{},{}],
  100. autoLoad:true
  101. })
  102. },{
  103. xtype: 'form',
  104. anchor: '100% 22%',
  105. bodyStyle: 'background: #f1f1f1;',
  106. layout: 'border',
  107. items: [{
  108. xtype: 'fieldcontainer',
  109. region: 'center',
  110. autoScroll: true,
  111. scrollable: true,
  112. defaults: {
  113. width: 300
  114. },
  115. layout: {
  116. type: 'table',
  117. columns: 2
  118. },
  119. items: [{
  120. xtype: 'fieldcontainer',
  121. fieldLabel : '操作',
  122. defaultType: 'radiofield',
  123. layout: 'hbox',
  124. colspan: 2,
  125. width: 450,
  126. defaults: {
  127. flex: 1
  128. },
  129. items: [ {
  130. boxLabel : '上料',
  131. inputValue: 'get',
  132. name: 'operator',
  133. id : 'get',
  134. checked: true
  135. },{
  136. boxLabel : '取消上料',
  137. inputValue: 'back',
  138. name: 'operator',
  139. id : 'back'
  140. }]
  141. },{
  142. xtype: 'textfield',
  143. fieldLabel: '序列号',
  144. readOnly:true,
  145. colspan: 2,
  146. id:'ms_code',
  147. plugins: [Ext.create("Ext.ux.form.field.ClearButton")]
  148. },{
  149. xtype: 'textfield',
  150. fieldLabel: '录入框',
  151. readOnly:false,
  152. colspan: 2,
  153. id:'input',
  154. allowBlank: true
  155. }]
  156. },{
  157. xtype: 'dataview',
  158. region : 'east',
  159. width: 350,
  160. id: 't_result',
  161. store: new Ext.data.Store({
  162. fields: ['type', 'text']
  163. }),
  164. cls: 'msg-body',
  165. tpl: new Ext.XTemplate(
  166. '<audio id="audio-success" src="' + basePath + 'resource/audio/success.wav"></audio>',
  167. '<audio id="audio-error" src="' + basePath + 'resource/audio/error.wav"></audio>',
  168. '<tpl for=".">',
  169. '<div class="msg-item">',
  170. '<tpl if="type == \'success\'"><span class="text-info">{text}</span></tpl>',
  171. '<tpl if="type == \'error\'"><span class="text-warning">{text}</span></tpl>',
  172. '</div>',
  173. '</tpl>'
  174. ),
  175. itemSelector: 'div.msg-item',
  176. emptyText: '提示信息',
  177. deferEmptyText: false,
  178. autoScroll: true,
  179. append: function(text, type) {
  180. type = type || 'success';
  181. this.getStore().add({text: text, type: type});
  182. this.getEl().scroll("b", this.getEl().getHeight(), true);
  183. var el = Ext.get('audio-' + type).dom;
  184. el.play();
  185. }
  186. }],
  187. buttonAlign: 'center',
  188. buttons: [{
  189. xtype: 'button',
  190. id : 'confirm',
  191. text: $I18N.common.button.erpConfirmButton,
  192. cls: 'x-btn-gray',
  193. style: {
  194. marginLeft: '10px'
  195. },
  196. width: 60
  197. }]
  198. }]
  199. });
  200. me.callParent(arguments);
  201. }
  202. });