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/MsCodeAll/LanesIndex.js

576 lines
18 KiB
JavaScript

2 years ago
//集运管理-路单查询
Ext.namespace('Shipping');
Shipping.LanesIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.LanesIndex.superclass.constructor.call(this);
};
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
Ext.extend(Shipping.LanesIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.formname = "MsCodeLanesIndex";
//#region 定义数据集
//#endregion
/////////////////////////////////////////
//#region 主列表
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode2.load();
this.comboxOP2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode2,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeOpCode3= Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode3.load();
this.comboxOP3 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode3,
forceSelection: true,
name: 'CUSTSERVICE',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'Code_lanesmb',
remoteSort: true,
//groupField: 'GroupDate',
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/MvcShipping/MsCodeAll/GetLanesList',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.column = [
{
sortable: true,hidden:true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'LANEID',
10 months ago
header: Zi.LAN.LANEID,
2 years ago
width: 80,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'LANE',
10 months ago
header: Zi.LAN.LANE,
2 years ago
width: 160,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'LANEEN',
10 months ago
header: Zi.LAN.LANEEN,
2 years ago
width: 160,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'EDICODE',
10 months ago
header: Zi.LAN.EDICODE,
2 years ago
width: 120,
editor: {
xtype: 'textfield', //numberfield textfield
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'OP',
10 months ago
header: Zi.LAN.OP ,
2 years ago
width: 120,
editor: this.comboxOP
},
{
sortable: true,
dataIndex: 'DOC',
10 months ago
header: Zi.LAN.DOC,
2 years ago
width: 120,
editor: this.comboxOP2
},
{
sortable: true,
dataIndex: 'CUSTSERVICE',
10 months ago
header: Zi.LAN.CUSTSERVICE,
2 years ago
width: 120,
editor: this.comboxOP3
}
];
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel'
, {
checkOnly: false
, singleSelect: true
,
listeners: {
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function () { gridList.getSelectionModel().clearSelections(); }
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
10 months ago
loadMask: { msg: Zi.LAN.LoadData},
2 years ago
trackMouseOver: true,
disableSelection: false,
//selModel: this.MainCB,
columns: this.column,
plugins: [
this.cellEditing
],
/*features: [{
id: 'group',
ftype: 'grouping',
groupHeaderTpl: '{name}',
hideGroupedHeader: true,
enableGroupingMenu: true
}],*/
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
10 months ago
displayMsg: Zi.LAN.FenYe,
emptyMsg: Zi.LAN.Nodata
2 years ago
})
});
/////////////以下部分为获取存储的gridpanel显示样式
//this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id表名 中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//#endregion
//////////////////////////////////////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
10 months ago
fieldLabel: Zi.LAN.LANE,
2 years ago
name: 'LANE'
}, {
10 months ago
fieldLabel: Zi.LAN.LANEEN,
2 years ago
name: 'LANEEN'
}, {
//fieldLabel: '从开船日期',
//format: 'Y-m-d',
xtype: 'hiddenfield',
flex:3
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
//, this.comboxFeeNameRef
//, { xtype: 'hiddenfield', flex: 2 }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
10 months ago
text: Zi.LAN.xnew, id: "btnadd", //hidden: true,
2 years ago
iconCls: "btnadd",
handler: function (button, event) {
//this.OprationStatus = 'add';
//DsOpenEditWin("/TruckMng/MsWlPc/Edit_ADL", "", "700", "1000");
this.onAddPCClick();
},
scope: this
}, {
10 months ago
text: Zi.LAN.delete1, id: "btndelete",
2 years ago
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
10 months ago
text: Zi.LAN.Save, id: "SaveBtn",
2 years ago
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
}, '-', '-', {
10 months ago
text: Zi.LAN.ExecuteQuery,
2 years ago
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, '-', {
10 months ago
text: Zi.LAN.ExportExcel ,
2 years ago
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
//,this.CB_EditMode
]
});
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
10 months ago
height: 75,
2 years ago
items: [this.formSearch, this.panelBtn]
});
this.panelContract = new Ext.Panel({
//title: '',
layout: "border",
region: 'center',
height: 800,
margin: '1 2',
split: true,
items: [this.gridList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelContract]
});
///以下集中绑定事件
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.PCAfterEdit(editor, e, eOpts);
}, this);
/*
this.cellEditing.on('beforeedit', function (editor, e) {
//alert("beforeedit");
return this.PCBeforeEdit(editor, e);
}, this);
*/
this.LoadInitData();
}, //end initUIComponents
LoadInitData: function () {
//this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} });
},
onAuditRefuseClick: function (button, event) {
var sql = " A.GID in (select bsno from ch_fee where FEESTATUS=6)";
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
10 months ago
waitMsg: Zi.LAN.NowSelect,
2 years ago
scope: this
});
},
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
10 months ago
waitMsg: Zi.LAN.NowSelect,
2 years ago
scope: this
});
//}
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var LANE = form.findField('LANE').getValue();
sql = sql + getAndConSql(sql, LANE, " LANE like '%" + LANE + "%' ");
var LANEEN = form.findField('LANEEN').getValue();
sql = sql + getAndConSql(sql, LANEEN, " LANEEN like '%" + LANEEN + "%' ");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
if (this.OprationStatus == "add") {
ret[3] = "";
} else {
ret[3] = this.SelectedRecord.data.REFBILLNO;
}
ret[4] = "MsRptPcHeadQryIndex";
ret[5] = formtype;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
onSaveClick: function () {
var bodyList = [];
for (i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
bodyList.push(member);
};
var jsonBody = ConvertRecordsToJson(bodyList);
if (jsonBody == '') {
return;
}
10 months ago
Ext.Msg.wait(Zi.LAN.Msg_SavingAndWait);
2 years ago
Ext.Ajax.request({
10 months ago
waitMsg: Zi.LAN.Msg_SavingAndWait,
2 years ago
url: '/MvcShipping/MsCodeAll/SaveLanesList',
scope: this,
params: {
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
//this.onRefreshClick();
} else {
10 months ago
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
2 years ago
}
} else {
Ext.Msg.show({ title: '请重试',
10 months ago
msg: Zi.LAN.FuWuQiError,
2 years ago
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
,
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
10 months ago
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.SelectDanju, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
2 years ago
return;
}
var record = selections[0];
10 months ago
Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) {
2 years ago
if (btn == 'yes') {
10 months ago
Ext.Msg.wait(Zi.LAN.nowdelete);
2 years ago
Ext.Ajax.request({
10 months ago
waitMsg: Zi.LAN.nowdelete,
2 years ago
url: '/MvcShipping/MsCodeAll/DeleteLanes',
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);
10 months ago
Ext.Msg.show({ title: Zi.LAN.Prompt , msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
2 years ago
}
else {
10 months ago
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
2 years ago
}
}
},
failure: function (response, options) {
10 months ago
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
2 years ago
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onAddPCClick: function (button, event) {
var record = Ext.create('Code_lanesmb', {
'GID': '',
'LANEID': '',
'LANE': '',
'LANEEN': '',
'EDICODE': '',
'OP': '',
'DOC': ''
});
this.storeList.add(record);
var n = this.storeList.getCount();
this.cellEditing.startEditByPosition({ row: n - 1, column: 1 });
//this.storeTruckNo.load({ params: { condition: " A.truckno not in (select DISTINCT truckno from tMsWlPcHead where isnull(isend,0)=0 ) "} });
}
});