Feeder.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. Ext.define('erp.view.pm.mes.Feeder',{
  2. extend: 'Ext.Viewport',
  3. layout: 'fit',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. id:'FeederViewport',
  10. layout: 'anchor',
  11. items: [{
  12. xtype: 'erpFormPanel',
  13. anchor: '100% 35%',
  14. saveUrl: 'pm/mes/saveFeeder.action',
  15. deleteUrl: 'pm/mes/deleteFeeder.action',
  16. updateUrl: 'pm/mes/updateFeeder.action',
  17. getIdUrl: 'common/getId.action?seq=Feeder_SEQ',
  18. submitUrl: 'pm/mes/submitFeeder.action',
  19. auditUrl: 'pm/mes/auditFeeder.action',
  20. resAuditUrl: 'pm/mes/resAuditFeeder.action',
  21. resSubmitUrl: 'pm/mes/resSubmitFeeder.action',
  22. keyField: 'fe_id',
  23. codeField: 'fe_code',
  24. statusField: 'fe_status',
  25. statuscodeField: 'fe_statuscode'
  26. },{
  27. xtype:'tabpanel',
  28. id:'tab',
  29. anchor: '100% 65%',
  30. items:[{
  31. xtype: 'erpGridPanel2',
  32. title:'保养维修记录',
  33. anchor: '100% 65%',
  34. keyField: 'fl_id',
  35. mainField: 'fl_feid',
  36. id: 'grid1',
  37. headerCt: Ext.create("Ext.grid.header.Container",{
  38. forceFit: false,
  39. sortable: true,
  40. enableColumnMove:true,
  41. enableColumnResize:true,
  42. enableColumnHide: true
  43. }),
  44. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu'),Ext.create('erp.view.core.grid.HeaderFilter')],
  45. invalidateScrollerOnRefresh: false,
  46. listeners: {
  47. 'headerfiltersapply': function(grid, filters) {
  48. if(this.allowFilter){
  49. var condition = null;
  50. for(var fn in filters){
  51. var value = filters[fn],f = grid.getHeaderFilterField(fn);
  52. if(!Ext.isEmpty(value)){
  53. if(f.filtertype) {
  54. if (f.filtertype == 'numberfield') {
  55. value = fn + "=" + value + " ";
  56. }
  57. } else {
  58. if(Ext.isDate(value)){
  59. value = Ext.Date.toString(value);
  60. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  61. } else {
  62. var exp_t = /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
  63. exp_d = /^(\d{4})\-(\d{2})\-(\d{2})$/;
  64. if(exp_d.test(value)){
  65. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  66. } else if(exp_t.test(value)){
  67. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value.substr(0, 10) + "' ";
  68. } else{
  69. if (f.xtype == 'combo' || f.xtype == 'combofield') {
  70. if (value == '-所有-') {
  71. continue;
  72. } else if (value == '-无-') {
  73. value = 'nvl(' + fn + ',\' \')=\' \'';
  74. } else {
  75. value = fn + " LIKE '" + value + "%' ";
  76. }
  77. } else {
  78. //**字符串转换下简体*//*
  79. var SimplizedValue=this.BaseUtil.Simplized(value);
  80. //可能就是按繁体筛选
  81. if(f.ignoreCase) {// 忽略大小写
  82. fn = 'upper(' + fn + ')';
  83. value = value.toUpperCase();
  84. }
  85. if(!f.autoDim) {
  86. if(SimplizedValue!=value){
  87. value = "("+fn + " LIKE '" + value + "%' or "+fn+" LIKE '"+SimplizedValue+"%')";
  88. }else value = fn + " LIKE '" + value + "%' ";
  89. } else if(f.exactSearch){
  90. value=fn+"='"+value+"'";
  91. }else {
  92. if(SimplizedValue!=value){
  93. value = "("+fn + " LIKE '%" + value + "%' or "+fn+" LIKE '%"+SimplizedValue+"%')";
  94. }else value = fn + " LIKE '%" + value + "%' ";
  95. }
  96. }
  97. }
  98. }
  99. }
  100. if(condition == null){
  101. condition = value;
  102. } else {
  103. condition = condition + " AND " + value;
  104. }
  105. }
  106. }
  107. this.filterCondition = condition;
  108. var grid=Ext.getCmp('grid');
  109. if(grid.store.data!=grid.store.prefetchData){
  110. grid.store.loadData(grid.store.prefetchData.items);
  111. }
  112. } else {
  113. this.allowFilter = true;
  114. }
  115. return false;
  116. }
  117. },
  118. viewConfig: {
  119. trackOver: false
  120. },
  121. buffered: true,
  122. sync: true
  123. },{
  124. title:'使用记录',
  125. items: [],
  126. layout: 'anchor',
  127. id: 'tab-list'
  128. }]
  129. }]
  130. }]
  131. });
  132. me.callParent(arguments);
  133. }
  134. });