?? erpcustomer.js
字號:
/*
* Ext JS Library 1.1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*
* @author Lingo
* @since 2007-10-02
* http://code.google.com/p/anewssystem/
*/
Ext.onReady(function(){
// 開啟提示功能
Ext.QuickTips.init();
// 使用cookies保持狀態
// TODO: 完全照抄,作用不明
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
// 布局管理器
var layout = new Ext.BorderLayout(document.body, {
center: {
autoScroll : true,
titlebar : false,
tabPosition : 'top',
closeOnTab : true,
alwaysShowTabs : true,
resizeTabs : true,
fillToFrame : true
}
});
// 設置布局
layout.beginUpdate();
layout.add('center', new Ext.ContentPanel('tab1', {
title : '客戶',
toolbar : null,
closable : false,
fitToFrame : true
}));
layout.add('center', new Ext.ContentPanel('tab2', {
title: "幫助",
toolbar: null,
closable: false,
fitToFrame: true
}));
layout.restoreState();
layout.endUpdate();
layout.getRegion("center").showPanel("tab1");
// 默認需要id, name, theSort, parent, children
// 其他隨意定制
var metaData = [
{id:'id', qtip:"ID", vType:"integer", allowBlank:true,defValue:-1,w:50},
{id:'name', qtip:"客戶名稱", vType:"chn", allowBlank:false,w:200},
{id:'code', qtip:"客戶編碼", vType:"chn", allowBlank:false,w:100,showInGrid:false},
{id:'type', qtip:"客戶類型", vType:"comboBox", allowBlank:false,w:100,showInGrid:false},
{id:'zip', qtip:"郵編", vType:"alphanum", allowBlank:false,w:80,showInGrid:false},
{id:'leader', qtip:"負責人", vType:"chn", allowBlank:false,w:80,showInGrid:false},
{id:'fax', qtip:"傳真", vType:"chn", allowBlank:false,w:100,showInGrid:false},
{id:'linkMan', qtip:"聯系人", vType:"chn", allowBlank:false,w:200},
{id:'email', qtip:"電子郵件", vType:"alphanum", allowBlank:false,w:100,showInGrid:false},
{id:'tel', qtip:"電話", vType:"alphanum", allowBlank:false,w:100},
{id:'homepage', qtip:"主頁", vType:"url", allowBlank:false,w:100,showInGrid:false},
{id:'province', qtip:"省", vType:"comboBox", allowBlank:false,w:100,showInGrid:false,skip:true},
{id:'city', qtip:"市", vType:"comboBox", allowBlank:false,w:100,showInGrid:false,skip:true},
{id:'town', qtip:"縣", vType:"comboBox", allowBlank:false,w:100,showInGrid:false,skip:true},
{id:'address', qtip:"地址", vType:"chn", allowBlank:false,w:100,showInGrid:false},
{id:'source', qtip:"客戶渠道", vType:"comboBox", allowBlank:false,w:100,showInGrid:false},
{id:'rank', qtip:"信用等級", vType:"comboBox", allowBlank:false,w:100},
{id:'status', qtip:"狀態", vType:"comboBox", allowBlank:false,w:100},
{id:'inputMan', qtip:"錄入人", vType:"chn", allowBlank:false,w:100,showInGrid:false},
{id:'inputTime', qtip:"錄入時間", vType:"date", allowBlank:false,w:100,showInGrid:false},
{id:'descn', qtip:"備注", vType:"editor", allowBlank:false,w:100,showInGrid:false}
];
// 創建表格
var lightGrid = new Ext.lingo.JsonGrid("lightgrid", {
metaData : metaData,
dialogContent : "content"
});
// 渲染表格
lightGrid.render();
var provinceId;
var cityId;
var townId;
var regionRecord = Ext.data.Record.create([
{name: 'id'},
{name: 'name'}
]);
var provinceStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'../region/getChildren.htm'}),
reader: new Ext.data.JsonReader({},regionRecord)
});
var cityStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'../region/getChildren.htm'}),
reader: new Ext.data.JsonReader({},regionRecord)
});
var townStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'../region/getChildren.htm'}),
reader: new Ext.data.JsonReader({},regionRecord)
});
lightGrid.createDialog();
lightGrid.columns.province = new Ext.form.ComboBox({
id:'province',
name:'province',
fieldLabel: '省',
hiddenName:'province',
store: provinceStore,
valueField:'id',
displayField:'name',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'請選擇',
selectOnFocus:true,
width:200,
transform:'province'
});
lightGrid.columns.city = new Ext.form.ComboBox({
id:'city',
name:'city',
fieldLabel: '市',
hiddenName:'city',
store: cityStore,
valueField:'id',
displayField:'name',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'請選擇',
selectOnFocus:true,
width:200,
transform:'city'
});
lightGrid.columns.town = new Ext.form.ComboBox({
id:'town',
name:'town',
fieldLabel: '縣',
hiddenName:'town',
store: townStore,
valueField:'id',
displayField:'name',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'請選擇',
selectOnFocus:true,
width:200,
transform:'town'
});
provinceStore.load();
//cityStore.load();
//townStore.load();
lightGrid.columns.province.on('select',function() {
provinceId = lightGrid.columns.province.getValue();
cityStore.load({
params:{node:provinceId}
});
});
lightGrid.columns.city.on('select',function() {
cityId = lightGrid.columns.city.getValue();
townStore.load({
params:{node:cityId}
});
});
});
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -