WCPlan.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. Ext.define('erp.view.pm.make.WCPlan',{
  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:'border',
  10. items: [{
  11. xtype: 'erpFormPanel',
  12. anchor: '100% 30%',
  13. region:'north',
  14. saveUrl: 'pm/make/saveWCPlan.action',
  15. deleteUrl: 'pm/make/deleteWCPlan.action',
  16. updateUrl: 'pm/make/updateWCPlan.action',
  17. submitUrl: 'pm/make/submitWCPlan.action',
  18. auditUrl: 'pm/make/auditWCPlan.action',
  19. resAuditUrl: 'pm/make/resAuditWCPlan.action',
  20. resSubmitUrl: 'pm/make/resSubmitWCPlan.action',
  21. getIdUrl: 'common/getId.action?seq=WCPLAN_SEQ',
  22. runLackMaterialUrl:'pm/make/RunLackMaterial.action',
  23. keyField: 'wc_id',
  24. statusField: 'wc_status',
  25. codeField: 'wc_statuscode'
  26. },{
  27. anchor: '100% 80%',
  28. xtype:'erpGridPanel2',
  29. headerCt: Ext.create("Ext.grid.header.Container",{
  30. forceFit: false,
  31. sortable: true,
  32. enableColumnMove:true,
  33. enableColumnResize:true,
  34. enableColumnHide: true
  35. }),
  36. selModel: Ext.create('Ext.selection.CheckboxModel',{
  37. headerWidth: 0
  38. }),
  39. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu'),Ext.create('erp.view.core.grid.HeaderFilter')],
  40. invalidateScrollerOnRefresh: false,
  41. listeners: {
  42. 'headerfiltersapply': function(grid, filters) {
  43. if(this.allowFilter){
  44. var condition = null;
  45. for(var fn in filters){
  46. var value = filters[fn],f = grid.getHeaderFilterField(fn);
  47. if(!Ext.isEmpty(value)){
  48. if(f.filtertype) {
  49. if (f.filtertype == 'numberfield') {
  50. value = fn + "=" + value + " ";
  51. }
  52. } else {
  53. if(Ext.isDate(value)){
  54. value = Ext.Date.toString(value);
  55. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  56. } else {
  57. var exp_t = /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
  58. exp_d = /^(\d{4})\-(\d{2})\-(\d{2})$/;
  59. if(exp_d.test(value)){
  60. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value + "' ";
  61. } else if(exp_t.test(value)){
  62. value = "to_char(" + fn + ",'yyyy-MM-dd')='" + value.substr(0, 10) + "' ";
  63. } else{
  64. if (f.xtype == 'combo' || f.xtype == 'combofield') {
  65. if (value == '-所有-') {
  66. continue;
  67. } else if (value == '-无-') {
  68. value = 'nvl(' + fn + ',\' \')=\' \'';
  69. } else {
  70. value = fn + " LIKE '" + value + "%' ";
  71. }
  72. } else {
  73. /**字符串转换下简体*/
  74. var SimplizedValue=this.BaseUtil.Simplized(value);
  75. //可能就是按繁体筛选
  76. if(f.ignoreCase) {// 忽略大小写
  77. fn = 'upper(' + fn + ')';
  78. value = value.toUpperCase();
  79. }
  80. if(!f.autoDim) {
  81. if(SimplizedValue!=value){
  82. value = "("+fn + " LIKE '" + value + "%' or "+fn+" LIKE '"+SimplizedValue+"%')";
  83. }else value = fn + " LIKE '" + value + "%' ";
  84. } else if(f.exactSearch){
  85. value=fn+"='"+value+"'";
  86. }else {
  87. if(SimplizedValue!=value){
  88. value = "("+fn + " LIKE '%" + value + "%' or "+fn+" LIKE '%"+SimplizedValue+"%')";
  89. }else value = fn + " LIKE '%" + value + "%' ";
  90. }
  91. }
  92. }
  93. }
  94. }
  95. if(condition == null){
  96. condition = value;
  97. } else {
  98. condition = condition + " AND " + value;
  99. }
  100. }
  101. }
  102. this.filterCondition = condition;
  103. var grid=Ext.getCmp('grid');
  104. grid.store.remoteSort=true;
  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. region:'center'
  120. }]
  121. }]
  122. });
  123. me.callParent(arguments);
  124. }
  125. });