Ext.namespace('Shipping'); Shipping.MsOpSubSeaeImportAIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSubSeaeImportAIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSubSeaeImportAIndex, Ext.Panel, { PageSize: 100, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isShowAdvancedQuery: 0, //是否显示高级查询面板 IsAudit: false, BillType: 1, OrType:1, initUIComponents: function () { this.formname = "formMsOpSubSeaeImportAIndex"; //页面名称 //定义数据集 this.storectndisp = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CtnDispModel', proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' } }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsSubSeaOrderModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSubSeaOrder/GetDataList', reader: { id: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); //#region List列表显示信息 Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.girdcolums = [{ sortable: true, dataIndex: 'BSNO', header: 'BSNO', width: 0 }, { sortable: true, dataIndex: 'SPCHARGE', header: 'SPECIAL CHARGE', renderer: function (value, p, record) { if (value == true) { return "YES" } else { return "NO" } }, width: 60 }, { sortable: true, dataIndex: 'MBLNO', header: 'MBLNO', width: 120 }, { sortable: true, dataIndex: 'ETD', header: 'ETD', width: 90 }, { sortable: true, dataIndex: 'BLFRT', header: 'BLFRT', width: 120 }, { sortable: true, dataIndex: 'CARGOID', header: 'CARGO', width: 60 }, { sortable: true, dataIndex: 'GOODSNAME', header: 'GOODS NAME', width: 120 }, { sortable: true, dataIndex: 'PKGS', header: 'PKGS', width: 80 }, { sortable: true, dataIndex: 'KGS', header: 'KGS', width: 80 }, { sortable: true, dataIndex: 'CNTRTOTAL', header: 'CNTR', width: 120 }, { sortable: true, dataIndex: 'INPUTBY', header: 'INPUTBY', width: 80 }, { sortable: true, dataIndex: 'VESSEL', header: 'VESSEL', width: 100 }, { sortable: true, dataIndex: 'VOYNO', header: 'VOYNO', width: 60 }, { sortable: true, dataIndex: 'PORTLOAD', header: 'PORTLOAD', width: 100 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: 'PORTDISCHARGE', width: 100 }, { sortable: true, dataIndex: 'KINDPKGS', header: 'KINDPKGS', width: 60 }]; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "Loading,Wait..." }, trackMouseOver: true, disableSelection: false, viewConfig: { autoFill: true, getRowClass: function (record, rowIndex, rowParams, store) { var Status = record.get('SPCHARGE'); if (Status == true) { return 'feestatus_nopass'; } } }, listeners: { cellclick: function (thisTab, record, item, index, e, eOpts) { if (index == 10) {//设置按钮列 // alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode); } } }, columns: this.girdcolums, // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: 'Display {0} - {1}Record/Total {2}Records', emptyMsg: "NO DATA" }) }); /////////////以下部分为获取存储的gridpanel显示样式 this.column = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridList.reconfigure(this.storeList, this.girdcolums); this.gridList.columns[0] = new Ext.grid.RowNumberer(); //////////////////////////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcShipping/MsOpSubSeaOrder/EditAgentExport'); // window.open('/MvcShipping/MsOpSubSeaOrder/EditAgentExport', "ORDERA EDIT", 'width=1200,height=' + (window.screen.availHeight - 55) + ',top=0,left=0,resizable=yes,status=yes,menubar=no,scrollbars=yes'); }, this); //国际港口(进口装货港、出口卸货港) this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeDisport.load(); this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'PORTLOAD', store: this.storeCodeDisport, forceSelection: true, name: 'PORTLOAD', valueField: 'PORT', displayField: 'PORT' }); //国内港口(出口装货港、进口卸货港) this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.storeCodeLoadport.load(); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'PORTDISCHARGE', store: this.storeCodeLoadport, forceSelection: true, name: 'PORTDISCHARGE', valueField: 'PORT', displayField: 'PORT' }); //#endregion //#region formSearch 查询面板 this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.VesselModel', proxy: { url: '/CommMng/BasicDataRef/GetVesselList' } }); this.storeVoyVeg.load({ params: { condition: ""} }); this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: 'VESSEL', store: this.storeVoyVeg, name: 'VESSEL', valueField: 'VESSEL', flex: 2, displayField: 'VESSEL' }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: 'MBLNO', name: 'MblNo' }, this.comboxVoyVeg, { fieldLabel: 'VOYNO', name: 'VOYNO' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, { fieldLabel: 'ETD', format: 'Y-m-d', xtype: 'datefield', name: 'ETDbgn' }, { fieldLabel: 'TO', format: 'Y-m-d', xtype: 'datefield', name: 'ETDend' }] }]//end items(fieldset 1) }]//end root items }); //#endregion formSearch //按钮工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "Query", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "Reset", iconCls: "btnreset", handler: function (button, event) { this.onClearSql(button, event); }, scope: this }, '-', { text: "Arrival Notice", handler: function (button, event) { this.OprationStatus = 'edit'; var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: 'Prompt', msg: 'Please Select The BILL!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } this.SelectedRecord = selections[0]; DsOpenEditWin('/MvcShipping/MsOpSubSeaOrder/EditArrival'); }, scope: this }, '-', { text: "Save Display List", id: "btntest", handler: function (button, event) { this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true); }, scope: this }] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, items: [this.panelBtn, this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.onRefreshClick(); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql, billtype: this.BillType, ortype: this.OrType }); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { //var girdcolums = this.gridList.getColumnMode(); var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: this.BillType, ortype: this.OrType }, waitMsg: "Data being queried...", scope: this }); }, onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: 'Prompt', msg: 'Please Select The BILL!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.ORSTATUS == '0') { Ext.Msg.show({ title: 'Warning', msg: "The BILL Is Posted,Can't Delete !", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('Prompt', 'Sure To Delete This Record?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('Deleting...'); Ext.Ajax.request({ waitMsg: 'Deleting...', url: '/MvcShipping/MsOpSubSeaOrder/Delete', params: { data: Ext.JSON.encode(record.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(record); Ext.Msg.show({ title: 'Prompt', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: 'Error', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: 'Warning', msg: 'The Server Response Error, Please Try Again', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onSubmitAuditClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: 'Prompt', msg: 'Please Select Need Post The BILL!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.ORSTATUS != '9' && record.data.ORSTATUS != '2') { Ext.Msg.show({ title: 'Warning', msg: "The BILL Is Posted,Can't Post!", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } _this = this; Ext.MessageBox.confirm('Prompt', 'Sure To Post This Record?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('POSTING...'); Ext.Ajax.request({ waitMsg: 'POSTING...', url: '/MvcShipping/MsOpSubSeaOrder/SubmitAudit', params: { data: Ext.JSON.encode(record.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: 'Prompt', msg: 'Post Successful!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: 'Error', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: 'Warning', msg: 'The Server Response Error, Please Try Again', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onSubmitAuditBackClick: function () { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: 'Prompt', msg: 'Please Select Need Cancel Post The BILL!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; if (record.data.ORSTATUS != '1') { Ext.Msg.show({ title: 'Warning', msg: "The BILL Is Posted,Can't Post!", icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } _this = this; Ext.MessageBox.confirm('Prompt', 'Sure To Cancel Post This Record?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('Cancel Posting...'); Ext.Ajax.request({ waitMsg: 'Cancel Posting...', url: '/MvcShipping/MsOpSubSeaOrder/SubmitAuditBack', params: { data: Ext.JSON.encode(record.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: 'Prompt', msg: 'Cancel Post Successful!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: 'Error', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: 'Warning', msg: 'The Server Response Error, Please Try Again', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid() ) { Ext.Msg.alert('prompt', 'Query Conditions Assignment Errors,Pls Check。'); return ''; } var sql = ''; //#region formSearch 查询面板 //编号包括(主提单号) var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, "(MBLNO like '%" + MblNo + "%' )"); //到港日期 var ETDbgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, ETDbgn, "ETD >='" + ETDbgn + "'"); var ETDend = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, ETDend, "ETD <='" + ETDend + "'"); // //牌号 // var CNTRTOTAL = form.findField('CNTRTOTAL').getValue(); // sql = sql + getAndConSql(sql, CNTRTOTAL, "CNTRTOTAL like '%" + CNTRTOTAL + "%'"); //装货港 var PORTLOAD = form.findField('PORTLOAD').getValue(); sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD like '%" + PORTLOAD + "%'"); //卸货港 var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue(); sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE like '%" + PORTDISCHARGE + "%'"); //船名 var VESSEL = form.findField('VESSEL').getValue(); sql = sql + getAndConSql(sql, VESSEL, "VESSEL like '%" + VESSEL + "%'"); //航次 var VOYNO = form.findField('VOYNO').getValue(); sql = sql + getAndConSql(sql, VOYNO, "VOYNO like '%" + VOYNO + "%'"); return sql; }, setIsShowAdvancedQuery: function () { if (this.isShowAdvancedQuery == 0) { this.panelSearch.show(); this.isShowAdvancedQuery = 1; } else { this.panelSearch.hide(); this.isShowAdvancedQuery = 0; } }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.IsAudit; ret[4] = this.BillType; ret[5] = this.OrType; return ret; } });