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

851 lines
30 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 //设置单击单元格编辑
})
2 years ago
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
2 years ago
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong },
trackMouseOver: true,
disableSelection: false,
2 years ago
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
2 years ago
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);
2 years ago
_thisfeecode = this;
2 years ago
//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
}, '-',
{
2 years ago
text: Zi.LAN.Print,
2 years ago
iconCls: 'btnprint',
handler: function (button, event) {
_this.Print();
},
scope: this
}, {
2 years ago
text: Zi.LAN.Excel,
2 years ago
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
2 years ago
}, {
text: Zi.LAN.FeeNameModify,
handler: function (button, event) {
2 years ago
this.winModifyShow.show();
2 years ago
},
scope: this
}, {
text: Zi.LAN.FeeNameReapeat,
handler: function (button, event) {
this.onShowReapeat();
},
scope: this
2 years ago
}
]
});
2 years ago
2 years ago
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();
2 years ago
this.formModify = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: Zi.LAN.FEECODE, //'费用代码',
name: 'FEECODE'
}, {
fieldLabel: Zi.LAN.NAME, //'费用名称',
name: 'NAME'
}, {
fieldLabel: Zi.LAN.DESCRIPTION, //'费用英文名称',
labelWidth: 90,
name: 'DESCRIPTION'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.winModifyShow = Ext.create('Ext.window.Window', {
title: "费用代码修改",
width: 820,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formModify],
buttons: [{
text: "确认修改",
minWidth: 70,
handler: function () {
_thisfeecode.onModifyClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_thisfeecode.winModifyShow.close();
}
}]
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
});
this.storeFeeNameRef.load();
this.comboxFeeNameRef = Ext.create('DsExt.ux.DCombox', {
store: this.storeFeeNameRef,
minChars: 1,
fieldLabel: Zi.LAN.NAME, //'默认计费标准',
matchFieldWidth: false,
//queryParam: 'Name',
forceSelection: true,
lazyRender: false,
name: 'OldFeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeFeeNameRef2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
});
this.storeFeeNameRef2.load();
this.comboxFeeNameRef2 = Ext.create('DsExt.ux.DCombox', {
store: this.storeFeeNameRef2,
minChars: 1,
fieldLabel: '合并为', //'默认计费标准',
matchFieldWidth: false,
//queryParam: 'Name',
forceSelection: true,
lazyRender: false,
name: 'NewFeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.formReapeat = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFeeNameRef, this.comboxFeeNameRef2
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.winReapeatShow = Ext.create('Ext.window.Window', {
title: "费用名称合并",
width: 820,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formReapeat],
buttons: [{
text: "确认合并",
minWidth: 70,
handler: function () {
_thisfeecode.onReapeatClick()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_thisfeecode.winReapeatShow.close();
}
}]
});
2 years ago
}, //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
});
},
2 years ago
onShowReapeat: function () {
_thisfeecode.winReapeatShow.show();
},
onReapeatClick: function (menu, event) {
var oldfeename = this.formReapeat.getForm().findField('OldFeeName').getValue();
var newfeename = this.formReapeat.getForm().findField('NewFeeName').getValue();
if (oldfeename == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg:'原费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (newfeename == '') {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '替换费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var GidStr = '';
Ext.Ajax.request({
waitMsg: '正在修改...',
url: '/MvcShipping/MsCodeFeeSetList/Reapeat',
params: {
oldfeename: oldfeename,
newfeename: newfeename
},
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 });
_this.onRefreshClick();
_this.winReapeatShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onModifyClick: function (menu, event) {
var GidStr = '';
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 rec = selections[0];
var data = this.formModify.getForm().getValues();
var bodyAddDatas = [];
bodyAddDatas.push(rec);
_this = this;
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要修改的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在修改...',
url: '/MvcShipping/MsCodeFeeSetList/modify',
params: {
data: Ext.JSON.encode(rec.data),
modifydata: 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 });
_this.onRefreshClick();
_this.winModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
2 years ago
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;
}
});