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.
DS7/DSWeb/MvcShipping/Viewsjs/MsCodeFeeSetList/MsCodeFeeSetListIndex.js

588 lines
22 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsCodeFeeSetListIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCodeFeeSetListIndex.superclass.constructor.call(this);
};
//默认计费标准
Ext.extend(Shipping.MsCodeFeeSetListIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
PageSize: 100,
//需求编号SR2017061200005-2
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsCodeFeeSetList',
pageSize: this.PageSize,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeFeeSetList/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
var rowEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2 //设置单击单元格编辑
})
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'FEECODE',
header: Zi.LAN.FEECODE, //'费用代码',
width: 120
}, {
sortable: true,
dataIndex: 'NAME',
header: Zi.LAN.NAME, //'费用名称',
width: 160
}, {
sortable: true,
dataIndex: 'DESCRIPTION',
header: Zi.LAN.DESCRIPTION, //'费用英文名称',
width: 160
}, {
sortable: true,
dataIndex: 'DEFAULTCURR',
header: Zi.LAN.DEFAULTCURR, //'默认币别',
width: 80,
}, {
sortable: true,
dataIndex: 'ISSEA',
header: Zi.LAN.ISSEA, //'是否海运',
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'ISAIR',
header: Zi.LAN.ISAIR, //'是否空运',
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'ISTRUCKING',
header: Zi.LAN.ISTRUCKING, //'是否陆运',
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'ISTRUCKINGFIXED',
header: Zi.LAN.ISTRUCKINGFIXED, //'是否陆运固定费用',
width: 120,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'ISWMS',
header: Zi.LAN.ISWMS, //'是否仓储费用',
width: 100,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'ISADVANCEDPAY',
header: Zi.LAN.ISADVANCEDPAY, //'是否垫付费用',
width: 80,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'DEFAULTUNITREF',
header: Zi.LAN.DEFAULTUNIT, //'默认计费标准',
width: 80
}, {
sortable: true,
dataIndex: 'DEFAULTDEBITREF',
header: Zi.LAN.DEFAULTDEBIT, //'默认收费客户类型',
width: 120
}, {
sortable: true,
dataIndex: 'DEFAULTCREDITREF',
header: Zi.LAN.DEFAULTCREDIT, //'默认付费客户类型',
width: 120
}, {
sortable: true,
dataIndex: 'FEEFRT',
header: Zi.LAN.FEEFRT, //'默认FRT',
width: 60
}, {
sortable: true,
dataIndex: 'TAXRATE',
header: Zi.LAN.TAXRATE, //'默认税率',
width: 60
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: Zi.LAN.CREATEUSERREF, //'创建人',
width: 60
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: Zi.LAN.CREATETIME, //'创建时间',
width: 140
}, {
sortable: true,
dataIndex: 'FEEGROUP',
header: Zi.LAN.FEEGROUP, //'费用分组',
width: 100
}
],
// plugins: [rowEditing],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 300) / 2 + ",Left= " + (screen.width - 700) / 2
var openType = "_blank";
var openUrl = "/MvcShipping/MsCodeFeeSetList/Edit";
window.open(openUrl, openType, openSet);
}, this);
//this.gridList.on('edit', onEdit, this);
function onEdit(e) {
var s = this.storeList.getUpdatedRecords();
var jsonDataEncode = "";
//jsonDataEncode = Ext.encode(s);
var listRecord = "";
Ext.each(s, function (record) {
listRecord += Ext.encode(record.data) + ",";
});
listRecord = '[' + listRecord.substr(0, listRecord.length - 1) + ']'
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); //'正在提交数据...'
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在提交数据...',
url: '/MvcShipping/MsCodeFeeSetList/Update',
params: {
data: listRecord
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(s);
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.storeList.reload();
}
else {
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// this.SelectedRecord = record;
// this.OprationStatus = 'edit';
// DsOpenEditWin('/MvcShipping/MsCodeFeeSetList/Edit');
// }, this);
//#region formSearch
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '80%'
},
items: [ {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.FEECODE, //'费用代码',
name: 'FEECODE', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: Zi.LAN.NAME, //'费用名称',
name: 'NAME',flex:1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {xtype:'hiddenfield',flex:2}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: Zi.LAN.btnAdd, //"新建",
iconCls: "btnadd",
scope: this,
handler: function () {
this.OprationStatus = 'add';
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 300) / 2 + ",Left= " + (screen.width - 700) / 2
var openType = "_blank";
var openUrl = "/MvcShipping/MsCodeFeeSetList/Edit";
window.open(openUrl, openType, openSet);
}
},
{
text: Zi.LAN.btnDelete, //"删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: Zi.LAN.btnrRefresh, //"执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
handler: function (button, event) {
_this.Print();
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
//
// ,
// {
// text: Zi.LAN.btnSave, //"保存",
// iconCls: "btnsave",
// handler: function (button, event) {
// var s = this.storeList.getUpdatedRecords();
// var jsonDataEncode = "";
// //jsonDataEncode = Ext.encode(s);
// var listRecord = "";
// Ext.each(s, function (record) {
// listRecord += Ext.encode(record.data) + ",";
// });
// var newdatas = "";
// var n = this.storeList.getNewRecords();
// Ext.each(n, function (record) {
// newdatas += Ext.encode(record.data) + ",";
// });
// if (n.length > 0) {
// listRecord = '[' + listRecord + newdatas.substr(0,newdatas.length-1)+ ']';
// } else {
// listRecord = '[' + listRecord.substr(0, listRecord.length - 1) + ']';
// }
// Ext.Msg.wait('正在提交数据...');
// Ext.Ajax.request({
// waitMsg: '正在提交数据...',
// url: '/MvcShipping/MsCodeFeeSetList/Update',
// params: {
// data: listRecord
// },
// callback: function (options, success, response) {
// if (success) {
// var jsonresult = Ext.JSON.decode(response.responseText);
// if (jsonresult.Success) {
// this.storeList.remove(s);
// Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// this.storeList.reload();
// }
// else {
// Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// }
// }
// },
// failure: function (response, options) {
// Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// },
// success: function (response, options) {
// },
// scope: this
// }); //end Ext.Ajax.request
// },
// scope: this
// }
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.currentPage = 1;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, //"正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu); //'正在删除数据...'
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在删除数据...',
url: '/MvcShipping/MsCodeFeeSetList/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.ChaXunTiaoJianFuZhiCuoWu);
return '';
}
var sql = '';
var FEENAME = form.findField('NAME').getValue();
sql = sql + getAndConSql(sql, FEENAME, "NAME like '%" + FEENAME + "%'");
var FEECODE = form.findField('FEECODE').getValue();
sql = sql + getAndConSql(sql, FEECODE, "FEECODE like '%" + FEECODE + "%'");
return sql;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsCodeFeeSetList/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSCODEFEELIST';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});