erp2buyorder.js
来自「anewssystem新闻发布系统集成使用了spring hibernate f」· JavaScript 代码 · 共 919 行 · 第 1/3 页
JS
919 行
EditForm = {
getInsertForm : function(closeTagHandler) {
this.createForm('./insert.htm', 'insert-box');
var form = this.form;
form.addButton({
text:'提交',
handler:function(){
if (!form.isValid()){
return;
}
form.el.mask('提交数据,请稍候...', 'x-mask-loading');
var hide = function(){
form.el.unmask();
};
var buyOrderValue = EditForm.form.getValues();
buyOrderValue.totalPrice = document.getElementById("amount1").innerHTML;
EditForm.grid.stopEditing();
var infoValues = new Array();
var ds = EditForm.grid.dataSource;
for (var i = 0; i < ds.getCount(); i++) {
var record = ds.getAt(i);
var item = {};
item.id = record.data.id;
item.productId = record.data.productId;
item.code = record.data.code;
item.parameter = record.data.parameter;
item.num = record.data.num;
item.unit = record.data.unit;
item.price = record.data.price;
item.totalPrice = record.data.totalPrice;
item.descn = record.data.descn;
infoValues.push(item);
}
var json = {buyOrderValue:buyOrderValue,infos:infoValues}
Ext.lib.Ajax.request(
'POST',
'./insert.htm',
{success:function(){
form.el.unmask();
Ext.MessageBox.confirm('提示', '保存添加成功,是否继续添加', function(btn){
if (btn == 'yes') {
form.reset();
EditForm.grid.dataSource.removeAll();
EditForm.form.findField("statusId2").clearValue("");
EditForm.form.findField("supplierNameId2").clearValue("");
EditForm.form.findField("auditId2").clearValue("");
} else {
closeTagHandler();
}
});
},failure:function(){
form.el.unmask();
}},
'data=' + encodeURIComponent(Ext.encode(json))
);
}
});
form.addButton({
text:'重置',
handler:function(){
form.reset();
EditForm.grid.dataSource.removeAll();
EditForm.form.findField("statusId2").clearValue("");
EditForm.form.findField("supplierNameId2").clearValue("");
EditForm.form.findField("auditId2").clearValue("");
}
});
form.addButton({
text:'取消',
handler:closeTagHandler
});
form.render("insert-form");
this.createGrid();
var grid = this.grid;
return form;
},
getUpdateForm : function(closeTagHandler, id) {
this.createForm('./update.htm', 'update-box');
this.id = id;
var form = this.form;
form.load({url:'./loadData.htm?id=' + id});
form.addButton({
text:'提交',
handler:function(){
if (!form.isValid()) {
return;
}
form.el.mask('提交数据,请稍候...', 'x-mask-loading');
var hide = function() {
form.el.unmask();
};
var buyOrderValue = EditForm.form.getValues();
buyOrderValue.totalPrice = document.getElementById("amount1").innerHTML;
buyOrderValue.id = EditForm.id;
EditForm.grid.stopEditing();
var infoValues = new Array();
var ds = EditForm.grid.dataSource;
for (var i = 0; i < ds.getCount(); i++) {
var record = ds.getAt(i);
var item = {};
item.id = record.data.id;
item.productId = record.data.productId;
item.code = record.data.code;
item.parameter = record.data.parameter;
item.num = record.data.num;
item.unit = record.data.unit;
item.price = record.data.price;
item.totalPrice = record.data.totalPrice;
item.descn = record.data.descn;
infoValues.push(item);
}
var json = {buyOrderValue:buyOrderValue,infos:infoValues}
Ext.lib.Ajax.request(
'POST',
'./update.htm',
{success:function(){
form.el.unmask();
Ext.MessageBox.confirm('提示', '修改成功,是否返回' , function(btn){
if (btn == 'yes') {
closeTagHandler();
} else {
form.reset();
EditForm.grid.dataSource.load({params:{id:EditForm.id}});
}
});
},failure:function(){
form.el.unmask();
}},
'data=' + encodeURIComponent(Ext.encode(json))
);
}
});
form.addButton({
text:'重置',
handler:function(){
form.load({url:'./loadData.htm?id=' + this.id});
}
});
form.addButton({
text:'取消',
handler:closeTagHandler
});
form.render("update-form");
this.createGrid();
var grid = this.grid;
grid.dataSource.load({params:{id:id}});
return form;
},
getRecordBuyOrderInfo : function() {
// 数据模型
this.RecordBuyOrderInfo = Ext.data.Record.create([
{name:"id"},
{name:"code"},
{name:'productId',mapping:'erp2Product.id'},
{name:"productName",mapping:'erp2Product.name'},
{name:"productType",mapping:'erp2Product.type'},
{name:"material",mapping:'erp2Product.material'},
{name:'parameter'},
{name:"factory",mapping:'erp2Product.factory'},
{name:"num"},
{name:"unit"},
{name:"price"},
{name:"totalPrice"},
{name:"descn"}
]);
},
createForm : function(url, waitMsgTarget) {
this.getRecordBuyOrderInfo();
var form = new Ext.form.Form({
labelAlign:'right',
labelWidth:80,
url:url,
method: 'POST',
waitMsgTarget:waitMsgTarget,
reader : new Ext.data.JsonReader({}, [
'code',
'status',
'name',
{name:'supplierName',mapping:'erp2Supplier.name'},
'linkman',
'provideDate',
'orderDate',
'audit',
'username'
])
});
form.fieldset(
{legend:'采购订单', hideLabels:false}
);
var supplierDataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'../erp2supplier/pagedQueryForCombo.htm'}),
reader: new Ext.data.JsonReader({
root : "result",
totalProperty : "totalCount",
id : "id"
},['id','name'])
})
var supplierName = new Ext.form.ComboBox({
id:'supplierNameId2',
name:'supplierName',
readOnly:true,
fieldLabel:'供应商名称',
hiddenName:'supplierName',
store: supplierDataStore,
valueField:'id',
displayField:'name',
typeAhead:true,
mode:'remove',
triggerAction:'all',
emptyText:'请选择',
selectOnFocus:true,
width:200,
allowBlank:false,
pageSize:10
});
form.column(
{width:320},
new Ext.form.TextField({
fieldLabel:'采购订单编号',
name:'code',
width:200
}),
new Ext.form.ComboBox({
id:'statusId2',
name:'status',
readOnly:true,
fieldLabel:'订单状态',
hiddenName:'status',
store: new Ext.data.SimpleStore({
fields:['id', 'name'],
data:[[0,'待审'],[1,'审核'],[2,'完成']]
}),
valueField:'id',
displayField:'name',
typeAhead:true,
mode:'local',
triggerAction:'all',
emptyText:'请选择',
selectOnFocus:true,
width:200,
allowBlank:false
}),
new Ext.form.TextField({
fieldLabel:'订单名称',
name:'name',
width:200
}),
supplierName,
new Ext.form.TextField({
fieldLabel:'联系人',
name:'linkman',
width:200
})
);
form.column(
{width:320, clear:true},
new Ext.form.DateField({
fieldLabel:'要求供货日期',
name:'provideDate',
width:200,
format:'Y-m-d'
}),
new Ext.form.DateField({
fieldLabel:'签订日期',
name:'orderDate',
width:200,
format:'Y-m-d'
}),
new Ext.form.ComboBox({
id:'auditId2',
name:'audit',
readOnly:true,
fieldLabel:'审核受理',
hiddenName:'audit',
store: new Ext.data.SimpleStore({
fields:['id', 'name'],
data:[[0,'立即审核'],[1,'常规审核']]
}),
valueField:'id',
displayField:'name',
typeAhead:true,
mode:'local',
triggerAction:'all',
emptyText:'请选择',
selectOnFocus:true,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?