MakePrepare.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. Ext.define('erp.view.pm.mes.MakePrepare',{
  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% 25%',
  11. saveUrl: 'pm/mes/saveMakePrepare.action',
  12. updateUrl: 'pm/mes/updateMakePrepare.action',
  13. deleteUrl:'pm/mes/deleteMakePrepare.action',
  14. getIdUrl: 'common/getId.action?seq=MakePrepare_SEQ',
  15. submitUrl: 'pm/mes/submitMakePrepare.action',
  16. resSubmitUrl: 'pm/mes/resSubmitMakePrepare.action',
  17. auditUrl: 'pm/mes/auditMakePrepare.action',
  18. resAuditUrl: 'pm/mes/resAuditMakePrepare.action',
  19. keyField: 'mp_id',
  20. codeField: 'mp_code',
  21. statusField: 'mp_status',
  22. statuscodeField: 'mp_statuscode'
  23. },{
  24. xtype:'tabpanel',
  25. anchor: '100% 55%',
  26. items:[{
  27. anchor: '100% 55%',
  28. xtype: 'erpGridPanel2',
  29. title:'已备料料卷列表',
  30. id: 'grid',
  31. mainField:'md_mpid',
  32. keyField:'mp_id',
  33. headerCt: Ext.create("Ext.grid.header.Container",{
  34. forceFit: false,
  35. sortable: true,
  36. enableColumnMove:true,
  37. enableColumnResize:true,
  38. enableColumnHide: true
  39. }),
  40. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu'),Ext.create('erp.view.core.grid.HeaderFilter')],
  41. invalidateScrollerOnRefresh: false,
  42. listeners: {
  43. 'headerfiltersapply': function(grid, filters) {
  44. if(this.allowFilter){
  45. var condition = null;
  46. for(var fn in filters){
  47. var value = filters[fn],f = grid.getHeaderFilterField(fn);
  48. if(!Ext.isEmpty(value)){
  49. if(f.filtertype) {
  50. if (f.filtertype == 'numberfield') {
  51. value = fn + "=" + value + " ";
  52. }
  53. } else {
  54. if(Ext.isDate(value)){
  55. value = Ext.Date.toString(value);
  56. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  57. } else {
  58. var exp_t = /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
  59. exp_d = /^(\d{4})\-(\d{2})\-(\d{2})$/;
  60. if(exp_d.test(value)){
  61. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  62. } else if(exp_t.test(value)){
  63. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value.substr(0, 10) + "' ";
  64. } else{
  65. if (f.xtype == 'combo' || f.xtype == 'combofield') {
  66. if (value == '-所有-') {
  67. continue;
  68. } else if (value == '-无-') {
  69. value = 'nvl(' + fn + ',\' \')=\' \'';
  70. } else {
  71. value = fn + " LIKE '" + value + "%' ";
  72. }
  73. } else {
  74. //**字符串转换下简体*//*
  75. var SimplizedValue=this.BaseUtil.Simplized(value);
  76. //可能就是按繁体筛选
  77. if(f.ignoreCase) {// 忽略大小写
  78. fn = 'upper(' + fn + ')';
  79. value = value.toUpperCase();
  80. }
  81. if(!f.autoDim) {
  82. if(SimplizedValue!=value){
  83. value = "("+fn + " LIKE '" + value + "%' or "+fn+" LIKE '"+SimplizedValue+"%')";
  84. }else value = fn + " LIKE '" + value + "%' ";
  85. } else if(f.exactSearch){
  86. value=fn+"='"+value+"'";
  87. }else {
  88. if(SimplizedValue!=value){
  89. value = "("+fn + " LIKE '%" + value + "%' or "+fn+" LIKE '%"+SimplizedValue+"%')";
  90. }else value = fn + " LIKE '%" + value + "%' ";
  91. }
  92. }
  93. }
  94. }
  95. }
  96. if(condition == null){
  97. condition = value;
  98. } else {
  99. condition = condition + " AND " + value;
  100. }
  101. }
  102. }
  103. this.filterCondition = condition;
  104. var grid=Ext.getCmp('grid');
  105. if(grid.store.data!=grid.store.prefetchData){
  106. grid.store.loadData(grid.store.prefetchData.items);
  107. }
  108. } else {
  109. this.allowFilter = true;
  110. }
  111. return false;
  112. }
  113. },
  114. viewConfig: {
  115. trackOver: false
  116. },
  117. buffered: true,
  118. sync: true
  119. },{
  120. items: [],
  121. title:'备料清单',
  122. layout: 'anchor',
  123. id: 'tab-list'
  124. }]
  125. },{
  126. xtype: 'form',
  127. anchor: '100% 20%',
  128. bodyStyle: 'background: #f1f1f1;',
  129. layout: 'border',
  130. items: [{
  131. xtype: 'fieldcontainer',
  132. region: 'center',
  133. autoScroll: true,
  134. scrollable: true,
  135. defaults: {
  136. width: 300
  137. },
  138. items: [{
  139. xtype: 'textfield',
  140. fieldLabel: '操作人员',
  141. readOnly:true,
  142. id:'man',
  143. allowBlank: false,
  144. value: em_name
  145. },{
  146. xtype: 'fieldcontainer',
  147. fieldLabel : '操作',
  148. defaultType: 'radiofield',
  149. layout: 'hbox',
  150. colspan: 2,
  151. defaults: {
  152. flex: 1
  153. },
  154. items: [{
  155. boxLabel : '备料',
  156. inputValue: 'get',
  157. name: 'operator',
  158. id : 'get',
  159. checked: true
  160. }, {
  161. boxLabel : '退回',
  162. inputValue: 'back',
  163. name: 'operator',
  164. id : 'back'
  165. }]
  166. },{
  167. xtype: 'textfield',
  168. fieldLabel: '料卷编号',
  169. readOnly:false,
  170. id:'code',
  171. colspan: 1,
  172. emptyText: '请采集料卷编号',
  173. allowBlank: false
  174. },{
  175. xtype: 'textfield',
  176. fieldLabel: '数量',
  177. readOnly:true,
  178. colspan: 1,
  179. id:'qty'
  180. }]
  181. },{
  182. xtype: 'dataview',
  183. region : 'east',
  184. width: 500,
  185. id: 't_result',
  186. store: new Ext.data.Store({
  187. fields: ['type', 'text']
  188. }),
  189. cls: 'msg-body',
  190. tpl: new Ext.XTemplate(
  191. '<audio id="audio-success" src="' + basePath + 'resource/audio/success.wav"></audio>',
  192. '<audio id="audio-error" src="' + basePath + 'resource/audio/error.wav"></audio>',
  193. '<tpl for=".">',
  194. '<div class="msg-item">',
  195. '<tpl if="type == \'success\'"><span class="text-info">{text}</span></tpl>',
  196. '<tpl if="type == \'error\'"><span class="text-warning">{text}</span></tpl>',
  197. '</div>',
  198. '</tpl>'
  199. ),
  200. itemSelector: 'div.msg-item',
  201. emptyText: '提示信息',
  202. deferEmptyText: false,
  203. autoScroll: true,
  204. append: function(text, type) {
  205. type = type || 'success';
  206. this.getStore().add({text: text, type: type});
  207. this.getEl().scroll("b", this.getEl().getHeight(), true);
  208. var el = Ext.get('audio-' + type).dom;
  209. el.play();
  210. }
  211. }],
  212. buttonAlign: 'center',
  213. buttons: [{
  214. xtype: 'button',
  215. id : 'confirm',
  216. text: $I18N.common.button.erpConfirmButton,
  217. cls: 'x-btn-gray',
  218. style: {
  219. marginLeft: '10px'
  220. },
  221. width: 80
  222. }]
  223. }]
  224. });
  225. me.callParent(arguments);
  226. }
  227. });