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.

731 lines
26 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsInfoClientBlackIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsInfoClientBlackIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientBlackIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsInfoClientBlack',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetClientBlackList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
disableSelection: false,
tbar: [{
text: '新建', //'增加费用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.winAuditShow.show();
},
scope: this
}, '-', {
text: '删除', //'删除费用明细',
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNAME',
header: '客户黑名单', //'VGM称重日期',
width: 180
}
]
});
this.storeUserList = Ext.create('Ext.data.Store', {
model: 'MsClientBsWhile',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBill/GetWhileDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListUserCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
//定义Grid
this.GridCheckUserBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListUser = new Ext.grid.GridPanel({
store: this.storeUserList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
plugins: [this.gridListUserCellEditing],
selModel: this.GridCheckUserBoxModel,
disableSelection: false,
tbar: [{
text: '添加', //'增加费用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
DsOpenEditWin('/MvcShipping/MsInfoClient/WhileBsAdd');
},
scope: this
}, '-', {
text: '删除', //'删除费用明细',
handler: function (button, event) {
this.onDeleteUserClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'CUSTNO',
header:'委托编号',//委托编号
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header:'主提单号',//主提单号
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
header:'分提单号', //分提单号
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header:'报关单号', //报关单号
width: 120
}, {
sortable: true,
id: '',
align: 'center',
dataIndex: 'BSSTATUSREF',
header:'业务锁定',//业务锁定
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
sortable: true,
id: '',
align: 'center',
dataIndex: 'FEESTATUSREF',
header:'费用锁定',//费用锁定
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header:'委托单位',//委托单位
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header:'开船日期',//开船日期
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'SALE',
header:'揽货人',//揽货人
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header:'集装箱',//集装箱
width: 120
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间', //会计期间
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header:'业务来源', //业务来源
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细', //业务来源
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作', //操作
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人', //录入人
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港', //起运港
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港', //目的港
width: 120
}, {
sortable: true,
dataIndex: 'PLACERECEIPT',
header:'收货地', //收货地
width: 120
}, {
sortable: true,
dataIndex: 'DESTINATION',
header: '目的地', //目的地
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名', //船名
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次', //航次
width: 60
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司', //航次
width: 60
}
]
});
this.gridListUser.on('edit', function (editor, e, eOpts) {
this.gridUserAfterEdit(editor, e, eOpts);
}, this);
// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// this.SelectedRecord = record;
// this.OprationStatus = 'edit';
// window.open('/MvcShipping/MsCodeOpMustField/Edit', "CODEOPMUSTFIELD", 'width=800,height=600,top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes');
// }, this);
//#region formSearch
//#region formSearch枚举参照相关
_thisclientblack = this;
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "刷新",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
});
//#region formSearch
//#region formSearch枚举参照相关
this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreOpLb.load({ params: { enumTypeId: 96005 } });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类型',
store: this.StoreOpLb,
forceSelection: true,
name: 'PS_OPLB',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
matchFieldWidth: false, //下拉款自适应宽度
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'PS_CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
height:50,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'PS_MBLNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},{
fieldLabel: '从业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEBGN',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_EXPDATEEND',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
, this.comboxCustCode, {
xtype: 'button',
width: 90,
text: '查询',
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
this.panelSouth = new Ext.Panel({
layout: "border",
title:'业务白名单',
region: "south",
height: 500,
items: [this.formSearch, this.gridListUser]
});
Ext.apply(this, {
items: [this.panelBtn, this.gridList, this.panelSouth]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
var sql = '';
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeCust = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
this.comboxCust = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'客户名称',
store: this.storeCust,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.formAuditShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 100,
msgTarget: 'qtip'
},
items: [
this.comboxCust
]//end root items
});
this.winAuditShow = Ext.create('Ext.window.Window', {
title: '新增客户黑名单信息',
//width: 220,
//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.formAuditShow],
buttons: [{
text: "完成",
minWidth: 70,
handler: function () {
var cust = _thisclientblack.formAuditShow.getForm().findField('CUSTNAME').getValue();
if (cust == '') {
Ext.Msg.show({ title: '提示', msg: '客户名称不能为空!', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK });
return;
}
_thisclientblack.onAddBlackClick(cust);
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_thisclientblack.winAuditShow.close();
}
}]
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeUserList.load({
params: { start: 0, limit: 500, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
addDetail: function () {
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var record = Ext.create('MsSysIpWhile', {
BSNO:'*',
IP: ''
});
this.storeList.add(record);
var n = this.storeList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
onAddBlackClick: function (cust) {
_thisfee = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsInfoClient/SaveClientBlack',
scope: this,
params: {
custname: cust
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.reload();
_thisclientblack.winAuditShow.close();
} 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
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsInfoClient/DeleteClientBlack',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.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 });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onDeleteUserClick: function (button, event) {
var selections = this.gridListUser.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsInfoClient/DeleteClientWhileBs',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeUserList.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 });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
gridUserAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'USERID') {
var records = DsStoreQueryBy(this.storeSalesCode, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var USERNAME = data.UserName;
e.record.set('USERNAME', USERNAME);
}
}
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
var mblNo = form.findField('PS_MBLNO').getValue();
sql = sql + getAndConSql(sql, mblNo, " (B.CUSTNO like '%" + mblNo + "%' or B.MBLNO like '%" + mblNo + "%' or B.HBLNO like '%" + mblNo + "%' or B.CUSTOMNO like '%" + mblNo + "%' or B.ORDERNO like '%" + mblNo + "%')");
var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, expDate_Min, " B.OPDATE>='" + expDate_Min + "'");
var expDate_Max = form.findField('PS_EXPDATEEND').getRawValue();
sql = sql + getAndConSql(sql, expDate_Max, " B.OPDATE<='" + expDate_Max + " 23:59:59'");
var CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "B.CUSTOMERNAME='" + CUSTOMERNAME + "'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});