Ext.namespace('Shipping'); Shipping.MsCrmPriceCarrierImp = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsCrmPriceCarrierImp.superclass.constructor.call(this); }; //需求编号:SR2017091200003 Ext.extend(Shipping.MsCrmPriceCarrierImp, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, BsRecord: null, CtnStoreList: null, sqlcontext: '', BsType: "", initUIComponents: function () { this.formname = "MsCrmPriceCarrierImp"; //ds7新运价查询 var currdate = new Date(); var mainform = window.parent.opener._this; if (mainform) { var ret = mainform.OprationSwap(); this.BsRecord = ret[0]; this.CtnStoreList = ret[1]; this.BsType=ret[2]; } //#region formSearch 下拉框信息加载_用于查询 //航线 this.storeLANE_2 = Ext.create('DsExt.ux.RefTableStore', { model: 'XiaLaKuangModel', proxy: { url: '/MvcShipping/MsCrmPriceCarrierList/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/MsCrmPriceCarrierList/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: this.BsRecord.get('PORTLOAD'), 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, // forceSelection: true, name: 'PORTDISCHARGEID_2', queryMode: 'remote', minChars: 0, queryParam: 'CODENAME', valueField: 'VALUE', displayField: 'CodeAndName', value: this.BsRecord.get('PORTDISCHARGE'), matchFieldWidth: false }); //中转港,国外港口 this.storeVIA_2 = Ext.create('DsExt.ux.RefTableStore', { model: 'XiaLaKuangModel', proxy: { url: '/MvcShipping/MsCrmPriceCarrierList/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', value: this.BsRecord.get('TRANSPORT'), forceSelection: false }); //船公司 this.storeCARRIER_2 = Ext.create('DsExt.ux.RefTableStore', { model: 'XiaLaKuangModel', proxy: { url: '/MvcShipping/MsCrmPriceCarrierList/GetCARRIERList' } }); this.storeCARRIER_2.load(); this.comboxCARRIER_2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeCARRIER_2, value: this.BsRecord.get('CARRIER'), 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.comboxISISSUE, { fieldLabel: '合约号', name: 'CONTRACTNO', value: this.BsRecord.get('CONTRACTNO'), enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, // 'copy': { // fn: function (e) { // var clipboardData = e.originalEvent.clipboardData; // clipboardData.setData('Text','11111111111'); // }, scope: this } } }]//, { xtype: 'hiddenfield', flex: 1} }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: "copyTarget", //'MSHIPPER', xtype: 'textareafield', id: 'copyTarget', name: 'copyTarget', hidden: true }, { fieldLabel: '有效期', format: 'Y-m-d', xtype: 'datefield', value: this.BsRecord.get('ETD'), //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 } } }, this.comboxLANE_2, { 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: 'REMARK_2', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'keyup': { fn: function (_field, e) { if (e.getKey() == 13) { this.onRefreshClick(); } }, scope: this } } }]//, { xtype: 'hiddenfield', flex: 1} }] }]//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: "" }, { xtype: 'label', text: "批注", align: 'center' }, { xtype: 'hiddenfield', width: 10 }, { xtype: 'panel', html: "" }, { xtype: 'label', text: "...", align: 'center' }, { xtype: 'panel', html: "" }, { xtype: 'label', text: "修改次数", align: 'center' }]//, { xtype: 'hiddenfield', flex: 1} }] }]//end items(fieldset 1) }); //#endregion formSearch //#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 定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCrmPriceCarrierModel_All', remoteSort: true, //autoLoad: false, proxy: { type: 'ajax', url: '/MvcShipping/MsCrmPriceCarrierList/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 ""; } else { return ""; } } }, { dataIndex: 'ISISSUE', text: '发布', align: 'center', width: 40, renderer: function (value) { if (value == true) { return ""; } else { return ""; } } }, { dataIndex: 'LANE', text: '航线', width: 80 }, { dataIndex: 'PODLOAD', text: '起运港', width: 100 }, { dataIndex: 'PORTDISCHARGEID', text: '卸货港', width: 100 }, { dataIndex: 'PORTDISCHARGE', text: '卸货港中文', width: 100 }, { dataIndex: 'CARRIER', text: '船公司', width: 100 }, { dataIndex: 'VIA', text: '中转港', width: 100 }, { dataIndex: 'ETD', text: '船期', width: 80 }, { dataIndex: 'TT', text: '航程', width: 80 }, { dataIndex: 'EFFECTIVEDATE', text: '开始日期', align: 'center', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 }, { dataIndex: 'VALIDDATE', text: '结束日期', align: 'center', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 }, { dataIndex: 'COMMODITY', text: '特殊商品', width: 80 }, { dataIndex: 'CONTRACTNO', text: '约号', 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 }]; //#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); } } } }, bbar: Ext.create('Ext.PagingToolbar', { pageSize: this.PageSize, store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); // this.gridList.addListener('itemdblclick', function (_thisView, record, item, index, e, eOpts) { // this.SelectedRecord = record; // }, this); //#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: '复制', iconCls: "btnadd", handler: function (button, event) { this.onCopyClipClick(); }, 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.initgirdcolums); _this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true); } }], 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(); var sql = this.sqlcontext; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.storeList.on('load', function (store, records) { if (store.getCount() > 0) { this.gridList.getSelectionModel().select(0); } else { } }, this); LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery); this.initgrid(); //#endregion }, //end initUIComponents //#region 执行查询 initgrid: function () { // Ext.Msg.wait('正在查询数据, 请稍侯..'); //需求编号:SR2017092500001 if (this.isRefresh) { this.isRefresh = false; return; } //end 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 ""; } 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, 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: '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: 'ETD', type: 'string' }, //开航日/船期 {name: 'TT', type: 'string' }, //航程 {name: 'EFFECTIVEDATE', type: 'DateTime' }, //生效期/开始日期 {name: 'VALIDDATE', type: 'DateTime' }, //有效期/结束日期 { name: 'COMMODITY', type: 'string' }, //品名/特殊商品 { name: 'CONTRACTNO', type: 'string' }, //约号 {name: 'REMARK', 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/GetBaoJiaChaXun' } }); 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: 100, 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) { var sFIELDNAME2 = record.fields.keys[iCol - 1]; var sGID = record.data.GID.toString(); //查询运价标识:提取样式表数据,匹配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 sLINKGID = member.data.LINKGID.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 + " " + ""; } } for (var k = 0; k < _this.storeListXGCS.getCount(); k++) { var member = _this.storeListXGCS.getAt(k); var sFIELDNAME = member.data.FIELDNAME.toString().trim(); var sLINKGID = member.data.LINKGID.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 + " " + ""; } else if (iHJ == 2) { value = value + " " + ""; } else if (iHJ == 3) { value = value + " " + ""; } else if (iHJ == 4) { value = value + " " + ""; } else if (iHJ == 5) { value = value + " " + ""; } else if (iHJ == 6) { value = value + " " + ""; } else if (iHJ == 7) { value = value + " " + ""; } else if (iHJ == 8) { value = value + " " + ""; } else if (iHJ == 9) { value = value + " " + ""; } } } return value; }, listeners: { scope: this, 'dblclick': function (_gridView, _td, iRow, iCol, e, record) { var sFIELDNAME = record.fields.keys[iCol - 1]; _this.onCellBiaoShiClick(sFIELDNAME); } } }); this.strHeader += ",[" + memberyf.data.NAME + "]"; }; if (acolumn.length > 0) { zlcolumn.push({ text: ctn.data.NAME, columns: acolumn }); } } //#endregion } for (var k in myfield2) { Columnfield.push(myfield2[k]); } for (var k in myfield) { Columnfield.push(myfield[k]); } //#endregion // // Ext.define('ColumnModel', { extend: 'Ext.data.Model', fields: Columnfield }); // this.storeList = Ext.create('Ext.data.Store', { // pageSize: this.PageSize, // model: 'ColumnModel', // remoteSort: true, // proxy: { // type: 'ajax', // url: '/MvcShipping/MsCrmPriceCarrier/GetDataList', // reader: { // id: 'GID', // root: 'data', // totalProperty: 'totalCount' // } // } // }); // //this.storeList.removeAll(); _this.initgirdcolums = _this.girdcolums; _this.girdcolums = zlcolumn; _this.girdcolums = DsTruck.GetGridPanel(USERID, _this.formname, _this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 _this.gridList.reconfigure(_this.storeList, _this.girdcolums); _this.onRefreshClick(); // this.gridList.reconfigure(this.storeList, zlcolumn); // this.sqlcontext = sql; // this.storeListXGCS.load({ params: { condition: sql }, waitMsg: "正在刷新数据...", scope: this }); // this.storeListBiaoShi.load({ params: { condition: sql, condition2: "" }, waitMsg: "正在刷新数据...", scope: this }); // 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 }, 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 }); // this.storeListXGCS.load({ params: { condition: this.sqlcontext }, waitMsg: "正在刷新数据...", scope: this }); // this.storeListBiaoShi.load({ params: { condition: this.sqlcontext, condition2: "" }, waitMsg: "正在刷新数据...", scope: this }); //end }, //#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, " (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 sEFFECTIVEDATE_2 = form.findField('EFFECTIVEDATE_2').getRawValue(); sql = sql + getAndConSql(sql, sEFFECTIVEDATE_2, "VALIDDATE>='" + sEFFECTIVEDATE_2 + "'"); var sVALIDDATE_2 = form.findField('VALIDDATE_2').getRawValue(); sql = sql + getAndConSql(sql, sVALIDDATE_2, "[VALIDDATE]<='" + sVALIDDATE_2 + "'"); var CONTRACTNO = form.findField('CONTRACTNO').getValue(); if (CONTRACTNO != null) { if (CONTRACTNO != "") { sql = sql + getAndConSql(sql, CONTRACTNO, "[CONTRACTNO]='" + CONTRACTNO.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 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"); } } sql = sql + getAndConSql(sql, "1=1", "[ISISSUE]=1"); // sql = sql + " and [LOCKFLAG]=1"; return sql; }, //#endregion //#region 重置条件 onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //#endregion //#region 设置运价标识_单元格 onCellBiaoShiClick: function (sFIELDNAME) { 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 record = selections[0]; var gids = record.get('GID'); if (gids.toString().trim() != "") { var required = '*'; //#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: [{ 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 导出Excel //#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; } if (selections.length>1) { Ext.Msg.show({ title: '提示', msg: '只能选中一条报价!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } var bodydatas = []; for (var i = 0; i < this.CtnStoreList.getCount() ; i += 1) { var member = this.CtnStoreList.getAt(i); bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcShipping/MsCrmPriceCarrierList/CreateOrderFeeBl', params: { data: Ext.JSON.encode(this.BsRecord.data), body: jsonBody, price: Ext.JSON.encode(selections[0].data), bstype: this.BsType }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { Ext.MessageBox.hide(); if (window.parent.opener._this.panelFee !=undefined&&window.parent.opener._this.panelFee != NaN) window.parent.opener._this.panelFee.storeCrChFee.reload(); window.close(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request }, //#endregion //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/MsCrmPriceCarrierList/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 = 'MsCrmPriceCarrierListList'; 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 OprationSwapJK: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });