1.
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 <% 3 String path = request.getContextPath(); 4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 %> 6 7 8 9 1011 12 培训信息 13 14 19 20 21 22 23 24
2.税率表js
1 /** 2 * 税率信息 3 * 4 * @author sux 2011-02-22 5 * @memberOf {TypeName} 6 */ 7 var Revenue = Ext.extend(Ext.grid.EditorGridPanel, { 8 id : 'revenueId', 9 constructor : function() { 10 // 实现统一的提示方式 11 Ext.form.Field.prototype.msgTarget = 'title'; 12 var number = new Ext.grid.RowNumberer(); 13 var sm = new Ext.grid.CheckboxSelectionModel(); 14 var revenueStore = new Ext.data.JsonStore({ 15 url : 'revenue_edit.action', 16 root : 'root', 17 totalProperty : 'totalProperty', 18 fields : [ 'reId', 'reMin', 'reMax', 'rePercent', 'reMinus' ] 19 }); 20 var cm = new Ext.grid.ColumnModel([ number, sm, { 21 header : '编号', 22 dataIndex : 'reId', 23 align : 'center' 24 }, { 25 header : '最小值', 26 dataIndex : 'reMin', 27 align : 'center', 28 //设置在编辑状态下,指定编辑器 29 //Ext_数字输入框_Ext.form.NumberField 30 editor : new Ext.form.NumberField({ 31 allowBlank : false, 32 blankText : '不能为空' 33 }) 34 }, { 35 header : '最大值', 36 dataIndex : 'reMax', 37 align : 'center', 38 editor : new Ext.form.NumberField({ 39 allowBlank : false, 40 blankText : '不能为空' 41 }) 42 }, { 43 header : '税率', 44 dataIndex : 'rePercent', 45 align : 'center', 46 editor : new Ext.form.NumberField({ 47 allowBlank : false, 48 blankText : '不能为空' 49 }) 50 }, { 51 header : '速算减值', 52 dataIndex : 'reMinus', 53 align : 'center', 54 editor : new Ext.form.NumberField({ 55 allowBlank : false, 56 blankText : '不能为空' 57 }) 58 } ]); 59 60 Revenue.superclass.constructor.call(this, { 61 width: Ext.getCmp('mainTab').getActiveTab().getInnerWidth(), 62 height: Ext.getCmp('mainTab').getActiveTab().getInnerHeight(), 63 /**表格高度自适应 document.body.clientHeight浏览器页面高度 start**/ 64 monitorResize: true, 65 doLayout: function() { 66 this.setWidth(document.body.clientWidth-205); 67 this.setHeight(document.body.clientHeight-140); 68 Ext.grid.GridPanel.prototype.doLayout.call(this); 69 } , 70 viewConfig: { 71 forceFit: true 72 }, 73 sm: sm, 74 cm: cm, 75 store: revenueStore, 76 tbar: new Ext.Toolbar({ 77 items: [{ 78 text: '删除', 79 iconCls: 'delete', 80 id: 'reve_delete', 81 handler: delRevenueFn 82 },{ 83 text: '新增', 84 iconCls: 'add', 85 id: 'reve_add', 86 handler: newRevenueFn 87 },{ 88 text: '保存或修改', 89 iconCls: 'save', 90 id: 'reve_saveorupdate', 91 handler: modifyRevenueFn 92 }] 93 }), 94 bbar: new PagingToolbar(revenueStore, 20) 95 }); 96 revenueStore.load({ 97 params: { 98 start: 0, 99 limit: 20100 }101 });102 }103 });104 //删除105 delRevenueFn = function(){106 gridDel('revenueId', 'reId','revenue_delete.action');107 };108 //新增109 newRevenueFn = function(){110 111 var DefaultRecord = new Ext.data.Record.create([{name: 'reId', mapping: 0},{name: 'reMin', mapping: 1},112 {name: 'reMax', mapping: 2},{name: 'rePercent', mapping: 3},{name: 'reMinus', mapping: 4}]);113 //Store.getCount()返回的是store中的所有数据记录,然后使用for循环遍历整个store,从而得到每条记录。114 var num = Ext.getCmp('revenueId').getStore().getCount();115 var newRecord = new DefaultRecord({116 reId: num+1,117 reMin: '',118 reMax: '',119 rePercent: '',120 reMinus: ''121 });122 Ext.getCmp('revenueId').getStore().insert(0,newRecord); 123 };124 //保存或修改125 modifyRevenueFn=function(){126 //获取以后都是第一次修改的值127 var modifiedRecords = Ext.getCmp('revenueId').getStore().getModifiedRecords();128 129 var revenues = reRevenueJson(modifiedRecords);130 Ext.Ajax.request({131 url: 'revenue_modify.action',132 waitTitle: '提示',133 waitMsg: '正在保存数据...',134 method: 'post',135 params: {136 json: revenues137 },138 success: reModifySuccessFn,139 failure: reModifyfailureFn140 })141 };142 //保存成功后处理143 reModifySuccessFn = function(response, options){144 var datas = Ext.util.JSON.decode(response.responseText);145 Ext.Msg.alert('提示',datas.msg,function(){146 Ext.getCmp('revenueId').getStore().load({147 params: {148 start: 0,149 limit: 20150 }151 });152 });153 };154 //删除成功后处理155 reModifyfailureFn = function(response, options){156 Ext.Msg.alert('提示','连接失败',function(){})157 };158 //转化json159 reRevenueJson = function(modifiedRecords){160 var count = modifiedRecords.length;161 var revenues='';162 //有修改163 if(count > 0){164 revenues = "[";165 for(i=0; i