Buganalyse.js 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.plm.test.Buganalyse', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. BaseUtil: Ext.create('erp.util.BaseUtil'),
  7. views:[
  8. 'plm.test.Buganalyse','plm.project.ProjectTreePanel','common.datalist.Toolbar','plm.test.AnalyseTestGrid','plm.test.AnalyseHandGrid','core.form.ConDateField',
  9. 'plm.project.AnalyseForm'
  10. ],
  11. init:function(){
  12. var me=this;
  13. var menu =null;
  14. this.control({
  15. 'erpProjectTreePanel': {
  16. itemmousedown: function(selModel, record){
  17. if(record.get('leaf')){
  18. var id=record.get('id');
  19. condition=" cl_prjplanid='"+id+"'";
  20. var testgrid=Ext.getCmp('test');
  21. var handgrid=Ext.getCmp('hand');
  22. testgrid.getColumnsAndStore(condition);
  23. handgrid.getColumnsAndStore(condition);
  24. }
  25. },
  26. afterrender:function(tree){
  27. }
  28. },
  29. 'datepicker':{
  30. afterrender:function(picker){
  31. }
  32. },
  33. 'condatefield':{
  34. afterrender:function(field){
  35. Ext.getCmp('recorddate_to').setValue(new Date());
  36. Ext.getCmp('recorddate_from').setValue('2012-04-01');
  37. }
  38. },
  39. /** 'datefield[name=recorddate_from]':{
  40. change:function(field){
  41. var start=Ext.getCmp('recorddate_from').getValue();
  42. var end=Ext.getCmp('recorddate_to').getValue();
  43. var picker=Ext.getCmp('picker');
  44. console.log(picker);
  45. console.log(picker.numDays);
  46. console.log(picker.cells);
  47. console.log(picker.dom);
  48. console.log(document.getElementById('picker'));
  49. for(var i=0; i < picker.numDays; ++i) {
  50. var cell=picker.cells.elements[i];
  51. var value=cell.firstChild.dateValue;
  52. if(end!=null&&value >= start.getTime()&&value <= end.getTime()) {
  53. cell.className = picker.baseCls + '-today';
  54. }else{
  55. cell.className= picker.baseCls + '-disabled';
  56. }
  57. }
  58. }
  59. },
  60. 'datefield[name=recorddate_to]':{
  61. change:function(field){
  62. var start=Ext.getCmp('recorddate_from').getValue();
  63. var end=Ext.getCmp('recorddate_to').getValue();
  64. var picker=Ext.getCmp('picker');
  65. for(var i=0; i < picker.numDays; ++i) {
  66. var cell=picker.cells.elements[i];
  67. var value=cell.firstChild.dateValue;
  68. if(start!=null&&value >= start.getTime()&&value <= end.getTime()) {
  69. cell.className = picker.baseCls + '-today';
  70. }else{
  71. cell.className= picker.baseCls + '-disabled';
  72. }
  73. }
  74. }
  75. }, **/
  76. 'button[id=scan]':{
  77. click:function(btn){
  78. var start=Ext.getCmp('recorddate_from').getValue();
  79. startdate=start==''?'2012-04-01':start;
  80. var end=Ext.getCmp('recorddate_to').getValue();
  81. enddate=end==''?Ext.Date.format(new Date(),'Y-m-d'):end;
  82. var testgrid=Ext.getCmp('test');
  83. var handgrid=Ext.getCmp('hand');
  84. testgrid.getColumnsAndStore(condition,startdate,enddate);
  85. handgrid.getColumnsAndStore(condition,startdate,enddate);
  86. }
  87. },
  88. 'erpAnalyseTestGridPanel': {
  89. itemclick: function(selModel, record,el,num){//grid行选择
  90. if(record.data['testingbug']==0) return;
  91. var emid=record.data['exhibitorid'],
  92. startdate=Ext.getCmp('recorddate_from').getValue(),
  93. enddate=Ext.getCmp('recorddate_to').getValue();
  94. var data=me.getData(emid,startdate,enddate,'plm/test/getTestData.action');
  95. var store = Ext.create('Ext.data.Store', {
  96. autoLoad:true,
  97. fields:[{name:'bugname',type:'string'},{name:'date',type:'date',format:'Y-m-d'}, {name:'emname',type:'string'}],
  98. data: data
  99. });
  100. if(menu==null){
  101. menu= Ext.create('Ext.menu.Menu', {
  102. async:false,
  103. id: 'mainMenu',
  104. ownerCt : this.ownerCt,
  105. renderTo:Ext.getBody(),
  106. width:'540',
  107. style: {
  108. overflow: 'visible',
  109. },
  110. items: [{
  111. width:540,
  112. xtype:'grid',
  113. columnLines:true,
  114. id:'smallgrid',
  115. height:200,
  116. buttonAlign:'center',
  117. store:store,
  118. bodyStyle: 'background:#EEE5DE; padding:0px;',
  119. columns: [{ header: 'BUG名称', dataIndex: 'bugname' ,cls :'x-grid-header-1',width:340},
  120. { header: '日期', dataIndex: 'date', flex: 1 ,cls :'x-grid-header-1',format:'Y-m-d',xtype:'datecolumn'},
  121. { header: '人员名称', dataIndex: 'emname',cls :'x-grid-header-1' },
  122. ],
  123. dockedItems: [{
  124. buttonAlign:'center',
  125. xtype: 'toolbar',
  126. dock: 'bottom',
  127. style: 'background:#EEE9BF; padding:0px;',
  128. items: [{ xtype: 'button',
  129. text: '关闭',
  130. iconCls: 'x-button-icon-close',
  131. style :'margin-left:230px',
  132. handler:function(btn){
  133. Ext.getCmp('mainMenu').hide();
  134. }
  135. }]
  136. }],
  137. }]
  138. });
  139. }
  140. else Ext.getCmp('smallgrid').getStore().loadData(data);
  141. menu.alignTo(el, 'tl-bl?',[280, 0]);
  142. menu.show();
  143. },
  144. },
  145. 'erpAnalyseHandGridPanel':{
  146. itemclick: function(selModel, record,el,num){//grid行选择
  147. if(record.data['pendingbug']==0) return;
  148. var emid=record.data['handerid'],
  149. startdate=Ext.getCmp('recorddate_from').getValue(),
  150. enddate=Ext.getCmp('recorddate_to').getValue();
  151. var data=this.getData(emid,startdate,enddate,'plm/test/getHandData.action');
  152. var store = Ext.create('Ext.data.Store', {
  153. autoLoad:true,
  154. fields:[{name:'bugname',type:'string'},{name:'date',type:'date',format:'Y-m-d'}, {name:'emname',type:'string'}],
  155. data: data
  156. });
  157. if(menu==null){
  158. menu= Ext.create('Ext.menu.Menu', {
  159. async:false,
  160. id: 'mainMenu',
  161. ownerCt : this.ownerCt,
  162. renderTo:Ext.getBody(),
  163. width:'540',
  164. style: {
  165. overflow: 'visible',
  166. },
  167. items: [{
  168. width:540,
  169. xtype:'grid',
  170. columnLines:true,
  171. id:'smallgrid',
  172. height:200,
  173. buttonAlign:'center',
  174. store:store,
  175. bodyStyle: 'background:#EEE5DE; padding:0px;',
  176. columns: [{ header: 'BUG名称', dataIndex: 'bugname' ,cls :'x-grid-header-1',width:340},
  177. { header: '日期', dataIndex: 'date', flex: 1 ,cls :'x-grid-header-1',format:'Y-m-d',xtype:'datecolumn'},
  178. { header: '人员名称', dataIndex: 'emname',cls :'x-grid-header-1' },
  179. ],
  180. dockedItems: [{
  181. buttonAlign:'center',
  182. xtype: 'toolbar',
  183. dock: 'bottom',
  184. style: 'background:#EEE9BF; padding:0px;',
  185. items: [{ xtype: 'button',
  186. text: '关闭',
  187. iconCls: 'x-button-icon-close',
  188. style :'margin-left:230px',
  189. handler:function(btn){
  190. Ext.getCmp('mainMenu').hide();
  191. }
  192. }]
  193. }],
  194. }]
  195. });
  196. }
  197. else Ext.getCmp('smallgrid').getStore().loadData(data);
  198. menu.alignTo(el, 'tl-bl?',[280, 0]);
  199. menu.show();
  200. },
  201. }
  202. });
  203. },
  204. getData:function(emid,startdate,enddate,url){
  205. var data=null;
  206. Ext.Ajax.request({
  207. url : basePath + url,
  208. params:{
  209. startdate:startdate,
  210. enddate:enddate,
  211. emid:emid,
  212. },
  213. async:false,
  214. method : 'get',
  215. callback : function(options,success,response){
  216. var rs = new Ext.decode(response.responseText);
  217. if(rs.exceptionInfo){
  218. showError(rs.exceptionInfo);return;
  219. }
  220. else if(rs.success){
  221. data=rs.data;
  222. }
  223. }
  224. });
  225. return data;
  226. }
  227. });