/**
 * 各自务必修改 customerInfoForm 变为自己的页面的form的名称
 */
var chargeQueryCusForm = {};Ext.onReady(function() {
if (!Ext.isIE6) {
// 写上它ie6树展开报错 }
cursorSwitch_();
// 整体布局
var viewport = new Ext.Viewport({
layout : 'border', // [wiki1] layout为fit时,showMessage()等弹出层将不起作用,原因未知
items : {
id : 'mainPanel',
title : "<span class='extTitle'>" + chargeTypeLabel + "客户选择</span>",
region : 'center',
layout : 'border',
margins : '5 4 5 5',
items : [areaTreePanel, centerPanel]
}
});
publicFunction.fn_areaSelect("areaSelectedName", "areaSelectedValue");
queryHotKeys_(chargeQueryCusForm.fn_query, false);
if (isSupportDevice) {
setTimeout(function() {
$("#cusNo").focus();
}, 500);
} else {
setTimeout(function() {
$("input[tabindex=1]").focus();
}, 500);
}
});/**
 * "搜索条件"区域
 */
var searchPanel = new Ext.Panel({
region : 'north',
border : false,
style : 'border-left:solid 1px #99bbe8;',
// height : 80,
contentEl : 'cusSearchDiv'
});/**
 *  定义客户列表列标题
 */
var cusGridColModel = [{
header : '客户ID',
width : 40,
dataIndex : '客户ID',
hidden : true
}, {
header : '客户卡号',
width : 50,
dataIndex : '客户卡号'
}, {
header : '小区名称',
width : 80,
dataIndex : '小区名称'
}, {
header : '楼',
width : 50,
dataIndex : '楼号'
}, {
header : '单元',
width : 50,
dataIndex : '单元号'
}, {
header : '室',
width : 50,
dataIndex : '室号'
}, {
header : '客户名称',
width : 100,
dataIndex : '客户名称',
css : 'color: #752f6e;font-weight: bold;'
}, {
header : '采暖面积',
width : 60,
dataIndex : '采暖面积'
}, {
header : '客户类型',
width : 60,
dataIndex : '客户类型'
}];/**
 * 定义客户列表
 */
var cusGridPanel = new Ext.zk.GridPanel({
id : 'cusGrid',
margins : '0 0 0 0',
url : padUrl("/charge/charge/customer.ao?method=processQueryCustomerInfo"),
style : 'border-left:solid 1px #99bbe8;border-top:solid 1px #99bbe8;',
columns : cusGridColModel
});/**
 * 小区树
 */
var areaTreePanel = new Ext.zk.AreaTreePanel({});/**
 * 小区列表叶子节点单击事件
 */
areaTreePanel.on('click', function(node) {
if (node.isLeaf()) {
cusGridPanel.getStore().proxy = new Ext.data.HttpProxy({
method : 'post',
url : padUrl('/customer/infoManage/year.ao?method=queryCustomerListWithHoustNo&nodeId='
+ encodeURIComponent(node.id))
}), cusGridPanel.getStore().load({
callback : function(r, options, success) {
if (success) {
cusGridPanel.render();
} else {
showMessage('加载客户信息异常,请联系管理员', 'warn');
}
}
})
}
});/**
 * 客户列表行双击事件
 */ 
cusGridPanel.on('rowdblclick', function(grid, rowIndex, e) {
var selectionModel = grid.getSelectionModel({
singleSelected : true
});
openWindow_(url, 880, 540);
});/**
 * 中间整体panel
 */
var centerPanel = new Ext.Panel({
region : 'center',
border : false,
layout : 'border',
items : [searchPanel, cusGridPanel]
});/**
 * 查询
 */ 
chargeQueryCusForm.fn_query = function() {
cusGridPanel.render();
cusGridPanel.getStore().baseParams = {
buildingNo : Ext.get('buildingNoTxt').getValue(),
houseNo : Ext.get('houseNoTxt').getValue(),
roomNo : Ext.get('roomNoTxt').getValue(),
cusName : Ext.get('cusName').getValue(),
areaId : Ext.get('areaSelectedValue').getValue(),
cusNo : Ext.get('cusNo').getValue(),
cusTypeId : Ext.get('cusType').getValue()
};
Ext.getCmp("cusGrid").getStore().load({
callback : function(r, options, success) {
if (r.length == 1) {
openWindow_(url, 880, 520);
}
}
});
cusGridPanel.render();
}
Ext,HttpProxy,store