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: 1000, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', strHeader: "", initUIComponents: function () { this.formname = "formMsCrmPriceCarrierIndex"; //ds7新运价管理 //#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', forceSelection: false, value: 'Qingdao' }); //卸货港,国外港口 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: '卸货港ID', store: this.storePORTDISCHARGE_2, name: 'PORTDISCHARGEID_2', 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 } } }); //#endregion //#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, { 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 } } }]//, { xtype: 'hiddenfield', flex: 1} }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ 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 } } }, { fieldLabel: '备注', name: 'REMARK_2', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }, this.comboxLOCKFLAG, this.comboxISISSUE, { xtype: 'hiddenfield', flex: 1}]// }] }]//end items(fieldset 1) }); //#endregion formSearch //#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: 'CodeAndName', 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.girdcolums = [{ sortable: false, dataIndex: 'GID', header: '惟一编号', align: 'center', hidden: true, width: 0 }, { dataIndex: 'LOCKFLAG', header: '锁定', align: 'center', width: 40, renderer: function (value) { if (value == true) { return ""; } else { return ""; } } }, { dataIndex: 'ISISSUE', header: '发布', align: 'center', width: 40, renderer: function (value) { if (value == true) { return ""; } else { return ""; } } }, { dataIndex: 'LANE', header: '航线', width: 80, editor: this.comboxLANE }, { dataIndex: 'PODLOAD', header: '起运港', width: 100, editor: this.comboxPODLOAD }, { dataIndex: 'PORTDISCHARGEID', header: '卸货港', width: 100, editor: this.comboxPORTDISCHARGEID }, { dataIndex: 'PORTDISCHARGE', header: '卸货港中文', width: 100, editor: this.comboxPORTDISCHARGE }, { dataIndex: 'CARRIER', header: '船公司', width: 100, editor: this.comboxCARRIER }, { dataIndex: 'VIA', header: '中转港', width: 100, editor: this.comboxVIA }, { dataIndex: 'ETD', header: '船期', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'TT', header: '航程', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'EFFECTIVEDATE', header: '开始日期', 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', header: '结束日期', 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 }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { var rq = currdate.format('yyyy-MM-dd'); if (rq > value) { return '' + value.toString().substr(0, 10) + ''; } return value.toString().substr(0, 10); } }, { dataIndex: 'COMMODITY', header: '特殊商品', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: '备注', width: 200, editor: { xtype: 'textfield', selectOnFocus: true } } //#region 费用与集装箱费用 // , // { // dataIndex: 'FEE0', // header: 'FEE0', // width: 100, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'FEE1', // header: 'FEE1', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'FEE2', // header: 'FEE2', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'FEE3', // header: 'FEE3', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'FEE4', // header: 'FEE4', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN00', // header: 'CTN00', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN10', // header: 'CTN10', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN20', // header: 'CTN20', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN30', // header: 'CTN30', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN40', // header: 'CTN40', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN50', // header: 'CTN50', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN60', // header: 'CTN60', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN70', // header: 'CTN70', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN80', // header: 'CTN80', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN90', // header: 'CTN90', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN01', // header: 'CTN01', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN11', // header: 'CTN11', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN21', // header: 'CTN21', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN31', // header: 'CTN31', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN41', // header: 'CTN41', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN51', // header: 'CTN51', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN61', // header: 'CTN61', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN71', // header: 'CTN71', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN81', // header: 'CTN81', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN91', // header: 'CTN91', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN02', // header: 'CTN02', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN12', // header: 'CTN12', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN22', // header: 'CTN22', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN32', // header: 'CTN32', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN42', // header: 'CTN42', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN52', // header: 'CTN52', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN62', // header: 'CTN62', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN72', // header: 'CTN72', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN82', // header: 'CTN82', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN92', // header: 'CTN92', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN03', // header: 'CTN03', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN13', // header: 'CTN13', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN23', // header: 'CTN23', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN33', // header: 'CTN33', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN43', // header: 'CTN43', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN53', // header: 'CTN53', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN63', // header: 'CTN63', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN73', // header: 'CTN73', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN83', // header: 'CTN83', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN93', // header: 'CTN93', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN04', // header: 'CTN04', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN14', // header: 'CTN14', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN24', // header: 'CTN24', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN34', // header: 'CTN34', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN44', // header: 'CTN44', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN54', // header: 'CTN54', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN64', // header: 'CTN64', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN74', // header: 'CTN74', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN84', // header: 'CTN84', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // }, // { // dataIndex: 'CTN94', // header: 'CTN94', // width: 80, // editor: { // xtype: 'textfield', // selectOnFocus: true // } // } //#endregion ]; //#endregion //#region 定义Grid this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 //1单击,2双击 }); 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], selType: 'cellmodel', columns: this.girdcolums, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, bbar: Ext.create('Ext.PagingToolbar', { pageSize: this.PageSize, store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); //#endregion //#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 }, '-', { text: "操作", tooltip: '操作', menu: [{ 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 }], 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 }, '-', this.CheckSaveQuery] }); //#endregion //#region 页面布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, 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); this.onRefreshClick(); LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery); //#endregion }, //end initUIComponents //#region 执行查询 onRefreshClick: function (button, event) { Ext.Msg.wait('正在查询数据, 请稍侯..'); var sql = this.getCondition(); //#region 列 var zlcolumn = [{ sortable: false, dataIndex: 'GID', header: '惟一编号', align: 'center', hidden: true, width: 0 }, { dataIndex: 'LOCKFLAG', header: '锁定', align: 'center', width: 40, renderer: function (value) { if (value == true) { return ""; } else { return ""; } } }, { dataIndex: 'ISISSUE', header: '发布', align: 'center', width: 40, renderer: function (value) { if (value == true) { return ""; } else { return ""; } } }, { dataIndex: 'LANE', header: '航线', width: 80, editor: this.comboxLANE }, { dataIndex: 'PODLOAD', header: '起运港', width: 100, editor: this.comboxPODLOAD }, { dataIndex: 'PORTDISCHARGEID', header: '卸货港', width: 100, editor: this.comboxPORTDISCHARGEID }, { dataIndex: 'PORTDISCHARGE', header: '卸货港中文', width: 100, editor: this.comboxPORTDISCHARGE }, { dataIndex: 'CARRIER', header: '船公司', width: 100, editor: this.comboxCARRIER }, { dataIndex: 'VIA', header: '中转港', width: 100, editor: this.comboxVIA }, { dataIndex: 'ETD', header: '船期', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'TT', header: '航程', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'EFFECTIVEDATE', header: '开始日期', 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', header: '结束日期', 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 }, renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { var rq = currdate.format('yyyy-MM-dd'); if (rq > value) { return '' + value.toString().substr(0, 10) + ''; } return value.toString().substr(0, 10); } }, { dataIndex: 'COMMODITY', header: '特殊商品', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }, { dataIndex: 'REMARK', header: '备注', width: 200, editor: { xtype: 'textfield', selectOnFocus: true } }]; //#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 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]; acolumn2.push({ dataIndex: memberyf.data.VALUE, //"列名" header: 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]; acolumn.push({ dataIndex: ctn.data.VALUE + memberyf.data.VALUE, //"列名" header: memberyf.data.NAME, //"标题" align: 'right', width: 80, editor: { xtype: 'textfield', selectOnFocus: true } }); this.strHeader += ",[" + memberyf.data.NAME + "]"; }; if (acolumn.length > 0) { zlcolumn.push({ text: ctn.data.NAME, columns: acolumn }); } } //#endregion } //#endregion this.gridList.reconfigure(this.storeList, zlcolumn); this.sqlcontext = sql; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); Ext.Msg.hide(); } }, async: false, scope: this }); //#endregion } } }, async: false, scope: this }); //#endregion }, //#endregion //#region 查询条件 getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查!'); return ''; } var sql = ''; 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, "[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 sEFFECTIVEDATE_2 = form.findField('EFFECTIVEDATE_2').getRawValue(); sql = sql + getAndConSql(sql, sEFFECTIVEDATE_2, "[EFFECTIVEDATE]<='" + sEFFECTIVEDATE_2 + "'"); var sVALIDDATE_2 = form.findField('VALIDDATE_2').getRawValue(); sql = sql + getAndConSql(sql, sVALIDDATE_2, "[VALIDDATE]>='" + sVALIDDATE_2 + "'"); 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"); } } 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.strCondition }, 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', { GID: '*', //惟一编号 LOCKFLAG: false, //是否锁定 ISISSUE: false, //是否发布 LANE: '', //航线 PODLOAD: '', //起运港 PORTDISCHARGEID: '', //卸货港ID PORTDISCHARGE: '', //卸货港中文 CARRIER: '', //船公司 VIA: '', //中转港 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'); } } 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', name: 'EFFECTIVEDATE_3', value: currdate.format('yyyy-MM-dd') }, { fieldLabel: '结束日期', format: 'Y-m-d', xtype: 'datefield', editable: false, allowBlank: false, id: 'VALIDDATE_3', name: 'VALIDDATE_3', value: currdate.format('yyyy-MM-dd') //,width: 200, //anchor: '98%' }], 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(); Ext.Ajax.request({ waitMsg: '正在组织数据, 请稍侯...', url: '/MvcShipping/MsCrmPriceCarrier/onCopyClick', params: { sEFFECTIVEDATE: sEFFECTIVEDATE_3, sVALIDDATE: sVALIDDATE_3, 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.load({ params: { condition: _this.strCondition }, 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: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); return; }, //#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 = ""; 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); var required = '*'; //#region formSearch 下拉框信息加载 //运价箱型 this.storeCTN = Ext.create('DsExt.ux.RefTableStore', { model: 'XiaLaKuangModel', proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetCtn' } }); this.storeCTN.load(); this.comboxCTN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运价箱型', store: this.storeCTN, id: 'CTN', name: 'CTN', valueField: 'VALUE', displayField: 'CodeAndName', forceSelection: true }); //运价级别 this.storeYJJB = Ext.create('DsExt.ux.RefTableStore', { model: 'XiaLaKuangModel', proxy: { url: '/MvcShipping/MsCrmPriceCarrier/GetBaoJia' } }); this.storeYJJB.load(); this.comboxYJJB = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '运价级别', store: this.storeYJJB, id: 'YJJB', name: 'YJJB', valueField: 'VALUE', displayField: 'CodeAndName', forceSelection: true }); //#endregion //#region 编辑formDiv 基本信息 var formDiv = Ext.widget('form', { //id: 'formDiv', border: false, bodyPadding: 10, fieldDefaults: { labelAlign: 'right', labelWidth: 60, labelStyle: 'font-weight:bold' }, items: [{ 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' //,width: 200, //anchor: '98%' }, this.comboxCTN, this.comboxYJJB, { xtype: 'numberfield', selectOnFocus: true, //得到焦点时自动选择文本 allowDecimals: true, //允许输入小数 align: 'right', nanText: '请输入有效数值', fieldLabel: '运价', id: 'Fee', name: 'Fee' }], buttons: [{ id: 'submit', text: '修改', handler: function (options, success, response) { var sEFFECTIVEDATE_3 = Ext.getCmp('EFFECTIVEDATE_3').getRawValue(); var sVALIDDATE_3 = Ext.getCmp('VALIDDATE_3').getRawValue(); var sCTN = Ext.getCmp('CTN').getValue(); var sYJJB = Ext.getCmp('YJJB').getValue(); var sFee = Ext.getCmp('Fee').getValue(); if (sEFFECTIVEDATE_3 != "" || sVALIDDATE_3 != "" || (sCTN != "" && sYJJB != "" && sFee != "" && sCTN != undefined && sYJJB != undefined && sFee != null)) { Ext.MessageBox.confirm('提示', '确定修改吗?', function (btn) { if (btn == 'yes') { Ext.Ajax.request({ waitMsg: '正在组织数据, 请稍侯...', url: '/MvcShipping/MsCrmPriceCarrier/onAlterClick', params: { sEFFECTIVEDATE: sEFFECTIVEDATE_3, sVALIDDATE: sVALIDDATE_3, sCTN: sCTN, sYJJB: sYJJB, sFee: sFee, 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; this.storeList.load({ params: { condition: this.strCondition }, 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(); } }], listeners: { scope: this, 'render': function (thisDiv, thisExtend) { //#region 加载下拉框信息 this.storeCTN.load({ async: false }); this.storeYJJB.load({ async: false }); //#endregion } } }); //#endregion win = Ext.widget('window', { title: '批量修改运价信息', closeAction: 'destroy', //hide, width: 250, height: 220, 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 删除 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.strCondition }, 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; //是否发布 if (!blLOCKFLAG && !blISISSUE) { 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) { this.storeList.load({ params: { condition: this.strCondition }, waitMsg: "正在刷新数据...", scope: this }); 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.strCondition }, 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.strCondition }, 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.strCondition }, 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.strCondition }, 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 选择发布 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.strCondition }, 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.strCondition }, 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.strCondition }, 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.strCondition }, 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 OprationSwapJK: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });