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/MsCrmPriceCarrier/MsCrmPriceCarrierIndex.js

3406 lines
145 KiB
JavaScript

2 years ago

Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
//#region 当前日期格式
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(), //cond
"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();
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);
}
}
xhr.send(null);
//#endregion
Shipping.MsCrmPriceCarrierIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCrmPriceCarrierIndex.superclass.constructor.call(this);
};
//需求编号SR2017091200003
Ext.extend(Shipping.MsCrmPriceCarrierIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
strtext: "",
isRefresh: false, //需求编号SR2017092500001
initUIComponents: function () {
this.formname = "formMsCrmPriceCarrierIndex"; //ds7新运价管理
//#region 查询
//#region formSearch 下拉框信息加载_用于查询
//航线
this.storeLANE_2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetLANEList' }
});
this.storeLANE_2.load();
this.comboxLANE_2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE_2,
name: 'LANE_2',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: false
});
//启运港,国内港口
this.storePODLOAD_2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetPODLOADList' }
});
this.storePODLOAD_2.load();
this.comboxPODLOAD_2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '启运港',
store: this.storePODLOAD_2,
name: 'PODLOAD_2',
valueField: 'VALUE',
displayField: 'CodeAndName',
// value: 'Qingdao',
forceSelection: false
});
//卸货港,国外港口
this.storePORTDISCHARGE_2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetPORTDISCHARGEList' }
});
this.storePORTDISCHARGE_2.load();
this.comboxPORTDISCHARGE_2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storePORTDISCHARGE_2,
name: 'PORTDISCHARGEID_2',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
valueField: 'VALUE',
displayField: 'CodeAndName',
matchFieldWidth: false, //下拉款自适应宽度
forceSelection: false
});
//中转港,国外港口
this.storeVIA_2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetVIAList' }
});
this.storeVIA_2.load();
this.comboxVIA_2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转港',
store: this.storeVIA_2,
name: 'VIA_2',
valueField: 'VALUE',
displayField: 'VALUE',
forceSelection: false
});
//船公司
this.storeCARRIER_2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetCARRIERList' }
});
this.storeCARRIER_2.load();
this.comboxCARRIER_2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER_2,
name: 'CARRIER_2',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: false
});
//锁定状态
Ext.define('LOCKFLAGModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataLOCKFLAG = [{ "Name": "未锁定" }, { "Name": "已锁定" }, { "Name": ""}];
var storeLOCKFLAG = Ext.create('Ext.data.Store', { model: 'LOCKFLAGModel', data: dataLOCKFLAG });
this.comboxLOCKFLAG = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '锁定',
forceSelection: true,
store: storeLOCKFLAG,
name: 'LOCKFLAG_2',
width: 100,
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//发布状态
Ext.define('ISISSUEModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataISISSUE = [{ "Name": "未发布" }, { "Name": "已发布" }, { "Name": ""}];
var storeISISSUE = Ext.create('Ext.data.Store', { model: 'ISISSUEModel', data: dataISISSUE });
this.comboxISISSUE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '发布',
forceSelection: true,
store: storeISISSUE,
name: 'ISISSUE_2',
width: 100,
labelAlign: 'right',
valueField: 'Name',
displayField: 'Name',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
this.storeCT = getPriceCtnTypeStore();
this.comboxCTNTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱型',
store: this.storeCT,
name: 'CTNTYPE',
valueField: 'ID',
displayField: 'NAME',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
});
//#endregion
// this.pickerColor = Ext.create('Ext.picker.Color', {
// value: '993300', // initial selected color
// renderTo: Ext.getBody(),
// listeners: {
// select: function (picker, selColor) {
// alert(selColor);
// }
// }
// });
// this.pickerColor = Ext.create('MyExtend.Form.Field.ColorField', {
// renderTo: Ext.getBody()
// });
//#region formSearch 查询面板
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPODLOAD_2, this.comboxPORTDISCHARGE_2, this.comboxVIA_2, this.comboxCARRIER_2, this.comboxLANE_2]//, { xtype: 'hiddenfield', flex: 1}
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '有效期',
format: 'Y-m-d',
xtype: 'datefield',
//editable: false,
name: 'EFFECTIVEDATE_2',
// value: currdate.format('yyyy-MM-dd'),
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '有效期至',
format: 'Y-m-d',
xtype: 'datefield',
//editable: false,
name: 'VALIDDATE_2',
// value: currdate.format('yyyy-MM-dd'),
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '船期',
name: 'ETD_2',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '航程',
name: 'TT_2',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '特殊商品',
name: 'COMMODITY_2',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}]//
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxLOCKFLAG, this.comboxISISSUE, {
fieldLabel: '备注',
name: 'REMARK_2',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, {
fieldLabel: '约号',
name: 'CONTRACTNO',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'keyup': {
fn: function (_field, e) {
if (e.getKey() == 13) {
this.onRefreshClick();
}
},
scope: this
}
}
}, this.comboxCTNTYPE]//
}]
}]//end items(fieldset 1)
});
//#endregion formSearch
//#region formBiaoShi 标识解释面板
this.formBiaoShi = Ext.widget('form', {
frame: true,
border: false,
region: 'east',
width: 180,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'label',
text: "普通运价",
style: 'background-color: white;',
align: 'center'
}, { xtype: 'hiddenfield', width: 10 }, {
xtype: 'label',
text: "优势运价",
style: 'background-color: #FF4500;',
align: 'center'
}, { xtype: 'hiddenfield', width: 10 }, {
xtype: 'label',
text: "运价涂黑",
style: 'background-color: #C1C1C1;',
align: 'center'
}]//, { xtype: 'hiddenfield', flex: 1}
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 10}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'panel',
html: "<img src='../../../../TruckMng/Content/Images/edit.png'/>"
}, {
xtype: 'label',
text: "批注",
align: 'center'
}, { xtype: 'hiddenfield', width: 10 }, {
xtype: 'panel',
html: "<img src='../../../../TruckMng/Content/Images/001.png'/>"
}, {
xtype: 'label',
text: "...",
align: 'center'
}, {
xtype: 'panel',
html: "<img src='../../../../TruckMng/Content/Images/009.png'/>"
}, {
xtype: 'label',
text: "修改次数",
align: 'center'
}]//, { xtype: 'hiddenfield', flex: 1}
}]
}]//end items(fieldset 1)
});
//#endregion formSearch
//#endregion
//#region 颜色_数据集
this.storeListBiaoShi = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'CrmPriceCarrierDetailModel',
remoteSort: true,
//autoLoad: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCrmPriceCarrier/GetDataListBiaoShi',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 修改次数_数据集
this.storeListXGCS = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'CrmPriceCarrierDetailModel',
remoteSort: true,
//autoLoad: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCrmPriceCarrier/GetDataListXGCS',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列表_数据集
//#region 下拉框信息加载_用于列表
//航线
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetLANEList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '航线',
store: this.storeLANE,
name: 'LANE',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: false
});
//启运港,国内港口
this.storePODLOAD = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetPODLOADList' }
});
this.storePODLOAD.load();
this.comboxPODLOAD = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '启运港',
store: this.storePODLOAD,
name: 'PODLOAD',
valueField: 'VALUE',
displayField: 'CodeAndName',
forceSelection: false
});
//卸货港ID国外港口
this.storePORTDISCHARGEID = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetPORTDISCHARGEList' }
});
this.storePORTDISCHARGEID.load();
this.comboxPORTDISCHARGEID = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '卸货港',
store: this.storePORTDISCHARGEID,
name: 'PORTDISCHARGEID',
valueField: 'VALUE',
displayField: 'CodeAndName',
matchFieldWidth: false, //下拉款自适应宽度
forceSelection: false
});
//卸货港,国外港口
this.storePORTDISCHARGE = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetPORTDISCHARGEList' }
});
this.storePORTDISCHARGE.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '卸货港',
store: this.storePORTDISCHARGE,
name: 'PORTDISCHARGE',
valueField: 'NAME',
displayField: 'NAME',
matchFieldWidth: false, //下拉款自适应宽度
forceSelection: false
});
//中转港,国外港口
this.storeVIA = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetVIAList' }
});
this.storeVIA.load();
this.comboxVIA = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '中转港',
store: this.storeVIA,
name: 'VIA',
valueField: 'VALUE',
displayField: 'CodeAndName',
forceSelection: false
});
//船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetCARRIERList' }
});
this.storeCARRIER.load();
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '船公司',
store: this.storeCARRIER,
name: 'CARRIER',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: false
});
//#endregion
//#region 定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCrmPriceCarrierModel',
remoteSort: true,
//autoLoad: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCrmPriceCarrier/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 定义列
this.initgirdcolums = [{
sortable: false,
dataIndex: 'GID',
text: '惟一编号',
align: 'center',
hidden: true,
width: 0
},
{
dataIndex: 'LOCKFLAG',
text: '锁定',
align: 'center',
width: 40,
renderer: function (value) {
if (value == true) {
return "<img src='../../../../TruckMng/Content/Images/Lock.png'/>";
}
else {
return "";
}
}
},
{
dataIndex: 'ISISSUE',
text: '发布',
align: 'center',
width: 40,
renderer: function (value) {
if (value == true) {
return "<img src='../../../../TruckMng/Content/Images/Lock.png'/>";
}
else {
return "";
}
}
},
{
dataIndex: 'LANE',
text: '航线',
width: 80,
editor: this.comboxLANE
},
{
dataIndex: 'PODLOAD',
text: '起运港',
width: 100,
editor: this.comboxPODLOAD
},
{
dataIndex: 'PORTDISCHARGEID',
text: '卸货港',
width: 100,
editor: this.comboxPORTDISCHARGEID
},
{
dataIndex: 'PORTDISCHARGE',
text: '卸货港中文',
width: 100,
editor: this.comboxPORTDISCHARGE
},
{
dataIndex: 'CARRIER',
text: '船公司',
width: 100,
editor: this.comboxCARRIER
},
{
dataIndex: 'VIA',
text: '中转港',
width: 100,
editor: this.comboxVIA
},
{
dataIndex: 'VIA2',
text: '中转港2',
width: 100,
editor: this.comboxVIA
},
{
dataIndex: 'ETD',
text: '船期',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'TT',
text: '航程',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'EFFECTIVEDATE',
text: '开始日期',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
allowBlank: false,
selectOnFocus: true
}
},
{
dataIndex: 'VALIDDATE',
text: '结束日期',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
allowBlank: false,
selectOnFocus: true
}
},
{
dataIndex: 'COMMODITY',
text: '特殊商品',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CONTRACTNO',
text: '约号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CONTRACTBSNO',
text: 'CONTRACTBSNO',
width: 80
},
{
dataIndex: 'CTN0DETENTION',
text: '目的港免箱期_小柜',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN1DETENTION',
text: '目的港免箱期_大柜',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN2DETENTION',
text: '目的港免箱期_超高',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN3DETENTION',
text: '目的港免箱期_小冻',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN4DETENTION',
text: '目的港免箱期_超冻',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'REMARK',
text: '备注',
width: 200,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}];
//#endregion
//#region 定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
autoCancel: false
});
var _this = this;
this.girdcolums = this.initgirdcolums;
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
enableHdMenu: false, //是否显示表格列的菜单
stripeRows: true, //斑马线效果
trackMouseOver: true,
disableSelection: false,
rowLines: true,
columnLines: true,
selModel: this.GridCheckBoxModel,
plugins: [this.gridListCellEditing],
//plugins: [rowEditing],
selType: 'cellmodel',
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var sVALIDDATE = record.get('VALIDDATE');
var rq = currdate.format('yyyy-MM-dd');
if (rq > sVALIDDATE) {
return Shipping.GetXGridRowClass(1);
}
//查询运价标识提取样式表数据匹配GID修改行颜色样式
for (i = 0; i < _this.storeListBiaoShi.getCount(); i += 1) {
var member = _this.storeListBiaoShi.getAt(i);
var iFIELDCONTENT = parseInt(member.data.FIELDCONTENT);
var sFIELDNAME = member.data.FIELDNAME.toString().trim();
var sLINKGID = member.data.LINKGID.toString();
var iFIELDTYPE = parseInt(member.data.FIELDTYPE);
if (sLINKGID == record.get('GID').toString() && sFIELDNAME == "" && iFIELDTYPE == 1) {
return Shipping.GetXGridRowClass(iFIELDCONTENT);
}
}
}
},
listeners: {
scope: this,
'beforeedit': function (editor, e, eOpts) {
var blLOCKFLAG = e.record.data['LOCKFLAG']; //是否锁定
var blISISSUE = e.record.data['ISISSUE']; //是否发布
if (blLOCKFLAG || blISISSUE) {
return false;
}
return true;
}
},
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
id: 'bbar',
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#endregion
//运价级别
this.storeYJJB = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetBaoJia' }
});
this.storeYJJB.load();
//#region 按钮工具条
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: '记忆查询条件',
checked: true,
width: 120
});
this.panelBtn = new Ext.Panel({
layout: "border",
region: "north",
border: false,
tbar: [{
text: "执行查询",
tooltip: '执行查询',
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
var isvisible = false;
var issavevalue = false;
if (this.CheckSaveQuery.checked) {
issavevalue = true
}
saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue);
},
scope: this
}, {
text: "重置条件",
tooltip: '重置条件',
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-'
//需求编号SR2017092500001
, {
text: "添加",
tooltip: '添加',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddClick();
},
scope: this
}, {
text: "保存",
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.Save();
},
scope: this
}, {
text: '复制',
tooltip: '复制',
iconCls: "btnadd",
handler: function (button, event) {
this.onCopyClick();
},
scope: this
}, {
text: '批量修改',
tooltip: '批量修改',
iconCls: "btnadd",
handler: function (button, event) {
this.onAlterClick();
},
scope: this
}, {
text: '删除',
tooltip: '删除',
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick();
},
scope: this
}, '-', {
text: "导入导出",
tooltip: '导入导出',
menu: [{
text: "下载Excel模板",
tooltip: '下载Excel模板',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onDownloadClick(button, event);
},
scope: this
}, {
text: "导入Excel",
tooltip: '导入Excel',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onImportClick(button, event);
},
scope: this
}, {
text: "导出Excel",
tooltip: '导出Excel',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}],
scope: this
}, {
text: "打印",
tooltip: '打印',
iconCls: 'btnprint',
handler: function (button, event) {
this.Print();
},
scope: this
}, '-', {
text: "锁定",
tooltip: '锁定',
menu: [{
text: "选择锁定",
tooltip: '选择锁定',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onLockflagClick(button, event);
},
scope: this
}, {
text: "取消选择锁定",
tooltip: '取消选择锁定',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onNotLockflagClick(button, event);
},
scope: this
}, {
text: "全部锁定",
tooltip: '全部锁定',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onAllLockflagClick(button, event);
},
scope: this
}, {
text: "取消全部锁定",
tooltip: '取消全部锁定',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onNotAllLockflagClick(button, event);
},
scope: this
}],
scope: this
}, '-', {
text: "发布",
tooltip: '发布',
menu: [{
text: "选择发布",
tooltip: '选择发布',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onIsissueClick(button, event);
},
scope: this
}, {
text: "取消发布",
tooltip: '取消发布',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onNotIsissueClick(button, event);
},
scope: this
}, {
text: "全部发布",
tooltip: '全部发布',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onAllIsissueClick(button, event);
},
scope: this
}, {
text: "取消全部发布",
tooltip: '取消全部发布',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onNotAllIsissueClick(button, event);
},
scope: this
}],
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.initgrid();
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
},
// '-', {
// text: "标识",
// tooltip: '标识',
// menu: [{
// text: "普通运价",
// tooltip: '普通运价',
// iconCls: "btnexportexcel",
// handler: function (button, event) {
// this.onYunJiaBiaoShiClick("普通运价", 1);
// },
// scope: this
// }, {
// text: "优势运价",
// tooltip: '优势运价',
// iconCls: "btnexportexcel",
// handler: function (button, event) {
// this.onYunJiaBiaoShiClick("优势运价", 1);
// },
// scope: this
// }, {
// text: "运价涂黑",
// tooltip: '运价涂黑',
// iconCls: "btnexportexcel",
// handler: function (button, event) {
// this.onYunJiaBiaoShiClick("运价涂黑", 1);
// },
// scope: this
// }],
// scope: this
// },
'-', this.CheckSaveQuery]
});
//#endregion
//#region 页面布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 120,
border: false,
items: [this.panelBtn, this.formSearch]
});
Ext.apply(this, {
border: false,
items: [this.panelTop, this.gridList]
});
//#endregion
//#region 页面加载
//加载事件
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
if (sql.toString() != "") {
Ext.apply(store.proxy.extraParams, { condition: sql });
}
}, this);
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
this.initgrid();
// this.onRefreshClick();
//
// var blLS = LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
// if (blLS) {
// this.onRefreshClick();
// }
//#endregion
}, //end initUIComponents
//#region 执行查询
initgrid: function () {
if (this.isRefresh) {
this.isRefresh = false;
return;
}
_this = this;
var sql = this.getCondition();
//#region 列
var zlcolumn = [
{
sortable: false,
dataIndex: 'GID',
text: '惟一编号',
align: 'center',
hidden: true,
width: 0
},
{
dataIndex: 'LOCKFLAG',
text: '锁定',
align: 'center',
width: 40,
renderer: function (value) {
if (value == true) {
return "<img src='../../../../TruckMng/Content/Images/Lock.png'/>";
}
else {
return "";
}
}
},
{
dataIndex: 'ISISSUE',
text: '发布',
align: 'center',
width: 40,
renderer: function (value) {
if (value == true) {
return "<img src='../../../../TruckMng/Content/Images/Lock.png'/>";
}
else {
return "";
}
}
},
{
dataIndex: 'LANE',
text: '航线',
width: 80,
sortable: true,
editor: this.comboxLANE
},
{
dataIndex: 'PODLOAD',
text: '起运港',
width: 100,
sortable: true,
editor: this.comboxPODLOAD
},
{
dataIndex: 'PORTDISCHARGEID',
text: '卸货港',
width: 100,
sortable: true,
editor: this.comboxPORTDISCHARGEID
},
{
dataIndex: 'PORTDISCHARGE',
text: '卸货港中文',
width: 100,
sortable: true,
editor: this.comboxPORTDISCHARGE
},
{
dataIndex: 'CARRIER',
text: '船公司',
width: 100,
sortable: true,
editor: this.comboxCARRIER
},
{
dataIndex: 'VIA',
text: '中转港',
width: 100,
sortable: true,
editor: this.comboxVIA
},
{
dataIndex: 'VIA2',
text: '中转港2',
width: 100,
sortable: true,
editor: this.comboxVIA
},
{
dataIndex: 'ETD',
text: '船期',
width: 80,
sortable: true,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'TT',
text: '航程',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'COMMODITY',
text: '特殊商品',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CONTRACTNO',
text: '约号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CONTRACTBSNO', hidden: true,
text: 'CONTRACTBSNO'
},
{
dataIndex: 'CTN0DETENTION',
text: '目的港免箱期_小柜',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN1DETENTION',
text: '目的港免箱期_大柜',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN2DETENTION',
text: '目的港免箱期_超高',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN3DETENTION',
text: '目的港免箱期_小冻',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'CTN4DETENTION',
text: '目的港免箱期_超冻',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'REMARK',
text: '备注',
width: 200,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'INPUTBYREF',
text: '录入人',
width: 200
},
{
dataIndex: 'INPUTTIME',
text: '录入时间',
width: 200
}
];
//#endregion
//#region 列字段
var myfield = [];
var myfield2 = [];
var Columnfield = [
{ name: 'GID', type: 'string' }, //惟一编号
{ name: 'LOCKFLAG', type: 'bool' }, //是否锁定
{ name: 'ISISSUE', type: 'bool' }, //是否发布
{ name: 'LANE', type: 'string' }, //航线
{ name: 'PODLOAD', type: 'string' }, //起运港
{ name: 'PORTDISCHARGEID', type: 'string' }, //卸货港ID
{ name: 'PORTDISCHARGE', type: 'string' }, //卸货港中文
{ name: 'CARRIER', type: 'string' }, //船公司
{ name: 'VIA', type: 'string' }, //中转港
{ name: 'VIA2', type: 'string' }, //中转港2
{ name: 'ETD', type: 'string' }, //开航日/船期
{ name: 'TT', type: 'string' }, //航程
{ name: 'EFFECTIVEDATE', type: 'DateTime' }, //生效期/开始日期
{ name: 'VALIDDATE', type: 'DateTime' }, //有效期/结束日期
{ name: 'COMMODITY', type: 'string' }, //品名/特殊商品
{ name: 'CONTRACTNO', type: 'string' }, //约号
{ name: 'CONTRACTBSNO', type: 'string' }, //约号序列号
{ name: 'REMARK', type: 'string' }, //备注
{ name: 'INPUTBYREF', type: 'string' }, //备注
{ name: 'INPUTTIME', type: 'string' } //备注
];
//#endregion
//#region 取其他费用权限
var feeList;
this.storeFeeData = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetFeeName' }
});
this.storeFeeData.load({
params: {},
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
feeList = r;
}
}
},
async: false,
scope: this
});
//#endregion
//#region 取集装箱权限
var _this = this;
var ctnList;
this.storeCtnData = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetCtn' }
});
this.storeCtnData.load({
params: {},
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
ctnList = r;
//#region 取报价权限
this.storeMonthData = Ext.create('DsExt.ux.RefTableStore', {
model: 'XiaLaKuangModel',
proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetBaoJia' }
});
this.storeMonthData.load({
params: {},
callback: function (r, options, success) {
if (success) {
//#region 列循环
if (r.length != 0) {
//#region 列循环_其他费用
if (feeList != null) {
var acolumn2 = [];
for (i = 0; i < feeList.length; i++) {
var memberyf = feeList[i];
myfield2.push({ name: memberyf.data.VALUE, type: 'string' });
acolumn2.push({
dataIndex: memberyf.data.VALUE, //"列名"
text: memberyf.data.NAME, //"标题"
align: 'right',
width: 200,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
});
this.strHeader += ",[" + memberyf.data.NAME + "]";
};
if (acolumn2.length > 0) {
for (var k in acolumn2) {
zlcolumn.push(acolumn2[k]);
}
}
}
//#endregion
//#region 列循环_报价
for (j = 0; j < ctnList.length; j++) {
var ctn = ctnList[j];
var acolumn = [];
for (i = 0; i < r.length; i++) {
var memberyf = r[i];
myfield.push({ name: ctn.data.VALUE + memberyf.data.VALUE, type: 'decimal' });
zlcolumn.push({
dataIndex: ctn.data.VALUE + memberyf.data.VALUE, //"列名"
text: ctn.data.NAME + memberyf.data.NAME, //"标题"
align: 'right',
width: 70,
editor: {
//xtype: 'textfield',
xtype: 'numberfield',
selectOnFocus: true,
listeners: {
scope: this,
'render': function (_field, eOpts) {//自定义函数,定义双击事件
//var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var sValue = _field.getValue();
var sFIELDNAME = _field.name;
_this.onCellBiaoShiClick(sFIELDNAME);
});
}
}
},
renderer: function (value, mCss, record, iRow, iCol, stores, views) {
//查询运价标识提取样式表数据匹配GID修改单元格颜色样式
for (var k = 0; k < _this.storeListBiaoShi.getCount(); k++) {
var member = _this.storeListBiaoShi.getAt(k);
var iFIELDCONTENT = parseInt(member.data.FIELDCONTENT);
var sFIELDNAME = member.data.FIELDNAME.toString().trim();
var sFIELDNAME2 = record.fields.keys[iCol - 1];
var sLINKGID = member.data.LINKGID.toString();
var sGID = record.data.GID.toString();
var iFIELDTYPE = parseInt(member.data.FIELDTYPE);
if (sLINKGID == sGID && sFIELDNAME == sFIELDNAME2 && iFIELDTYPE == 1) {
mCss.tdCls = Shipping.GetXGridCellClass(iFIELDCONTENT);
}
if (sLINKGID == sGID && sFIELDNAME == sFIELDNAME2 && iFIELDTYPE == 3) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/edit.png'/>";
}
}
for (var k = 0; k < _this.storeListXGCS.getCount(); k++) {
var member = _this.storeListXGCS.getAt(k);
var sFIELDNAME = member.data.FIELDNAME.toString().trim();
var sFIELDNAME2 = record.fields.keys[iCol - 1];
var sLINKGID = member.data.LINKGID.toString();
var sGID = record.data.GID.toString();
var iFIELDTYPE = parseInt(member.data.FIELDTYPE);
var iHJ = parseInt(member.data.hj) - 1;
if (sLINKGID == sGID && sFIELDNAME == sFIELDNAME2 && iFIELDTYPE == 2) {
if (iHJ == 1) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/001.png'/>";
}
else if (iHJ == 2) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/002.png'/>";
}
else if (iHJ == 3) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/003.png'/>";
}
else if (iHJ == 4) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/004.png'/>";
}
else if (iHJ == 5) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/005.png'/>";
}
else if (iHJ == 6) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/006.png'/>";
}
else if (iHJ == 7) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/007.png'/>";
}
else if (iHJ == 8) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/008.png'/>";
}
else if (iHJ == 9) {
value = value + " " + "<img src='../../../../TruckMng/Content/Images/009.png'/>";
}
}
}
return value;
}
,
listeners: {
scope: this,
'dblclick': function (_gridView, _td, iRow, iCol, e, record) {
//var sFIELDNAME = record.fields.keys[iCol - 1];
_column = _gridList.columns[iCol];
var sFIELDNAME = _column.dataIndex;
//_this.onCellBiaoShiClick(sFIELDNAME);
//20200506 将原来的批注/修改历史窗口
CONTRACTBSNO = record.get("CONTRACTBSNO");
PODLOAD = record.get("PODLOAD");
PORTDISCHARGEID = record.get("PORTDISCHARGEID");
VIA = record.get("VIA");
VIA2 = record.get("VIA2");
fieldname = sFIELDNAME;
//改为显示费用来源明细
//Ext.Msg.show({
// title: '提示',
// msg: CONTRACTBSNO + "<br />" + fieldname,
// icon: Ext.Msg.Info,
// buttons: Ext.Msg.OK
//});
_onDetailClick(fieldname, CONTRACTBSNO, PODLOAD, PORTDISCHARGEID, VIA, VIA2);
}
}
});
this.strHeader += ",[" + memberyf.data.NAME + "]";
};
}
//#endregion
}
for (var k in myfield2) {
Columnfield.push(myfield2[k]);
}
for (var k in myfield) {
Columnfield.push(myfield[k]);
}
zlcolumn.push(
{
dataIndex: 'EFFECTIVEDATE',
text: '开始日期',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
allowBlank: false,
selectOnFocus: true
}
});
zlcolumn.push(
{
dataIndex: 'VALIDDATE',
text: '结束日期',
align: 'center',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
value: currdate.format('yyyy-MM-dd'),
allowBlank: false,
selectOnFocus: true
}
});
_this.initgirdcolums = _this.girdcolums;
_this.girdcolums = zlcolumn;
_this.girdcolums = DsTruck.GetGridPanel(USERID, _this.formname, _this.girdcolums, 1);
_this.gridList.reconfigure(_this.storeList, _this.girdcolums);
Ext.Msg.hide();
}
},
async: false,
scope: this
});
//#endregion
}
}
},
async: false,
scope: this
});
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
//#endregion
},
onRefreshClick: function (button, event) {
// Ext.Msg.wait('正在查询数据, 请稍侯..');
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.currentPage = 1;
this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
},
//#region 查询条件
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查!');
return '';
}
var sql = '';
// var strCp_2 = form.findField('cp_2').getValue();
// var strCp_3 = form.findField('cp_2').getRawValue();
// if (strCp_2 != null) {
// }
var strPORTLOADID = form.findField('PODLOAD_2').getValue();
if (strPORTLOADID != null) {
if (strPORTLOADID != "") {
sql = sql + getAndConSql(sql, strPORTLOADID, "[PODLOAD]='" + strPORTLOADID.toString().trim() + "'");
}
}
var strPORTDISCHARGEID_2 = form.findField('PORTDISCHARGEID_2').getValue();
if (strPORTDISCHARGEID_2 != null) {
if (strPORTDISCHARGEID_2 != "") {
sql = sql + getAndConSql(sql, strPORTDISCHARGEID_2, " (PORTDISCHARGE='" + strPORTDISCHARGEID_2.toString().trim() + "' or [PORTDISCHARGEID]='" + strPORTDISCHARGEID_2.toString().trim() + "') ");
}
}
var strVIA_2 = form.findField('VIA_2').getValue();
if (strVIA_2 != null) {
if (strVIA_2 != "") {
sql = sql + getAndConSql(sql, strVIA_2, "[VIA]='" + strVIA_2.toString().trim() + "'");
}
}
var strCARRIER = form.findField('CARRIER_2').getValue();
if (strCARRIER != null) {
if (strCARRIER != "") {
sql = sql + getAndConSql(sql, strCARRIER, "[CARRIER]='" + strCARRIER.toString().trim() + "'");
}
}
var strLANE = form.findField('LANE_2').getValue();
if (strLANE != null) {
if (strLANE != "") {
sql = sql + getAndConSql(sql, strLANE, "[LANE]='" + strLANE.toString().trim() + "'");
}
}
var strCOMMODITY_2 = form.findField('COMMODITY_2').getValue();
if (strCOMMODITY_2 != null) {
if (strCOMMODITY_2 != "") {
sql = sql + getAndConSql(sql, strCOMMODITY_2, "[COMMODITY] like '%" + strCOMMODITY_2.toString().trim() + "%'");
}
}
var ETD_BGN = form.findField('EFFECTIVEDATE_2').getRawValue();
var ETD_END = form.findField('VALIDDATE_2').getRawValue();
if (!isNullorEmpty(ETD_BGN) && !isNullorEmpty(ETD_END)) {
dataA = "'" + ETD_BGN + "'";
dataB = "'" + ETD_END + "'";
sql = sql + getAndConSql(sql, ETD_BGN, "((" + dataA + " >=EFFECTIVEDATE and " + dataA + " <=VALIDDATE)or(" + dataB + " >=EFFECTIVEDATE and " + dataB + " <=VALIDDATE)or(" + dataA + " <=EFFECTIVEDATE and " + dataB + " >=VALIDDATE))");
} else {
sql = sql + getAndConSql(sql, ETD_BGN, " VALIDDATE>='" + ETD_BGN + "'");
sql = sql + getAndConSql(sql, ETD_END, " EFFECTIVEDATE<='" + ETD_END + " 23:59:59'");
}
var strCOMMODITY_2 = form.findField('COMMODITY_2').getValue();
if (strCOMMODITY_2 != null) {
if (strCOMMODITY_2 != "") {
sql = sql + getAndConSql(sql, strCOMMODITY_2, "[COMMODITY] like '%" + strCOMMODITY_2.toString().trim() + "%'");
}
}
var strETD_2 = form.findField('ETD_2').getValue();
if (strETD_2 != null) {
if (strETD_2 != "") {
sql = sql + getAndConSql(sql, strETD_2, "[ETD] like '%" + strETD_2.toString().trim() + "%'");
}
}
var strTT_2 = form.findField('TT_2').getValue();
if (strTT_2 != null) {
if (strTT_2 != "") {
sql = sql + getAndConSql(sql, strTT_2, "[TT] like '%" + strTT_2.toString().trim() + "%'");
}
}
var LOCKFLAG_2 = form.findField('LOCKFLAG_2').getValue();
if (LOCKFLAG_2 != null) {
if (LOCKFLAG_2 == "未锁定") {
sql = sql + getAndConSql(sql, LOCKFLAG_2, "[LOCKFLAG]=0");
}
else if (LOCKFLAG_2 == "已锁定") {
sql = sql + getAndConSql(sql, LOCKFLAG_2, "[LOCKFLAG]=1");
}
}
var ISISSUE_2 = form.findField('ISISSUE_2').getValue();
if (ISISSUE_2 != null) {
if (ISISSUE_2 == "未发布") {
sql = sql + getAndConSql(sql, ISISSUE_2, "[ISISSUE]=0");
}
else if (ISISSUE_2 == "已发布") {
sql = sql + getAndConSql(sql, ISISSUE_2, "[ISISSUE]=1");
}
}
var REMARK_2 = form.findField('REMARK_2').getValue();
if (REMARK_2 != null) {
sql = sql + getAndConSql(sql, REMARK_2, "REMARK like '%" + REMARK_2+"%'");
}
var CONTRACTNO = form.findField('CONTRACTNO').getValue();
if (CONTRACTNO != null) {
sql = sql + getAndConSql(sql, CONTRACTNO, "CONTRACTNO like '%" + CONTRACTNO + "%'");
}
var CTNTYPE = form.findField('CTNTYPE').getValue();
sql = sql + getAndConSql(sql, CTNTYPE, " isnull(" + CTNTYPE + "0,0)>0 ");
return sql;
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
//#endregion
//#region 下载Excel模板
onDownloadClick: function (button, event) {
window.open("../../download/运价模板.xls");
},
//#endregion
//#region 导入Excel
onImportClick: function (button, event) {
var _this = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadExcel',
name: 'LoadExcel',
emptyText: '请选择EXCEL文件',
fieldLabel: 'EXCEL',
buttonText: '选择文件',
allowBlank: false,
width: 200,
buttonCfg: { iconCls: 'uploaddialog' },
anchor: '98%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) {
Ext.Msg.show({ title: "错误", msg: '请确认你上传的文件为EXCEL文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsCrmPriceCarrier/onImportClick',
waitMsg: "正在操作数据, 请稍侯...",
method: 'POST',
//params: { bsno: BSNO },
success: function (form, action) {
win.close(this);
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID) {
Ext.MessageBox.alert("警告", action.result.Message);
}
win.close(this);
_this.storeList.load({ params: { condition: _this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传EXCEL",
closeAction: 'destroy', //hide,
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
//#endregion
//#region 导出Excel
onExportClick2: function (button, event) {
if (this.storeList.getCount() == 0) {
return;
}
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/GetDataListSQL',
params: {
condition: this.sqlcontext,
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
if (returnStr.toString() != "") {
var openSet = "height=1, width=400, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top=" + (screen.height - 200) / 2 + ",Left=" + (screen.width - 400) / 2;
var openType = "_blank";
var condition1 = escape(returnStr.toString());
var openUrl = "../../Reports/RptExport.aspx?handle=MsCrmPriceCarrierIndex&formname=" + this.formname + "&condition1=" + condition1 + "&condition2=" + this.strHeader.toString();
window.open(openUrl, openType, openSet);
}
} 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 });
}
},
scope: this
});
},
//ExtJs 自带的导出当前页的excel导出函数
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
// grid2Excel(this.gridList, "运价维护");
},
//#endregion
//#region 打印
Print: function () {
if (this.storeList.getCount() == 0) {
return;
}
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/GetDataListStr',
params: {
condition: this.sqlcontext,
printstr: 'true'
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
var printType = 'MsCrmPriceCarrierList';
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 });
}
},
scope: this
});
},
//#endregion
//#region 添加
onAddClick: function () {
var n = this.storeList.getCount();
var record = Ext.create('MsCrmPriceCarrierModel_All', {
GID: '*', //惟一编号
LOCKFLAG: false, //是否锁定
ISISSUE: false, //是否发布
LANE: '', //航线
PODLOAD: '', //起运港
PORTDISCHARGEID: '', //卸货港ID
PORTDISCHARGE: '', //卸货港中文
CARRIER: '', //船公司
VIA: '', //中转港
VIA2: '', //中转港
ETD: '', //开航日/船期
TT: '', //航程
EFFECTIVEDATE: '', //生效期/开始日期
VALIDDATE: '', //有效期/结束日期
COMMODITY: '', //品名/特殊商品
REMARK: '', //备注
FEE0: '', //FEE0
FEE1: '', //FEE1
FEE2: '', //FEE2
FEE3: '', //FEE3
FEE4: '', //FEE4
CTN00: 0, //CTN00
CTN10: 0, //CTN10
CTN20: 0, //CTN20
CTN30: 0, //CTN30
CTN40: 0, //CTN40
CTN50: 0, //CTN50
CTN60: 0, //CTN60
CTN70: 0, //CTN70
CTN80: 0, //CTN80
CTN90: 0, //CTN90
CTN01: 0, //CTN01
CTN11: 0, //CTN11
CTN21: 0, //CTN21
CTN31: 0, //CTN31
CTN41: 0, //CTN41
CTN51: 0, //CTN51
CTN61: 0, //CTN61
CTN71: 0, //CTN71
CTN81: 0, //CTN81
CTN91: 0, //CTN91
CTN02: 0, //CTN02
CTN12: 0, //CTN12
CTN22: 0, //CTN22
CTN32: 0, //CTN32
CTN42: 0, //CTN42
CTN52: 0, //CTN52
CTN62: 0, //CTN62
CTN72: 0, //CTN72
CTN82: 0, //CTN82
CTN92: 0, //CTN92
CTN03: 0, //CTN03
CTN13: 0, //CTN13
CTN23: 0, //CTN23
CTN33: 0, //CTN33
CTN43: 0, //CTN43
CTN53: 0, //CTN53
CTN63: 0, //CTN63
CTN73: 0, //CTN73
CTN83: 0, //CTN83
CTN93: 0, //CTN93
CTN04: 0, //CTN04
CTN14: 0, //CTN14
CTN24: 0, //CTN24
CTN34: 0, //CTN34
CTN44: 0, //CTN44
CTN54: 0, //CTN54
CTN64: 0, //CTN64
CTN74: 0, //CTN74
CTN84: 0, //CTN84
CTN94: 0 //CTN94
});
//this.storeList.add(record);
//this.gridListCellEditing.startEditByPosition({ row: n, column: 3 }); //n - 1
this.storeList.insert(0, record);
this.gridListCellEditing.startEditByPosition({ row: 0, column: 4 }); //n - 1
},
//#endregion
//#region 复制
onCopyClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
if (i == 0) {
gids = record.get('GID');
}
else {
gids += "," + record.get('GID');
}
}
this.CheckIsCopy = new Ext.form.Checkbox({
fieldLabel: '复制运价', //'货代提单',
checked: false
});
var _this = this;
var imgform = new Ext.FormPanel({
region: 'center',
frame: true,
autoScroll: false,
border: false,
items: [{
fieldLabel: '开始日期',
format: 'Y-m-d',
xtype: 'datefield',
editable: false,
// allowBlank: false,
id: 'EFFECTIVEDATE_3',
// value: currdate.format('yyyy-MM-dd'),
name: 'EFFECTIVEDATE_3'
}, {
fieldLabel: '结束日期',
format: 'Y-m-d',
xtype: 'datefield',
editable: false,
// allowBlank: false,
id: 'VALIDDATE_3',
// value: currdate.format('yyyy-MM-dd'),
name: 'VALIDDATE_3'
//,width: 200,
//anchor: '98%'
}, this.CheckIsCopy],
buttons: [{
text: '复制',
type: 'submit',
handler: function () {
if (!imgform.form.isValid()) { return; }
Ext.MessageBox.confirm('提示', '确定复制吗?', function (btn) {
if (btn == 'yes') {
var sEFFECTIVEDATE_3 = Ext.getCmp('EFFECTIVEDATE_3').getRawValue();
var sVALIDDATE_3 = Ext.getCmp('VALIDDATE_3').getRawValue();
var ISCOPYYJ = 0;
if (_this.CheckIsCopy.checked) {
ISCOPYYJ = 1;
}
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/onCopyClick',
params: {
sEFFECTIVEDATE: sEFFECTIVEDATE_3,
sVALIDDATE: sVALIDDATE_3,
ISCOPYYJ: ISCOPYYJ,
gids: gids
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
win.close(this);
_this.storeList.reload();
//_this.storeList.load({ params: { condition: _this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
// _this.storeList.load({ params: { condition: _this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
} 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 });
}
},
scope: this
});
}
}, this);
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "复制运价信息",
closeAction: 'destroy', //hide,
width: 300,
height: 160,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
//#endregion
//#region 复制
onCopyClipClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var clipstr = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
clipstr = clipstr + '#13#10' + '船公司:' + record.data.CARRIER + " 船期:" + record.data.ETD;
}
window.copy(clipstr);
},
//#endregion
//#region 批量修改
onAlterClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var blLOCKFLAG = record.data.LOCKFLAG; //是否锁定
var blISISSUE = record.data.ISISSUE; //是否发布
if (!blLOCKFLAG && !blISISSUE) {
gids += "," + record.get('GID');
}
}
if (gids.toString().trim() !== "") {
gids = gids.substr(1);
var comboxPortdischarge3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卸货港',
store: this.storePORTDISCHARGE_2,
name: 'PORTDISCHARGEID_2',
queryMode: 'remote',
minChars: 0,
id: 'PORTDISCHARGEID_22',
queryParam: 'CODENAME',
valueField: 'VALUE',
displayField: 'CodeAndName',
forceSelection: true
});
var comboxVIA_3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转港',
store: this.storeVIA_2,
id: 'VIA3',
name: 'VIA_3',
valueField: 'VALUE',
displayField: 'VALUE',
forceSelection: false
});
var comboxVIA_4 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转港2',
store: this.storeVIA_2,
id: 'VIA4',
name: 'VIA_4',
valueField: 'VALUE',
displayField: 'VALUE',
forceSelection: false
});
var comboxCarrier3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER_2,
id: 'CARRIER_22',
name: 'CARRIER_2',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: true
});
var comboxLane3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE_2,
id: 'LANE22',
name: 'LANE',
valueField: 'NAME',
displayField: 'CodeAndName',
forceSelection: true
});
var comboxYjjb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运价级别',
store: this.storeYJJB,
id: 'YJJB',
name: 'YJJB',
valueField: 'VALUE',
displayField: 'CodeAndName',
forceSelection: true
});
//#region 编辑formDiv 基本信息
Ext.create('Ext.form.Panel', {
id:"formPanel",
border: false,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 100,
labelStyle: 'font-weight:bold'
},
items: [
comboxPortdischarge3, comboxVIA_3, comboxVIA_4, comboxCarrier3, comboxLane3,
{
fieldLabel: '开始日期',
format: 'Y-m-d',
xtype: 'datefield',
id: 'EFFECTIVEDATE_3',
name: 'EFFECTIVEDATE_3'
}, {
fieldLabel: '结束日期',
format: 'Y-m-d',
xtype: 'datefield',
id: 'VALIDDATE_3',
name: 'VALIDDATE_3'
},
comboxYjjb,
{
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
align: 'right',
nanText: '请输入有效数值',
fieldLabel: 'CTN0 | 小柜运价',
id: 'Fee0',
name: 'CTN0'
}, {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
align: 'right',
nanText: '请输入有效数值',
fieldLabel: 'CTN1 | 大柜运价',
id: 'Fee1',
name: 'CTN1'
}, {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
align: 'right',
nanText: '请输入有效数值',
fieldLabel: 'CTN2 | 超高运价',
id: 'Fee2',
name: 'CTN2'
}, {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
align: 'right',
nanText: '请输入有效数值',
fieldLabel: 'CTN3 | 小冻运价',
id: 'Fee3',
name: 'CTN3'
}, {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
align: 'right',
nanText: '请输入有效数值',
fieldLabel: 'CTN4 | 超冻运价',
id: 'Fee4',
name: 'CTN4'
}]
});
//#endregion
var win= Ext.create('Ext.window.Window',
{
title: '批量修改',
draggable: true, //拖动
resizable: false,
autoRender: true,
autoShow: true,
height: 440,
width: 310,
bodyStyle: {
backgroundColor: '#fff',
padding: '12px'
},
constrain: true,//防止拖动超出窗体
autoScroll: true,
overflowX: 'auto',
overflowY: 'auto',
modal: true,
listeners: {
show: function () {
this.add(Ext.getCmp("formPanel"));
}
},
buttons: [{
id: 'submit',
text: '修改',
handler: function(options, success, response) {
var sEffectivedate3 = Ext.getCmp('EFFECTIVEDATE_3').getRawValue();
var sValiddate3 = Ext.getCmp('VALIDDATE_3').getRawValue();
var psc = Ext.getCmp('PORTDISCHARGEID_22').getValue();//卸货港ID
var psc_zh = "";
if (Ext.getCmp("PORTDISCHARGEID_22").valueModels.length>0)
psc_zh = Ext.getCmp("PORTDISCHARGEID_22").valueModels[0].data.NAME;//卸货港中文
var crr = Ext.getCmp('CARRIER_22').getValue();//船公司
var lane = Ext.getCmp('LANE22').getValue();//航线
var sYjjb = Ext.getCmp('YJJB').getValue();
var sFee0 = Ext.getCmp('Fee0').getValue();
var sFee1 = Ext.getCmp('Fee1').getValue();
var sFee2 = Ext.getCmp('Fee2').getValue();
var sFee3 = Ext.getCmp('Fee3').getValue();
var sFee4 = Ext.getCmp('Fee4').getValue();
var VIA3 = Ext.getCmp('VIA3').getValue();
var VIA4 = Ext.getCmp('VIA4').getValue();
if (sEffectivedate3 !== "" || sValiddate3 !== "" || sYjjb !== "") {
Ext.MessageBox.confirm('提示',
'确定修改吗?',
function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/onAlterClick',
params: {
sEFFECTIVEDATE: sEffectivedate3,
sVALIDDATE: sValiddate3,
psc: psc,
psc_zh: psc_zh,
crr: crr,
lane:lane,
sYJJB: sYjjb,
sFee0: sFee0,
sFee1: sFee1,
sFee2: sFee2,
sFee3: sFee3,
sFee4: sFee4,
VIA3: VIA3,
VIA4: VIA4,
gids: gids
},
callback: function(options, success, response) {
if (success) {
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({
params: { condition: this.sqlcontext },
waitMsg: "正在刷新数据...",
scope: this
});
win.close(this);
} 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
});
}
},
scope: this
});
}
},
this);
} else {
Ext.Msg.show({
title: '警告',
msg: '请先确定修改内容的准确性!',
icon: Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
},
scope: this
}, {
text: '关闭',
handler: function () {
//this.up('form').getForm().reset();
this.up('window').close();
}
}]
});
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择未锁定并且未发布的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 删除
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
var sError = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var blLOCKFLAG = record.data.LOCKFLAG; //是否锁定
var blISISSUE = record.data.ISISSUE; //是否发布
if (!blLOCKFLAG && !blISISSUE) {
gids += "," + record.get('GID');
}
}
if (gids.toString().trim() != "") {
gids = gids.substr(1);
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsCrmPriceCarrier/Delete',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
Ext.Msg.show({ title: '提示', msg: jsonresult.Message + sError, 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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择未锁定并且未发布的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 保存
Save: function () {
Ext.Msg.wait('正在保存数据, 请稍侯..');
//
var bodydatas = [];
var records = this.storeList.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = this.storeList.getNewRecords(); //获得幻影行
records = records.concat(phantoms); //将幻影数据与真实数据合并
if (records.length != 0) {
for (var i = 0; i < records.length; i += 1) {
var member = records[i];
var blLOCKFLAG = member.data.LOCKFLAG; //是否锁定
var blISISSUE = member.data.ISISSUE; //是否发布
var EFFECTIVEDATE = member.data.EFFECTIVEDATE;
var VALIDDATE = member.data.VALIDDATE;
if (!blLOCKFLAG && !blISISSUE) {
if (EFFECTIVEDATE != '' && VALIDDATE != '') {
var oDate1 = new Date(EFFECTIVEDATE);
var oDate2 = new Date(VALIDDATE);
if (oDate1.getTime() >= oDate2.getTime()) {
Ext.Msg.show({ title: "提示", msg: "开始日期不能大于结束日期", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
bodydatas.push(member);
}
}
}
//
if (bodydatas.length > 0) {
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsCrmPriceCarrier/Save',
scope: this,
params: {
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//需求编号SR2017092500001
//this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
for (var i = 0; i < records.length; i += 1) {
var member = records[i];
member.commit();
this.isRefresh = true;
}
//end
Ext.Msg.hide();
} 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.WARNING, buttons: Ext.Msg.OK });
}
}
});
} else {
Ext.Msg.show({ title: '警告', msg: '没有要保存的数据!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
}
},
//#endregion
//#region 选择锁定
onLockflagClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var blLOCKFLAG = record.data.LOCKFLAG; //是否锁定
var blISISSUE = record.data.ISISSUE; //是否发布
if (!blLOCKFLAG && !blISISSUE) {
gids += "," + record.get('GID');
}
}
if (gids.toString().trim() != "") {
gids = gids.substr(1);
Ext.MessageBox.confirm('提示', '确定锁定吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在锁定数据...');
Ext.Ajax.request({
waitMsg: '正在锁定数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onLockflagClick',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择未锁定且未发布的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 取消选择锁定
onNotLockflagClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var blLOCKFLAG = record.data.LOCKFLAG; //是否锁定
var blISISSUE = record.data.ISISSUE; //是否发布
if (blLOCKFLAG && !blISISSUE) {
gids += "," + record.get('GID');
}
}
if (gids.toString().trim() != "") {
gids = gids.substr(1);
Ext.MessageBox.confirm('提示', '确定取消锁定吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在取消锁定数据...');
Ext.Ajax.request({
waitMsg: '正在取消锁定数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onNotLockflagClick',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择已锁定且未发布的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 全部锁定
onAllLockflagClick: function (button, event) {
Ext.MessageBox.confirm('提示', '确定全部锁定吗?(注意:只锁定未锁定且未发布的数据)', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在锁定数据...');
Ext.Ajax.request({
waitMsg: '正在锁定数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onAllLockflagClick',
//params: { gids: gids },
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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 });
}
}
Ext.Msg.hide();
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
//#region 取消全部锁定
onNotAllLockflagClick: function (button, event) {
Ext.MessageBox.confirm('提示', '确定取消全部锁定吗?(注意:只取消锁定已锁定且未发布的数据)', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在取消锁定数据...');
Ext.Ajax.request({
waitMsg: '正在取消锁定数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onNotAllLockflagClick',
//params: { gids: gids },
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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 });
}
}
Ext.Msg.hide();
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
gridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'PORTDISCHARGEID') {
var records = DsStoreQueryBy(this.storePORTDISCHARGEID, 'VALUE', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var NAME = data.NAME;
e.record.set('PORTDISCHARGE', NAME);
}
} else if (e.field == 'EFFECTIVEDATE' || e.field == 'VALIDDATE') {
var EFFECTIVEDATE = e.record.data['EFFECTIVEDATE'];
var VALIDDATE = e.record.data['VALIDDATE'];
if (EFFECTIVEDATE != '' && VALIDDATE != '') {
var oDate1 = new Date(EFFECTIVEDATE);
var oDate2 = new Date(VALIDDATE);
if (oDate1.getTime() >= oDate2.getTime()) {
Ext.Msg.show({ title: "提示", msg: "开始日期不能大于结束日期", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
}
if (e.field == 'CTN00') {
e.record.set('CTN02', e.value);
}
if (e.field == 'CTN10') {
e.record.set('CTN12', e.value);
}
if (e.field == 'CTN20') {
e.record.set('CTN22', e.value);
}
},
//#region 选择发布
onIsissueClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var blLOCKFLAG = record.data.LOCKFLAG; //是否发布
var blISISSUE = record.data.ISISSUE; //是否发布
if (blLOCKFLAG && !blISISSUE) {
gids += "," + record.get('GID');
}
}
if (gids.toString().trim() != "") {
gids = gids.substr(1);
Ext.MessageBox.confirm('提示', '确定发布吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在发布数据...');
Ext.Ajax.request({
waitMsg: '正在发布数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onIsissueClick',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择已锁定且未发布的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 取消选择发布
onNotIsissueClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
var blLOCKFLAG = record.data.LOCKFLAG; //是否发布
var blISISSUE = record.data.ISISSUE; //是否发布
if (blLOCKFLAG && blISISSUE) {
gids += "," + record.get('GID');
}
}
if (gids.toString().trim() != "") {
gids = gids.substr(1);
Ext.MessageBox.confirm('提示', '确定取消发布吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在取消发布数据...');
Ext.Ajax.request({
waitMsg: '正在取消发布数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onNotIsissueClick',
params: {
gids: gids
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择已锁定且已发布的业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 全部发布
onAllIsissueClick: function (button, event) {
Ext.MessageBox.confirm('提示', '确定全部发布吗?(注意:只发布已锁定且未发布的数据)', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在发布数据...');
Ext.Ajax.request({
waitMsg: '正在发布数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onAllIsissueClick',
//params: { gids: gids },
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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 });
}
}
Ext.Msg.hide();
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
//#region 取消全部发布
onNotAllIsissueClick: function (button, event) {
Ext.MessageBox.confirm('提示', '确定取消全部发布吗?(注意:只取消发布已锁定且已发布的数据)', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在取消发布数据...');
Ext.Ajax.request({
waitMsg: '正在取消发布数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onNotAllIsissueClick',
//params: { gids: gids },
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
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 });
}
}
Ext.Msg.hide();
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
//#endregion
//#region 设置运价标识
onYunJiaBiaoShiClick: function (sFIELDCONTENT, iFIELDTYPE) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var gids = "";
for (var i = 0; i < selections.length; i++) {
var record = selections[i];
gids += "," + record.get('GID');
}
if (gids.toString().trim() != "") {
gids = gids.substr(1);
Ext.Msg.wait('正在操作数据...');
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsCrmPriceCarrier/onYunJiaBiaoShiClick',
params: {
gids: gids,
sFIELDNAME: "",
iFIELDTYPE: iFIELDTYPE,
sFIELDCONTENT: sFIELDCONTENT
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeListXGCS.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
this.storeListBiaoShi.load({ params: { condition: this.sqlcontext, condition2: "" }, waitMsg: "正在刷新数据...", scope: this });
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
Ext.Msg.hide();
}
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.WARNING, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
else {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 设置运价标识_单元格
onCellBiaoShiClick: function (sFIELDNAME, _gridList) {
var selections = _gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var gids = record.get('GID');
if (gids.toString().trim() != "") {
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
//#region 历史运价信息
//#region 列定义
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.girdcolumsBiaoShi = [new Ext.grid.RowNumberer(), {
sortable: false,
text: '运价',
dataIndex: 'FIELDCONTENT',
width: 120,
align: 'right'
}];
//#endregion
//#region gridList列表显示信息
this.gridListBiaoShi = new Ext.grid.GridPanel({
title: '历史运价信息',
region: 'center',
frame: true,
anchor: '100%',
//width: 150,
height: 200,
store: this.storeListBiaoShi,
//enableHdMenu: false, //是否显示表格列的菜单
//hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
selType: 'cellmodel',
columns: this.girdcolumsBiaoShi
});
//#endregion
//#endregion
//#region 编辑formDiv 基本信息
var formDiv = Ext.widget('form', {
frame: true,
border: false,
bodyPadding: 10,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 30,
labelStyle: 'font-weight:bold'
},
//items: [this.panelWest, this.gridListBiaoShi],
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '批注',
xtype: 'textareafield',
grow: true,
height: 200,
id: 'FIELDCONTENT',
name: 'FIELDCONTENT',
//anchor: '100%',
listeners: {
scope: this,
'render': function (_field, eOpts) {
//#region 查询运价标识:提取当前数据的批注内容
for (var k = 0; k < this.storeListBiaoShi.getCount(); k += 1) {
var member = this.storeListBiaoShi.getAt(k);
var sLINKGID = member.data.LINKGID.toString();
var sFIELDNAME2 = member.data.FIELDNAME.toString().trim();
var iFIELDTYPE = parseInt(member.data.FIELDTYPE);
var sFIELDCONTENT = member.data.FIELDCONTENT;
if (sLINKGID == gids && sFIELDNAME == sFIELDNAME2 && iFIELDTYPE == 3) {
_field.setValue(sFIELDCONTENT);
}
}
//#endregion
}
}
}, { xtype: 'hiddenfield', width: 20 }, this.gridListBiaoShi]//flex: 1
}]
}],
buttons: [{
id: 'submit',
text: '保存批注',
handler: function (options, success, response) {
var sFIELDCONTENT = Ext.getCmp('FIELDCONTENT').getValue();
if (sFIELDCONTENT != "") {
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/onYunJiaBiaoShiClick',
params: {
gids: gids,
sFIELDNAME: sFIELDNAME,
iFIELDTYPE: 3,
sFIELDCONTENT: sFIELDCONTENT
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
this.storeListXGCS.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
this.storeListBiaoShi.load({ params: { condition: this.sqlcontext, condition2: "" }, waitMsg: "正在刷新数据...", scope: this });
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
win.close(this);
} 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 });
}
},
scope: this
});
}
else {
Ext.Msg.show({ title: '警告', msg: '请先确定修改内容的准确性!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
},
scope: this
}, {
id: 'submitPtyj',
text: '普通运价',
handler: function (options, success, response) {
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/onYunJiaBiaoShiClick',
params: {
gids: gids,
sFIELDNAME: sFIELDNAME,
iFIELDTYPE: 1,
sFIELDCONTENT: "普通运价"
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
this.storeListXGCS.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
this.storeListBiaoShi.load({ params: { condition: this.sqlcontext, condition2: "" }, waitMsg: "正在刷新数据...", scope: this });
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
win.close(this);
} 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 });
}
},
scope: this
});
},
scope: this
}, {
id: 'submitYsyj',
text: '优势运价',
handler: function (options, success, response) {
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/onYunJiaBiaoShiClick',
params: {
gids: gids,
sFIELDNAME: sFIELDNAME,
iFIELDTYPE: 1,
sFIELDCONTENT: "优势运价"
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
this.storeListXGCS.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
this.storeListBiaoShi.load({ params: { condition: this.sqlcontext, condition2: "" }, waitMsg: "正在刷新数据...", scope: this });
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
win.close(this);
} 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 });
}
},
scope: this
});
},
scope: this
}, {
id: 'submitYjth',
text: '运价涂黑',
handler: function (options, success, response) {
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsCrmPriceCarrier/onYunJiaBiaoShiClick',
params: {
gids: gids,
sFIELDNAME: sFIELDNAME,
iFIELDTYPE: 1,
sFIELDCONTENT: "运价涂黑"
},
callback: function (options, success, response) {
if (success) {
var ddd = Ext.MessageBox.isVisible();
if (Ext.MessageBox.isVisible()) {
Ext.MessageBox.hide();
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnStr = jsonresult.data;
this.storeListXGCS.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
this.storeListBiaoShi.load({ params: { condition: this.sqlcontext, condition2: "" }, waitMsg: "正在刷新数据...", scope: this });
this.storeList.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this });
win.close(this);
} 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 });
}
},
scope: this
});
},
scope: this
}, {
text: '关闭',
handler: function () {
this.up('form').getForm().reset();
this.up('window').close();
}
}],
listeners: {
scope: this,
//'beforeload': function () {
'render': function (thisDiv, thisExtend) {
//#region 加载下拉框信息
var strCondition2 = "FIELDNAME='" + sFIELDNAME + "' and FIELDTYPE=2 and LINKGID in ('" + gids.replace(",", "','") + "')";
this.storeListBiaoShi.load({ async: false, params: { condition: this.sqlcontext, condition2: strCondition2 }, waitMsg: "正在刷新数据...", scope: this });
//#endregion
}
}
});
//#endregion
win = Ext.widget('window', {
title: '设置运价单元格标识',
closeAction: 'destroy', //hide,
width: 420,
height: 290,
layout: 'fit',
modal: true,
closable: false, //为false时tab上不显示叉号
resizable: false, //是否可改变列宽,默认为true
border: false,
items: formDiv
//draggable: false,//不允许窗体被拖拽
//获取当前鼠标坐标并设置为其生产的初始位置
//x: 250,
//y: 150,
});
win.show();
}
else {
Ext.Msg.show({ title: '提示', msg: '请选择业务!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return;
}
},
//#endregion
//#region 双击显示运价底价明细
onDetailClick: function (fieldname, CONTRACTBSNO, PODLOAD, PORTDISCHARGEID, VIA, VIA2) {
Ext.Ajax.request({
waitMsg: '正在组织数据, 请稍侯...',
url: '/MvcShipping/MsPrice/GetFeeDetail',
params: {
fieldname: fieldname,
CONTRACTBSNO: CONTRACTBSNO,
PODLOAD: PODLOAD,
PORTDISCHARGEID: PORTDISCHARGEID,
VIA: VIA,
VIA2: VIA2
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
_msg = returnData.replace(";", "<br />");
Ext.Msg.show({
title: '底价明细',
msg: _msg,
icon: Ext.Msg.Info,
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 });
}
},
scope: this
});
},
//#endregion
OprationSwapJK: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});