📄 mocargoinfo.js
字号:
}, {
// 货物保价
xtype : 'textfield',
fieldLabel : '货物保价',
name : 'CargoAmends',
allowBlank : false,
anchor : '85%'
}, {
// 库存状态
xtype : 'combo',
store : new Ext.data.SimpleStore({
fields : ["cargostatevalue", "cargostatename"],
data : [['0', '库存'], ['1', '在途'], ['2', '出库']]
}),
valueField : "cargostatevalue",
displayField : "cargostatename",
mode : 'local',
forceSelection : true,
blankText : '请选择状态',
emptyText : '请选择状态',
hiddenName : 'CargoState',
width : 125,
editable : false,
triggerAction : 'all',
allowBlank : false,
fieldLabel : '库存状态',
anchor : '85%'
}, {
xtype : 'datefield',
format : 'Ymd',
fieldLabel : '货物入库时间',
name : 'CargoStartData',
id : 'CargoStartData',
vtype : 'daterange',
endDateField : 'CargoEndData',
anchor : '85%'
}, {
xtype : 'datefield',
format : 'Ymd',
fieldLabel : '货物出库时间',
name : 'CargoEndData',
id : 'CargoEndData',
vtype : 'daterange',
startDateField : 'CargoStartData',
anchor : '85%'
}, {
// 备注
xtype : 'textarea',
fieldLabel : '备注',
name : 'CargoMemo',
autoScroll : false,
anchor : '85%'
}]
}]
}],
buttons : [{
text : '添加',
handler : function() {
from.getForm().submit({
success : function() {
Ext.MessageBox.alert('信息', '添加成功,点击返回列表页面');
grid.render();
store.load({
params : {
start : 0,
limit : 10
}
});
win.close();
},
failure : function() {
Ext.MessageBox.alert('信息', '添加失败,请与管理员联系!');
}
});
}
}]
});
/**
* 声明一个window,包装FormPanel
*/
win = new Ext.Window({
title : 'InfoWindow',
closable : true,
width : 660,
height : 375,
border : false,
plain : true,
draggable : true,
collapsible : true,
closeAction : 'hide',
items : [from]
});
win.show(Ext.get('addbtn'));
};
/**
* 为操作列修改按钮编写单击事件
*/
window.updateInfo = function() {
/**
* 声明一个变量,后期赋值为窗体
*/
var win;
if (!win) {
/**
* 获取Grid中选中行Record
*/
var selectRecode = grid.getSelectionModel().getSelected();
/**
* 创建分公司控件
*/
var BranchField = new Ext.form.TextField({
fieldLabel : '公司名称',
name : 'BranchID',
allowBlank : false,
readOnly : true,
anchor : '85%',
value : selectRecode.get("BranchID")
})
/**
* 声明一个FormPanel,显示选中信息,更改后提交
*/
var from = new Ext.form.FormPanel({
labelAlign : 'top',
buttonAlign : 'right',
title : '货物详细信息',
bodyStyle : 'padding:5px',
height : 350,
width : 650,
autoScroll : true,
frame : true,
url : '../moCargoInfoUpdate.do',
items : [{
layout : 'column',
border : false,
items : [{
columnWidth : .5,
layout : 'form',
border : false,
items : [{
// 货物编号
xtype : 'textfield',
fieldLabel : '货物编号',
readOnly : true,
name : 'CargoID',
allowBlank : false,
anchor : '85%'
}, {
// 货物名称
xtype : 'textfield',
fieldLabel : '货物名称',
name : 'CargoName',
allowBlank : false,
anchor : '85%'
}, {
// 货物重量
xtype : 'textfield',
fieldLabel : '货物重量(吨)',
name : 'CargoWeight',
vtype : 'alphanum',
allowBlank : false,
anchor : '85%'
}, {
// 货物体积
xtype : 'textfield',
fieldLabel : '货物体积(立方米)',
name : 'CargoBulk',
vtype : 'alphanum',
allowBlank : false,
anchor : '85%'
}, {
// 货物数量
xtype : 'textfield',
fieldLabel : '货物数量',
name : 'CargoNum',
allowBlank : false,
anchor : '85%'
}, {
// 货物单位
xtype : 'textfield',
fieldLabel : '货物单位',
name : 'CargoUnit',
allowBlank : false,
anchor : '85%'
}, {
// 货物价值
xtype : 'textfield',
fieldLabel : '货物价值',
name : 'CargoValue',
allowBlank : false,
anchor : '85%'
}]
}, {
columnWidth : .5,
layout : 'form',
border : false,
items : [BranchField, {
// 货物运费
xtype : 'textfield',
fieldLabel : '货物运费',
name : 'CargoFreight',
allowBlank : false,
anchor : '85%'
}, {
// 货物保价
xtype : 'textfield',
fieldLabel : '货物保价',
name : 'CargoAmends',
allowBlank : false,
anchor : '85%'
}, {
// 库存状态
xtype : 'combo',
store : new Ext.data.SimpleStore({
fields : ["cargostatevalue", "cargostatename"],
data : [['0', '库存'], ['1', '在途'], ['2', '出库']]
}),
valueField : "cargostatevalue",
displayField : "cargostatename",
mode : 'local',
forceSelection : true,
blankText : '请选择状态',
emptyText : '请选择状态',
hiddenName : 'CargoState',
width : 125,
editable : false,
triggerAction : 'all',
allowBlank : false,
fieldLabel : '库存状态',
anchor : '85%'
}, {
xtype : 'datefield',
format : 'Ymd',
fieldLabel : '货物入库时间',
name : 'CargoStartData',
id : 'CargoStartData',
vtype : 'daterange',
endDateField : 'CargoEndData',
anchor : '85%'
}, {
xtype : 'datefield',
format : 'Ymd',
fieldLabel : '货物出库时间',
name : 'CargoEndData',
id : 'CargoEndData',
vtype : 'daterange',
startDateField : 'CargoStartData',
anchor : '85%'
}, {
// 备注
xtype : 'textarea',
fieldLabel : '备注',
name : 'CargoMemo',
anchor : '85%'
}]
}]
}],
buttons : [{
text : '修改',
handler : function() {
from.getForm().submit({
success : function() {
Ext.MessageBox.alert('信息', '更新成功,点击返回列表页面');
grid.render();
store.load({
params : {
start : 0,
limit : 10
}
});
win.close();
},
failure : function() {
Ext.MessageBox.alert('信息', '更新失败,请与管理员联系!');
}
});
}
}]
});
/**
* 声明一个window,包装FormPanel
*/
win = new Ext.Window({
title : 'InfoWindow',
closable : true,
width : 660,
height : 375,
border : false,
plain : true,
draggable : true,
collapsible : true,
closeAction : 'hide',
items : [from]
});
}
win.show(Ext.get('update-btn'));
/**
* form加载事件
*/
from.getForm().loadRecord(selectRecode);
};
// =================================渲染呈现========================================
/**
* 渲染呈现Grid,Store初始化
*/
grid.render();
store.load({
params : {
start : 0,
limit : 10
}
});
})
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -