AnswerForm1.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Ext.define('erp.view.hr.emplmana.AnswerForm1',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.AnswerForm1',
  4. id: 'form1',
  5. title: '答题导航 ',
  6. frame : true,
  7. autoScroll : true,
  8. bodyStyle:'',
  9. buttonAlign : 'center',
  10. bodyStyle:'background:#FFFFFF',
  11. FormUtil: Ext.create('erp.util.FormUtil'),
  12. confirmUrl:'',
  13. fieldDefaults : {
  14. margin : '4 2 4 2',
  15. labelAlign : "right",
  16. msgTarget: 'side',
  17. blankText : $I18N.common.form.blankText
  18. },
  19. initComponent : function(){
  20. this.callParent(arguments);
  21. formCondition = getUrlParam('formCondition');//从url解析参数
  22. formCondition = (formCondition == null) ? "" : formCondition.replace(/IS/g,"=").split('=')[1];
  23. //集团版
  24. var master=getUrlParam('newMaster');
  25. var param = {caller: this.caller || caller, id: this.formCondition || formCondition, _noc: (getUrlParam('_noc') || this._noc),other:1};
  26. if(master){
  27. param.master=master;
  28. }
  29. this.createItemsAndButtons(this,this.params || param);
  30. },
  31. createItemsAndButtons:function(form,params){
  32. Ext.Ajax.request({//拿到form的items
  33. url : basePath + 'hr/emplmana/checkExam.action',
  34. params: params,
  35. method : 'post',
  36. async:false,
  37. callback : function(options, success, response){
  38. if (!response) return;
  39. var res = new Ext.decode(response.responseText);
  40. if(res.exceptionInfo != null){
  41. showError(res.exceptionInfo);return;
  42. }
  43. var items=new Array();
  44. var data=res.data;
  45. var qtype='',detno=0,numb=['一、','二、','三、','四、','五、','六、','七、'],need=0;
  46. Ext.each(data,function(name,index){
  47. if(qtype!=data[index][3]){
  48. if(need%5!=0){
  49. for(var i=0;i<5-need%5;i++){
  50. items.push('<div style="display:inline;float:left;width:20%;" class="x-timepicker-item x-timepicker-hours"></div>');
  51. }
  52. }
  53. qtype=data[index][3];
  54. var it='<div >'+numb[detno++]+data[index][3]+'</div>';
  55. items.push(it);
  56. need=0;
  57. }
  58. need++;
  59. if(data[index][7]==0){
  60. var item='<div style="display:inline;float:left;width:20%;" class="x-timepicker-item x-timepicker-hours">'
  61. +'<a id=a_'+data[index][1]+' style="background:red;" href="#q_'+data[index][1]+'" hidefocus="on" >'+data[index][1]+'</a>'+'</div>';
  62. }else{
  63. var item='<div style="display:inline;float:left;width:20%;" class="x-timepicker-item x-timepicker-hours">'
  64. +'<a id=a_'+data[index][1]+' style="background:#E4F2FD;" href="#q_'+data[index][1]+'" hidefocus="on" >'+data[index][1]+'</a>'+'</div>';
  65. }
  66. items.push(item);
  67. });
  68. if(need%5!=0){
  69. for(var i=0;i<5-need%5;i++){
  70. items.push('<div style="display:inline;float:left;width:20%;" class="x-timepicker-item x-timepicker-hours"></div>');
  71. }
  72. }
  73. var score=res.score==0?'':res.score;
  74. var judger=res.judger==null?'':res.judger;
  75. var time = res.judgetime==null?'':res.judgetime;
  76. items.push('<div>考 生:'+res.name+'</div>');
  77. items.push('<div>满 分:'+res.total+'</div>');
  78. items.push('<div>选择得分:'+res.choicescore+'</div>');
  79. items.push('<div>总 分:'+score+'</div>');
  80. items.push('<div>阅卷人:'+judger+'</div>');
  81. items.push('<div>阅卷时间:'+time+'</div>');
  82. form.html=items;
  83. }
  84. });
  85. },
  86. items: [],
  87. buttons: []
  88. });