1
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 <%@ taglib prefix="s" uri="/struts-tags" %> 3 4 <html > 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 7 </head> 8 9 <body> 10 <!-- <a href="emp_report.action?empId=0007" target="_blank">report</a> 11 <s:form action="emp_report.action"> 12 <s:textfield name="empId"/> 13 <s:submit value="确定"/> 14 </s:form>--> 15 <script type="text/javascript"> 16 var salaryPanel = new SalaryPanel(); 17 var w = Ext.getCmp('mainTab').getActiveTab().getInnerWidth(); 18 var h = Ext.getCmp('mainTab').getActiveTab().getInnerHeight(); 19 var activeTab = Ext.getCmp('salaryPanelId'); 20 if(activeTab){ 21 activeTab.setHeight(h); 22 activeTab.setWidth(w); 23 } 24 activeTab.render('salaryDiv'); 25 </script> 26 <div id="salaryDiv"></div> 27 </body> 28 </html> 29
2.
1 SalaryPanel = Ext.extend(Ext.Panel,{ 2 id: 'salaryPanelId', 3 constructor: function(){ 4 SalaryPanel.superclass.constructor.call(this, { 5 items: [{ 6 html: '<iframe src="" id="viewArea" width="100%" height="500" frameborder="0" scrolling="auto"></iframe>' 7 }], 8 tbar: new Ext.Toolbar({ 9 items: ['员工工号',{ 10 xtype: 'textfield', 11 id: 'report_empId', 12 80, 13 listeners: {'blur': blurFn2} 14 },'年份',{ 15 xtype: 'textfield', 16 80, 17 id: 'year' 18 },'月份',{ 19 xtype: 'combo', 20 mode: 'local', 21 editable: false, 22 store: new Ext.data.SimpleStore({ 23 fields: ['name','value'], 24 data: [[0,"全部"],[1,"一月"],[2,"二月"],[3,"三月"],[4,"四月"],[5,"五月"], 25 [6,"六月"],[7,"七月"],[8,"八月"],[9,"九月"],[10,"十月"],[11,"十一月"], 26 [12,"十二月"]] 27 }), 28 id: 'month', 29 70, 30 triggerAction: 'all', 31 displayField: 'value', 32 valueField: 'name' 33 },{ 34 text: '工资单预览', 35 handler: this.viewFn 36 },'-',{ 37 text: '工资单导出', 38 handler: this.exportFn 39 }] 40 }) 41 }) 42 }, 43 viewFn: function(){ 44 var url = 'salary_view.action?empId='; 45 var empId = Ext.get('report_empId').dom.value; 46 var year = Ext.get('year').dom.value; 47 var month = Ext.getCmp('month').getValue(); 48 Ext.get('viewArea').dom.src = url+empId+"&year="+year+"&month="+month; 49 }, 50 exportFn: function(){ 51 var url = 'emp_report.action?empId='; 52 var empId = Ext.get('report_empId').dom.value; 53 var year = Ext.get('year').dom.value; 54 var month = Ext.getCmp('month').getValue(); 55 document.location = 'salary_export.action?empId='+empId+"&year="+year+"&month="+month; 56 } 57 }); 58 blurFn2 = function(value){ 59 var empId = value.getRawValue(); 60 if(empId != '') 61 Ext.Ajax.request({ 62 url: 'emp_isExist.action', 63 method: 'post', 64 params: { 65 empId: empId 66 }, 67 success: isExistSuccessFn2, 68 failure: save_failure 69 }) 70 }; 71 isExistSuccessFn2 = function(response, options){ 72 if(response.responseText == ''){ 73 Ext.Msg.alert('提示','此工号不存在'); 74 } 75 }