📄 erp2bid.js
字号:
Ext.MessageBox.confirm('提示', '是否确定删除' , function(btn){
if(btn == 'yes') {
var selections = grid.getSelections();
var ids = new Array();
for(var i = 0, len = selections.length; i < len; i++){
try {
selections[i].get("id");
ids[i] = selections[i].get("id");
dataStore.remove(selections[i]);//从表格中删除
} catch (e) {
}
}
Ext.Ajax.request({
url : 'remove.htm?ids=' + ids,
success : function() {
Ext.MessageBox.alert('提示', '删除成功!');
//dataStore.reload();
},
failure : function(){Ext.MessageBox.alert('提示', '删除失败!');}
});
}
});
} else {
Ext.MessageBox.alert('警告', '至少要选择一条记录');
}
}
});
dataStore.on('beforeload', function() {
dataStore.baseParams = {
code : code.getValue(),
productName : productName.getRawValue(),
startDate : startDate.getValue()
};
});
dataStore.load({
params:{start:0, limit:paging.pageSize}
});
});
Bid = {
getInsertForm : function(closeTagHandler) {
this.createForm('./insert.htm', 'insert-box');
var form = this.form;
form.addButton({
text:'提交',
handler:function(){
if (form.isValid()) {
form.submit({
success:function(form, action){
Ext.MessageBox.confirm('提示', '保存添加成功,是否继续添加' , function(btn){
if (btn == 'yes') {
form.reset();
} else {
closeTagHandler();
}
});
}
,failure:function(form, action){
Ext.suggest.msg('错误', action.result.response);
}
,waitMsg:'提交中...'
});
}
}
});
form.addButton({
text:'重置',
handler:function(){
Bid.form.reset();
}
});
form.addButton({
text:'取消',
handler:closeTagHandler
});
form.render("insert-form");
return form;
},
getUpdateForm : function(closeTagHandler, id) {
this.createForm('./insert.htm', 'update-box');
this.id = id;
var form = this.form;
form.addButton({
text:'提交',
handler:function(){
if (form.isValid()) {
form.submit({
params:{id:Bid.id},
success:function(form, action){
Ext.MessageBox.confirm('提示', '保存修改成功,是否返回' , function(btn){
if (btn == 'yes') {
closeTagHandler();
} else {
form.reset();
}
});
}
,failure:function(form, action){
Ext.suggest.msg('错误', action.result.response);
}
,waitMsg:'提交中...'
});
}
}
});
form.addButton({
text:'重置',
handler:function(){
form.reset();
}
});
form.addButton({
text:'取消',
handler:closeTagHandler
});
form.render("update-form");
form.load({url:'./loadData.htm?id=' + id});
// 初始化地区的省市县信息
Ext.lib.Ajax.request(
'GET',
'./loadData.htm?id=' + this.id,
{success:function(response){
var entity = Ext.decode(response.responseText);
var productId = entity[0].erp2Product.id;
var productName = entity[0].erp2Product.name;
form.findField('product').setValue(productId);
form.findField('productId2').setRawValue(productName);
},failure:function(){}}
);
return form;
},
createForm : function(url, waitMsgTarget) {
var form = new Ext.form.Form({
labelAlign:'right',
labelWidth:80,
url:url,
method: 'POST',
waitMsgTarget:waitMsgTarget,
reader : new Ext.data.JsonReader({}, [
{name:'code'},
{name:'productNum'},
{name:'parameter'},
{name:'startDate'},
{name:'endDate'},
{name:'openDate'},
{name:'fax'},
{name:'descn'}
])
});
form.fieldset(
{legend:'标书信息', hideLabels:false}
);
form.column(
{width:300},
new Ext.form.TextField({
fieldLabel:'标书编号',
name:'code',
width:200,
allowBlank:false
}),
new Ext.form.TextField({
fieldLabel: '技术参数',
name: 'parameter',
width:200,
allowBlank:false
}),
new Ext.form.DateField({
fieldLabel: '投标开始时间',
name: 'startDate',
format:'Y-m-d',
width:200,
allowBlank:false
}),
new Ext.form.DateField({
fieldLabel: '投标截止时间',
name: 'endDate',
format:'Y-m-d',
width:200,
allowBlank:false
}),
new Ext.form.DateField({
fieldLabel: '开标时间',
name: 'openDate',
format:'Y-m-d',
width:200,
allowBlank:false
})
);
form.column(
{width:300},
new Ext.form.ComboBox({
id:'productId2',
name:'product',
readOnly:true,
fieldLabel:'产品名称',
hiddenName:'product',
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'../erp2product/pagedQueryForCombo.htm'}),
reader: new Ext.data.JsonReader({
root : "result",
totalProperty : "totalCount",
id : "id"
},['id','name'])
}),
valueField:'id',
displayField:'name',
typeAhead: true,
mode: 'remote',
triggerAction: 'all',
emptyText:'请选择',
selectOnFocus:true,
width:200,
allowBlank:false,
pageSize:10
}),
new Ext.form.NumberField({
fieldLabel: '产品数量',
name: 'productNum',
width:200,
allowBlank:false
}),
new Ext.form.TextArea({
fieldLabel:'备注',
name:'descn',
width:200,
height:80
})
);
//
this.form = form;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -