佛祖保佑-永不宕机-永无BUG
//////////////////////////////////////////////////////////////////// // _ooOoo_ // // o8888888o // // 88" . "88 // // (| ^_^ |) // // O\ = /O // // ____/`---'\____ // // .' \\| |// `. // // / \\||| : |||// \ // // / _||||| -:- |||||- \ // // | | \\\ - /// | | // // | \_| ''\---/'' | | // // \ .-\__ `-` ___/-. / // // ___`. .' /--.--\ `. . ___ // // ."" '< `.___\_<|>_/___.' >'"". // // | | : `- \`.;`\ _ /`;.`/ - ` : | | // // \ \ `-. \_ __\ /__ _/ .-` / / //` // ========`-.____`-.___\_____/___.-`____.-'======== // // `=---=' // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // 佛祖保佑 永不宕机 永无BUG // //////////////////////////////////////////////////////////////////// /* * Grid * eg: * var grid = Ext.create("*.\BKX\BGGL\BGSC\.Grid", {}) */ Ext.define("*.JXKH.BKX.SYDW.JXDF.Fjx.FjxGrid", { extend : "*.XTGL.Base.QueryGridPanelBase", // 从第几个列开始显示,自定义的控制 keyCount : 3, //withCheckbox : false, CurUserA00 : null, // 初始化界面走的方法 initComponent : function() { var me = this; var ndCombo = Ext.create("*.XTGL.code.field.CodeField", { dmGrp : "year", itemId : "yearComboItemID", useCodeTable : false, fieldLabel : "年度", miniyear : "2014", typeAhead : false,// typeAhead和editable设置成false是下拉框只能选择输入,而不能手动输入 editable : false, hsQXZ : false, labelWidth:60, width : 200, heigth:30, name : 'year', value : new Date().getFullYear()+"", validator : Ext.emptyFn(), storeAutoLoad : true, hideTrigger : false, labelAlign : "right", allowBlank : false, listeners : { change :function(){ me.QueryRecord(); } } }); // 工具栏代码,按需增删 this.tbar = [ndCombo,'->',{ text : '新增', handler : Ext.bind(this.AddFunction, this), v : 1 },{ text : '修改', handler : Ext.bind(this.EditFunction, this), v : 1 },{ text : '删除', handler : Ext.bind(this.DeleteFunction, this), v : 1 }]; this.callParent(); }, //重新查询 QueryRecord : function(){ this.baseParams.nd = this.down("#yearComboItemID").getValue(); this.Reload(); }, //新增 AddFunction:function(){ var addForm = this.GetEditForm(); addForm.Show(); }, //修改 EditFunction:function(){ var me = this; var selectRecords = this.GetSelections(); if (selectRecords.length == 0) { Ext.Msg.alert("提示", "请选择一条记录!"); return; } else if (selectRecords.length > 1) { Ext.Msg.alert("提示", "只能选择一条记录!"); return; } var recordID = selectRecords[0].get("JXKHBKX1300"); var form = this.GetEditForm(); form.LoadAttachment(recordID); form.Show(); form.LoadData("JXKHBKX1300", recordID); //加载数据成功后执行的操作 form.on("loadsuccess",function(){}) }, //删除 DeleteFunction:function(){ var me = this; var RECORDIDS = new Array(); var selectRecords = this.GetSelections(); if (selectRecords.length == 0) { Ext.Msg.alert("提示", "请选择一条记录!"); return; } for (var i = 0; i < selectRecords.length; i++) { var recordID = selectRecords[i].data["JXKHBKX1300"]; RECORDIDS.push(recordID); } Ext.Msg.confirm("提示", "确定删除?", function(i) { if('yes'==i){ Ext.Ajax.request({ url : '/jxkh/bkx/sydw/jxdf/Fjx/deletedata?theme=none', params : { RECORDID : RECORDIDS }, success : function(r) { var data = Ext.String.trim(r.responseText); var o = Ext.decode(data); if (o.success) { Ext.Msg.alert("提示", "删除成功!"); me.Reload(); } }, failure : function() { Ext.Msg.alert("提示", "删除失败!"); } }); }else{ } }); }, editForm: null, GetEditForm: function () { var me = this; var selectND = me.down("#yearComboItemID").getValue(); if (this.editForm) { this.editForm.destroy(); } var form = Ext.create("*.JXKH.BKX.SYDW.JXDF.Fjx.Form", { ND:selectND }); form.on("submit", function(form, action) { var data = Ext.decode(action.response.responseText); this.fjsc.baseParams.recordID = data.returnPKValue; this.fjsc.Save(); me.Reload(); }) this.editForm = form; return this.editForm; }, //下载附件 // getDownLoad : function(){ // var me = this; // var record = this.GetSelections(); // var fid = record[0].get("FID"); // Ext.DownLoad({ // url : "/jxkh/bkx/sydw/jxdf/Fjx/downLoad?theme=none&&fileID="+fid // }) // }, //附件 Fj : function(){ var me = this; var selectRecords = this.GetSelections(); if (selectRecords.length == 0) { Ext.Msg.alert("提示", "请选择一条记录!"); return; } else if (selectRecords.length > 1) { Ext.Msg.alert("提示", "只能选择一条记录!"); return; } var recordID = selectRecords[0].get("JXKHBKX1300"); var form = this.GetFjEditForm(); form.LoadAttachment(recordID); form.Show(); }, fjeditForm: null, GetFjEditForm: function () { var me = this; if (this.fjeditForm) { this.fjeditForm.destroy(); } var form = Ext.create("*.JXKH.BKX.SYDW.JXDF.Fjx.FjForm", { }); this.fjeditForm = form; return this.fjeditForm; }, LoadStructureAndData : function(params) { var me = this; var columnConfig = { '序号':{ width : 30 }, '单位名称 ':{ width : 100 }, '否决项 ':{ width : 100 }, "备注" : { width : 200 }, "附件" : { width : 50, renderer : function(v, k, r) { var htmlFormat = '<a href="javascript:Ext.getCmp(\'{0}\').Fj();">附件</a>'; var html = Ext.String.format(htmlFormat, this.id); return html; } } }; params = { nd : me.down("#yearComboItemID").getValue() }, this.LoadByMybatis("JXKH.BKXSYDW.JXDF.FJX_QUERY_LIST", params, columnConfig) }, // 初始化渲染的效果的方法 onRender : function() { this.callParent(); this.LoadStructureAndData(); } });