[code="java"]
Ext.namespace("SXP.Ext");
SXP.Ext.WelcomePage = Ext.extend(Ext.Panel, {
id : 'desktop_index',
title : '首 页',
closable : false,
autoScroll : true,
layout : "fit",
border : false,
getAjaxRequest : function() {
Ext.Ajax.request({
url : 'util?cmd=loadOnStart',
success : function(response) {
this.respText = Ext.decode(response.responseText);
this.store1 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.news
});
this.store2 = new Ext.data.SimpleStore({
fields : ['column', 'value'],
data : this.respText.statist
});
this.store3 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.notice
});
this.store4 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.rule
});
this.store5 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.mannual
});
this.store6 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.faq
});
},
failure : function() {
Ext.MessageBox.show({
title : '系统提示',
msg : '加载首页数据时出错了!',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.WARNING
});
}
});
},
fresh : function() {
if (this.store1 != null) {
this.store1.removeAll();
this.store2.removeAll();
this.store3.removeAll();
this.store4.removeAll();
this.store5.removeAll();
this.store6.removeAll();
}
this.getAjaxRequest();
},
createWin : function(width, height, type) {
var desc = "";
if (type == 'news')
desc = "最新新闻报道";
else if (type = 'rule')
desc = "系统运行规范";
else if (type == 'notice')
desc = "系统动态通知";
else if (type == 'mannual')
desc = "系统操作说明书";
else if (type == 'faq')
desc = "系统第一次使用必读";
var win = new Ext.Window({
width : width,
height : height,
title : desc,
modal : true,
resizable : false,
items : [{
xtype : 'tabpanel',
id : 'read_detail',
autoLoad : {
url : "",
nocache : false,
scripts : true
}
}]
});
return win;
},
buildComponent: function(){
Ext.Ajax.request({
url : 'util?cmd=loadOnStart',
success : function(response) {
Ext.MessageBox.hide();
this.respText = Ext.decode(response.responseText);
this.store1 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.news
});
this.store2 = new Ext.data.SimpleStore({
fields : ['column', 'value'],
data : this.respText.statist
});
this.store3 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.notice
});
this.store4 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.rule
});
this.store5 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.mannual
});
this.store6 = new Ext.data.SimpleStore({
fields : ['type', 'id', 'title', 'date'],
data : this.respText.faq
});
this.containerPanel = new Ext.Panel({
border : false,
layout : 'table',
bodyStyle : 'margin:0;padding:0',// background:#DFE8F6;
layoutConfig : {
columns : 3
},
defaults : {
frame : false
},
tbar : new Ext.Toolbar({
id : 'tbar_welcome',
items : ['-', {
xtype : 'button',
text : '刷新本页',
iconCls : 'refresh',
handler : this.fresh,
scope : this
}, '-']
}),
items : [{
columnWidth : .35,
title : '最新新闻报道',
hideBorders : true,
hideHeaders : true,
collapsible : true,
style : 'padding:5px',
height : 300,
frame : false,
viewConfig : {
forceFit : true
},
loadMask : true,
items : new Ext.grid.GridPanel({
border : false,
store : this.store1,
columns : [{
width : '75%',
dataIndex : 'title',
renderer : this.renderTitle
}, {
width : '25%',
dataIndex : 'date'
}]
})
}, {
columnWidth : .30,
title : '系统运行统计',
style : 'padding:5px;paddingLeft:0',
height : 300,
collapsible : true,
viewConfig : {
forceFit : true
},
hideHeaders : true,
loadMask : true,
frame : false,
items : new Ext.grid.GridPanel({
border : false,
store : this.store2,
columns : [{
width : '60%',
dataIndex : 'column'
}, {
width : '40%',
dataIndex : 'value'
}]
})
}, {
columnWidth : .35,
title : '系统动态通知',
html : '
style : 'padding:5px;paddingLeft:0',
height : 300,
collapsible : true,
viewConfig : {
forceFit : true
},
hideHeaders : true,
loadMask : true,
frame : false,
items : new Ext.grid.GridPanel({
border : false,
store : this.store3,
columns : [{
width : '75%',
dataIndex : 'title',
renderer : this.renderTitle
}, {
width : '25%',
dataIndex : 'date'
}]
})
}, {
columnWidth : .35,
title : '系统运行规范',
hideBorders : true,
hideHeaders : true,
collapsible : true,
shadow : true,
floating : false,
style : 'padding:5px',
height : 240,
frame : false,
viewConfig : {
forceFit : true
},
loadMask : true,
items : new Ext.grid.GridPanel({
border : false,
store : this.store4,
columns : [{
width : '75%',
dataIndex : 'title',
renderer : this.renderTitle
}, {
width : '25%',
dataIndex : 'date'
}]
})
}, {
columnWidth : .30,
title : '系统操作说明书',
style : 'padding:5px;paddingLeft:0',
height : 240,
collapsible : true,
viewConfig : {
forceFit : true
},
hideHeaders : true,
frame : false,
loadMask : true,
items : new Ext.grid.GridPanel({
border : false,
store : this.store5,
columns : [{
width : '70%',
dataIndex : 'title',
renderer : this.renderTitle
}, {
width : '30%',
dataIndex : 'date'
}]
})
}, {
columnWidth : .35,
title : '系统第一次使用必读',
style : 'padding:5px;paddingLeft:0',
height : 240,
collapsible : true,
viewConfig : {
forceFit : true
},
hideHeaders : true,
loadMask : true,
frame : false,
items : new Ext.grid.GridPanel({
border : false,
store : this.store6,
columns : [{
width : '75%',
dataIndex : 'title',
render : this.renderTitle
}, {
width : '25%',
dataIndex : 'date'
}]
})
}]
});this.add(this.containerPanel);
},
failure : function() {
Ext.MessageBox.hide();
Ext.MessageBox.show({
title : '系统提示',
msg : '加载首页数据时出错了!',
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.WARNING
});
}
});
},
readDetail : function(type, id) {
if (!this.win) {
this.win = this.createWin(700, 340, type);
}
this.win.show();
},
renderTitle : function(value, p, record) {
return String.format(
'<b><a href="javascript:readDetail(\"{2}\",{0})">{1}</a></b><br/>',
record.id, value, record.type)
},
initComponent : function() {
SXP.Ext.WelcomePage.superclass.initComponent.call(this);
Ext.MessageBox.show({
title : '请稍候',
msg : '数据正在加载中....',
icon : Ext.MessageBox.INFO,
closable : false
});
this.on("render", this.buildComponent, this);
}
});
[/code]
恳请解答,3Q!