| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- Ext.define('erp.view.hr.emplmana.StartExamForm',{
- extend: 'Ext.form.Panel',
- alias: 'widget.StartExamForm',
- id: 'form',
- title: '试 卷 ',
- // frame : true,
- autoScroll : true,
- bodyStyle:'background:transition !important',
- buttonAlign : 'center',
- FormUtil: Ext.create('erp.util.FormUtil'),
- confirmUrl:'',
- fieldDefaults : {
- margin : '4 2 4 2',
- //fieldStyle : "background:#FFFAFA;color:#515151;",
- labelAlign : "right",
- msgTarget: 'side',
- blankText : $I18N.common.form.blankText
- },
- initComponent : function(){
- this.callParent(arguments);
- formCondition = getUrlParam('id');//从url解析参数
- formCondition = (formCondition == null) ? id : formCondition.replace(/IS/g,"=");
- //集团版
- var master=getUrlParam('newMaster');
- var param = {caller: this.caller || caller, id: this.formCondition || formCondition, _noc: (getUrlParam('_noc') || this._noc)};
- if(master){
- param.master=master;
- }
- this.createItemsAndButtons(this,this.params || param);
- /*this.title = this.FormUtil.getActiveTab().title;*/
- },
- createItemsAndButtons:function(form,params){
- Ext.Ajax.request({//拿到form的items
- url : basePath + 'hr/emplmana/getExam.action',
- params: params,
- method : 'post',
- callback : function(options, success, response){
- if (!response) return;
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }
- var items=new Array();
- var data=res.data;
- Ext.each(data,function(name,index){
- var item=new Object();
- if(data[index][3]=='单选题'){
- item.xtype='radiogroup';
- item.id='q_'+data[index][1];
- item.fieldLabel=data[index][1]+'.'+data[index][2];
- item.labelAlign='top';
- item.labelSeparator='';
- item.labelStyle='background:#E4F2FD;';
- item.exdid=data[index][0];
- //item.labelStyle='background:#FFFAFA;color:#515151;';
- item.columns=1;
- item.items=new Array();
- var answs=data[index][4].split("#");
- Ext.each(answs,function(name,inde){
- var i=new Object();
- i.xtype= 'radiofield';
- i.name= data[index][1]+'.'+data[index][2];
- i.id=i.name+''+inde;
- i.anvalue= ["A","B","C","D","E","F","G"][inde];
- i.labelStyle='background:#FFFFFF;';
- i.boxLabel= answs[inde].replace(/(^\s*)|(\s*$)/g, "");
- item.items.push(i);
- });
- items.push(item);
- }else if(data[index][3]=='多选题'){
- item.xtype='checkboxgroup';
- item.id='q_'+data[index][1];
- item.fieldLabel=data[index][1]+'.'+data[index][2];
- item.labelAlign='top';
- item.labelSeparator='';
- item.exdid=data[index][0];
- item.labelStyle='background:#E4F2FD;';
- item.columns=1;
- item.items=new Array();
- var answs=data[index][4].split("#");
- Ext.each(answs,function(name,inde){
- var i=new Object();
- i.xtype= 'checkboxfield';
- i.name= data[index][1]+'.'+data[index][2];
- i.anvalue= ["A","B","C","D","E","F","G"][inde];
- i.boxLabel= answs[inde].replace(/(^\s*)|(\s*$)/g, "");
- item.items.push(i);
- });
- items.push(item);
- }else if(data[index][3]=='简答题'){
- item.xtype='textareafield';
- item.exdid=data[index][0];
- item.id='q_'+data[index][1];
- item.labelAlign='top';
- item.fieldLabel=data[index][1]+'.'+data[index][2];
- item.labelSeparator='';
- item.width=800;
- items.push(item);
- }
- });
- form.add(items);
- }
- });
- },
- buttons: [/*{
- xtype: 'erpStartAccountButton'
- },*/{
- xtype: 'erpSubmitButton'
- },{
- xtype: 'erpDeleteButton'
- }]
- });
|