You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

315 lines
11 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.ClearingAddEdit= function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.ClearingAddEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.ClearingAddEdit, Ext.Window, {
StoreList: null,
ParentPanel: null, //Tab页编辑模式
OpStatus: 'add',
StoreBill: null,
StoreCustType: null,
stroplb:'',
EditRecord: null,
// region: 'center',
initUIComponents: function () {
_thisAddClearing = this;
//#region 申请修改和删除界面
this.StoreCLEARINGMODE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE']
});
this.StoreCLEARINGMODE.add({ "BLTYPE": "简单清洗" });
this.StoreCLEARINGMODE.add({ "BLTYPE": "彻底清洗" });
this.comboxCLEARINGMODE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCLEARINGMODE,
fieldLabel: '清洗方式',
forceSelection: true,
name: 'CLEARINGMODE',
valueField: 'BLTYPE',
displayField: 'BLTYPE'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: "" } });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
fieldLabel: '检测机构',
forceSelection: true,
name: 'CHECKGOV',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeYARD.load({ params: { condition: "ISYARD='1'" } });
//场站
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeYARD,
fieldLabel: '场站',
forceSelection: true,
name: 'CURSTATOIN',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: "" } });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
fieldLabel: '费用名称',
name: 'FEENAME',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: "" } });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
fieldLabel: '币别',
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.DataLoading = false;
this.NewFeeEdit = Ext.widget('form', {
frame: true,
region: 'center',
trackResetOnLoad: true,
// title: Zi.LAN.FEE.NewFeeEdit, //'费用新值',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxYARD, {
fieldLabel: '进场时间',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'INSTATOINTIME'
}, this.comboxCLEARINGMODE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '清洗品名', //'备注',
name: 'PREGOODSNAME'
}, {
fieldLabel: '否有清洁证',
inputValue: true, flex: 1,
xtype: 'checkboxfield',
name: 'ISCLEAR_CERT'
}, this.comboxCustomerNameRef
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '发送清洗计划',
inputValue: true, flex: 1,
xtype: 'checkboxfield',
name: 'ISCLEAR_PLAN'
}, {
fieldLabel: '清洗时间',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'CLEARTIME'
}, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFeeNameRef, this.comboxCurr, {
fieldLabel: '金额', //'不含税单价',
xtype: 'numberfield',
value: 0,
name: 'AMOUNT'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注', //'备注',
name: 'Remark'
}]
// }]
}
]//end items(fieldset 1)
}//end fieldset 1
],
buttons: [{
text: '确定添加',
id: 'btnEnter',
handler: function (button, event) {
_thisAddClearing.execSql();
},
scope: this
}, {
text:'取消',
handler: function (button, event) {
var win = this.up("window");
win.close();
}
}]//end root items
});
//#endregion
//#region 布局
Ext.apply(this, {
height: 250,
closable: true,
draggable: true,
title: '新增维修改装',
defaultButton: 'btnEnter',
resizable: false,
items: [this.NewFeeEdit],
layout: "border",
width: 800,
xtype: "window",
id: "DsAddRepairWin"
});
//#endregion
}, execSql: function () {
var form = _thisAddClearing.NewFeeEdit.getForm();
//var FeeName = form.findField('ITEMNAME').getValue();
//if (FeeName == '' || FeeName == null || FeeName == undefined) {
// Ext.Msg.show({ title:'提示', msg:'项目名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //费用名称不能为空!'
// return;
//};
var CustomerName = form.findField('CURSTATOIN').getValue();
if (CustomerName == '' || CustomerName == null || CustomerName == undefined) {
Ext.Msg.show({ title:'提示', msg:'场站不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var FeeName = form.findField('FEENAME').getValue();
if (FeeName == '' || FeeName == null || FeeName == undefined) {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //费用名称不能为空!'
return;
};
var Currency = form.findField('CURRENCY').getValue();
if (Currency == '' || Currency == null || Currency == undefined) {
Ext.Msg.show({ title:'提示', msg:'币别不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount = form.findField('AMOUNT').getValue();;
if (Amount == 0) {
Ext.Msg.show({ title: '提示', msg:'金额不能为空', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var bodyAddDatas = [];
for (i = 0; i < this.StoreList.getCount(); i += 1) {
var memberyf = this.StoreList.getAt(i);
bodyAddDatas.push(memberyf);
}
var data = this.NewFeeEdit.getForm().getValues();
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg:'正在操作数据...',
url: '/MvcContainer/MsOpCtnBsCard/SavePLClearing',
params: {
bslist: jsonbodyAddDatas,
optype: _thisAddClearing.stroplb,
body: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title:'提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Msg.show({ title:'提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var win = Ext.getCmp("DsAddRepairWin");
win.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
});