www.gusucode.com > EXTJS界面的JSP人事管理系统源码程序 > EXTJS界面的JSP人事管理系统/WebRoot/WebRoot/panel.js

    

/** ************************************************* */

/**
 * @class
 * @extends Ext.Panel query log information
 */

InfoStat1 = Ext.extend(Ext.Panel,
		
 {
	closable : true,
	autoScroll : false,
	gridViewConfig : {},
	layout : "fit",
	id : "infoStat1",
	title : "Admin Information Statistic",
	renderTo : Ext.getBody(),
	createPanel : function() {
		Ext.form.Field.prototype.msgTarget = 'side';
		 var fs = new Ext.form.FieldSet({title:'Result',autoHeight:true,items:[this.grid]});
		fs.setVisible(true);
		var formPanel = new Ext.form.FormPanel({
			layout : 'form',
			frame : true,
			bodyStyle : 'text-align:center',
			autoScroll : true,
			defaults : {
				width : 870,
				allowBlank : false,
				labelAlign : 'right'
			},

			items : [{
				layout : 'form',
				bodyStyle : 'text-align:left;padding-top:20px',
				border : true,
				items : [{
					xtype : 'fieldset',
					title : 'Statistic Conditions',
					autoHeight : true,
					items : [{ // 桶中物件
						layout : 'column',
						border : false,
						defaults : {
							border : false
							
						},
						items : [{
							columnWidth : .25,
							layout : 'form',
							defaultType : 'textfield',
//							defaults : {
//								width : 100
//							},
							items : [this.deptCombo]
						}, {
							columnWidth : .25,
							layout : 'form',
							defaultType : 'textfield',
							defaults : {
								width : 100
							},
							items : [this.skillAreaCombo]
						}, {
							columnWidth : .25,
							layout : 'form',
							defaultType : 'textfield',
							defaults : {
								width : 100
							
							},
							items : [this.skillCombo]
						},{
							columnWidth : .25,
							layout : 'form',
							defaultType : 'textfield',
							defaults : {
								width : 100
							
							},
							items : [this.LevelCombo]
						}
						]
					},{},{},
					{
						layout : 'column',
					border : false,
					defaults : {
						border : false
					},
					items : [{
						columnWidth:.45,
						layout:'form',
						items:[{}]
					},
						{
						columnWidth : .3,
						layout : 'form',
						defaultType : 'button',
					
					items : [this.statisticButton]
					}
					]
					}]

				},{
					html:'<p align="right"><b>'+new Date().format('Y/m/d')+'</b></p>'
				}, {	
					items : [fs]
				}

				]

			}]
		});
		return formPanel;
		
	},
	
	storeMapping : ["position", "countOnProject", "percentOn", "countNotProject","percentNoton","total"],

	initComponent : function() {
		
		this.deptStore = new Ext.data.JsonStore({
			autoload : true,
			url : 'getDepartmentS.action',
			root : "rows",
			id : 'id',
			fields : ['id', 'deptName']

		});
		
		this.skillAreaStore = new Ext.data.JsonStore({
			autoload : true,
			url : 'getSkillArea.action',
			root : "rows",
			id : 'id',
			fields : ['id', 'areaName']

		});

		this.getSkillByAreaIdStore = new Ext.data.JsonStore({
			autoload : true,
			// url : 'getSkillByAreaId.action',
			root : "rows",
			id : 'id',
			fields : ['id', 'skillName']

		});

		this.LevelStore = new Ext.data.JsonStore({
			autoload : true,
			root : "rows",
			id : 'id',
			fields : ['id', 'gradeName']

		});
		
		this.statisticStore = new Ext.data.JsonStore({
			autoload:true,
			url:'getAllEmployeeByConditions.action',
			root:"rows",
			fields:['posName','numOnProject','percentOnProject','numOffProject','percentOffProject','total']
		});

		this.deptCombo = new Ext.form.ComboBox({

			store : this.deptStore,
			displayField : 'deptName',
			valueField : 'id',
			typeAhead : true,
			triggerAction : 'all',
			emptyText : '--select--',
			selectOnFocus : true,
			editable : false,
			fieldLabel : 'Department',
			name : 'deptName',
			width : 100,
			labelStyle:'text-align:right',
			listeners : {
				'select' : function() {
					this.alertSkillAreaCombo();
				},
				scope : this
			}
		});
		
		this.skillAreaCombo = new Ext.form.ComboBox({

			store : this.skillAreaStore,
			displayField : 'areaName',
			valueField : 'id',
			typeAhead : true,
			triggerAction : 'all',
			emptyText : '--select--',
			selectOnFocus : true,
			editable : false,
			disabled:true,
			fieldLabel : 'Skill Area',
			name : 'areaName',
			width : 100,
			labelStyle:'text-align:right',
			listeners : {
				'select' : function() {
					this.skillCombo.enable();
					this.alertSkillCombo();
				},
				scope : this
			}

		});

		this.skillCombo = new Ext.form.ComboBox({

			store : this.getSkillByAreaIdStore,
			displayField : 'skillName',
			valueField : 'id',
			typeAhead : true,
			triggerAction : 'all',
			emptyText : '--select--',
			selectOnFocus : true,
			editable : false,
			disabled: true,
			fieldLabel : 'Skill',
			name : 'skillName',
			width : 100,
			labelStyle:'text-align:right',
			listeners : {
				'select' : function() {
					this.LevelCombo.enable();
					this.setLevelCombo();
				},
				scope : this
			}

		});

		this.LevelCombo = new Ext.form.ComboBox({
			store : this.LevelStore,
			displayField : 'gradeName',
			valueField : 'id',
			typeAhead : true,
			triggerAction : 'all',
			emptyText : '--select--',
			selectOnFocus : true,
			editable : false,
			disabled: true,
			fieldLabel : 'Level',
			name : 'gradeName',
			width : 100,
			labelStyle:'text-align:right',
			listeners : {
				'select' : function(){
					this.setAbleStatisticButton();
				},
				scope : this
			}

		});
		
		this.statisticButton = new Ext.Button({
								text : '&nbsp;&nbsp;Statistic&nbsp;&nbsp;',
								bodyStyle : 'text-align:right',
								listeners : {
										'click' : function() {
											this.xlsButton.enable();
										var valueArray = this.fp.getForm()
												.getValues();
										this.statisticStore.load({
											params : {
												deptName : valueArray.deptName,
				                    			skillName : valueArray.skillName,
												gradeName : valueArray.gradeName   
											
											}

										});

									},
									scope : this
								}
							});
							
		this.xlsButton = new Ext.Button({
				text:'Get XLS',
				disabled: true,
				listeners: {
							'click' : function() {
								window.open("statistic.xls") ;
                                   
									},
									scope : this
								}
		}
		);					
		
		this.statisticButton.setDisabled(true);
		this.alertSkillAreaCombo = function(){
			this.skillAreaCombo.enable();
			
		};
		
		this.alertSkillCombo = function() {
			this.skillCombo.reset();
			this.getSkillByAreaIdStore.proxy = new Ext.data.HttpProxy({
				url : 'getSkillByAreaId.action?id='
						+ this.skillAreaCombo.getValue()

			});

			this.getSkillByAreaIdStore.reload();
			this.statisticButton.disable();
			

		},

		this.setLevelCombo = function() {
			this.LevelCombo.reset();
			this.LevelStore.proxy = new Ext.data.HttpProxy({
				url : 'getSkillLevel.action'
			});
			this.LevelStore.reload();
			this.statisticButton.disable();
			
		}, 

		this.setAbleStatisticButton = function() {
			this.statisticButton.enable();
		}
		
		
		
		
		this.cm = new Ext.grid.ColumnModel([{
			header : "Position",
			sortable : true,
			width : 100,
			dataIndex : "posName"
		}, {
			header : "No. On Projects",
			sortable : true,
			width : 145,
			dataIndex : "numOnProject"

		}, {
			header : "Percentage On Projects",
			sortable : true,
			width : 145,
			dataIndex : "percentOnProject"
		}, {
			header : "No. of Resource Bench",
			sortable : true,
			width : 145,
			dataIndex : "numOffProject"
		},{header : "Percentage of Resource Bench",
			sortable:true,
			width :145,
			dataIndex:"percentOffProject"
		},{
			header : "Total",
			sortable:true,
			width :145,
			dataIndex:"total"
		}]);


		InfoStat1.superclass.initComponent.call(this);
		var viewConfig = Ext.apply({
			forceFit : true
		}, this.gridViewConfig);
		
		
		this.grid = new Ext.grid.GridPanel({

			width : 850,
			height : 400,
			title:'the result of infomation statistic',
			ds:this.statisticStore,
			cm : this.cm,
			frame:true,
			trackMouseOver : true,
			loadMask : true,
			viewConfig : viewConfig,
			// tbar : [{pressed:true,text:'delete'}],
			buttons: [	
				this.xlsButton	
			],
       		buttonAlign:'center'
		});
			
		if (!this.fp) {
			this.fp = this.createPanel();
		}
		this.add(this.fp);

		// this.store.on('load', this.addUpdateEvent, this);

	}

});