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.

1091 lines
36 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsWmsFeeModelEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsWmsFeeModelEdit.superclass.constructor.call(this);
};
var GGID = '';
var GID = '';
Ext.extend(Shipping.MsWmsFeeModelEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
GGID: '',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.detailsDel = [];
this.loaderDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
Ext.regModel('IsCustOnly', {
fields: [{ name: 'value' }, { name: 'text'}]
})
var IsCustOnlyStore = new Ext.data.Store({
model: 'IsCustOnly',
data: [{ 'value': '0', 'text': '否' },
{ 'value': '1', 'text': '是'}]
});
var cbIsCustOnly = Ext.create('Ext.form.ComboBox', {
name: 'IsCustOnly',
queryMode: 'local',
id: 'IsCustOnly',
triggerAction: 'all',
forceSelection: true,
allowBlank: false,
flex: 1,
valueField: 'value',
displayField: 'text',
store: IsCustOnlyStore,
fieldLabel: '是否客户专有',
hidden:true,
listeners: {
afterRender: function (combo) {
combo.setValue('1'); //同时下拉框会将与name为firstValue值对应的 text显示
}
}
});
cbIsCustOnly.on('load', function () { Ext.getCmp("IsCustOnly").setValue('1'); });
//客户名称
var storeGainCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
var comboxGainCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '应收客户',
store: storeGainCust,
forceSelection: true,
allowBlank: false,
id: 'CustName',
name: 'CustName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//仓库
var storeCustWmsCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
storeCustWmsCode.load({ params: { condition: "ISWAREHOUSE='1'" } });
var comboxCustWmsCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'仓库名称',
store: storeCustWmsCode,
forceSelection: true,
id: 'STORAGENAME',
name: 'STORAGENAME',
valueField: 'CustName',
displayField: 'CodeAndName'
// allowBlank: false,
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '模板名称',
allowBlank: false,
name: 'ModelName'
}, comboxGainCust, {
fieldLabel: '有效期从...',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VALIDITYFROM'
}, {
fieldLabel: '有效期到...',
format: 'Y-m-d',
xtype: 'datefield',
name: 'VALIDITYTO'
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [comboxCustWmsCode,{
fieldLabel: '录入人',
readOnly: true,
name: 'Oper'
}, {
fieldLabel: '录入日期',
readOnly: true,
name: 'Optime'
}, {xtype:'hidden'}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-',
{
text: "复制新建",
handler: function (button, event) {
this.CopyNew();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表
//明细表表格相关
//明细表-数据集
this.storePinMingList = Ext.create('Ext.data.Store', {
model: 'WMSPinMing',
//remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSFeeModel/GetPinMing',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridList = new Ext.grid.GridPanel({
store: this.storePinMingList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 40
}, {
sortable: true,
dataIndex: 'CODE',
header: '代码',
width: 80
}, {
sortable: true,
dataIndex: 'NAME',
header: '品名',
width: 100
},{
sortable: true,
dataIndex: 'detailNum',
header: '仓储费用模板',
width: 80,
renderer: function (value, cellmeta) {
if (value !== '0' ) {
//return "是";
return "<img src='../../../../TruckMng/Content/Images/yes.png' />";
}
}
}, {
sortable: true,
dataIndex: 'loaderNum',
header: '装卸费用模板',
width: 80,
renderer: function (value, cellmeta) {
if (value != '0' ) {
//return "是";
return "<img src='../../../../TruckMng/Content/Images/yes.png' />";
}
}
}
]
});
this.gridList.addListener('cellclick', function (dataview, record, item, data, e, b) {
GGID = data.data.GID;
var condition = "";
if (this.opStatus == 'edit') {
condition = " PGID='" + GID + "' and GGID = '" + GGID + "'";
this.storeDetailsList.load({ params: { condition: condition } });
this.storeLoaderFeeList.load({ params: { condition: condition } });
}
}, this);
this.storeFangXiang = Ext.create('Ext.data.Store', {
fields: ['ID', 'TYPE']
});
this.storeFangXiang.add({ "ID": "1", "TYPE": "收" });
this.storeFangXiang.add({ "ID": "2", "TYPE": "付" });
this.comboxFangXiang = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFangXiang,
valueField: 'ID',
displayField: 'TYPE',
forceSelection: true,
name: 'SortType'
});
this.storeDetailsList = Ext.create('Ext.data.Store', {
model: 'WMSFeeModelDetails',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSFeeModel/GetDataDetailsList',
reader: {
id: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridDetailsListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridDetailsList = new Ext.grid.GridPanel({
title: '仓储费用模板',
store: this.storeDetailsList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridDetailsListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, 2);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, 2);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'PGID',
header: 'PGID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'GGID',
header: 'GGID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'JiFeiDengJi',
header: '计费等级',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 160
}, {
sortable: true,
dataIndex: 'ShouFuFangXiang',
header: '收付方向',
editor: this.comboxFangXiang,
renderer: function (value, p, record) {
return record.data.ShouFuFangXiang == '1' ? "收" : "付";
},
width: 100
}, {
sortable: true,
dataIndex: 'JiFeiQuJian',
header: '计费区间',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'JiFeiDanJia',
header: '计费单价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'ZengZhiJia',
header: '增值价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'FengDingJia',
header: '封顶价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Optime',
header: '修改时间',
width: 60
}
]
});
var CHARGEUNITData = [
{ "FEEUNIT": "CBM" }, { "FEEUNIT": "吨" }, { "FEEUNIT": "千克" }, { "FEEUNIT": "箱" }, { "FEEUNIT": "托" }];
this.storeCHARGEUNIT = Ext.create('Ext.data.Store', {
model: 'CHARGEUNITmb',
data: CHARGEUNITData
});
this.comboxFEEUNIT = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '计费单位',
forceSelection: true,
store: this.storeCHARGEUNIT,
name: 'FEEUNIT',
allowBlank: false,
valueField: 'FEEUNIT',
displayField: 'FEEUNIT'
});
Ext.define('FeeDirectionMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'FeeDirectionID', type: 'string' },
{ name: 'FeeDirectionName', type: 'string' }
]
});
var FeeDirectionData = [{ "FeeDirectionID": "1", "FeeDirectionName": "收" }/*,
{ "FeeDirectionID": "2", "FeeDirectionName": "付" }*/];
this.storeFeeDirection = Ext.create('Ext.data.Store', {
model: 'FeeDirectionMd',
data: FeeDirectionData
});
this.comboxFeeDirection = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeDirection,
valueField: 'FeeDirectionID',
displayField: 'FeeDirectionName'
});
Ext.define('FeeTypeMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'FeeTypeID', type: 'string' },
{ name: 'FeeTypeName', type: 'string' }
]
});
var FeeTypeData = [{ "FeeTypeID": "1", "FeeTypeName": "入库" },
{ "FeeTypeID": "2", "FeeTypeName": "出库" }];
this.storeFeeType = Ext.create('Ext.data.Store', {
model: 'FeeTypeMd',
data: FeeTypeData
});
this.comboxFeeType = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeType,
valueField: 'FeeTypeID',
displayField: 'FeeTypeName'
});
this.storeLoaderFeeList = Ext.create('Ext.data.Store', {
model: 'LoaderFeeModel',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSFeeModel/GetLoaderFeeList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//装卸费表格
this.gridLoaderFeeCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridLoaderFeeList = new Ext.grid.GridPanel({
title: '装卸费模板',
store: this.storeLoaderFeeList,
enableHdMenu: false,
region: 'south',
height: 320,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridLoaderFeeCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddLoaderClick(button, event, 2);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelLoaderClick(button, event, 2);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'PGID',
header: 'PGID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'GGID',
header: 'GGID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'FEETYPE',
header: '计费类型',
editor: this.comboxFeeType,
renderer: function (value, p, record) {
return record.data.FEETYPE == '1' ? "入库" : "出库";
},
width: 100
}, {
sortable: true,
dataIndex: 'FEEDIRECTION',
header: '计费方向',
editor: this.comboxFeeDirection,
renderer: function (value, p, record) {
return record.data.FEEDIRECTION == '1' ? "收" : "付";
},
width: 100
}, {
sortable: true,
dataIndex: 'FEEUNIT',
header: '计费单位',
editor: this.comboxFEEUNIT,
width: 100
},{
sortable: true,
dataIndex: 'FEEPRICE',
header: '计费单价',
editor: {
xtype: 'numberfield',
selectOnFocus: true
},
width: 100
}
]
});
this.panelService = new Ext.Panel({
title: '品名',
layout: "border",
region: 'west',
width: 350,
margin: '5 10',
items: [this.gridList]
});
this.panelFee = new Ext.Panel({
border: false,
id: "panelFee",
layout: "border",
region: 'center',
items: [this.gridDetailsList, this.gridLoaderFeeList]
});
this.paneldetail = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelService, this.panelFee
]
});
//#endregion 明细表
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 120,
items: [this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.paneldetail]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
if (this.opStatus == 'edit') {
storeGainCust.load({});
} else {
storeGainCust.load({ params: { condition: " SHORTNAME NOT IN (SELECT CustName FROM WMS_FEEMODEL)"} });
}
//绑定事件
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit')
condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/WMSFeeModel/GetData',
params: {
handle: opstatus,
condition: condition
},
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;
}
var data = result.data;
GID = data.GID;
if (this.opStatus == 'edit') {
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var modelid = 0;
if (this.opStatus == 'edit') {
modelid = this.editRecord.get('GID');
this.storePinMingList.load({ params: { condition: this.editRecord.get('GID') } });
}
else
this.storePinMingList.load({ params: { condition: '' } });
// this.storeDetailsList.load({ params: { condition: " GID='" + modelid + "'"} });
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
data.Oper = SHOWNAME;
if (this.opStatus == 'add') {
data.GID = "*";
}
var detailsArr = [];
for (var i = 0; i < this.storeDetailsList.getCount(); i += 1) {
var member = this.storeDetailsList.getAt(i);
detailsArr.push(member);
}
var loaderArr = [];
for (var j = 0; j < this.storeLoaderFeeList.getCount(); j += 1) {
var memberLoader = this.storeLoaderFeeList.getAt(j);
loaderArr.push(memberLoader);
}
var details = ConvertRecordsToJson(detailsArr);
var detailsDel = ConvertRecordsToJsonAll(this.detailsDel);
var loader = ConvertRecordsToJson(loaderArr);
var loaderDel = ConvertRecordsToJsonAll(this.loaderDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMSFeeModel/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
details: details,
detailsDel: detailsDel,
loader: loader,
loaderDel:loaderDel
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.opStatus == 'edit'
var returnData = jsonresult.Data;
GID = returnData.GID;
this.formEdit.getForm().setValues(returnData);
/*
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.EditRecord = arrNewRecords[0];
this.EditRecord.commit();
}
*/
if (type == '0') {
this.opStatus = 'edit';
this.LoadData('edit', " GID='" + GID + "'");
var condition = "";
if (this.opStatus == 'edit') {
condition = " PGID='" + GID + "' and GGID = '" + GGID + "'";
this.storeDetailsList.load({ params: { condition: condition } });
this.storeLoaderFeeList.load({ params: { condition: condition } });
}
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
}
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.OK, buttons: Ext.Msg.OK });
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
CopyNew: function () {
if (this.opStatus == 'add') {
return;
}
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
data.Oper = SHOWNAME;
_this = this;
Ext.Msg.wait('正在复制新建数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在复制新建数据...',
url: '/MvcShipping/WMSFeeModel/CopyNew',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.opStatus == 'edit'
var returnData = jsonresult.Data;
GID = returnData.GID;
_this.formEdit.getForm().setValues(returnData);
/*
var arrNewRecords = this.StoreList.add(returnData);
this.EditRecord = arrNewRecords[0];
this.EditRecord.commit();
*/
_this.opStatus = 'edit';
_this.LoadData('edit', " GID='" + GID + "'");
var condition = "";
if (_this.opStatus == 'edit') {
condition = " PGID='" + GID + "' and GGID = '" + GGID + "'";
_this.storeDetailsList.load({ params: { condition: condition } });
_this.storeLoaderFeeList.load({ params: { condition: condition } });
}
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.OK, buttons: Ext.Msg.OK });
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onAddDetailClick: function (button, event, type) {
this.addDetails(type);
},
onAddLoaderClick: function(button, event, type){
if (GGID == '') {
Ext.Msg.show({ title: '提示', msg: '请先选择品名!', icon: Ext.Msg.WARNNING, buttons: Ext.Msg.OK });
return;
}
var newSerialno = 0;
store = this.storeLoaderFeeList;
var newSerialno = this.storeDetailsList.getCount() + 1;
var record = Ext.create('LoaderFeeModel', {
GID: '-',
PGID: GID,
GGID: GGID,
FEETYPE: 1,
FEEDIRECTION: 1,
FEEUNIT: '吨',
FEEPRICE: 0
});
store.add(record);
var n = store.getCount();
this.gridLoaderFeeCellEditing.startEditByPosition({ row: n + 1, column: 1 });
},
onDelDetailClick: function (button, event, type) {
this.deleteDetail(type);
},
onDelLoaderFeeClick: function (button, event, type) {
var selectedRecords = this.gridLoaderFeeList.selModel.getSelection();
if (selectedRecords.length == 0) {//提示', msg: '没有要删除的费用明细!
Ext.Msg.show({ title: '提示', msg: '没有要删除的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var rec = selectedRecords[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/WMSFeeModel/DeleteLoader',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeLoaderFeeList.remove(rec);
// this.storeDetailsList.reload();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
});
}
}, this);
},
gridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'FeeName') {
var records = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var FeeCode = data.FeeCode;
e.record.set('FeeCode', FeeCode);
} else {
e.record.set('FeeCode', '');
}
}
},
deleteDetail: function (type) {
//var selectedRecords = this.gridList.selModel.getSelection();
//for (var i = 0; i < selectedRecords.length; i++) {
// var rec = selectedRecords[i];
// this.detailsDel.push(rec);
// this.storeBodyList.remove(rec);
//}
var selectedRecords = this.gridDetailsList.selModel.getSelection();
if (selectedRecords.length == 0) {//提示', msg: '没有要删除的费用明细!
Ext.Msg.show({ title: '提示', msg: '没有要删除的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var rec = selectedRecords[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/WMSFeeModel/DeleteDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeDetailsList.remove(rec);
// this.storeDetailsList.reload();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
});
}
}, this);
},
addDetails: function (type) {
if (GGID == '') {
Ext.Msg.show({ title: '提示', msg: '请先选择品名!', icon: Ext.Msg.WARNNING, buttons: Ext.Msg.OK });
return;
}
var newSerialno = 0;
store = this.storeDetailsList;
var newSerialno = this.storeDetailsList.getCount() + 1;
var record = Ext.create('WMSFeeModelDetails', {
GID: '*',
PGID: GID,
GGID: GGID,
JiFeiDengJi: 0,
ShouFuFangXiang: 1,
JiFeiQuJian: 0,
JiFeiDanJia: 0,
ZengZhiJia: 0,
FengDingJia: 0
});
store.add(record);
var n = store.getCount();
this.gridDetailsListCellEditing.startEditByPosition({ row: n + 1, column: 1 });
}
//,
//deleteDetail: function (type) {
// var selectedRecords = this.gridDetailsList.selModel.getSelection();
// for (var i = 0; i < selectedRecords.length; i++) {
// var rec = selectedRecords[i];
// this.storeDetailsList.remove(rec);
// }
//}
});